diff --git a/glide.lock b/glide.lock index 1908c0891..2c959d607 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 18dd0723044653b00d84e1ef3dd36307ef657eab3489bef683c93913ba59d4f4 -updated: 2019-09-27T06:51:48.447321479-04:00 +hash: 6968ae2bba8479f2ef7fb136c609dc914c0182abcebf7d0f5d94f71e89b9138a +updated: 2020-01-17T08:31:21.672698339-05:00 imports: - name: github.com/Azure/go-ansiterm version: d6e3b3328b783f23731bc4d058875b0371ff8109 @@ -30,16 +30,25 @@ imports: - pkg/ns - pkg/utils/hwaddr - name: github.com/coreos/etcd - version: 27fc7e2296f506182f58ce846e48f36b34fe6842 + version: 94745a4eed0425653b3b4275a208d38babceeaec subpackages: - auth/authpb - clientv3 + - clientv3/balancer + - clientv3/balancer/connectivity + - clientv3/balancer/picker + - clientv3/balancer/resolver/endpoint + - clientv3/credentials - etcdserver/api/v3rpc/rpctypes - etcdserver/etcdserverpb - mvcc/mvccpb + - pkg/logutil + - pkg/systemd - pkg/tlsutil - pkg/transport - pkg/types + - raft + - raft/raftpb - name: github.com/coreos/go-iptables version: 259c8e6a4275d497442c721fa52204d7a58bde8b subpackages: @@ -48,6 +57,11 @@ imports: version: e64a0ec8b42a61e2a9801dc1d0abe539dea79197 subpackages: - daemon + - journal +- name: github.com/coreos/pkg + version: 97fdf19511ea361ae1c100dd393cc47f8dcfa1e1 + subpackages: + - capnslog - name: github.com/davecgh/go-spew version: 8991bc29aa16c548c550c7ff78260e27b9ab7c73 subpackages: @@ -114,6 +128,7 @@ imports: version: b5d812f8a3706043e23a9cd5babf2e5423744d30 subpackages: - proto + - protoc-gen-go/descriptor - ptypes - ptypes/any - ptypes/duration @@ -214,7 +229,7 @@ imports: - name: github.com/opencontainers/go-digest version: 279bed98673dd5bef374d3b6e4b09e2af76183bf - name: github.com/opencontainers/runc - version: 84373aaa560b3f14cfda210b2f34ca14fd4b1fce + version: b133feaeeb2e69ba94aa95eac3a455a143435ea9 subpackages: - libcontainer/cgroups - libcontainer/configs @@ -224,13 +239,13 @@ imports: subpackages: - specs-go - name: github.com/openshift/api - version: 169848dd81372b8176b925c10b37a05424db5f2f + version: 2987a591a72cee08898c93dcc09816783d39a5bc subpackages: - config/v1 - network/v1 - unidling/v1alpha1 - name: github.com/openshift/client-go - version: 6afefc9bb37281f45d12d624156e39e363eaf4fd + version: f6563a70e19a12b2f240eaf4e716ef75baf7003e subpackages: - network/clientset/versioned - network/clientset/versioned/scheme @@ -241,7 +256,7 @@ imports: - network/informers/externalversions/network/v1 - network/listers/network/v1 - name: github.com/openshift/library-go - version: 76b67dd70a86d147ea3e7677aa5f9682ff94770f + version: e8b3a065ded2917960eb402ccba30d90433c17f3 subpackages: - pkg/config/leaderelection - pkg/network/networkapihelpers @@ -306,6 +321,18 @@ imports: - trace - trace/internal - trace/tracestate +- name: go.uber.org/atomic + version: 8dc6146f7569370a472715e178d8ae31172ee6da +- name: go.uber.org/multierr + version: ddea229ff1dff9e6fe8a6c0344ac73b09e81fce5 +- name: go.uber.org/zap + version: 67bc79d13d155c02fd008f721863ff8cc5f30659 + subpackages: + - buffer + - internal/bufferpool + - internal/color + - internal/exit + - zapcore - name: golang.org/x/crypto version: e84da0312774c21d64ee2317962ef669b27ffb41 subpackages: @@ -378,6 +405,7 @@ imports: - name: google.golang.org/genproto version: e7d98fc518a78c9f8b5ee77be7b0b317475d89e1 subpackages: + - googleapis/api/annotations - googleapis/rpc/status - name: google.golang.org/grpc version: 168a6198bcb0ef175f7dacec0b8691fc141dc9b8 @@ -391,7 +419,6 @@ imports: - encoding - encoding/proto - grpclog - - health/grpc_health_v1 - internal - internal/backoff - internal/channelz diff --git a/glide.yaml b/glide.yaml index 2ab9f3827..abd098640 100644 --- a/glide.yaml +++ b/glide.yaml @@ -25,11 +25,11 @@ import: # openshift second - package: github.com/openshift/api - version: prebase-1.16 + version: release-4.3 - package: github.com/openshift/client-go - version: prebase-1.16 + version: release-4.3 - package: github.com/openshift/library-go - version: prebase-1.16 + version: release-4.3 # ours: shared with kube, but forced by openshift # master: co-exist with klog @@ -47,3 +47,6 @@ import: # used to be ~v1 to keep up with fixes. It didn't build past v1.0.8. - package: github.com/miekg/dns version: v1.0.8 +# something is trying to pull in the wrong version of this +- package: github.com/Microsoft/go-winio + version: fc70bd9a86b5562b3b5eb1040e803febee1e90a1 diff --git a/vendor/github.com/coreos/etcd/.gitignore b/vendor/github.com/coreos/etcd/.gitignore index b055a9853..ea938d2c1 100644 --- a/vendor/github.com/coreos/etcd/.gitignore +++ b/vendor/github.com/coreos/etcd/.gitignore @@ -2,7 +2,6 @@ /coverage /covdir /docs -/vendor /gopath /gopath.proto /go-bindata diff --git a/vendor/github.com/coreos/etcd/.travis.yml b/vendor/github.com/coreos/etcd/.travis.yml index 568f7c24f..b647f3fec 100644 --- a/vendor/github.com/coreos/etcd/.travis.yml +++ b/vendor/github.com/coreos/etcd/.travis.yml @@ -6,7 +6,10 @@ sudo: required services: docker go: -- 1.10.4 +- 1.12.9 + +env: +- GO111MODULE=on notifications: on_success: never @@ -14,60 +17,50 @@ notifications: env: matrix: - - TARGET=linux-amd64-integration + - TARGET=linux-amd64-integration-1-cpu + - TARGET=linux-amd64-integration-4-cpu - TARGET=linux-amd64-functional - TARGET=linux-amd64-unit + - TARGET=linux-amd64-e2e - TARGET=all-build - TARGET=linux-386-unit matrix: fast_finish: true allow_failures: - - go: 1.10.4 - env: TARGET=linux-386-unit - exclude: - - go: tip + - go: 1.12.9 env: TARGET=linux-386-unit -before_install: -- if [[ $TRAVIS_GO_VERSION == 1.* ]]; then docker pull gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION}; fi - install: -- pushd cmd/etcd && go get -t -v ./... && popd +- go get -t -v -d ./... script: - echo "TRAVIS_GO_VERSION=${TRAVIS_GO_VERSION}" - > case "${TARGET}" in - linux-amd64-integration) - docker run --rm \ - --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=amd64 PASSES='integration' ./test" + linux-amd64-integration-1-cpu) + GOARCH=amd64 CPU=1 PASSES='integration' ./test + ;; + linux-amd64-integration-4-cpu) + GOARCH=amd64 CPU=4 PASSES='integration' ./test ;; linux-amd64-functional) - docker run --rm \ - --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "./build && GOARCH=amd64 PASSES='functional' ./test" + ./build && GOARCH=amd64 PASSES='functional' ./test ;; linux-amd64-unit) - docker run --rm \ - --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=amd64 PASSES='unit' ./test" + ./build && GOARCH=amd64 PASSES='unit' ./test + ;; + linux-amd64-e2e) + GOARCH=amd64 PASSES='build release e2e' MANUAL_VER=v3.3.13 ./test ;; all-build) - docker run --rm \ - --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=amd64 PASSES='build' ./test \ - && GOARCH=386 PASSES='build' ./test \ - && GO_BUILD_FLAGS='-v' GOOS=darwin GOARCH=amd64 ./build \ - && GO_BUILD_FLAGS='-v' GOOS=windows GOARCH=amd64 ./build \ - && GO_BUILD_FLAGS='-v' GOARCH=arm ./build \ - && GO_BUILD_FLAGS='-v' GOARCH=arm64 ./build \ - && GO_BUILD_FLAGS='-v' GOARCH=ppc64le ./build" + GOARCH=386 PASSES='build' ./test \ + && GO_BUILD_FLAGS='-v' GOOS=darwin GOARCH=amd64 ./build \ + && GO_BUILD_FLAGS='-v' GOARCH=arm ./build \ + && GO_BUILD_FLAGS='-v' GOARCH=arm64 ./build \ + && GO_BUILD_FLAGS='-v' GOARCH=ppc64le ./build ;; linux-386-unit) - docker run --rm \ - --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ - /bin/bash -c "GOARCH=386 PASSES='unit' ./test" + GOARCH=386 ./build && GOARCH=386 PASSES='unit' ./test ;; esac diff --git a/vendor/github.com/coreos/etcd/CHANGELOG.md b/vendor/github.com/coreos/etcd/CHANGELOG.md deleted file mode 100644 index 603e501d2..000000000 --- a/vendor/github.com/coreos/etcd/CHANGELOG.md +++ /dev/null @@ -1,746 +0,0 @@ -## [v3.3.0](https://github.com/coreos/etcd/releases/tag/v3.3.0) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.0...v3.3.0) and [v3.3 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_3.md) for any breaking changes. - -### Improved - -- Use [`coreos/bbolt`](https://github.com/coreos/bbolt/releases) to replace [`boltdb/bolt`](https://github.com/boltdb/bolt#project-status). - - Fix [etcd database size grows until `mvcc: database space exceeded`](https://github.com/coreos/etcd/issues/8009). -- [Reduce memory allocation](https://github.com/coreos/etcd/pull/8428) on [Range operations](https://github.com/coreos/etcd/pull/8475). -- [Rate limit](https://github.com/coreos/etcd/pull/8099) and [randomize](https://github.com/coreos/etcd/pull/8101) lease revoke on restart or leader elections. - - Prevent [spikes in Raft proposal rate](https://github.com/coreos/etcd/issues/8096). -- Support `clientv3` balancer failover under [network faults/partitions](https://github.com/coreos/etcd/issues/8711). -- Better warning on [mismatched `--initial-cluster`](https://github.com/coreos/etcd/pull/8083) flag. - -### Changed(Breaking Changes) - -- Require [Go 1.9+](https://github.com/coreos/etcd/issues/6174). - - Compile with *Go 1.9.2*. - - Deprecate [`golang.org/x/net/context`](https://github.com/coreos/etcd/pull/8511). -- Require [`google.golang.org/grpc`](https://github.com/grpc/grpc-go/releases) [**`v1.7.4`**](https://github.com/grpc/grpc-go/releases/tag/v1.7.4) or [**`v1.7.5+`**](https://github.com/grpc/grpc-go/releases/tag/v1.7.5): - - Deprecate [`metadata.Incoming/OutgoingContext`](https://github.com/coreos/etcd/pull/7896). - - Deprecate `grpclog.Logger`, upgrade to [`grpclog.LoggerV2`](https://github.com/coreos/etcd/pull/8533). - - Deprecate [`grpc.ErrClientConnTimeout`](https://github.com/coreos/etcd/pull/8505) errors in `clientv3`. - - Use [`MaxRecvMsgSize` and `MaxSendMsgSize`](https://github.com/coreos/etcd/pull/8437) to limit message size, in etcd server. -- Upgrade [`github.com/grpc-ecosystem/grpc-gateway`](https://github.com/grpc-ecosystem/grpc-gateway/releases) `v1.2.2` to `v1.3.0`. -- Translate [gRPC status error in v3 client `Snapshot` API](https://github.com/coreos/etcd/pull/9038). -- Upgrade [`github.com/ugorji/go/codec`](https://github.com/ugorji/go) for v2 `client`. - - [Regenerated](https://github.com/coreos/etcd/pull/8721) v2 `client` source code with latest `ugorji/go/codec`. -- Fix [`/health` endpoint JSON output](https://github.com/coreos/etcd/pull/8312). -- v3 `etcdctl` [`lease timetolive LEASE_ID`](https://github.com/coreos/etcd/issues/9028) on expired lease now prints [`lease LEASE_ID already expired`](https://github.com/coreos/etcd/pull/9047). - - <=3.2 prints `lease LEASE_ID granted with TTL(0s), remaining(-1s)`. - -### Added(`etcd`) - -- Add [`--experimental-enable-v2v3`](https://github.com/coreos/etcd/pull/8407) flag to [emulate v2 API with v3](https://github.com/coreos/etcd/issues/6925). -- Add [`--experimental-corrupt-check-time`](https://github.com/coreos/etcd/pull/8420) flag to [raise corrupt alarm monitoring](https://github.com/coreos/etcd/issues/7125). -- Add [`--experimental-initial-corrupt-check`](https://github.com/coreos/etcd/pull/8554) flag to [check database hash before serving client/peer traffic](https://github.com/coreos/etcd/issues/8313). -- Add [`--max-txn-ops`](https://github.com/coreos/etcd/pull/7976) flag to [configure maximum number operations in transaction](https://github.com/coreos/etcd/issues/7826). -- Add [`--max-request-bytes`](https://github.com/coreos/etcd/pull/7968) flag to [configure maximum client request size](https://github.com/coreos/etcd/issues/7923). - - If not configured, it defaults to 1.5 MiB. -- Add [`--client-crl-file`, `--peer-crl-file`](https://github.com/coreos/etcd/pull/8124) flags for [Certificate revocation list](https://github.com/coreos/etcd/issues/4034). -- Add [`--peer-require-cn`](https://github.com/coreos/etcd/pull/8616) flag to support [CN-based auth for inter-peer connection](https://github.com/coreos/etcd/issues/8262). -- Add [`--listen-metrics-urls`](https://github.com/coreos/etcd/pull/8242) flag for additional `/metrics` endpoints. - - Support [additional (non) TLS `/metrics` endpoints for a TLS-enabled cluster](https://github.com/coreos/etcd/pull/8282). - - e.g. `--listen-metrics-urls=https://localhost:2378,http://localhost:9379` to serve `/metrics` in secure port 2378 and insecure port 9379. - - Useful for [bypassing critical APIs when monitoring etcd](https://github.com/coreos/etcd/issues/8060). -- Add [`--auto-compaction-mode`](https://github.com/coreos/etcd/pull/8123) flag to [support revision-based compaction](https://github.com/coreos/etcd/issues/8098). -- Change `--auto-compaction-retention` flag to [accept string values](https://github.com/coreos/etcd/pull/8563) with [finer granularity](https://github.com/coreos/etcd/issues/8503). -- Add [`--grpc-keepalive-min-time`, `--grpc-keepalive-interval`, `--grpc-keepalive-timeout`](https://github.com/coreos/etcd/pull/8535) flags to configure server-side keepalive policies. -- Serve [`/health` endpoint as unhealthy](https://github.com/coreos/etcd/pull/8272) when [alarm is raised](https://github.com/coreos/etcd/issues/8207). -- Provide [error information in `/health`](https://github.com/coreos/etcd/pull/8312). - - e.g. `{"health":false,"errors":["NOSPACE"]}`. -- Move [logging setup to embed package](https://github.com/coreos/etcd/pull/8810) - - Disable gRPC server log by default. -- Use [monotonic time in Go 1.9](https://github.com/coreos/etcd/pull/8507) for `lease` package. -- Warn on [empty hosts in advertise URLs](https://github.com/coreos/etcd/pull/8384). - - Address [advertise client URLs accepts empty hosts](https://github.com/coreos/etcd/issues/8379). - - etcd `v3.4` will exit on this error. - - e.g. `--advertise-client-urls=http://:2379`. -- Warn on [shadowed environment variables](https://github.com/coreos/etcd/pull/8385). - - Address [error on shadowed environment variables](https://github.com/coreos/etcd/issues/8380). - - etcd `v3.4` will exit on this error. - -### Added(API) - -- Support [ranges in transaction comparisons](https://github.com/coreos/etcd/pull/8025) for [disconnected linearized reads](https://github.com/coreos/etcd/issues/7924). -- Add [nested transactions](https://github.com/coreos/etcd/pull/8102) to extend [proxy use cases](https://github.com/coreos/etcd/issues/7857). -- Add [lease comparison target in transaction](https://github.com/coreos/etcd/pull/8324). -- Add [lease list](https://github.com/coreos/etcd/pull/8358). -- Add [hash by revision](https://github.com/coreos/etcd/pull/8263) for [better corruption checking against boltdb](https://github.com/coreos/etcd/issues/8016). - -### Added(`etcd/clientv3`) - -- Add [health balancer](https://github.com/coreos/etcd/pull/8545) to fix [watch API hangs](https://github.com/coreos/etcd/issues/7247), improve [endpoint switch under network faults](https://github.com/coreos/etcd/issues/7941). -- [Refactor balancer](https://github.com/coreos/etcd/pull/8840) and add [client-side keepalive pings](https://github.com/coreos/etcd/pull/8199) to handle [network partitions](https://github.com/coreos/etcd/issues/8711). -- Add [`MaxCallSendMsgSize` and `MaxCallRecvMsgSize`](https://github.com/coreos/etcd/pull/9047) fields to [`clientv3.Config`](https://godoc.org/github.com/coreos/etcd/clientv3#Config). - - Fix [exceeded response size limit error in client-side](https://github.com/coreos/etcd/issues/9043). - - Address [kubernetes#51099](https://github.com/kubernetes/kubernetes/issues/51099). - - `MaxCallSendMsgSize` default value is 2 MiB, if not configured. - - `MaxCallRecvMsgSize` default value is `math.MaxInt32`, if not configured. -- Accept [`Compare_LEASE`](https://github.com/coreos/etcd/pull/8324) in [`clientv3.Compare`](https://godoc.org/github.com/coreos/etcd/clientv3#Compare). -- Add [`LeaseValue` helper](https://github.com/coreos/etcd/pull/8488) to `Cmp` `LeaseID` values in `Txn`. -- Add [`MoveLeader`](https://github.com/coreos/etcd/pull/8153) to `Maintenance`. -- Add [`HashKV`](https://github.com/coreos/etcd/pull/8351) to `Maintenance`. -- Add [`Leases`](https://github.com/coreos/etcd/pull/8358) to `Lease`. -- Add [`clientv3/ordering`](https://github.com/coreos/etcd/pull/8092) for enforce [ordering in serialized requests](https://github.com/coreos/etcd/issues/7623). - -### Added(v2 `etcdctl`) - -- Add [`backup --with-v3`](https://github.com/coreos/etcd/pull/8479) flag. - -### Added(v3 `etcdctl`) - -- Add [`--discovery-srv`](https://github.com/coreos/etcd/pull/8462) flag. -- Add [`--keepalive-time`, `--keepalive-timeout`](https://github.com/coreos/etcd/pull/8663) flags. -- Add [`lease list`](https://github.com/coreos/etcd/pull/8358) command. -- Add [`lease keep-alive --once`](https://github.com/coreos/etcd/pull/8775) flag. -- Make [`lease timetolive LEASE_ID`](https://github.com/coreos/etcd/issues/9028) on expired lease print [`lease LEASE_ID already expired`](https://github.com/coreos/etcd/pull/9047). - - <=3.2 prints `lease LEASE_ID granted with TTL(0s), remaining(-1s)`. -- Add [`defrag --data-dir`](https://github.com/coreos/etcd/pull/8367) flag. -- Add [`move-leader`](https://github.com/coreos/etcd/pull/8153) command. -- Add [`endpoint hashkv`](https://github.com/coreos/etcd/pull/8351) command. -- Add [`endpoint --cluster`](https://github.com/coreos/etcd/pull/8143) flag, equivalent to [v2 `etcdctl cluster-health`](https://github.com/coreos/etcd/issues/8117). -- Make `endpoint health` command terminate with [non-zero exit code on unhealthy status](https://github.com/coreos/etcd/pull/8342). -- Add [`lock --ttl`](https://github.com/coreos/etcd/pull/8370) flag. -- Support [`watch [key] [range_end] -- [exec-command…]`](https://github.com/coreos/etcd/pull/8919), equivalent to [v2 `etcdctl exec-watch`](https://github.com/coreos/etcd/issues/8814). -- Enable [`clientv3.WithRequireLeader(context.Context)` for `watch`](https://github.com/coreos/etcd/pull/8672) command. -- Print [`"del"` instead of `"delete"`](https://github.com/coreos/etcd/pull/8297) in `txn` interactive mode. -- Print [`ETCD_INITIAL_ADVERTISE_PEER_URLS` in `member add`](https://github.com/coreos/etcd/pull/8332). - -### Added(metrics) - -- Add [`etcd --listen-metrics-urls`](https://github.com/coreos/etcd/pull/8242) flag for additional `/metrics` endpoints. - - Useful for [bypassing critical APIs when monitoring etcd](https://github.com/coreos/etcd/issues/8060). -- Add [`etcd_server_version`](https://github.com/coreos/etcd/pull/8960) Prometheus metric. - - To replace [Kubernetes `etcd-version-monitor`](https://github.com/coreos/etcd/issues/8948). -- Add [`etcd_debugging_mvcc_db_compaction_keys_total`](https://github.com/coreos/etcd/pull/8280) Prometheus metric. -- Add [`etcd_debugging_server_lease_expired_total`](https://github.com/coreos/etcd/pull/8064) Prometheus metric. - - To improve [lease revoke monitoring](https://github.com/coreos/etcd/issues/8050). -- Document [Prometheus 2.0 rules](https://github.com/coreos/etcd/pull/8879). -- Initialize gRPC server [metrics with zero values](https://github.com/coreos/etcd/pull/8878). - -### Added(`grpc-proxy`) - -- Add [`grpc-proxy start --experimental-leasing-prefix`](https://github.com/coreos/etcd/pull/8341) flag: - - For disconnected linearized reads. - - Based on [V system leasing](https://github.com/coreos/etcd/issues/6065). - - See ["Disconnected consistent reads with etcd" blog post](https://coreos.com/blog/coreos-labs-disconnected-consistent-reads-with-etcd). -- Add [`grpc-proxy start --experimental-serializable-ordering`](https://github.com/coreos/etcd/pull/8315) flag. - - To ensure serializable reads have monotonically increasing store revisions across endpoints. -- Add [`grpc-proxy start --metrics-addr`](https://github.com/coreos/etcd/pull/8242) flag for an additional `/metrics` endpoint. - - Set `--metrics-addr=http://[HOST]:9379` to serve `/metrics` in insecure port 9379. -- Serve [`/health` endpoint in grpc-proxy](https://github.com/coreos/etcd/pull/8322). -- Add [`grpc-proxy start --debug`](https://github.com/coreos/etcd/pull/8994) flag. - -### Added(gRPC gateway) - -- Replace [gRPC gateway](https://github.com/grpc-ecosystem/grpc-gateway) endpoint with [`/v3beta`](https://github.com/coreos/etcd/pull/8880). - - To deprecate [`/v3alpha`](https://github.com/coreos/etcd/issues/8125) in `v3.4`. -- Support ["authorization" token](https://github.com/coreos/etcd/pull/7999). -- Support [websocket for bi-directional streams](https://github.com/coreos/etcd/pull/8257). - - Fix [`Watch` API with gRPC gateway](https://github.com/coreos/etcd/issues/8237). -- Upgrade gRPC gateway to [v1.3.0](https://github.com/coreos/etcd/issues/8838). - -### Added(`etcd/raft`) - -- Add [non-voting member](https://github.com/coreos/etcd/pull/8751). - - To implement [Raft thesis 4.2.1 Catching up new servers](https://github.com/coreos/etcd/issues/8568). - - `Learner` node does not vote or promote itself. - -### Added/Fixed(Security/Auth) - -- Add [CRL based connection rejection](https://github.com/coreos/etcd/pull/8124) to manage [revoked certs](https://github.com/coreos/etcd/issues/4034). -- Document [TLS authentication changes](https://github.com/coreos/etcd/pull/8895): - - [Server accepts connections if IP matches, without checking DNS entries](https://github.com/coreos/etcd/pull/8223). For instance, if peer cert contains IP addresses and DNS names in Subject Alternative Name (SAN) field, and the remote IP address matches one of those IP addresses, server just accepts connection without further checking the DNS names. - - [Server supports reverse-lookup on wildcard DNS `SAN`](https://github.com/coreos/etcd/pull/8281). For instance, if peer cert contains only DNS names (no IP addresses) in Subject Alternative Name (SAN) field, server first reverse-lookups the remote IP address to get a list of names mapping to that address (e.g. `nslookup IPADDR`). Then accepts the connection if those names have a matching name with peer cert's DNS names (either by exact or wildcard match). If none is matched, server forward-lookups each DNS entry in peer cert (e.g. look up `example.default.svc` when the entry is `*.example.default.svc`), and accepts connection only when the host's resolved addresses have the matching IP address with the peer's remote IP address. -- Add [`etcd --peer-require-cn`](https://github.com/coreos/etcd/pull/8616) flag. - - To support [CommonName(CN) based auth](https://github.com/coreos/etcd/issues/8262) for inter peer connection. -- [Swap priority](https://github.com/coreos/etcd/pull/8594) of cert CommonName(CN) and username + password. - - To address ["username and password specified in the request should take priority over CN in the cert"](https://github.com/coreos/etcd/issues/8584). -- Protect [lease revoke with auth](https://github.com/coreos/etcd/pull/8031). -- Provide user's role on [auth permission error](https://github.com/coreos/etcd/pull/8164). -- Fix [auth store panic with disabled token](https://github.com/coreos/etcd/pull/8695). -- Update `golang.org/x/crypto/bcrypt` (see [golang/crypto@6c586e1](https://github.com/golang/crypto/commit/6c586e17d90a7d08bbbc4069984180dce3b04117)). - -### Fixed(v2) - -- [Fail-over v2 client](https://github.com/coreos/etcd/pull/8519) to next endpoint on [oneshot failure](https://github.com/coreos/etcd/issues/8515). -- [Put back `/v2/machines`](https://github.com/coreos/etcd/pull/8062) endpoint for python-etcd wrapper. - -### Fixed(v3) - -- Fix [range/put/delete operation metrics](https://github.com/coreos/etcd/pull/8054) with transaction: - - `etcd_debugging_mvcc_range_total` - - `etcd_debugging_mvcc_put_total` - - `etcd_debugging_mvcc_delete_total` - - `etcd_debugging_mvcc_txn_total` -- Fix [`etcd_debugging_mvcc_keys_total`](https://github.com/coreos/etcd/pull/8390) on restore. -- Fix [`etcd_debugging_mvcc_db_total_size_in_bytes`](https://github.com/coreos/etcd/pull/8120) on restore. - - Also change to [`prometheus.NewGaugeFunc`](https://github.com/coreos/etcd/pull/8150). -- Fix [backend database in-memory index corruption](https://github.com/coreos/etcd/pull/8127) issue on restore (only 3.2.0 is affected). -- Fix [watch restore from snapshot](https://github.com/coreos/etcd/pull/8427). -- Fix ["put at-most-once" in `clientv3`](https://github.com/coreos/etcd/pull/8335). -- Handle [empty key permission](https://github.com/coreos/etcd/pull/8514) in `etcdctl`. -- [Fix server crash](https://github.com/coreos/etcd/pull/8010) on [invalid transaction request from gRPC gateway](https://github.com/coreos/etcd/issues/7889). -- Fix [`clientv3.WatchResponse.Canceled`](https://github.com/coreos/etcd/pull/8283) on [compacted watch request](https://github.com/coreos/etcd/issues/8231). -- Handle [WAL renaming failure on Windows](https://github.com/coreos/etcd/pull/8286). -- Make [peer dial timeout longer](https://github.com/coreos/etcd/pull/8599). - - See [coreos/etcd-operator#1300](https://github.com/coreos/etcd-operator/issues/1300) for more detail. -- Make server [wait up to request time-out](https://github.com/coreos/etcd/pull/8267) with [pending RPCs](https://github.com/coreos/etcd/issues/8224). -- Fix [`grpc.Server` panic on `GracefulStop`](https://github.com/coreos/etcd/pull/8987) with [TLS-enabled server](https://github.com/coreos/etcd/issues/8916). -- Fix ["multiple peer URLs cannot start" issue](https://github.com/coreos/etcd/issues/8383). -- Fix server-side auth so [concurrent auth operations do not return old revision error](https://github.com/coreos/etcd/pull/8442). -- Fix [`concurrency/stm` `Put` with serializable snapshot](https://github.com/coreos/etcd/pull/8439). - - Use store revision from first fetch to resolve write conflicts instead of modified revision. -- Fix [`grpc-proxy` Snapshot API error handling](https://github.com/coreos/etcd/commit/dbd16d52fbf81e5fd806d21ff5e9148d5bf203ab). -- Fix [`grpc-proxy` KV API `PrevKv` flag handling](https://github.com/coreos/etcd/pull/8366). -- Fix [`grpc-proxy` KV API `KeysOnly` flag handling](https://github.com/coreos/etcd/pull/8552). -- Upgrade [`coreos/go-systemd`](https://github.com/coreos/go-systemd/releases) to `v15` (see https://github.com/coreos/go-systemd/releases/tag/v15). - -### Other - -- Support previous two minor versions (see our [new release policy](https://github.com/coreos/etcd/pull/8805)). -- `v3.3.x` is the last release cycle that supports `ACI`: - - AppC was [officially suspended](https://github.com/appc/spec#-disclaimer-), as of late 2016. - - [`acbuild`](https://github.com/containers/build#this-project-is-currently-unmaintained) is not maintained anymore. - - `*.aci` files won't be available from etcd `v3.4` release. -- Add container registry [`gcr.io/etcd-development/etcd`](https://gcr.io/etcd-development/etcd). - - [quay.io/coreos/etcd](https://quay.io/coreos/etcd) is still supported as secondary. - - -## [v3.2.12](https://github.com/coreos/etcd/releases/tag/v3.2.12) (2017-12-20) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.11...v3.2.12) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Fixed - -- Fix [error message of `Revision` compactor](https://github.com/coreos/etcd/pull/8999) in server-side. - -### Added(`etcd/clientv3`,`etcdctl/v3`) - -- Add [`MaxCallSendMsgSize` and `MaxCallRecvMsgSize`](https://github.com/coreos/etcd/pull/9047) fields to [`clientv3.Config`](https://godoc.org/github.com/coreos/etcd/clientv3#Config). - - Fix [exceeded response size limit error in client-side](https://github.com/coreos/etcd/issues/9043). - - Address [kubernetes#51099](https://github.com/kubernetes/kubernetes/issues/51099). - - `MaxCallSendMsgSize` default value is 2 MiB, if not configured. - - `MaxCallRecvMsgSize` default value is `math.MaxInt32`, if not configured. - -### Other - -- Pin [grpc v1.7.5](https://github.com/grpc/grpc-go/releases/tag/v1.7.5), [grpc-gateway v1.3.0](https://github.com/grpc-ecosystem/grpc-gateway/releases/tag/v1.3.0). - - No code change, just to be explicit about recommended versions. - - -## [v3.2.11](https://github.com/coreos/etcd/releases/tag/v3.2.11) (2017-12-05) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.10...v3.2.11) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Fixed - -- Fix racey grpc-go's server handler transport `WriteStatus` call to prevent [TLS-enabled etcd server crash](https://github.com/coreos/etcd/issues/8904): - - Upgrade [`google.golang.org/grpc`](https://github.com/grpc/grpc-go/releases) `v1.7.3` to `v1.7.4`. - - Add [gRPC RPC failure warnings](https://github.com/coreos/etcd/pull/8939) to help debug such issues in the future. -- Remove `--listen-metrics-urls` flag in monitoring document (non-released in `v3.2.x`, planned for `v3.3.x`). - -### Added - -- Provide [more cert details](https://github.com/coreos/etcd/pull/8952/files) on TLS handshake failures. - - -## [v3.1.11](https://github.com/coreos/etcd/releases/tag/v3.1.11) (2017-11-28) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.10...v3.1.11) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Fixed - -- [#8411](https://github.com/coreos/etcd/issues/8411),[#8806](https://github.com/coreos/etcd/pull/8806) mvcc: fix watch restore from snapshot -- [#8009](https://github.com/coreos/etcd/issues/8009),[#8902](https://github.com/coreos/etcd/pull/8902) backport coreos/bbolt v1.3.1-coreos.5 - - -## [v3.2.10](https://github.com/coreos/etcd/releases/tag/v3.2.10) (2017-11-16) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.9...v3.2.10) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Fixed - -- Replace backend key-value database `boltdb/bolt` with [`coreos/bbolt`](https://github.com/coreos/bbolt/releases) to address [backend database size issue](https://github.com/coreos/etcd/issues/8009). -- Fix `clientv3` balancer to handle [network partitions](https://github.com/coreos/etcd/issues/8711): - - Upgrade [`google.golang.org/grpc`](https://github.com/grpc/grpc-go/releases) `v1.2.1` to `v1.7.3`. - - Upgrade [`github.com/grpc-ecosystem/grpc-gateway`](https://github.com/grpc-ecosystem/grpc-gateway/releases) `v1.2` to `v1.3`. -- Revert [discovery SRV auth `ServerName` with `*.{ROOT_DOMAIN}`](https://github.com/coreos/etcd/pull/8651) to support non-wildcard subject alternative names in the certs (see [issue #8445](https://github.com/coreos/etcd/issues/8445) for more contexts). - - For instance, `etcd --discovery-srv=etcd.local` will only authenticate peers/clients when the provided certs have root domain `etcd.local` (**not `*.etcd.local`**) as an entry in Subject Alternative Name (SAN) field. - - -## [v3.2.9](https://github.com/coreos/etcd/releases/tag/v3.2.9) (2017-10-06) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.8...v3.2.9) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Fixed(Security) - -- Compile with [Go 1.8.4](https://groups.google.com/d/msg/golang-nuts/sHfMg4gZNps/a-HDgDDDAAAJ). -- Update `golang.org/x/crypto/bcrypt` (see [golang/crypto@6c586e1](https://github.com/golang/crypto/commit/6c586e17d90a7d08bbbc4069984180dce3b04117)). -- Fix discovery SRV bootstrapping to [authenticate `ServerName` with `*.{ROOT_DOMAIN}`](https://github.com/coreos/etcd/pull/8651), in order to support sub-domain wildcard matching (see [issue #8445](https://github.com/coreos/etcd/issues/8445) for more contexts). - - For instance, `etcd --discovery-srv=etcd.local` will only authenticate peers/clients when the provided certs have root domain `*.etcd.local` as an entry in Subject Alternative Name (SAN) field. - - -## [v3.2.8](https://github.com/coreos/etcd/releases/tag/v3.2.8) (2017-09-29) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.7...v3.2.8) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Fixed - -- Fix v2 client failover to next endpoint on mutable operation. -- Fix grpc-proxy to respect `KeysOnly` flag. - - -## [v3.2.7](https://github.com/coreos/etcd/releases/tag/v3.2.7) (2017-09-01) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.6...v3.2.7) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Fixed - -- Fix server-side auth so concurrent auth operations do not return old revision error. -- Fix concurrency/stm Put with serializable snapshot - - Use store revision from first fetch to resolve write conflicts instead of modified revision. - - -## [v3.2.6](https://github.com/coreos/etcd/releases/tag/v3.2.6) (2017-08-21) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.5...v3.2.6). - -### Fixed - -- Fix watch restore from snapshot. -- Fix `etcd_debugging_mvcc_keys_total` inconsistency. -- Fix multiple URLs for `--listen-peer-urls` flag. -- Add `--enable-pprof` flag to etcd configuration file format. - - -## [v3.2.5](https://github.com/coreos/etcd/releases/tag/v3.2.5) (2017-08-04) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.4...v3.2.5) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Changed - -- Use reverse lookup to match wildcard DNS SAN. -- Return non-zero exit code on unhealthy `endpoint health`. - -### Fixed - -- Fix unreachable /metrics endpoint when `--enable-v2=false`. -- Fix grpc-proxy to respect `PrevKv` flag. - -### Added - -- Add container registry `gcr.io/etcd-development/etcd`. - - -## [v3.2.4](https://github.com/coreos/etcd/releases/tag/v3.2.4) (2017-07-19) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.3...v3.2.4) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Fixed - -- Do not block on active client stream when stopping server -- Fix gRPC proxy Snapshot RPC error handling - - -## [v3.2.3](https://github.com/coreos/etcd/releases/tag/v3.2.3) (2017-07-14) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.2...v3.2.3) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Fixed - -- Let clients establish unlimited streams - -### Added - -- Tag docker images with minor versions - - e.g. `docker pull quay.io/coreos/etcd:v3.2` to fetch latest v3.2 versions - - -## [v3.1.10](https://github.com/coreos/etcd/releases/tag/v3.1.10) (2017-07-14) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.9...v3.1.10) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - -### Changed - -- Compile with Go 1.8.3 to fix panic on `net/http.CloseNotify` - -### Added - -- Tag docker images with minor versions. - - e.g. `docker pull quay.io/coreos/etcd:v3.1` to fetch latest v3.1 versions. - - -## [v3.2.2](https://github.com/coreos/etcd/releases/tag/v3.2.2) (2017-07-07) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.1...v3.2.2) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Improved - -- Rate-limit lease revoke on expiration. -- Extend leases on promote to avoid queueing effect on lease expiration. - -### Fixed - -- Use user-provided listen address to connect to gRPC gateway: - - `net.Listener` rewrites IPv4 0.0.0.0 to IPv6 [::], breaking IPv6 disabled hosts. - - Only v3.2.0, v3.2.1 are affected. -- Accept connection with matched IP SAN but no DNS match. - - Don't check DNS entries in certs if there's a matching IP. -- Fix 'tools/benchmark' watch command. - - -## [v3.2.1](https://github.com/coreos/etcd/releases/tag/v3.2.1) (2017-06-23) - -See [code changes](https://github.com/coreos/etcd/compare/v3.2.0...v3.2.1) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Fixed - -- Fix backend database in-memory index corruption issue on restore (only 3.2.0 is affected). -- Fix gRPC gateway Txn marshaling issue. -- Fix backend database size debugging metrics. - - -## [v3.2.0](https://github.com/coreos/etcd/releases/tag/v3.2.0) (2017-06-09) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.0...v3.2.0) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. - -### Improved - -- Improve backend read concurrency. - -### Added - -- Embedded etcd - - `Etcd.Peers` field is now `[]*peerListener`. -- RPCs - - Add Election, Lock service. -- Native client etcdserver/api/v3client - - client "embedded" in the server. -- gRPC proxy - - Proxy endpoint discovery. - - Namespaces. - - Coalesce lease requests. -- v3 client - - STM prefetching. - - Add namespace feature. - - Add `ErrOldCluster` with server version checking. - - Translate `WithPrefix()` into `WithFromKey()` for empty key. -- v3 etcdctl - - Add `check perf` command. - - Add `--from-key` flag to role grant-permission command. - - `lock` command takes an optional command to execute. -- etcd flags - - Add `--enable-v2` flag to configure v2 backend (enabled by default). - - Add `--auth-token` flag. -- `etcd gateway` - - Support DNS SRV priority. -- Auth - - Support Watch API. - - JWT tokens. -- Logging, monitoring - - Server warns large snapshot operations. - - Add `etcd_debugging_server_lease_expired_total` metrics. -- Security - - Deny incoming peer certs with wrong IP SAN. - - Resolve TLS `DNSNames` when SAN checking. - - Reload TLS certificates on every client connection. -- Release - - Annotate acbuild with supports-systemd-notify. - - Add `nsswitch.conf` to Docker container image. - - Add ppc64le, arm64(experimental) builds. - - Compile with `Go 1.8.3`. - -### Changed - -- v3 client - - `LeaseTimeToLive` returns TTL=-1 resp on lease not found. - - `clientv3.NewFromConfigFile` is moved to `clientv3/yaml.NewConfig`. - - concurrency package's elections updated to match RPC interfaces. - - let client dial endpoints not in the balancer. -- Dependencies - - Update [`google.golang.org/grpc`](https://github.com/grpc/grpc-go/releases) to `v1.2.1`. - - Update [`github.com/grpc-ecosystem/grpc-gateway`](https://github.com/grpc-ecosystem/grpc-gateway/releases) to `v1.2.0`. - -### Fixed - -- Allow v2 snapshot over 512MB. - - -## [v3.1.9](https://github.com/coreos/etcd/releases/tag/v3.1.9) (2017-06-09) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.8...v3.1.9) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - -### Fixed - -- Allow v2 snapshot over 512MB. - - -## [v3.1.8](https://github.com/coreos/etcd/releases/tag/v3.1.8) (2017-05-19) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.7...v3.1.8) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - - -## [v3.1.7](https://github.com/coreos/etcd/releases/tag/v3.1.7) (2017-04-28) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.6...v3.1.7) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - - -## [v3.1.6](https://github.com/coreos/etcd/releases/tag/v3.1.6) (2017-04-19) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.5...v3.1.6) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - -### Changed - -- Remove auth check in Status API. - -### Fixed - -- Fill in Auth API response header. - - -## [v3.1.5](https://github.com/coreos/etcd/releases/tag/v3.1.5) (2017-03-27) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.4...v3.1.5) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - -### Added - -- Add `/etc/nsswitch.conf` file to alpine-based Docker image. - -### Fixed - -- Fix raft memory leak issue. -- Fix Windows file path issues. - - -## [v3.1.4](https://github.com/coreos/etcd/releases/tag/v3.1.4) (2017-03-22) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.3...v3.1.4) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - - -## [v3.1.3](https://github.com/coreos/etcd/releases/tag/v3.1.3) (2017-03-10) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.2...v3.1.3) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - -### Changed - -- Use machine default host when advertise URLs are default values(`localhost:2379,2380`) AND if listen URL is `0.0.0.0`. - -### Fixed - -- Fix `etcd gateway` schema handling in DNS discovery. -- Fix sd_notify behaviors in `gateway`, `grpc-proxy`. - - -## [v3.1.2](https://github.com/coreos/etcd/releases/tag/v3.1.2) (2017-02-24) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.1...v3.1.2) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - -### Changed - -- Use IPv4 default host, by default (when IPv4 and IPv6 are available). - -### Fixed - -- Fix `etcd gateway` with multiple endpoints. - - -## [v3.1.1](https://github.com/coreos/etcd/releases/tag/v3.1.1) (2017-02-17) - -See [code changes](https://github.com/coreos/etcd/compare/v3.1.0...v3.1.1) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - -### Changed - -- Compile with `Go 1.7.5`. - - -## [v2.3.8](https://github.com/coreos/etcd/releases/tag/v2.3.8) (2017-02-17) - -See [code changes](https://github.com/coreos/etcd/compare/v2.3.7...v2.3.8). - -### Changed - -- Compile with `Go 1.7.5`. - - -## [v3.1.0](https://github.com/coreos/etcd/releases/tag/v3.1.0) (2017-01-20) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.0...v3.1.0) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. - -### Improved - -- Faster linearizable reads (implements Raft read-index). -- v3 authentication API is now stable. - -### Added - -- Automatic leadership transfer when leader steps down. -- etcd flags - - `--strict-reconfig-check` flag is set by default. - - Add `--log-output` flag. - - Add `--metrics` flag. -- v3 client - - Add `SetEndpoints` method; update endpoints at runtime. - - Add `Sync` method; auto-update endpoints at runtime. - - Add `Lease TimeToLive` API; fetch lease information. - - replace Config.Logger field with global logger. - - Get API responses are sorted in ascending order by default. -- v3 etcdctl - - Add `lease timetolive` command. - - Add `--print-value-only` flag to get command. - - Add `--dest-prefix` flag to make-mirror command. - - `get` command responses are sorted in ascending order by default. -- `recipes` now conform to sessions defined in `clientv3/concurrency`. -- ACI has symlinks to `/usr/local/bin/etcd*`. -- Experimental gRPC proxy feature. - -### Changed - -- Deprecated following gRPC metrics in favor of [go-grpc-prometheus](https://github.com/grpc-ecosystem/go-grpc-prometheus): - - `etcd_grpc_requests_total` - - `etcd_grpc_requests_failed_total` - - `etcd_grpc_active_streams` - - `etcd_grpc_unary_requests_duration_seconds` -- etcd uses default route IP if advertise URL is not given. -- Cluster rejects removing members if quorum will be lost. -- SRV records (e.g., infra1.example.com) must match the discovery domain (i.e., example.com) if no custom certificate authority is given. - - `TLSConfig.ServerName` is ignored with user-provided certificates for backwards compatibility; to be deprecated. - - For example, `etcd --discovery-srv=example.com` will only authenticate peers/clients when the provided certs have root domain `example.com` as an entry in Subject Alternative Name (SAN) field. -- Discovery now has upper limit for waiting on retries. -- Warn on binding listeners through domain names; to be deprecated. - - -## [v3.0.16](https://github.com/coreos/etcd/releases/tag/v3.0.16) (2016-11-13) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.15...v3.0.16) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - - -## [v3.0.15](https://github.com/coreos/etcd/releases/tag/v3.0.15) (2016-11-11) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.14...v3.0.15) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - -### Fixed - -- Fix cancel watch request with wrong range end. - - -## [v3.0.14](https://github.com/coreos/etcd/releases/tag/v3.0.14) (2016-11-04) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.13...v3.0.14) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - -### Added - -- v3 `etcdctl migrate` command now supports `--no-ttl` flag to discard keys on transform. - - -## [v3.0.13](https://github.com/coreos/etcd/releases/tag/v3.0.13) (2016-10-24) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.12...v3.0.13) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - - -## [v3.0.12](https://github.com/coreos/etcd/releases/tag/v3.0.12) (2016-10-07) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.11...v3.0.12) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - - -## [v3.0.11](https://github.com/coreos/etcd/releases/tag/v3.0.11) (2016-10-07) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.10...v3.0.11) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - -### Added - -- Server returns previous key-value (optional) - - `clientv3.WithPrevKV` option - - v3 etcdctl `put,watch,del --prev-kv` flag - - -## [v3.0.10](https://github.com/coreos/etcd/releases/tag/v3.0.10) (2016-09-23) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.9...v3.0.10) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - - -## [v3.0.9](https://github.com/coreos/etcd/releases/tag/v3.0.9) (2016-09-15) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.8...v3.0.9) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - -### Added - -- Warn on domain names on listen URLs (v3.2 will reject domain names). - - -## [v3.0.8](https://github.com/coreos/etcd/releases/tag/v3.0.8) (2016-09-09) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.7...v3.0.8) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - -### Changed - -- Allow only IP addresses in listen URLs (domain names are rejected). - - -## [v3.0.7](https://github.com/coreos/etcd/releases/tag/v3.0.7) (2016-08-31) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.6...v3.0.7) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - -### Changed - -- SRV records only allow A records (RFC 2052). - - -## [v3.0.6](https://github.com/coreos/etcd/releases/tag/v3.0.6) (2016-08-19) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.5...v3.0.6) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - - -## [v3.0.5](https://github.com/coreos/etcd/releases/tag/v3.0.5) (2016-08-19) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.4...v3.0.5) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - -### Changed - -- SRV records (e.g., infra1.example.com) must match the discovery domain (i.e., example.com) if no custom certificate authority is given. - - -## [v3.0.4](https://github.com/coreos/etcd/releases/tag/v3.0.4) (2016-07-27) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.3...v3.0.4) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - -### Changed - -- v2 auth can now use common name from TLS certificate when `--client-cert-auth` is enabled. - -### Added - -- v2 `etcdctl ls` command now supports `--output=json`. -- Add /var/lib/etcd directory to etcd official Docker image. - - -## [v3.0.3](https://github.com/coreos/etcd/releases/tag/v3.0.3) (2016-07-15) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.2...v3.0.3) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - -### Changed - -- Revert Dockerfile to use `CMD`, instead of `ENTRYPOINT`, to support `etcdctl` run. - - Docker commands for v3.0.2 won't work without specifying executable binary paths. -- v3 etcdctl default endpoints are now `127.0.0.1:2379`. - - -## [v3.0.2](https://github.com/coreos/etcd/releases/tag/v3.0.2) (2016-07-08) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.1...v3.0.2) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - -### Changed - -- Dockerfile uses `ENTRYPOINT`, instead of `CMD`, to run etcd without binary path specified. - - -## [v3.0.1](https://github.com/coreos/etcd/releases/tag/v3.0.1) (2016-07-01) - -See [code changes](https://github.com/coreos/etcd/compare/v3.0.0...v3.0.1) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. - - -## [v3.0.0](https://github.com/coreos/etcd/releases/tag/v3.0.0) (2016-06-30) - -See [code changes](https://github.com/coreos/etcd/compare/v2.3.0...v3.0.0) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. diff --git a/vendor/github.com/coreos/etcd/Documentation/_index.md b/vendor/github.com/coreos/etcd/Documentation/_index.md new file mode 100644 index 000000000..289dd26cf --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/_index.md @@ -0,0 +1,3 @@ +--- +title: etcd version 3.3.12 +--- diff --git a/vendor/github.com/coreos/etcd/Documentation/benchmarks/README.md b/vendor/github.com/coreos/etcd/Documentation/benchmarks/README.md deleted file mode 100644 index 897112f32..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/benchmarks/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Benchmarks - -etcd benchmarks will be published regularly and tracked for each release below: - -- [etcd v2.1.0-alpha][2.1] -- [etcd v2.2.0-rc][2.2] -- [etcd v3 demo][3.0] - -# Memory Usage Benchmarks - -It records expected memory usage in different scenarios. - -- [etcd v2.2.0-rc][2.2-mem] - -[2.1]: etcd-2-1-0-alpha-benchmarks.md -[2.2]: etcd-2-2-0-rc-benchmarks.md -[2.2-mem]: etcd-2-2-0-rc-memory-benchmarks.md -[3.0]: etcd-3-demo-benchmarks.md diff --git a/vendor/github.com/coreos/etcd/Documentation/benchmarks/_index.md b/vendor/github.com/coreos/etcd/Documentation/benchmarks/_index.md new file mode 100644 index 000000000..63610b272 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/benchmarks/_index.md @@ -0,0 +1,3 @@ +--- +title: Benchmarks +--- \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-1-0-alpha-benchmarks.md b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-1-0-alpha-benchmarks.md index c1a19bdd0..7f2e4a333 100644 --- a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-1-0-alpha-benchmarks.md +++ b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-1-0-alpha-benchmarks.md @@ -1,3 +1,7 @@ +--- +title: Benchmarking etcd v2.1.0 +--- + ## Physical machines GCE n1-highcpu-2 machine type diff --git a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-benchmarks.md b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-benchmarks.md index e9b0178df..6aae3596d 100644 --- a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-benchmarks.md +++ b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-benchmarks.md @@ -1,4 +1,6 @@ -# Benchmarking etcd v2.2.0 +--- +title: Benchmarking etcd v2.2.0 +--- ## Physical Machines @@ -26,7 +28,7 @@ Go OS/Arch: linux/amd64 Bootstrap another machine, outside of the etcd cluster, and run the [`hey` HTTP benchmark tool](https://github.com/rakyll/hey) with a connection reuse patch to send requests to each etcd cluster member. See the [benchmark instructions](../../hack/benchmark/) for the patch and the steps to reproduce our procedures. -The performance is calulated through results of 100 benchmark rounds. +The performance is calculated through results of 100 benchmark rounds. ## Performance diff --git a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-rc-benchmarks.md b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-rc-benchmarks.md index ca18f6eb8..df325103d 100644 --- a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-rc-benchmarks.md +++ b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-rc-benchmarks.md @@ -1,4 +1,8 @@ -## Physical machines +--- +title: Benchmarking etcd v2.2.0-rc +--- + +## Physical machine GCE n1-highcpu-2 machine type diff --git a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-rc-memory-benchmarks.md b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-rc-memory-benchmarks.md index ef9ed6f31..7244c6989 100644 --- a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-rc-memory-benchmarks.md +++ b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-2-2-0-rc-memory-benchmarks.md @@ -1,3 +1,7 @@ +--- +title: Benchmarking etcd v2.2.0-rc-memory +--- + ## Physical machine GCE n1-standard-2 machine type diff --git a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-3-demo-benchmarks.md b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-3-demo-benchmarks.md index ae78f9171..13ed2fe8d 100644 --- a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-3-demo-benchmarks.md +++ b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-3-demo-benchmarks.md @@ -1,3 +1,7 @@ +--- +title: Benchmarking etcd v3 +--- + ## Physical machines GCE n1-highcpu-2 machine type diff --git a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-3-watch-memory-benchmark.md b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-3-watch-memory-benchmark.md index c02a8d622..226e10d1e 100644 --- a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-3-watch-memory-benchmark.md +++ b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-3-watch-memory-benchmark.md @@ -1,4 +1,6 @@ -# Watch Memory Usage Benchmark +--- +title: Watch Memory Usage Benchmark +--- *NOTE*: The watch features are under active development, and their memory usage may change as that development progresses. We do not expect it to significantly increase beyond the figures stated below. diff --git a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-storage-memory-benchmark.md b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-storage-memory-benchmark.md index 3834a1922..034f622fa 100644 --- a/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-storage-memory-benchmark.md +++ b/vendor/github.com/coreos/etcd/Documentation/benchmarks/etcd-storage-memory-benchmark.md @@ -1,4 +1,6 @@ -# Storage Memory Usage Benchmark +--- +title: Storage Memory Usage Benchmark +--- Two components of etcd storage consume physical memory. The etcd process allocates an *in-memory index* to speed key lookup. The process's *page cache*, managed by the operating system, stores recently-accessed data from disk for quick re-use. diff --git a/vendor/github.com/coreos/etcd/Documentation/branch_management.md b/vendor/github.com/coreos/etcd/Documentation/branch_management.md index e82a13e39..b236c1a2a 100644 --- a/vendor/github.com/coreos/etcd/Documentation/branch_management.md +++ b/vendor/github.com/coreos/etcd/Documentation/branch_management.md @@ -1,4 +1,6 @@ -# Branch management +--- +title: Branch management +--- ## Guide diff --git a/vendor/github.com/coreos/etcd/Documentation/demo.md b/vendor/github.com/coreos/etcd/Documentation/demo.md index 8d86f7a9f..576fa891b 100644 --- a/vendor/github.com/coreos/etcd/Documentation/demo.md +++ b/vendor/github.com/coreos/etcd/Documentation/demo.md @@ -1,4 +1,6 @@ -# Demo +--- +title: Demo +--- This series of examples shows the basic procedures for working with an etcd cluster. diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/_index.md b/vendor/github.com/coreos/etcd/Documentation/dev-guide/_index.md new file mode 100644 index 000000000..20cbfb091 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/_index.md @@ -0,0 +1,3 @@ +--- +title: Developer guide +--- \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_concurrency_reference_v3.md b/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_concurrency_reference_v3.md index 9ae1dab75..01059c7c1 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_concurrency_reference_v3.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_concurrency_reference_v3.md @@ -1,4 +1,6 @@ -### etcd concurrency API Reference +--- +title: etcd concurrency API Reference +--- This is a generated documentation. Please read the proto files for more. @@ -20,7 +22,7 @@ The lock service exposes client-side locking facilities as a gRPC interface. | Field | Description | Type | | ----- | ----------- | ---- | | name | name is the identifier for the distributed shared lock to be acquired. | bytes | -| lease | lease is the ID of the lease that will be attached to ownership of the lock. If the lease expires or is revoked and currently holds the lock, the lock is automatically released. Calls to Lock with the same lease will be treated as a single acquistion; locking twice with the same lease is a no-op. | int64 | +| lease | lease is the ID of the lease that will be attached to ownership of the lock. If the lease expires or is revoked and currently holds the lock, the lock is automatically released. Calls to Lock with the same lease will be treated as a single acquisition; locking twice with the same lease is a no-op. | int64 | diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_grpc_gateway.md b/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_grpc_gateway.md index 6d115e699..433959d30 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_grpc_gateway.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_grpc_gateway.md @@ -1,16 +1,29 @@ +--- +title: Why gRPC gateway +--- -## Why grpc-gateway +etcd v3 uses [gRPC][grpc] for its messaging protocol. The etcd project includes a gRPC-based [Go client][go-client] and a command line utility, [etcdctl][etcdctl], for communicating with an etcd cluster through gRPC. For languages with no gRPC support, etcd provides a JSON [gRPC gateway][grpc-gateway]. This gateway serves a RESTful proxy that translates HTTP/JSON requests into gRPC messages. -etcd v3 uses [gRPC][grpc] for its messaging protocol. The etcd project includes a gRPC-based [Go client][go-client] and a command line utility, [etcdctl][etcdctl], for communicating with an etcd cluster through gRPC. For languages with no gRPC support, etcd provides a JSON [grpc-gateway][grpc-gateway]. This gateway serves a RESTful proxy that translates HTTP/JSON requests into gRPC messages. +## Using gRPC gateway +The gateway accepts a [JSON mapping][json-mapping] for etcd's [protocol buffer][api-ref] message definitions. Note that `key` and `value` fields are defined as byte arrays and therefore must be base64 encoded in JSON. The following examples use `curl`, but any HTTP/JSON client should work all the same. -## Using grpc-gateway +### Notes -The gateway accepts a [JSON mapping][json-mapping] for etcd's [protocol buffer][api-ref] message definitions. Note that `key` and `value` fields are defined as byte arrays and therefore must be base64 encoded in JSON. The following examples use `curl`, but any HTTP/JSON client should work all the same. +gRPC gateway endpoint has changed since etcd v3.3: + +- etcd v3.2 or before uses only `[CLIENT-URL]/v3alpha/*`. +- etcd v3.3 uses `[CLIENT-URL]/v3beta/*` while keeping `[CLIENT-URL]/v3alpha/*`. +- etcd v3.4 uses `[CLIENT-URL]/v3/*` while keeping `[CLIENT-URL]/v3beta/*`. + - **`[CLIENT-URL]/v3alpha/*` is deprecated**. +- etcd v3.5 or later uses only `[CLIENT-URL]/v3/*`. + - **`[CLIENT-URL]/v3beta/*` is deprecated**. + +gRPC-gateway does not support authentication using TLS Common Name. ### Put and get keys -Use the `/v3beta/kv/range` and `/v3beta/kv/put` services to read and write keys: +Use the `/v3/kv/range` and `/v3/kv/put` services to read and write keys: ```bash </dev/null 2>&1 +curl -L http://localhost:2379/v3/kv/put \ + -X POST -d '{"key": "Zm9v", "value": "YmFy"}' >/dev/null 2>&1 # {"result":{"header":{"cluster_id":"12585971608760269493","member_id":"13847567121247652255","revision":"2","raft_term":"2"},"events":[{"kv":{"key":"Zm9v","create_revision":"2","mod_revision":"2","version":"1","value":"YmFy"}}]}} ``` ### Transactions -Issue a transaction with `/v3beta/kv/txn`: +Issue a transaction with `/v3/kv/txn`: ```bash -curl -L http://localhost:2379/v3beta/kv/txn \ - -X POST \ - -d '{"compare":[{"target":"CREATE","key":"Zm9v","createRevision":"2"}],"success":[{"requestPut":{"key":"Zm9v","value":"YmFy"}}]}' +# target CREATE +curl -L http://localhost:2379/v3/kv/txn \ + -X POST \ + -d '{"compare":[{"target":"CREATE","key":"Zm9v","createRevision":"2"}],"success":[{"requestPut":{"key":"Zm9v","value":"YmFy"}}]}' # {"header":{"cluster_id":"12585971608760269493","member_id":"13847567121247652255","revision":"3","raft_term":"2"},"succeeded":true,"responses":[{"response_put":{"header":{"revision":"3"}}}]} ``` +```bash +# target VERSION +curl -L http://localhost:2379/v3/kv/txn \ + -X POST \ + -d '{"compare":[{"version":"4","result":"EQUAL","target":"VERSION","key":"Zm9v"}],"success":[{"requestRange":{"key":"Zm9v"}}]}' +# {"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"6","raft_term":"3"},"succeeded":true,"responses":[{"response_range":{"header":{"revision":"6"},"kvs":[{"key":"Zm9v","create_revision":"2","mod_revision":"6","version":"4","value":"YmF6"}],"count":"1"}}]} +``` + ### Authentication -Set up authentication with the `/v3beta/auth` service: +Set up authentication with the `/v3/auth` service: ```bash # create root user -curl -L http://localhost:2379/v3beta/auth/user/add \ - -X POST -d '{"name": "root", "password": "pass"}' +curl -L http://localhost:2379/v3/auth/user/add \ + -X POST -d '{"name": "root", "password": "pass"}' # {"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"1","raft_term":"2"}} # create root role -curl -L http://localhost:2379/v3beta/auth/role/add \ - -X POST -d '{"name": "root"}' +curl -L http://localhost:2379/v3/auth/role/add \ + -X POST -d '{"name": "root"}' # {"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"1","raft_term":"2"}} # grant root role -curl -L http://localhost:2379/v3beta/auth/user/grant \ - -X POST -d '{"user": "root", "role": "root"}' +curl -L http://localhost:2379/v3/auth/user/grant \ + -X POST -d '{"user": "root", "role": "root"}' # {"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"1","raft_term":"2"}} # enable auth -curl -L http://localhost:2379/v3beta/auth/enable -X POST -d '{}' +curl -L http://localhost:2379/v3/auth/enable -X POST -d '{}' # {"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"1","raft_term":"2"}} ``` -Authenticate with etcd for an authentication token using `/v3beta/auth/authenticate`: +Authenticate with etcd for an authentication token using `/v3/auth/authenticate`: ```bash # get the auth token for the root user -curl -L http://localhost:2379/v3beta/auth/authenticate \ - -X POST -d '{"name": "root", "password": "pass"}' +curl -L http://localhost:2379/v3/auth/authenticate \ + -X POST -d '{"name": "root", "password": "pass"}' # {"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"1","raft_term":"2"},"token":"sssvIpwfnLAcWAQH.9"} ``` Set the `Authorization` header to the authentication token to fetch a key using authentication credentials: ```bash -curl -L http://localhost:2379/v3beta/kv/put \ - -H 'Authorization : sssvIpwfnLAcWAQH.9' \ - -X POST -d '{"key": "Zm9v", "value": "YmFy"}' +curl -L http://localhost:2379/v3/kv/put \ + -H 'Authorization : sssvIpwfnLAcWAQH.9' \ + -X POST -d '{"key": "Zm9v", "value": "YmFy"}' # {"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"2","raft_term":"2"}} ``` @@ -108,9 +130,8 @@ Generated [Swagger][swagger] API definitions can be found at [rpc.swagger.json][ [api-ref]: ./api_reference_v3.md [go-client]: https://github.com/coreos/etcd/tree/master/clientv3 [etcdctl]: https://github.com/coreos/etcd/tree/master/etcdctl -[grpc]: http://www.grpc.io/ +[grpc]: https://www.grpc.io/ [grpc-gateway]: https://github.com/grpc-ecosystem/grpc-gateway [json-mapping]: https://developers.google.com/protocol-buffers/docs/proto3#json [swagger]: http://swagger.io/ [swagger-doc]: apispec/swagger/rpc.swagger.json - diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_reference_v3.md b/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_reference_v3.md index cf492a182..2d2000d8a 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_reference_v3.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/api_reference_v3.md @@ -1,4 +1,6 @@ -### etcd API Reference +--- +title: etcd API Reference +--- This is a generated documentation. Please read the proto files for more. @@ -69,8 +71,8 @@ This is a generated documentation. Please read the proto files for more. | Alarm | AlarmRequest | AlarmResponse | Alarm activates, deactivates, and queries alarms regarding cluster health. | | Status | StatusRequest | StatusResponse | Status gets the status of the member. | | Defragment | DefragmentRequest | DefragmentResponse | Defragment defragments a member's backend database to recover storage space. | -| Hash | HashRequest | HashResponse | Hash computes the hash of the KV's backend. This is designed for testing; do not use this in production when there are ongoing transactions. | -| HashKV | HashKVRequest | HashKVResponse | HashKV computes the hash of all MVCC keys up to a given revision. | +| Hash | HashRequest | HashResponse | Hash computes the hash of whole backend keyspace, including key, lease, and other buckets in storage. This is designed for testing ONLY! Do not rely on this in production with ongoing transactions, since Hash operation does not hold MVCC locks. Use "HashKV" API instead for "key" bucket consistency checks. | +| HashKV | HashKVRequest | HashKVResponse | HashKV computes the hash of all MVCC keys up to a given revision. It only iterates "key" bucket in backend storage. | | Snapshot | SnapshotRequest | SnapshotResponse | Snapshot sends a snapshot of the entire backend from a member over a stream to a client. | | MoveLeader | MoveLeaderRequest | MoveLeaderResponse | MoveLeader requests current leader node to transfer its leadership to transferee. | @@ -226,8 +228,8 @@ Empty field. | Field | Description | Type | | ----- | ----------- | ---- | | role | | string | -| key | | string | -| range_end | | string | +| key | | bytes | +| range_end | | bytes | @@ -476,6 +478,31 @@ Empty field. +##### message `LeaseCheckpoint` (etcdserver/etcdserverpb/rpc.proto) + +| Field | Description | Type | +| ----- | ----------- | ---- | +| ID | ID is the lease ID to checkpoint. | int64 | +| remaining_TTL | Remaining_TTL is the remaining time until expiry of the lease. | int64 | + + + +##### message `LeaseCheckpointRequest` (etcdserver/etcdserverpb/rpc.proto) + +| Field | Description | Type | +| ----- | ----------- | ---- | +| checkpoints | | (slice of) LeaseCheckpoint | + + + +##### message `LeaseCheckpointResponse` (etcdserver/etcdserverpb/rpc.proto) + +| Field | Description | Type | +| ----- | ----------- | ---- | +| header | | ResponseHeader | + + + ##### message `LeaseGrantRequest` (etcdserver/etcdserverpb/rpc.proto) | Field | Description | Type | @@ -706,7 +733,7 @@ Empty field. | count_only | count_only when set returns only the count of the keys in the range. | bool | | min_mod_revision | min_mod_revision is the lower bound for returned key mod revisions; all keys with lesser mod revisions will be filtered away. | int64 | | max_mod_revision | max_mod_revision is the upper bound for returned key mod revisions; all keys with greater mod revisions will be filtered away. | int64 | -| min_create_revision | min_create_revision is the lower bound for returned key create revisions; all keys with lesser create trevisions will be filtered away. | int64 | +| min_create_revision | min_create_revision is the lower bound for returned key create revisions; all keys with lesser create revisions will be filtered away. | int64 | | max_create_revision | max_create_revision is the upper bound for returned key create revisions; all keys with greater create revisions will be filtered away. | int64 | @@ -740,7 +767,7 @@ Empty field. | ----- | ----------- | ---- | | cluster_id | cluster_id is the ID of the cluster which sent the response. | uint64 | | member_id | member_id is the ID of the member which sent the response. | uint64 | -| revision | revision is the key-value store revision when the request was applied. | int64 | +| revision | revision is the key-value store revision when the request was applied. For watch progress responses, the header.revision indicates progress. All future events recieved in this stream are guaranteed to have a higher revision number than the header.revision number. | int64 | | raft_term | raft_term is the raft term when the request was applied. | uint64 | @@ -785,10 +812,13 @@ Empty field. | ----- | ----------- | ---- | | header | | ResponseHeader | | version | version is the cluster protocol version used by the responding member. | string | -| dbSize | dbSize is the size of the backend database, in bytes, of the responding member. | int64 | +| dbSize | dbSize is the size of the backend database physically allocated, in bytes, of the responding member. | int64 | | leader | leader is the member ID which the responding member believes is the current leader. | uint64 | -| raftIndex | raftIndex is the current raft index of the responding member. | uint64 | +| raftIndex | raftIndex is the current raft committed index of the responding member. | uint64 | | raftTerm | raftTerm is the current raft term of the responding member. | uint64 | +| raftAppliedIndex | raftAppliedIndex is the current raft applied index of the responding member. | uint64 | +| errors | errors contains alarm/health information and status. | (slice of) string | +| dbSizeInUse | dbSizeInUse is the size of the backend database logically in use, in bytes, of the responding member. | int64 | @@ -832,6 +862,16 @@ From google paxosdb paper: Our implementation hinges around a powerful primitive | progress_notify | progress_notify is set so that the etcd server will periodically send a WatchResponse with no events to the new watcher if there are no recent events. It is useful when clients wish to recover a disconnected watcher starting from a recent known revision. The etcd server may decide how often it will send notifications based on current load. | bool | | filters | filters filter the events at server side before it sends back to the watcher. | (slice of) FilterType | | prev_kv | If prev_kv is set, created watcher gets the previous KV before the event happens. If the previous KV is already compacted, nothing will be returned. | bool | +| watch_id | If watch_id is provided and non-zero, it will be assigned to this watcher. Since creating a watcher in etcd is not a synchronous operation, this can be used ensure that ordering is correct when creating multiple watchers on the same stream. Creating a watcher with an ID already in use on the stream will cause an error to be returned. | int64 | +| fragment | fragment enables splitting large revisions into multiple watch responses. | bool | + + + +##### message `WatchProgressRequest` (etcdserver/etcdserverpb/rpc.proto) + +Requests the a watch stream progress status be sent in the watch response stream as soon as possible. + +Empty field. @@ -842,6 +882,7 @@ From google paxosdb paper: Our implementation hinges around a powerful primitive | request_union | request_union is a request to either create a new watcher or cancel an existing watcher. | oneof | | create_request | | WatchCreateRequest | | cancel_request | | WatchCancelRequest | +| progress_request | | WatchProgressRequest | @@ -855,6 +896,7 @@ From google paxosdb paper: Our implementation hinges around a powerful primitive | canceled | canceled is set to true if the response is for a cancel watch request. No further events will be sent to the canceled watcher. | bool | | compact_revision | compact_revision is set to the minimum index if a watcher tries to watch at a compacted index. This happens when creating a watcher at a compacted revision or the watcher cannot catch up with the progress of the key-value store. The client should treat the watcher as canceled and should not try to create any watcher with the same start_revision again. | int64 | | cancel_reason | cancel_reason indicates the reason for canceling the watcher. | string | +| fragment | framgment is true if large watch response was split over multiple responses. | bool | | events | | (slice of) mvccpb.Event | @@ -888,6 +930,7 @@ From google paxosdb paper: Our implementation hinges around a powerful primitive | ----- | ----------- | ---- | | ID | | int64 | | TTL | | int64 | +| RemainingTTL | | int64 | diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/rpc.swagger.json b/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/rpc.swagger.json index d3b2272a8..a76c9d3a8 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/rpc.swagger.json +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/rpc.swagger.json @@ -15,7 +15,7 @@ "version": "version not set" }, "paths": { - "/v3beta/auth/authenticate": { + "/v3/auth/authenticate": { "post": { "tags": [ "Auth" @@ -34,7 +34,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthenticateResponse" } @@ -42,7 +42,7 @@ } } }, - "/v3beta/auth/disable": { + "/v3/auth/disable": { "post": { "tags": [ "Auth" @@ -61,7 +61,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthDisableResponse" } @@ -69,7 +69,7 @@ } } }, - "/v3beta/auth/enable": { + "/v3/auth/enable": { "post": { "tags": [ "Auth" @@ -88,7 +88,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthEnableResponse" } @@ -96,7 +96,7 @@ } } }, - "/v3beta/auth/role/add": { + "/v3/auth/role/add": { "post": { "tags": [ "Auth" @@ -115,7 +115,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthRoleAddResponse" } @@ -123,7 +123,7 @@ } } }, - "/v3beta/auth/role/delete": { + "/v3/auth/role/delete": { "post": { "tags": [ "Auth" @@ -142,7 +142,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthRoleDeleteResponse" } @@ -150,7 +150,7 @@ } } }, - "/v3beta/auth/role/get": { + "/v3/auth/role/get": { "post": { "tags": [ "Auth" @@ -169,7 +169,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthRoleGetResponse" } @@ -177,7 +177,7 @@ } } }, - "/v3beta/auth/role/grant": { + "/v3/auth/role/grant": { "post": { "tags": [ "Auth" @@ -196,7 +196,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthRoleGrantPermissionResponse" } @@ -204,7 +204,7 @@ } } }, - "/v3beta/auth/role/list": { + "/v3/auth/role/list": { "post": { "tags": [ "Auth" @@ -223,7 +223,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthRoleListResponse" } @@ -231,7 +231,7 @@ } } }, - "/v3beta/auth/role/revoke": { + "/v3/auth/role/revoke": { "post": { "tags": [ "Auth" @@ -250,7 +250,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthRoleRevokePermissionResponse" } @@ -258,7 +258,7 @@ } } }, - "/v3beta/auth/user/add": { + "/v3/auth/user/add": { "post": { "tags": [ "Auth" @@ -277,7 +277,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthUserAddResponse" } @@ -285,7 +285,7 @@ } } }, - "/v3beta/auth/user/changepw": { + "/v3/auth/user/changepw": { "post": { "tags": [ "Auth" @@ -304,7 +304,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthUserChangePasswordResponse" } @@ -312,7 +312,7 @@ } } }, - "/v3beta/auth/user/delete": { + "/v3/auth/user/delete": { "post": { "tags": [ "Auth" @@ -331,7 +331,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthUserDeleteResponse" } @@ -339,7 +339,7 @@ } } }, - "/v3beta/auth/user/get": { + "/v3/auth/user/get": { "post": { "tags": [ "Auth" @@ -358,7 +358,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthUserGetResponse" } @@ -366,7 +366,7 @@ } } }, - "/v3beta/auth/user/grant": { + "/v3/auth/user/grant": { "post": { "tags": [ "Auth" @@ -385,7 +385,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthUserGrantRoleResponse" } @@ -393,7 +393,7 @@ } } }, - "/v3beta/auth/user/list": { + "/v3/auth/user/list": { "post": { "tags": [ "Auth" @@ -412,7 +412,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthUserListResponse" } @@ -420,7 +420,7 @@ } } }, - "/v3beta/auth/user/revoke": { + "/v3/auth/user/revoke": { "post": { "tags": [ "Auth" @@ -439,7 +439,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAuthUserRevokeRoleResponse" } @@ -447,7 +447,7 @@ } } }, - "/v3beta/cluster/member/add": { + "/v3/cluster/member/add": { "post": { "tags": [ "Cluster" @@ -466,7 +466,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbMemberAddResponse" } @@ -474,7 +474,7 @@ } } }, - "/v3beta/cluster/member/list": { + "/v3/cluster/member/list": { "post": { "tags": [ "Cluster" @@ -493,7 +493,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbMemberListResponse" } @@ -501,7 +501,7 @@ } } }, - "/v3beta/cluster/member/remove": { + "/v3/cluster/member/remove": { "post": { "tags": [ "Cluster" @@ -520,7 +520,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbMemberRemoveResponse" } @@ -528,7 +528,7 @@ } } }, - "/v3beta/cluster/member/update": { + "/v3/cluster/member/update": { "post": { "tags": [ "Cluster" @@ -547,7 +547,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbMemberUpdateResponse" } @@ -555,7 +555,7 @@ } } }, - "/v3beta/kv/compaction": { + "/v3/kv/compaction": { "post": { "tags": [ "KV" @@ -574,7 +574,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbCompactionResponse" } @@ -582,7 +582,7 @@ } } }, - "/v3beta/kv/deleterange": { + "/v3/kv/deleterange": { "post": { "tags": [ "KV" @@ -601,7 +601,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbDeleteRangeResponse" } @@ -609,13 +609,13 @@ } } }, - "/v3beta/kv/lease/leases": { + "/v3/kv/lease/leases": { "post": { "tags": [ "Lease" ], "summary": "LeaseLeases lists all existing leases.", - "operationId": "LeaseLeases", + "operationId": "LeaseLeases2", "parameters": [ { "name": "body", @@ -628,7 +628,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbLeaseLeasesResponse" } @@ -636,13 +636,13 @@ } } }, - "/v3beta/kv/lease/revoke": { + "/v3/kv/lease/revoke": { "post": { "tags": [ "Lease" ], "summary": "LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.", - "operationId": "LeaseRevoke", + "operationId": "LeaseRevoke2", "parameters": [ { "name": "body", @@ -655,7 +655,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbLeaseRevokeResponse" } @@ -663,13 +663,13 @@ } } }, - "/v3beta/kv/lease/timetolive": { + "/v3/kv/lease/timetolive": { "post": { "tags": [ "Lease" ], "summary": "LeaseTimeToLive retrieves lease information.", - "operationId": "LeaseTimeToLive", + "operationId": "LeaseTimeToLive2", "parameters": [ { "name": "body", @@ -682,7 +682,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbLeaseTimeToLiveResponse" } @@ -690,7 +690,7 @@ } } }, - "/v3beta/kv/put": { + "/v3/kv/put": { "post": { "tags": [ "KV" @@ -709,7 +709,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbPutResponse" } @@ -717,7 +717,7 @@ } } }, - "/v3beta/kv/range": { + "/v3/kv/range": { "post": { "tags": [ "KV" @@ -736,7 +736,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbRangeResponse" } @@ -744,7 +744,7 @@ } } }, - "/v3beta/kv/txn": { + "/v3/kv/txn": { "post": { "tags": [ "KV" @@ -763,7 +763,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbTxnResponse" } @@ -771,7 +771,7 @@ } } }, - "/v3beta/lease/grant": { + "/v3/lease/grant": { "post": { "tags": [ "Lease" @@ -790,7 +790,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbLeaseGrantResponse" } @@ -798,7 +798,7 @@ } } }, - "/v3beta/lease/keepalive": { + "/v3/lease/keepalive": { "post": { "tags": [ "Lease" @@ -807,7 +807,7 @@ "operationId": "LeaseKeepAlive", "parameters": [ { - "description": "(streaming inputs)", + "description": " (streaming inputs)", "name": "body", "in": "body", "required": true, @@ -818,7 +818,7 @@ ], "responses": { "200": { - "description": "(streaming responses)", + "description": "A successful response.(streaming responses)", "schema": { "$ref": "#/definitions/etcdserverpbLeaseKeepAliveResponse" } @@ -826,7 +826,88 @@ } } }, - "/v3beta/maintenance/alarm": { + "/v3/lease/leases": { + "post": { + "tags": [ + "Lease" + ], + "summary": "LeaseLeases lists all existing leases.", + "operationId": "LeaseLeases", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/etcdserverpbLeaseLeasesRequest" + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/etcdserverpbLeaseLeasesResponse" + } + } + } + } + }, + "/v3/lease/revoke": { + "post": { + "tags": [ + "Lease" + ], + "summary": "LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.", + "operationId": "LeaseRevoke", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/etcdserverpbLeaseRevokeRequest" + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/etcdserverpbLeaseRevokeResponse" + } + } + } + } + }, + "/v3/lease/timetolive": { + "post": { + "tags": [ + "Lease" + ], + "summary": "LeaseTimeToLive retrieves lease information.", + "operationId": "LeaseTimeToLive", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/etcdserverpbLeaseTimeToLiveRequest" + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/etcdserverpbLeaseTimeToLiveResponse" + } + } + } + } + }, + "/v3/maintenance/alarm": { "post": { "tags": [ "Maintenance" @@ -845,7 +926,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbAlarmResponse" } @@ -853,7 +934,7 @@ } } }, - "/v3beta/maintenance/defragment": { + "/v3/maintenance/defragment": { "post": { "tags": [ "Maintenance" @@ -872,7 +953,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbDefragmentResponse" } @@ -880,12 +961,12 @@ } } }, - "/v3beta/maintenance/hash": { + "/v3/maintenance/hash": { "post": { "tags": [ "Maintenance" ], - "summary": "HashKV computes the hash of all MVCC keys up to a given revision.", + "summary": "HashKV computes the hash of all MVCC keys up to a given revision.\nIt only iterates \"key\" bucket in backend storage.", "operationId": "HashKV", "parameters": [ { @@ -899,7 +980,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbHashKVResponse" } @@ -907,7 +988,7 @@ } } }, - "/v3beta/maintenance/snapshot": { + "/v3/maintenance/snapshot": { "post": { "tags": [ "Maintenance" @@ -926,7 +1007,7 @@ ], "responses": { "200": { - "description": "(streaming responses)", + "description": "A successful response.(streaming responses)", "schema": { "$ref": "#/definitions/etcdserverpbSnapshotResponse" } @@ -934,7 +1015,7 @@ } } }, - "/v3beta/maintenance/status": { + "/v3/maintenance/status": { "post": { "tags": [ "Maintenance" @@ -953,7 +1034,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbStatusResponse" } @@ -961,7 +1042,7 @@ } } }, - "/v3beta/maintenance/transfer-leadership": { + "/v3/maintenance/transfer-leadership": { "post": { "tags": [ "Maintenance" @@ -980,7 +1061,7 @@ ], "responses": { "200": { - "description": "(empty)", + "description": "A successful response.", "schema": { "$ref": "#/definitions/etcdserverpbMoveLeaderResponse" } @@ -988,7 +1069,7 @@ } } }, - "/v3beta/watch": { + "/v3/watch": { "post": { "tags": [ "Watch" @@ -997,7 +1078,7 @@ "operationId": "Watch", "parameters": [ { - "description": "(streaming inputs)", + "description": " (streaming inputs)", "name": "body", "in": "body", "required": true, @@ -1008,7 +1089,7 @@ ], "responses": { "200": { - "description": "(streaming responses)", + "description": "A successful response.(streaming responses)", "schema": { "$ref": "#/definitions/etcdserverpbWatchResponse" } @@ -1286,10 +1367,12 @@ "type": "object", "properties": { "key": { - "type": "string" + "type": "string", + "format": "byte" }, "range_end": { - "type": "string" + "type": "string", + "format": "byte" }, "role": { "type": "string" @@ -2017,7 +2100,7 @@ "format": "int64" }, "min_create_revision": { - "description": "min_create_revision is the lower bound for returned key create revisions; all keys with\nlesser create trevisions will be filtered away.", + "description": "min_create_revision is the lower bound for returned key create revisions; all keys with\nlesser create revisions will be filtered away.", "type": "string", "format": "int64" }, @@ -2112,7 +2195,7 @@ "format": "uint64" }, "revision": { - "description": "revision is the key-value store revision when the request was applied.", + "description": "revision is the key-value store revision when the request was applied.\nFor watch progress responses, the header.revision indicates progress. All future events\nrecieved in this stream are guaranteed to have a higher revision number than the\nheader.revision number.", "type": "string", "format": "int64" } @@ -2164,10 +2247,22 @@ "type": "object", "properties": { "dbSize": { - "description": "dbSize is the size of the backend database, in bytes, of the responding member.", + "description": "dbSize is the size of the backend database physically allocated, in bytes, of the responding member.", "type": "string", "format": "int64" }, + "dbSizeInUse": { + "description": "dbSizeInUse is the size of the backend database logically in use, in bytes, of the responding member.", + "type": "string", + "format": "int64" + }, + "errors": { + "description": "errors contains alarm/health information and status.", + "type": "array", + "items": { + "type": "string" + } + }, "header": { "$ref": "#/definitions/etcdserverpbResponseHeader" }, @@ -2176,8 +2271,13 @@ "type": "string", "format": "uint64" }, + "raftAppliedIndex": { + "description": "raftAppliedIndex is the current raft applied index of the responding member.", + "type": "string", + "format": "uint64" + }, "raftIndex": { - "description": "raftIndex is the current raft index of the responding member.", + "description": "raftIndex is the current raft committed index of the responding member.", "type": "string", "format": "uint64" }, @@ -2259,6 +2359,11 @@ "$ref": "#/definitions/WatchCreateRequestFilterType" } }, + "fragment": { + "description": "fragment enables splitting large revisions into multiple watch responses.", + "type": "boolean", + "format": "boolean" + }, "key": { "description": "key is the key to register for watching.", "type": "string", @@ -2283,9 +2388,18 @@ "description": "start_revision is an optional revision to watch from (inclusive). No start_revision is \"now\".", "type": "string", "format": "int64" + }, + "watch_id": { + "description": "If watch_id is provided and non-zero, it will be assigned to this watcher.\nSince creating a watcher in etcd is not a synchronous operation,\nthis can be used ensure that ordering is correct when creating multiple\nwatchers on the same stream. Creating a watcher with an ID already in\nuse on the stream will cause an error to be returned.", + "type": "string", + "format": "int64" } } }, + "etcdserverpbWatchProgressRequest": { + "description": "Requests the a watch stream progress status be sent in the watch response stream as soon as\npossible.", + "type": "object" + }, "etcdserverpbWatchRequest": { "type": "object", "properties": { @@ -2294,6 +2408,9 @@ }, "create_request": { "$ref": "#/definitions/etcdserverpbWatchCreateRequest" + }, + "progress_request": { + "$ref": "#/definitions/etcdserverpbWatchProgressRequest" } } }, @@ -2325,6 +2442,11 @@ "$ref": "#/definitions/mvccpbEvent" } }, + "fragment": { + "description": "framgment is true if large watch response was split over multiple responses.", + "type": "boolean", + "format": "boolean" + }, "header": { "$ref": "#/definitions/etcdserverpbResponseHeader" }, diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/v3election.swagger.json b/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/v3election.swagger.json index a479e7cd2..b0d33ad08 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/v3election.swagger.json +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/v3election.swagger.json @@ -15,13 +15,13 @@ "application/json" ], "paths": { - "/v3beta/election/campaign": { + "/v3/election/campaign": { "post": { "summary": "Campaign waits to acquire leadership in an election, returning a LeaderKey\nrepresenting the leadership if successful. The LeaderKey can then be used\nto issue new values on the election, transactionally guard API requests on\nleadership still being held, and resign from the election.", "operationId": "Campaign", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/v3electionpbCampaignResponse" } @@ -42,13 +42,13 @@ ] } }, - "/v3beta/election/leader": { + "/v3/election/leader": { "post": { "summary": "Leader returns the current election proclamation, if any.", "operationId": "Leader", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/v3electionpbLeaderResponse" } @@ -69,13 +69,13 @@ ] } }, - "/v3beta/election/observe": { + "/v3/election/observe": { "post": { "summary": "Observe streams election proclamations in-order as made by the election's\nelected leaders.", "operationId": "Observe", "responses": { "200": { - "description": "(streaming responses)", + "description": "A successful response.(streaming responses)", "schema": { "$ref": "#/definitions/v3electionpbLeaderResponse" } @@ -96,13 +96,13 @@ ] } }, - "/v3beta/election/proclaim": { + "/v3/election/proclaim": { "post": { "summary": "Proclaim updates the leader's posted value with a new value.", "operationId": "Proclaim", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/v3electionpbProclaimResponse" } @@ -123,13 +123,13 @@ ] } }, - "/v3beta/election/resign": { + "/v3/election/resign": { "post": { "summary": "Resign releases election leadership so other campaigners may acquire\nleadership on the election.", "operationId": "Resign", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/v3electionpbResignResponse" } @@ -168,7 +168,7 @@ "revision": { "type": "string", "format": "int64", - "description": "revision is the key-value store revision when the request was applied." + "description": "revision is the key-value store revision when the request was applied.\nFor watch progress responses, the header.revision indicates progress. All future events\nrecieved in this stream are guaranteed to have a higher revision number than the\nheader.revision number." }, "raft_term": { "type": "string", diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/v3lock.swagger.json b/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/v3lock.swagger.json index 464f7a071..45a826150 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/v3lock.swagger.json +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/apispec/swagger/v3lock.swagger.json @@ -15,13 +15,13 @@ "application/json" ], "paths": { - "/v3beta/lock/lock": { + "/v3/lock/lock": { "post": { "summary": "Lock acquires a distributed shared lock on a given named lock.\nOn success, it will return a unique key that exists so long as the\nlock is held by the caller. This key can be used in conjunction with\ntransactions to safely ensure updates to etcd only occur while holding\nlock ownership. The lock is held until Unlock is called on the key or the\nlease associate with the owner expires.", "operationId": "Lock", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/v3lockpbLockResponse" } @@ -42,13 +42,13 @@ ] } }, - "/v3beta/lock/unlock": { + "/v3/lock/unlock": { "post": { "summary": "Unlock takes a key returned by Lock and releases the hold on lock. The\nnext Lock caller waiting for the lock will then be woken up and given\nownership of the lock.", "operationId": "Unlock", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/v3lockpbUnlockResponse" } @@ -87,7 +87,7 @@ "revision": { "type": "string", "format": "int64", - "description": "revision is the key-value store revision when the request was applied." + "description": "revision is the key-value store revision when the request was applied.\nFor watch progress responses, the header.revision indicates progress. All future events\nrecieved in this stream are guaranteed to have a higher revision number than the\nheader.revision number." }, "raft_term": { "type": "string", @@ -107,7 +107,7 @@ "lease": { "type": "string", "format": "int64", - "description": "lease is the ID of the lease that will be attached to ownership of the\nlock. If the lease expires or is revoked and currently holds the lock,\nthe lock is automatically released. Calls to Lock with the same lease will\nbe treated as a single acquistion; locking twice with the same lease is a\nno-op." + "description": "lease is the ID of the lease that will be attached to ownership of the\nlock. If the lease expires or is revoked and currently holds the lock,\nthe lock is automatically released. Calls to Lock with the same lease will\nbe treated as a single acquisition; locking twice with the same lease is a\nno-op." } } }, diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/experimental_apis.md b/vendor/github.com/coreos/etcd/Documentation/dev-guide/experimental_apis.md index dde2f09d6..aba974208 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/experimental_apis.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/experimental_apis.md @@ -1,7 +1,9 @@ -# Experimental APIs and features +--- +title: Experimental APIs and features +--- For the most part, the etcd project is stable, but we are still moving fast! We believe in the release fast philosophy. We want to get early feedback on features still in development and stabilizing. Thus, there are, and will be more, experimental features and APIs. We plan to improve these features based on the early feedback from the community, or abandon them if there is little interest, in the next few releases. Please do not rely on any experimental features or APIs in production environment. ## The current experimental API/features are: -- [KV ordering](https://godoc.org/github.com/coreos/etcd/clientv3/ordering) wrapper. When an etcd client switches endpoints, responses to serializable reads may go backward in time if the new endpoint is lagging behind the rest of the cluster. The ordering wrapper caches the current cluster revision from response headers. If a response revision is less than the cached revision, the client selects another endpoint and reissues the read. Enable in grpcproxy with `--experimental-serializable-ordering`. +- [KV ordering](https://godoc.org/github.com/etcd-io/etcd/clientv3/ordering) wrapper. When an etcd client switches endpoints, responses to serializable reads may go backward in time if the new endpoint is lagging behind the rest of the cluster. The ordering wrapper caches the current cluster revision from response headers. If a response revision is less than the cached revision, the client selects another endpoint and reissues the read. Enable in grpcproxy with `--experimental-serializable-ordering`. diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/grpc_naming.md b/vendor/github.com/coreos/etcd/Documentation/dev-guide/grpc_naming.md index 4662d6ee7..77287c6e1 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/grpc_naming.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/grpc_naming.md @@ -1,4 +1,6 @@ -# gRPC naming and discovery +--- +title: gRPC naming and discovery +--- etcd provides a gRPC resolver to support an alternative name system that fetches endpoints from etcd for discovering gRPC services. The underlying mechanism is based on watching updates to keys prefixed with the service name. @@ -8,8 +10,8 @@ The etcd client provides a gRPC resolver for resolving gRPC endpoints with an et ```go import ( - "github.com/coreos/etcd/clientv3" - etcdnaming "github.com/coreos/etcd/clientv3/naming" + "go.etcd.io/etcd/clientv3" + etcdnaming "go.etcd.io/etcd/clientv3/naming" "google.golang.org/grpc" ) @@ -19,7 +21,7 @@ import ( cli, cerr := clientv3.NewFromURL("http://localhost:2379") r := &etcdnaming.GRPCResolver{Client: cli} b := grpc.RoundRobin(r) -conn, gerr := grpc.Dial("my-service", grpc.WithBalancer(b)) +conn, gerr := grpc.Dial("my-service", grpc.WithBalancer(b), grpc.WithBlock(), ...) ``` ## Managing service endpoints diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/interacting_v3.md b/vendor/github.com/coreos/etcd/Documentation/dev-guide/interacting_v3.md index 2f01aae86..3638cd30b 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/interacting_v3.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/interacting_v3.md @@ -1,8 +1,12 @@ -# Interacting with etcd +--- +title: Interacting with etcd +--- Users mostly interact with etcd by putting or getting the value of a key. This section describes how to do that by using etcdctl, a command line tool for interacting with etcd server. The concepts described here should apply to the gRPC APIs or client library APIs. -By default, etcdctl talks to the etcd server with the v2 API for backward compatibility. For etcdctl to speak to etcd using the v3 API, the API version must be set to version 3 via the `ETCDCTL_API` environment variable. However note that any key that was created using the v2 API will not be able to be queried via the v3 API. A v3 API ```etcdctl get``` of a v2 key will exit with 0 and no key data, this is the expected behaviour. +The API version used by etcdctl to speak to etcd may be set to version `2` or `3` via the `ETCDCTL_API` environment variable. By default, etcdctl on master (3.4) uses the v3 API and earlier versions (3.3 and earlier) default to the v2 API. + +Note that any key that was created using the v2 API will not be able to be queried via the v2 API. A v3 API ```etcdctl get``` of a v2 key will exit with 0 and no key data, this is the expected behaviour. ```bash @@ -355,6 +359,26 @@ foo # key bar_latest # value of foo key after modification ``` +## Watch progress + +Applications may want to check the progress of a watch to determine how up-to-date the watch stream is. For example, if a watch is used to update a cache, it can be useful to know if the cache is stale compared to the revision from a quorum read. + +Progress requests can be issued using the "progress" command in interactive watch session to ask the etcd server to send a progress notify update in the watch stream: + +```bash +$ etcdctl watch -i +$ watch a +$ progress +progress notify: 1 +# in another terminal: etcdctl put x 0 +# in another terminal: etcdctl put y 1 +$ progress +progress notify: 3 +``` + +Note: The revision number in the progress notify response is the revision from the local etcd server node that the watch stream is connected to. If this node is partitioned and not part of quorum, this progress notify revision might be lower than +than the revision returned by a quorum read against a non-partitioned etcd server node. + ## Compacted revisions As we mentioned, etcd keeps revisions so that applications can read past versions of keys. However, to avoid accumulating an unbounded amount of history, it is important to compact past revisions. After compacting, etcd removes historical revisions, releasing resources for future use. All superseded data with revisions before the compacted revision will be unavailable. diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/limit.md b/vendor/github.com/coreos/etcd/Documentation/dev-guide/limit.md index 207b16700..0dfeca72f 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/limit.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/limit.md @@ -1,8 +1,10 @@ -# System limits +--- +title: System limits +--- ## Request size limit -etcd is designed to handle small key value pairs typical for metadata. Larger requests will work, but may increase the latency of other requests. For the time being, etcd guarantees to support RPC requests with up to 1MB of data. In the future, the size limit may be loosened or made configurable. +etcd is designed to handle small key value pairs typical for metadata. Larger requests will work, but may increase the latency of other requests. By default, the maximum size of any request is 1.5 MiB. This limit is configurable through `--max-request-bytes` flag for etcd server. ## Storage size limit diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-guide/local_cluster.md b/vendor/github.com/coreos/etcd/Documentation/dev-guide/local_cluster.md index 92ed1bc22..f41890830 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-guide/local_cluster.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-guide/local_cluster.md @@ -1,4 +1,6 @@ -# Set up a local cluster +--- +title: Set up a local cluster +--- For testing and development deployments, the quickest and easiest way is to configure a local cluster. For a production deployment, refer to the [clustering][clustering] section. @@ -21,14 +23,7 @@ The running etcd member listens on `localhost:2379` for client requests. Use `etcdctl` to interact with the running cluster: -1. Configure the environment to have `ETCDCTL_API=3` so `etcdctl` uses the etcd API version 3 instead of defaulting to version 2. - - ``` - # use API version 3 - $ export ETCDCTL_API=3 - ``` - -2. Store an example key-value pair in the cluster: +1. Store an example key-value pair in the cluster: ``` $ ./etcdctl put foo bar @@ -37,7 +32,7 @@ Use `etcdctl` to interact with the running cluster: If OK is printed, storing key-value pair is successful. -3. Retrieve the value of `foo`: +2. Retrieve the value of `foo`: ``` $ ./etcdctl get foo @@ -70,14 +65,7 @@ A `Procfile` at the base of the etcd git repository is provided to easily config Use `etcdctl` to interact with the running cluster: -1. Configure the environment to have `ETCDCTL_API=3` so `etcdctl` uses the etcd API version 3 instead of defaulting to version 2. - - ``` - # use API version 3 - $ export ETCDCTL_API=3 - ``` - -2. Print the list of members: +1. Print the list of members: ``` $ etcdctl --write-out=table --endpoints=localhost:2379 member list @@ -94,7 +82,7 @@ Use `etcdctl` to interact with the running cluster: +------------------+---------+--------+------------------------+------------------------+ ``` -3. Store an example key-value pair in the cluster: +2. Store an example key-value pair in the cluster: ``` $ etcdctl put foo bar diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-internal/discovery_protocol.md b/vendor/github.com/coreos/etcd/Documentation/dev-internal/discovery_protocol.md index 34da2b2c8..cbe3a467a 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-internal/discovery_protocol.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-internal/discovery_protocol.md @@ -1,4 +1,6 @@ -# Discovery service protocol +--- +title: Discovery service protocol +--- Discovery service protocol helps new etcd member to discover all other members in cluster bootstrap phase using a shared discovery URL. diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-internal/logging.md b/vendor/github.com/coreos/etcd/Documentation/dev-internal/logging.md index aa97dc2b5..ef0acd355 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-internal/logging.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-internal/logging.md @@ -1,4 +1,6 @@ -# Logging conventions +--- +title: Logging conventions +--- etcd uses the [capnslog][capnslog] library for logging application output categorized into *levels*. A log message's level is determined according to these conventions: diff --git a/vendor/github.com/coreos/etcd/Documentation/dev-internal/release.md b/vendor/github.com/coreos/etcd/Documentation/dev-internal/release.md index 8cec2c830..97aeb1722 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dev-internal/release.md +++ b/vendor/github.com/coreos/etcd/Documentation/dev-internal/release.md @@ -1,4 +1,6 @@ -# etcd release guide +--- +title: etcd release guide +--- The guide talks about how to release a new version of etcd. @@ -13,7 +15,8 @@ release and for ensuring the stability of the release branch. | Releases | Manager | | -------- | ------- | | 3.1 patch (post 3.1.0) | Joe Betz [@jpbetz](https://github.com/jpbetz) | -| 3.2 patch (post 3.2.0) | Gyuho Lee [@gyuho](https://github.com/gyuho) | +| 3.2 patch (post 3.2.0) | Joe Betz [@jpbetz](https://github.com/jpbetz) | +| 3.3 patch (post 3.3.0) | Gyuho Lee [@gyuho](https://github.com/gyuho) | ## Prepare release @@ -29,9 +32,9 @@ All releases version numbers follow the format of [semantic versioning 2.0.0](ht ### Major, minor version release, or its pre-release - Ensure the relevant milestone on GitHub is complete. All referenced issues should be closed, or moved elsewhere. -- Remove this release from [roadmap](https://github.com/coreos/etcd/blob/master/ROADMAP.md), if necessary. +- Remove this release from [roadmap](https://github.com/etcd-io/etcd/blob/master/ROADMAP.md), if necessary. - Ensure the latest upgrade documentation is available. -- Bump [hardcoded MinClusterVerion in the repository](https://github.com/coreos/etcd/blob/master/version/version.go#L29), if necessary. +- Bump [hardcoded MinClusterVerion in the repository](https://github.com/etcd-io/etcd/blob/master/version/version.go#L29), if necessary. - Add feature capability maps for the new version, if necessary. ### Patch version release @@ -49,14 +52,14 @@ All releases version numbers follow the format of [semantic versioning 2.0.0](ht ## Tag version -- Bump [hardcoded Version in the repository](https://github.com/coreos/etcd/blob/master/version/version.go#L30) to the latest version `${VERSION}`. +- Bump [hardcoded Version in the repository](https://github.com/etcd-io/etcd/blob/master/version/version.go#L30) to the latest version `${VERSION}`. - Ensure all tests on CI system are passed. - Manually check etcd is buildable in Linux, Darwin and Windows. - Manually check upgrade etcd cluster of previous minor version works well. - Manually check new features work well. - Add a signed tag through `git tag -s ${VERSION}`. - Sanity check tag correctness through `git show tags/$VERSION`. -- Push the tag to GitHub through `git push origin tags/$VERSION`. This assumes `origin` corresponds to "https://github.com/coreos/etcd". +- Push the tag to GitHub through `git push origin tags/$VERSION`. This assumes `origin` corresponds to "https://github.com/etcd-io/etcd". ## Build release binaries and images @@ -79,15 +82,15 @@ The following commands are used for public release sign: ``` cd release -for i in etcd-*{.zip,.tar.gz,.aci}; do gpg2 --default-key $SUBKEYID --armor --output ${i}.asc --detach-sign ${i}; done -for i in etcd-*{.zip,.tar.gz,.aci}; do gpg2 --verify ${i}.asc ${i}; done +for i in etcd-*{.zip,.tar.gz}; do gpg2 --default-key $SUBKEYID --armor --output ${i}.asc --detach-sign ${i}; done +for i in etcd-*{.zip,.tar.gz}; do gpg2 --verify ${i}.asc ${i}; done # sign zipped source code files -wget https://github.com/coreos/etcd/archive/${VERSION}.zip +wget https://github.com/etcd-io/etcd/archive/${VERSION}.zip gpg2 --armor --default-key $SUBKEYID --output ${VERSION}.zip.asc --detach-sign ${VERSION}.zip gpg2 --verify ${VERSION}.zip.asc ${VERSION}.zip -wget https://github.com/coreos/etcd/archive/${VERSION}.tar.gz +wget https://github.com/etcd-io/etcd/archive/${VERSION}.tar.gz gpg2 --armor --default-key $SUBKEYID --output ${VERSION}.tar.gz.asc --detach-sign ${VERSION}.tar.gz gpg2 --verify ${VERSION}.tar.gz.asc ${VERSION}.tar.gz ``` @@ -99,7 +102,7 @@ The public key for GPG signing can be found at [CoreOS Application Signing Key]( - Set release title as the version name. - Follow the format of previous release pages. -- Attach the generated binaries, aci image and signatures. +- Attach the generated binaries and signatures. - Select whether it is a pre-release. - Publish the release! @@ -155,5 +158,5 @@ git log ...${PREV_VERSION} --pretty=format:"%an" | sort | uniq | tr '\n' ',' | s ## Post release -- Create new stable branch through `git push origin ${VERSION_MAJOR}.${VERSION_MINOR}` if this is a major stable release. This assumes `origin` corresponds to "https://github.com/coreos/etcd". -- Bump [hardcoded Version in the repository](https://github.com/coreos/etcd/blob/master/version/version.go#L30) to the version `${VERSION}+git`. +- Create new stable branch through `git push origin ${VERSION_MAJOR}.${VERSION_MINOR}` if this is a major stable release. This assumes `origin` corresponds to "https://github.com/etcd-io/etcd". +- Bump [hardcoded Version in the repository](https://github.com/etcd-io/etcd/blob/master/version/version.go#L30) to the version `${VERSION}+git`. diff --git a/vendor/github.com/coreos/etcd/Documentation/dl_build.md b/vendor/github.com/coreos/etcd/Documentation/dl_build.md index ee5877c36..9787c52e5 100644 --- a/vendor/github.com/coreos/etcd/Documentation/dl_build.md +++ b/vendor/github.com/coreos/etcd/Documentation/dl_build.md @@ -1,4 +1,7 @@ -# Download and build +--- +title: Download and build +weight: 1 +--- ## System requirements @@ -15,7 +18,7 @@ For those wanting to try the very latest version, build etcd from the `master` b To build `etcd` from the `master` branch without a `GOPATH` using the official `build` script: ```sh -$ git clone https://github.com/coreos/etcd.git +$ git clone https://github.com/etcd-io/etcd.git $ cd etcd $ ./build ``` @@ -26,16 +29,8 @@ To build a vendored `etcd` from the `master` branch via `go get`: # GOPATH should be set $ echo $GOPATH /Users/example/go -$ go get github.com/coreos/etcd/cmd/etcd -``` - -To build `etcd` from the `master` branch without vendoring (may not build due to upstream conflicts): - -```sh -# GOPATH should be set -$ echo $GOPATH -/Users/example/go -$ go get github.com/coreos/etcd +$ go get -v go.etcd.io/etcd +$ go get -v go.etcd.io/etcd/etcdctl ``` ## Test the installation @@ -44,14 +39,14 @@ Check the etcd binary is built correctly by starting etcd and setting a key. ### Starting etcd -If etcd is built without using GOPATH, run the following: +If etcd is built without using `go get`, run the following: -``` +```sh $ ./bin/etcd ``` -If etcd is built using GOPATH, run the following: +If etcd is built using `go get`, run the following: -``` +```sh $ $GOPATH/bin/etcd ``` @@ -59,14 +54,16 @@ $ $GOPATH/bin/etcd Run the following: -``` -$ ETCDCTL_API=3 ./bin/etcdctl put foo bar +```sh +$ ./bin/etcdctl put foo bar OK ``` +(or `$GOPATH/bin/etcdctl put foo bar` if etcdctl was installed with `go get`) + If OK is printed, then etcd is working! -[github-release]: https://github.com/coreos/etcd/releases/ +[github-release]: https://github.com/etcd-io/etcd/releases/ [go]: https://golang.org/doc/install [build-script]: ../build [cmd-directory]: ../cmd diff --git a/vendor/github.com/coreos/etcd/Documentation/docs.md b/vendor/github.com/coreos/etcd/Documentation/docs.md deleted file mode 100644 index 0f9b6c1a4..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/docs.md +++ /dev/null @@ -1,114 +0,0 @@ -# Documentation - -etcd is a distributed key-value store designed to reliably and quickly preserve and provide access to critical data. It enables reliable distributed coordination through distributed locking, leader elections, and write barriers. An etcd cluster is intended for high availability and permanent data storage and retrieval. - -## Getting started - -New etcd users and developers should get started by [downloading and building][download_build] etcd. After getting etcd, follow this [quick demo][demo] to see the basics of creating and working with an etcd cluster. - -## Developing with etcd - -The easiest way to get started using etcd as a distributed key-value store is to [set up a local cluster][local_cluster]. - - - [Setting up local clusters][local_cluster] - - [Interacting with etcd][interacting] - - gRPC [etcd core][api_ref] and [etcd concurrency][api_concurrency_ref] API references - - [HTTP JSON API through the gRPC gateway][api_grpc_gateway] - - [gRPC naming and discovery][grpc_naming] - - [Client][namespace_client] and [proxy][namespace_proxy] namespacing - - [Embedding etcd][embed_etcd] - - [Experimental features and APIs][experimental] - - [System limits][system-limit] - -## Operating etcd clusters - -Administrators who need a fault-tolerant etcd cluster for either development or production should begin with a [cluster on multiple machines][clustering]. - -### Setting up etcd - - - [Configuration flags][conf] - - [Multi-member cluster][clustering] - - [gRPC proxy][grpc_proxy] - - [L4 gateway][gateway] - -### System configuration - - - [Supported systems][supported_platforms] - - [Hardware recommendations][hardware] - - [Performance benchmarking][performance] - - [Tuning][tuning] - -### Platform guides - - - [Amazon Web Services][aws_platform] - - [Container Linux, systemd][container_linux_platform] - - [FreeBSD][freebsd_platform] - - [Docker container][container_docker] - - [rkt container][container_rkt] - -### Security - - - [TLS][security] - - [Role-based access control][authentication] - -### Maintenance and troubleshooting - - - [Frequently asked questions][faq] - - [Monitoring][monitoring] - - [Maintenance][maintenance] - - [Failure modes][failures] - - [Disaster recovery][recovery] - - [Upgrading][upgrading] - -## Learning - -To learn more about the concepts and internals behind etcd, read the following pages: - - - [Why etcd?][why] - - [Understand data model][data_model] - - [Understand APIs][understand_apis] - - [Glossary][glossary] - - Internals - - [Auth subsystem][auth_design] - -[api_ref]: dev-guide/api_reference_v3.md -[api_concurrency_ref]: dev-guide/api_concurrency_reference_v3.md -[api_grpc_gateway]: dev-guide/api_grpc_gateway.md -[clustering]: op-guide/clustering.md -[conf]: op-guide/configuration.md -[system-limit]: dev-guide/limit.md -[faq]: faq.md -[why]: learning/why.md -[data_model]: learning/data_model.md -[demo]: demo.md -[download_build]: dl_build.md -[embed_etcd]: https://godoc.org/github.com/coreos/etcd/embed -[grpc_naming]: dev-guide/grpc_naming.md -[failures]: op-guide/failures.md -[gateway]: op-guide/gateway.md -[glossary]: learning/glossary.md -[namespace_client]: https://godoc.org/github.com/coreos/etcd/clientv3/namespace -[namespace_proxy]: op-guide/grpc_proxy.md#namespacing -[grpc_proxy]: op-guide/grpc_proxy.md -[hardware]: op-guide/hardware.md -[interacting]: dev-guide/interacting_v3.md -[local_cluster]: dev-guide/local_cluster.md -[performance]: op-guide/performance.md -[recovery]: op-guide/recovery.md -[maintenance]: op-guide/maintenance.md -[security]: op-guide/security.md -[monitoring]: op-guide/monitoring.md -[v2_migration]: op-guide/v2-migration.md -[container_rkt]: op-guide/container.md#rkt -[container_docker]: op-guide/container.md#docker -[understand_apis]: learning/api.md -[versioning]: op-guide/versioning.md -[supported_platforms]: op-guide/supported-platform.md -[container_linux_platform]: platforms/container-linux-systemd.md -[freebsd_platform]: platforms/freebsd.md -[aws_platform]: platforms/aws.md -[experimental]: dev-guide/experimental_apis.md -[authentication]: op-guide/authentication.md -[auth_design]: learning/auth_design.md -[tuning]: tuning.md -[upgrading]: upgrades/upgrading-etcd.md diff --git a/vendor/github.com/coreos/etcd/Documentation/faq.md b/vendor/github.com/coreos/etcd/Documentation/faq.md index 4078407e7..f89f23422 100644 --- a/vendor/github.com/coreos/etcd/Documentation/faq.md +++ b/vendor/github.com/coreos/etcd/Documentation/faq.md @@ -1,4 +1,6 @@ -# Frequently Asked Questions (FAQ) +--- +title: Frequently Asked Questions (FAQ) +--- ## etcd, general @@ -106,7 +108,7 @@ To recover from the low space quota alarm: This is gRPC-side warning when a server receives a TCP RST flag with client-side streams being prematurely closed. For example, a client closes its connection, while gRPC server has not yet processed all HTTP/2 frames in the TCP queue. Some data may have been lost in server side, but it is ok so long as client connection has already been closed. -Only [old versions of gRPC](https://github.com/grpc/grpc-go/issues/1362) log this. etcd [>=v3.2.13 by default log this with DEBUG level](https://github.com/coreos/etcd/pull/9080), thus only visible with `--debug` flag enabled. +Only [old versions of gRPC](https://github.com/grpc/grpc-go/issues/1362) log this. etcd [>=v3.2.13 by default log this with DEBUG level](https://github.com/etcd-io/etcd/pull/9080), thus only visible with `--debug` flag enabled. ## Performance @@ -147,14 +149,14 @@ etcd sends a snapshot of its complete key-value store to refresh slow followers [supported-platform]: ./op-guide/supported-platform.md [wal_fsync_duration_seconds]: ./metrics.md#disk [tuning]: ./tuning.md -[new_issue]: https://github.com/coreos/etcd/issues/new +[new_issue]: https://github.com/etcd-io/etcd/issues/new [backend_commit_metrics]: ./metrics.md#disk [raft]: https://raft.github.io/raft.pdf -[backup]: https://github.com/coreos/etcd/blob/master/Documentation/op-guide/recovery.md#snapshotting-the-keyspace +[backup]: https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/recovery.md#snapshotting-the-keyspace [chubby]: http://static.googleusercontent.com/media/research.google.com/en//archive/chubby-osdi06.pdf -[runtime reconfiguration]: https://github.com/coreos/etcd/blob/master/Documentation/op-guide/runtime-configuration.md +[runtime reconfiguration]: https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/runtime-configuration.md [benchmark]: https://github.com/coreos/etcd/tree/master/tools/benchmark -[benchmark-result]: https://github.com/coreos/etcd/blob/master/Documentation/op-guide/performance.md +[benchmark-result]: https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/performance.md [api-mvcc]: learning/api.md#revisions [maintenance-compact]: op-guide/maintenance.md#history-compaction [maintenance-defragment]: op-guide/maintenance.md#defragmentation diff --git a/vendor/github.com/coreos/etcd/Documentation/integrations.md b/vendor/github.com/coreos/etcd/Documentation/integrations.md index 11722cf09..8c2ed5b5f 100644 --- a/vendor/github.com/coreos/etcd/Documentation/integrations.md +++ b/vendor/github.com/coreos/etcd/Documentation/integrations.md @@ -1,8 +1,11 @@ -# Libraries and tools +--- +title: Libraries and tools +weight: 2 +--- **Tools** -- [etcdctl](https://github.com/coreos/etcd/tree/master/etcdctl) - A command line client for etcd +- [etcdctl](https://github.com/etcd-io/etcd/tree/master/etcdctl) - A command line client for etcd - [etcd-backup](https://github.com/fanhattan/etcd-backup) - A powerful command line utility for dumping/restoring etcd - Supports v2 - [etcd-dump](https://npmjs.org/package/etcd-dump) - Command line utility for dumping/restoring etcd. - [etcd-fs](https://github.com/xetorthio/etcd-fs) - FUSE filesystem for etcd @@ -15,17 +18,18 @@ - [etcd-rest](https://github.com/mickep76/etcd-rest) - Create generic REST API in Go using etcd as a backend with validation using JSON schema - [etcdsh](https://github.com/kamilhark/etcdsh) - A command line client with support of command history and tab completion. Supports v2 - [etcdloadtest](https://github.com/sinsharat/etcdloadtest) - A command line load test client for etcd version 3.0 and above. +- [lucas](https://github.com/ringtail/lucas) - A web-based key-value viewer for kubernetes etcd3.0+ cluster. **Go libraries** -- [etcd/clientv3](https://github.com/coreos/etcd/blob/master/clientv3) - the officially maintained Go client for v3 -- [etcd/client](https://github.com/coreos/etcd/blob/master/client) - the officially maintained Go client for v2 +- [etcd/clientv3](https://github.com/etcd-io/etcd/blob/master/clientv3) - the officially maintained Go client for v3 +- [etcd/client](https://github.com/etcd-io/etcd/blob/master/client) - the officially maintained Go client for v2 - [go-etcd](https://github.com/coreos/go-etcd) - the deprecated official client. May be useful for older (<2.0.0) versions of etcd. - [encWrapper](https://github.com/lumjjb/etcd/tree/enc_wrapper/clientwrap/encwrapper) - encWrapper is an encryption wrapper for the etcd client Keys API/KV. **Java libraries** -- [coreos/jetcd](https://github.com/coreos/jetcd) - Supports v3 +- [coreos/jetcd](https://github.com/etcd-io/jetcd) - Supports v3 - [boonproject/etcd](https://github.com/boonproject/boon/blob/master/etcd/README.md) - Supports v2, Async/Sync and waits - [justinsb/jetcd](https://github.com/justinsb/jetcd) - [diwakergupta/jetcd](https://github.com/diwakergupta/jetcd) - Supports v2 @@ -53,6 +57,7 @@ - [txaio-etcd](https://github.com/crossbario/txaio-etcd) - Asynchronous etcd v3-only client library for Twisted (today) and asyncio (future) - [dims/etcd3-gateway](https://github.com/dims/etcd3-gateway) - etcd v3 API library using the HTTP grpc gateway - [aioetcd3](https://github.com/gaopeiliang/aioetcd3) - (Python 3.6+) etcd v3 API for asyncio +- [Revolution1/etcd3-py](https://github.com/Revolution1/etcd3-py) - (python2.7 and python3.5+) Python client for etcd v3, using gRPC-JSON-Gateway **Node libraries** @@ -88,17 +93,20 @@ **Erlang libraries** -- [marshall-lee/etcd.erl](https://github.com/marshall-lee/etcd.erl) +- [marshall-lee/etcd.erl](https://github.com/marshall-lee/etcd.erl) - Supports v2 +- [zhongwencool/eetcd](https://github.com/zhongwencool/eetcd) - Supports v3+ (GRPC only) **.Net Libraries** - [wangjia184/etcdnet](https://github.com/wangjia184/etcdnet) - Supports v2 - [drusellers/etcetera](https://github.com/drusellers/etcetera) +- [shubhamranjan/dotnet-etcd](https://github.com/shubhamranjan/dotnet-etcd) - Supports v3+ (GRPC only) **PHP Libraries** - [linkorb/etcd-php](https://github.com/linkorb/etcd-php) - [activecollab/etcd](https://github.com/activecollab/etcd) +- [ouqiang/etcd-php](https://github.com/ouqiang/etcd-php) - Client for v3 gRPC gateway **Haskell libraries** @@ -138,6 +146,7 @@ - [cloudfoundry/cf-release](https://github.com/cloudfoundry/cf-release/tree/master/jobs/etcd) **Projects using etcd** + - [etcd Raft users](../raft/README.md#notable-users) - projects using etcd's raft library implementation. - [apache/celix](https://github.com/apache/celix) - an implementation of the OSGi specification adapted to C and C++ - [binocarlos/yoda](https://github.com/binocarlos/yoda) - etcd + ZeroMQ @@ -164,4 +173,9 @@ - [Vitess](http://vitess.io/) - Vitess is a database clustering system for horizontal scaling of MySQL. - [lclarkmichalek/etcdhcp](https://github.com/lclarkmichalek/etcdhcp) - DHCP server that uses etcd for persistence and coordination. - [openstack/networking-vpp](https://github.com/openstack/networking-vpp) - A networking driver that programs the [FD.io VPP dataplane](https://wiki.fd.io/view/VPP) to provide [OpenStack](https://www.openstack.org/) cloud virtual networking -- [openstack](https://github.com/openstack/governance/blob/master/reference/base-services.rst) - OpenStack services can rely on etcd as a base service. +- [OpenStack](https://github.com/openstack/governance/blob/master/reference/base-services.rst) - OpenStack services can rely on etcd as a base service. +- [CoreDNS](https://github.com/coredns/coredns/tree/master/plugin/etcd) - CoreDNS is a DNS server that chains plugins, part of CNCF and Kubernetes +- [Uber M3](https://github.com/m3db/m3) - M3: Uber’s Open Source, Large-scale Metrics Platform for Prometheus +- [Rook](https://github.com/rook/rook) - Storage Orchestration for Kubernetes +- [Patroni](https://github.com/zalando/patroni) - A template for PostgreSQL High Availability with ZooKeeper, etcd, or Consul +- [Trillian](https://github.com/google/trillian) - Trillian implements a Merkle tree whose contents are served from a data storage layer, to allow scalability to extremely large trees. diff --git a/vendor/github.com/coreos/etcd/Documentation/learning/_index.md b/vendor/github.com/coreos/etcd/Documentation/learning/_index.md new file mode 100644 index 000000000..acf1d0f06 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/learning/_index.md @@ -0,0 +1,3 @@ +--- +title: Learning +--- \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/Documentation/learning/api.md b/vendor/github.com/coreos/etcd/Documentation/learning/api.md index a326b05e7..828c73eee 100644 --- a/vendor/github.com/coreos/etcd/Documentation/learning/api.md +++ b/vendor/github.com/coreos/etcd/Documentation/learning/api.md @@ -1,4 +1,6 @@ -# etcd3 API +--- +title: etcd3 API +--- This document is meant to give an overview of the etcd3 API's central design. It is by no means all encompassing, but intended to focus on the basic ideas needed to understand etcd without the distraction of less common API calls. All etcd3 API's are defined in [gRPC services][grpc-service], which categorize remote procedure calls (RPCs) understood by the etcd server. A full listing of all etcd RPCs are documented in markdown in the [gRPC API listing][grpc-api]. @@ -472,10 +474,10 @@ message LeaseKeepAliveResponse { * ID - the lease that was refreshed with a new TTL. * TTL - the new time-to-live, in seconds, that the lease has remaining. -[elections]: https://github.com/coreos/etcd/blob/master/clientv3/concurrency/election.go -[kv-proto]: https://github.com/coreos/etcd/blob/master/mvcc/mvccpb/kv.proto +[elections]: https://github.com/etcd-io/etcd/blob/master/clientv3/concurrency/election.go +[kv-proto]: https://github.com/etcd-io/etcd/blob/master/mvcc/mvccpb/kv.proto [grpc-api]: ../dev-guide/api_reference_v3.md -[grpc-service]: https://github.com/coreos/etcd/blob/master/etcdserver/etcdserverpb/rpc.proto -[locks]: https://github.com/coreos/etcd/blob/master/clientv3/concurrency/mutex.go +[grpc-service]: https://github.com/etcd-io/etcd/blob/master/etcdserver/etcdserverpb/rpc.proto +[locks]: https://github.com/etcd-io/etcd/blob/master/clientv3/concurrency/mutex.go [mvcc]: https://en.wikipedia.org/wiki/Multiversion_concurrency_control -[stm]: https://github.com/coreos/etcd/blob/master/clientv3/concurrency/stm.go +[stm]: https://github.com/etcd-io/etcd/blob/master/clientv3/concurrency/stm.go diff --git a/vendor/github.com/coreos/etcd/Documentation/learning/api_guarantees.md b/vendor/github.com/coreos/etcd/Documentation/learning/api_guarantees.md index 936e74138..5bcd6aa71 100644 --- a/vendor/github.com/coreos/etcd/Documentation/learning/api_guarantees.md +++ b/vendor/github.com/coreos/etcd/Documentation/learning/api_guarantees.md @@ -1,4 +1,6 @@ -# KV API guarantees +--- +title: KV API guarantees +--- etcd is a consistent and durable key value store with [mini-transaction][txn] support. The key value store is exposed through the KV APIs. etcd tries to ensure the strongest consistency and durability guarantees for a distributed system. This specification enumerates the KV API guarantees made by etcd. @@ -51,7 +53,7 @@ Linearizability (also known as Atomic Consistency or External Consistency) is a For linearizability, suppose each operation receives a timestamp from a loosely synchronized global clock. Operations are linearized if and only if they always complete as though they were executed in a sequential order and each operation appears to complete in the order specified by the program. Likewise, if an operation’s timestamp precedes another, that operation must also precede the other operation in the sequence. -For example, consider a client completing a write at time point 1 (*t1*). A client issuing a read at *t2* (for *t2* > *t1*) should receive a value at least as recent as the previous write, completed at *t1*. However, the read might actually complete only by *t3*, and the returned value, current at *t2* when the read began, might be "stale" by *t3*. +For example, consider a client completing a write at time point 1 (*t1*). A client issuing a read at *t2* (for *t2* > *t1*) should receive a value at least as recent as the previous write, completed at *t1*. However, the read might actually complete only by *t3*. Linearizability guarantees the read returns the most current value. Without linearizability guarantee, the returned value, current at *t2* when the read began, might be "stale" by *t3* because a concurrent write might happen between *t2* and *t3*. etcd does not ensure linearizability for watch operations. Users are expected to verify the revision of watch responses to ensure correct ordering. diff --git a/vendor/github.com/coreos/etcd/Documentation/learning/auth_design.md b/vendor/github.com/coreos/etcd/Documentation/learning/auth_design.md index 52c979731..acf3dd5f2 100644 --- a/vendor/github.com/coreos/etcd/Documentation/learning/auth_design.md +++ b/vendor/github.com/coreos/etcd/Documentation/learning/auth_design.md @@ -1,4 +1,6 @@ -# etcd v3 authentication design +--- +title: etcd v3 authentication design +--- ## Why not reuse the v2 auth system? @@ -26,7 +28,7 @@ The metadata for auth should also be stored and managed in the storage controlle The authentication mechanism in the etcd v2 protocol has a tricky part because the metadata consistency should work as in the above, but does not: each permission check is processed by the etcd member that receives the client request (etcdserver/api/v2http/client.go), including follower members. Therefore, it's possible the check may be based on stale metadata. -This staleness means that auth configuration cannot be reflected as soon as operators execute etcdctl. Therefore there is no way to know how long the stale metadata is active. Practically, the configuration change is reflected immediately after the command execution. However, in some cases of heavy load, the inconsistent state can be prolonged and it might result in counter-intuitive situations for users and developers. It requires a workaround like this: https://github.com/coreos/etcd/pull/4317#issuecomment-179037582 +This staleness means that auth configuration cannot be reflected as soon as operators execute etcdctl. Therefore there is no way to know how long the stale metadata is active. Practically, the configuration change is reflected immediately after the command execution. However, in some cases of heavy load, the inconsistent state can be prolonged and it might result in counter-intuitive situations for users and developers. It requires a workaround like this: https://github.com/etcd-io/etcd/pull/4317#issuecomment-179037582 ### Inconsistent permissions are unsafe for linearized requests @@ -38,7 +40,7 @@ Therefore, the permission checking logic should be added to the state machine of ### Authentication -At first, a client must create a gRPC connection only to authenticate its user ID and password. An etcd server will respond with an authentication reply. The reponse will be an authentication token on success or an error on failure. The client can use its authentication token to present its credentials to etcd when making API requests. +At first, a client must create a gRPC connection only to authenticate its user ID and password. An etcd server will respond with an authentication reply. The response will be an authentication token on success or an error on failure. The client can use its authentication token to present its credentials to etcd when making API requests. The client connection used to request the authentication token is typically thrown away; it cannot carry the new token's credentials. This is because gRPC doesn't provide a way for adding per RPC credential after creation of the connection (calling `grpc.Dial()`). Therefore, a client cannot assign a token to its connection that is obtained through the connection. The client needs a new connection for using the token. diff --git a/vendor/github.com/coreos/etcd/Documentation/learning/client-architecture.md b/vendor/github.com/coreos/etcd/Documentation/learning/client-architecture.md new file mode 100644 index 000000000..9ee21aa4e --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/learning/client-architecture.md @@ -0,0 +1,114 @@ +--- +title: etcd client architecture +weight: 1 +--- + +## Introduction + +etcd server has proven its robustness with years of failure injection testing. Most complex application logic is already handled by etcd server and its data stores (e.g. cluster membership is transparent to clients, with Raft-layer forwarding proposals to leader). Although server components are correct, its composition with client requires a different set of intricate protocols to guarantee its correctness and high availability under faulty conditions. Ideally, etcd server provides one logical cluster view of many physical machines, and client implements automatic failover between replicas. This documents client architectural decisions and its implementation details. + +## Glossary + +**clientv3** --- etcd Official Go client for etcd v3 API. + +**clientv3-grpc1.0** --- Official client implementation, with [grpc-go v1.0.x](https://github.com/grpc/grpc-go/releases/tag/v1.0.0), which is used in latest etcd v3.1. + +**clientv3-grpc1.7** --- Official client implementation, with [grpc-go v1.7.x](https://github.com/grpc/grpc-go/releases/tag/v1.7.0), which is used in latest etcd v3.2 and v3.3. + +**clientv3-grpc1.14** --- Official client implementation, with [grpc-go v1.14.x](https://github.com/grpc/grpc-go/releases/tag/v1.14.0), which is used in latest etcd v3.4. + +**Balancer** --- etcd client load balancer that implements retry and failover mechanism. etcd client should automatically balance loads between multiple endpoints. + +**Endpoints** --- A list of etcd server endpoints that clients can connect to. Typically, 3 or 5 client URLs of an etcd cluster. + +**Pinned endpoint** --- When configured with multiple endpoints, <= v3.3 client balancer chooses only one endpoint to establish a TCP connection, in order to conserve total open connections to etcd cluster. In v3.4, balancer round-robins pinned endpoints for every request, thus distributing loads more evenly. + +**Client Connection** --- TCP connection that has been established to an etcd server, via gRPC Dial. + +**Sub Connection** --- gRPC SubConn interface. Each sub-connection contains a list of addresses. Balancer creates a SubConn from a list of resolved addresses. gRPC ClientConn can map to multiple SubConn (e.g. example.com resolves to `10.10.10.1` and `10.10.10.2` of two sub-connections). etcd v3.4 balancer employs internal resolver to establish one sub-connection for each endpoint. + +**Transient disconnect** --- When gRPC server returns a status error of [code Unavailable](https://godoc.org/google.golang.org/grpc/codes#Code). + +## Client requirements + +**Correctness** --- Requests may fail in the presence of server faults. However, it never violates consistency guarantees: global ordering properties, never write corrupted data, at-most once semantics for mutable operations, watch never observes partial events, and so on. + +**Liveness** --- Servers may fail or disconnect briefly. Clients should make progress in either way. Clients should [never deadlock](https://github.com/etcd-io/etcd/issues/8980) waiting for a server to come back from offline, unless configured to do so. Ideally, clients detect unavailable servers with HTTP/2 ping and failover to other nodes with clear error messages. + +**Effectiveness** --- Clients should operate effectively with minimum resources: previous TCP connections should be [gracefully closed](https://github.com/etcd-io/etcd/issues/9212) after endpoint switch. Failover mechanism should effectively predict the next replica to connect, without wastefully retrying on failed nodes. + +**Portability** --- Official client should be clearly documented and its implementation be applicable to other language bindings. Error handling between different language bindings should be consistent. Since etcd is fully committed to gRPC, implementation should be closely aligned with gRPC long-term design goals (e.g. pluggable retry policy should be compatible with [gRPC retry](https://github.com/grpc/proposal/blob/master/A6-client-retries.md)). Upgrades between two client versions should be non-disruptive. + +## Client overview + +The etcd client implements the following components: + +* balancer that establishes gRPC connections to an etcd cluster, +* API client that sends RPCs to an etcd server, and +* error handler that decides whether to retry a failed request or switch endpoints. + +Languages may differ in how to establish an initial connection (e.g. configure TLS), how to encode and send Protocol Buffer messages to server, how to handle stream RPCs, and so on. However, errors returned from etcd server will be the same. So should be error handling and retry policy. + +For example, etcd server may return `"rpc error: code = Unavailable desc = etcdserver: request timed out"`, which is transient error that expects retries. Or return `rpc error: code = InvalidArgument desc = etcdserver: key is not provided`, which means request was invalid and should not be retried. Go client can parse errors with `google.golang.org/grpc/status.FromError`, and Java client with `io.grpc.Status.fromThrowable`. + +### clientv3-grpc1.0: Balancer Overview + +`clientv3-grpc1.0` maintains multiple TCP connections when configured with multiple etcd endpoints. Then pick one address and use it to send all client requests. The pinned address is maintained until the client object is closed (see *Figure 1*). When the client receives an error, it randomly picks another and retries. + +{{< figure src="/img/client-architecture-balancer-figure-01.png" >}} + +### clientv3-grpc1.0: Balancer Limitation + +`clientv3-grpc1.0` opening multiple TCP connections may provide faster balancer failover but requires more resources. The balancer does not understand node’s health status or cluster membership. So, it is possible that balancer gets stuck with one failed or partitioned node. + +### clientv3-grpc1.7: Balancer Overview + +`clientv3-grpc1.7` maintains only one TCP connection to a chosen etcd server. When given multiple cluster endpoints, a client first tries to connect to them all. As soon as one connection is up, balancer pins the address, closing others (see **Figure 2**). + +{{< figure src="/img/client-architecture-balancer-figure-02.png" >}} + +The pinned address is to be maintained until the client object is closed. An error, from server or client network fault, is sent to client error handler (see **Figure 3**). + +{{< figure src="/img/client-architecture-balancer-figure-03.png" >}} + +The client error handler takes an error from gRPC server, and decides whether to retry on the same endpoint, or to switch to other addresses, based on the error code and message (see **Figure 4** and **Figure 5**). + +{{< figure src="/img/client-architecture-balancer-figure-04.png" >}} + +{{< figure src="/img/client-architecture-balancer-figure-05.png" >}} + +Stream RPCs, such as Watch and KeepAlive, are often requested with no timeouts. Instead, client can send periodic HTTP/2 pings to check the status of a pinned endpoint; if the server does not respond to the ping, balancer switches to other endpoints (see **Figure 6**). + +{{< figure src="/img/client-architecture-balancer-figure-06.png" >}} + +### clientv3-grpc1.7: Balancer Limitation + +`clientv3-grpc1.7` balancer sends HTTP/2 keepalives to detect disconnects from streaming requests. It is a simple gRPC server ping mechanism and does not reason about cluster membership, thus unable to detect network partitions. Since partitioned gRPC server can still respond to client pings, balancer may get stuck with a partitioned node. Ideally, keepalive ping detects partition and triggers endpoint switch, before request time-out (see [issue #8673](https://github.com/etcd-io/etcd/issues/8673) and **Figure 7**). + +{{< figure src="/img/client-architecture-balancer-figure-07.png" >}} + +`clientv3-grpc1.7` balancer maintains a list of unhealthy endpoints. Disconnected addresses are added to “unhealthy” list, and considered unavailable until after wait duration, which is hard coded as dial timeout with default value 5-second. Balancer can have false positives on which endpoints are unhealthy. For instance, endpoint A may come back right after being blacklisted, but still unusable for next 5 seconds (see **Figure 8**). + +`clientv3-grpc1.0` suffered the same problems above. + +{{< figure src="/img/client-architecture-balancer-figure-08.png" >}} + +Upstream gRPC Go had already migrated to new balancer interface. For example, `clientv3-grpc1.7` underlying balancer implementation uses new gRPC balancer and tries to be consistent with old balancer behaviors. While its compatibility has been maintained reasonably well, etcd client still [suffered from subtle breaking changes](https://github.com/grpc/grpc-go/issues/1649). Furthermore, gRPC maintainer recommends [not relying on the old balancer interface](https://github.com/grpc/grpc-go/issues/1942#issuecomment-375368665). In general, to get better support from upstream, it is best to be in sync with latest gRPC releases. And new features, such as retry policy, may not be backported to gRPC 1.7 branch. Thus, both etcd server and client must migrate to latest gRPC versions. + +### clientv3-grpc1.14: Balancer Overview + +`clientv3-grpc1.7` is so tightly coupled with old gRPC interface, that every single gRPC dependency upgrade broke client behavior. Majority of development and debugging efforts were devoted to fixing those client behavior changes. As a result, its implementation has become overly complicated with bad assumptions on server connectivities. + +The primary goal of `clientv3-grpc1.14` is to simplify balancer failover logic; rather than maintaining a list of unhealthy endpoints, which may be stale, simply roundrobin to the next endpoint whenever client gets disconnected from the current endpoint. It does not assume endpoint status. Thus, no more complicated status tracking is needed (see *Figure 8* and above). Upgrading to `clientv3-grpc1.14` should be no issue; all changes were internal while keeping all the backward compatibilities. + +Internally, when given multiple endpoints, `clientv3-grpc1.14` creates multiple sub-connections (one sub-connection per each endpoint), while `clientv3-grpc1.7` creates only one connection to a pinned endpoint (see *Figure 9*). For instance, in 5-node cluster, `clientv3-grpc1.14` balancer would require 5 TCP connections, while `clientv3-grpc1.7` only requires one. By preserving the pool of TCP connections, `clientv3-grpc1.14` may consume more resources but provide more flexible load balancer with better failover performance. The default balancing policy is round robin but can be easily extended to support other types of balancers (e.g. power of two, pick leader, etc.). `clientv3-grpc1.14` uses gRPC resolver group and implements balancer picker policy, in order to delegate complex balancing work to upstream gRPC. On the other hand, `clientv3-grpc1.7` manually handles each gRPC connection and balancer failover, which complicates the implementation. `clientv3-grpc1.14` implements retry in the gRPC interceptor chain that automatically handles gRPC internal errors and enables more advanced retry policies like backoff, while `clientv3-grpc1.7` manually interprets gRPC errors for retries. + +{{< figure src="/img/client-architecture-balancer-figure-09.png" >}} + +### clientv3-grpc1.14: Balancer Limitation + +Improvements can be made by caching the status of each endpoint. For instance, balancer can ping each server in advance to maintain a list of healthy candidates, and use this information when doing round-robin. Or when disconnected, balancer can prioritize healthy endpoints. This may complicate the balancer implementation, thus can be addressed in later versions. + +Client-side keepalive ping still does not reason about network partitions. Streaming request may get stuck with a partitioned node. Advanced health checking service need to be implemented to understand the cluster membership (see [issue #8673](https://github.com/etcd-io/etcd/issues/8673) for more detail). + +Currently, retry logic is handled manually as an interceptor. This may be simplified via [official gRPC retries](https://github.com/grpc/proposal/blob/master/A6-client-retries.md). diff --git a/vendor/github.com/coreos/etcd/Documentation/learning/client-feature-matrix.md b/vendor/github.com/coreos/etcd/Documentation/learning/client-feature-matrix.md new file mode 100644 index 000000000..4a70c0fa9 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/learning/client-feature-matrix.md @@ -0,0 +1,157 @@ +--- +title: Client feature matrix +--- + +## Features + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +Automatic retry | Yes | . +Retry backoff | Yes | . +Automatic failover | Yes | . +Load balancer | Round-Robin | · +`WithRequireLeader(context.Context)` | Yes | . +`TLS` | Yes | Yes +`SetEndpoints` | Yes | . +`Sync` endpoints | Yes | . +`AutoSyncInterval` | Yes | . +`KeepAlive` ping | Yes | . +`MaxCallSendMsgSize` | Yes | . +`MaxCallRecvMsgSize` | Yes | . +`RejectOldCluster` | Yes | . + +## [KV](https://godoc.org/go.etcd.io/etcd/clientv3#KV) + + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`Put` | Yes | . +`Get` | Yes | . +`Delete` | Yes | . +`Compact` | Yes | . +`Do(Op)` | Yes | . +`Txn` | Yes | . + +## [Lease](https://godoc.org/go.etcd.io/etcd/clientv3#Lease) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`Grant` | Yes | . +`Revoke` | Yes | . +`TimeToLive` | Yes | . +`Leases` | Yes | . +`KeepAlive` | Yes | . +`KeepAliveOnce` | Yes | . + +## [Watcher](https://godoc.org/go.etcd.io/etcd/clientv3#Watcher) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`Watch` | Yes | Yes +`RequestProgress` | Yes | . + +## [Cluster](https://godoc.org/go.etcd.io/etcd/clientv3#Cluster) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`MemberList` | Yes | Yes +`MemberAdd` | Yes | Yes +`MemberRemove` | Yes | Yes +`MemberUpdate` | Yes | Yes + +## [Maintenance](https://godoc.org/go.etcd.io/etcd/clientv3#Maintenance) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`AlarmList` | Yes | Yes +`AlarmDisarm` | Yes | · +`Defragment` | Yes | · +`Status` | Yes | · +`HashKV` | Yes | · +`Snapshot` | Yes | · +`MoveLeader` | Yes | · + +## [Auth](https://godoc.org/go.etcd.io/etcd/clientv3#Auth) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`AuthEnable` | Yes | . +`AuthDisable` | Yes | . +`UserAdd` | Yes | . +`UserDelete` | Yes | . +`UserChangePassword` | Yes | . +`UserGrantRole` | Yes | . +`UserGet` | Yes | . +`UserList` | Yes | . +`UserRevokeRole` | Yes | . +`RoleAdd` | Yes | . +`RoleGrantPermission` | Yes | . +`RoleGet` | Yes | . +`RoleList` | Yes | . +`RoleRevokePermission` | Yes | . +`RoleDelete` | Yes | . + +## [clientv3util](https://godoc.org/go.etcd.io/etcd/clientv3/clientv3util) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`KeyExists` | Yes | No +`KeyMissing` | Yes | No + +## [Concurrency](https://godoc.org/go.etcd.io/etcd/clientv3/concurrency) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`Session` | Yes | No +`NewMutex(Session, prefix)` | Yes | No +`NewElection(Session, prefix)` | Yes | No +`NewLocker(Session, prefix)` | Yes | No +`STM Isolation SerializableSnapshot` | Yes | No +`STM Isolation Serializable` | Yes | No +`STM Isolation RepeatableReads` | Yes | No +`STM Isolation ReadCommitted` | Yes | No +`STM Get` | Yes | No +`STM Put` | Yes | No +`STM Rev` | Yes | No +`STM Del` | Yes | No + +## [Leasing](https://godoc.org/go.etcd.io/etcd/clientv3/leasing) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`NewKV(Client, prefix)` | Yes | No + +## [Mirror](https://godoc.org/go.etcd.io/etcd/clientv3/mirror) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`SyncBase` | Yes | No +`SyncUpdates` | Yes | No + +## [Namespace](https://godoc.org/go.etcd.io/etcd/clientv3/namespace) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`KV` | Yes | No +`Lease` | Yes | No +`Watcher` | Yes | No + +## [Naming](https://godoc.org/go.etcd.io/etcd/clientv3/naming) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`GRPCResolver` | Yes | No + +## [Ordering](https://godoc.org/go.etcd.io/etcd/clientv3/ordering) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`KV` | Yes | No + +## [Snapshot](https://godoc.org/go.etcd.io/etcd/clientv3/snapshot) + +Feature | `clientv3-grpc1.14` | `jetcd v0.0.2` +:-------|:--------------------|:-------------- +`Save` | Yes | No +`Status` | Yes | No +`Restore` | Yes | No diff --git a/vendor/github.com/coreos/etcd/Documentation/learning/data_model.md b/vendor/github.com/coreos/etcd/Documentation/learning/data_model.md index e497238f2..bc430c907 100644 --- a/vendor/github.com/coreos/etcd/Documentation/learning/data_model.md +++ b/vendor/github.com/coreos/etcd/Documentation/learning/data_model.md @@ -1,4 +1,6 @@ -# Data model +--- +title: Data model +--- etcd is designed to reliably store infrequently updated data and provide reliable watch queries. etcd exposes previous versions of key-value pairs to support inexpensive snapshots and watch history events (“time travel queries”). A persistent, multi-version, concurrency-control data model is a good fit for these use cases. @@ -8,9 +10,9 @@ etcd stores data in a multiversion [persistent][persistent-ds] key-value store. The store’s logical view is a flat binary key space. The key space has a lexically sorted index on byte string keys so range queries are inexpensive. -The key space maintains multiple revisions. Each atomic mutative operation (e.g., a transaction operation may contain multiple operations) creates a new revision on the key space. All data held by previous revisions remains unchanged. Old versions of key can still be accessed through previous revisions. Likewise, revisions are indexed as well; ranging over revisions with watchers is efficient. If the store is compacted to save space, revisions before the compact revision will be removed. +The key space maintains multiple **revisions**. Each atomic mutative operation (e.g., a transaction operation may contain multiple operations) creates a new revision on the key space. All data held by previous revisions remains unchanged. Old versions of key can still be accessed through previous revisions. Likewise, revisions are indexed as well; ranging over revisions with watchers is efficient. If the store is compacted to save space, revisions before the compact revision will be removed. Revisions are monotonically increasing over the lifetime of a cluster. -A key’s lifetime spans a generation, denoted by its version. Each key may have one or multiple generations. Creating a key increments the version of that key, starting at 1 if the key never existed. Deleting a key generates a key tombstone, concluding the key’s current generation by resetting its version. Each modification of a key increments its version. Once a compaction happens, any version ended before the given revision will be removed and values set before the compaction revision except the latest one will be removed. +A key's life spans a generation, from creation to deletion. Each key may have one or multiple generations. Creating a key increments the **version** of that key, starting at 1 if the key does not exist at the current revision. Deleting a key generates a key tombstone, concluding the key’s current generation by resetting its version to 0. Each modification of a key increments its version; so, versions are monotonically increasing within a key's generation. Once a compaction happens, any generation ended before the compaction revision will be removed, and values set before the compaction revision except the latest one will be removed. ### Physical view diff --git a/vendor/github.com/coreos/etcd/Documentation/learning/glossary.md b/vendor/github.com/coreos/etcd/Documentation/learning/glossary.md index 876cb55e4..a2f80b5de 100644 --- a/vendor/github.com/coreos/etcd/Documentation/learning/glossary.md +++ b/vendor/github.com/coreos/etcd/Documentation/learning/glossary.md @@ -1,4 +1,6 @@ -# Glossary +--- +title: Glossary +--- This document defines the various terms used in etcd documentation, command line and source code. diff --git a/vendor/github.com/coreos/etcd/Documentation/learning/learner.md b/vendor/github.com/coreos/etcd/Documentation/learning/learner.md new file mode 100644 index 000000000..d2d595962 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/learning/learner.md @@ -0,0 +1,106 @@ +--- +title: Learner +--- + +## Background + +Membership reconfiguration has been one of the biggest operational challenges. Let’s review common challenges. + +A newly joined etcd member starts with no data, thus demanding more updates from leader until it catches up with leader’s logs. Then leader’s network is more likely to be overloaded, blocking or dropping leader heartbeats to followers. In such case, a follower may election-timeout to start a new leader election. That is, a cluster with a new member is more vulnerable to leader election. Both leader election and the subsequent update propagation to the new member are prone to causing periods of cluster unavailability (see **Figure 1** below). + +{{< figure src="/img/server-learner-figure-01.png" >}} + +What if network partition happens? It depends on leader partition. If the leader still maintains the active quorum, the cluster would continue to operate (see **Figure 2**). + +{{< figure src="/img/server-learner-figure-02.png" >}} + +What if the leader becomes isolated from the rest of the cluster? Leader monitors progress of each follower. When leader loses connectivity from the quorum it reverts back to follower which will affect the cluster availability (see **Figure 3**). + +{{< figure src="/img/server-learner-figure-03.png" >}} + +When a new node is added to 3 node cluster, the cluster size becomes 4 and the quorum size becomes 3. What if a new node had joined the cluster, and then network partition happens? It depends on which partition the new member gets located after partition. If the new node happens to be located in the same partition as leader’s, the leader still maintains the active quorum of 3. No leadership election happens, and no cluster availability gets affected (see **Figure 4**). + +{{< figure src="/img/server-learner-figure-04.png" >}} + +If the cluster is 2-and-2 partitioned, then neither of partition maintains the quorum of 3. In this case, leadership election happens (see **Figure 5**). + +{{< figure src="/img/server-learner-figure-05.png" >}} + +What if network partition happens first, and then a new member gets added? A partitioned 3-node cluster already has one disconnected follower. When a new member is added, the quorum changes from 2 to 3. Now, this cluster has only 2 active nodes out 4, thus losing quorum and starting a new leadership election (see **Figure 6**). + +{{< figure src="/img/server-learner-figure-06.png" >}} + +Since member add operation can change the size of quorum, it is always recommended to “member remove” first to replace an unhealthy node. + +Adding a new member to a 1-node cluster changes the quorum size to 2, immediately causing a leader election when the previous leader finds out quorum is not active. This is because “member add” operation is a 2-step process where user needs to apply “member add” command first, and then starts the new node process (see **Figure 7**). + +{{< figure src="/img/server-learner-figure-07.png" >}} + +An even worse case is when an added member is misconfigured. Membership reconfiguration is a two-step process: “etcdctl member add” and starting an etcd server process with the given peer URL. That is, “member add” command is applied regardless of URL, even when the URL value is invalid. If the first step is applied with invalid URLs, the second step cannot even start the new etcd. Once the cluster loses quorum, there is no way to revert the membership change (see **Figure 8**). + +{{< figure src="/img/server-learner-figure-08.png" >}} + +Same applies to a multi-node cluster. For example, the cluster has two members down (one is failed, the other is misconfigured) and two members up, but now it requires at least 3 votes to change the cluster membership (see **Figure 9**). + +{{< figure src="/img/server-learner-figure-09.png" >}} + +As seen above, a simple misconfiguration can fail the whole cluster into an inoperative state. In such case, an operator need manually recreate the cluster with `etcd --force-new-cluster` flag. As etcd has become a mission-critical service for [Kubernetes](https://kubernetes.io), even the slightest outage may have significant impact on users. What can we better to make etcd such operations easier? Among other things, leader election is most critical to cluster availability: Can we make membership reconfiguration less disruptive by not changing the size of quorum? Can a new node be idle, only requesting the minimum updates from leader, until it catches up? Can membership misconfiguration be always reversible and handled in a more secure way (wrong member add command run should never fail the cluster)? Should an user worry about network topology when adding a new member? Can member add API work regardless of the location of nodes and ongoing network partitions? + +## Raft learner + +In order to mitigate such availability gaps in the previous section, [Raft §4.2.1](https://ramcloud.stanford.edu/~ongaro/thesis.pdf) introduces a new node state “Learner,” which joins the cluster as a **non-voting member** until it catches up to the leader’s logs. + +## Features in v3.4 + +An operator should do the minimum amount of work possible to add a new learner node. `member add --learner` command to add a new learner, which joins cluster as a non-voting member but still receives all data from leader (see **Figure 10**). + +{{< figure src="/img/server-learner-figure-10.png" >}} + +When a learner has caught up with leader’s progress, the learner can be promoted to a voting member using the `member promote` API, which then counts towards the quorum (see **Figure 11**). + +{{< figure src="/img/server-learner-figure-11.png" >}} + +etcd server validates promote request to ensure its operational safety. Only after its log has caught up to leader’s can learner be promoted to a voting member (see **Figure 12**). + +{{< figure src="/img/server-learner-figure-12.png" >}} + +Learner only serves as a standby node until promoted: Leadership cannot be transferred to learner. Learner rejects client reads and writes (client balancer should not route requests to learner). Which means learner does not need issue Read Index requests to leader. Such limitation simplifies the initial learner implementation in v3.4 release (see **Figure 13**). + +{{< figure src="/img/server-learner-figure-13.png" >}} + +In addition, etcd limits the total number of learners that a cluster can have, and avoids overloading the leader with log replication. Learner never promotes itself. While etcd provides learner status information and safety checks, cluster operator must make the final decision whether to promote learner or not. + +## Features in v3.5 + +**Make learner state only and default** --- Defaulting a new member state to learner will greatly improve membership reconfiguration safety, because learner does not change the size of quorum. Misconfiguration will always be reversible without losing the quorum. + +**Make voting-member promotion fully automatic** --- Once a learner catches up to leader’s logs, a cluster can automatically promote the learner. etcd requires certain thresholds to be defined by the user, and once the requirements are satisfied, learner promotes itself to a voting member. From a user’s perspective, “member add” command would work the same way as today but with greater safety provided by learner feature. + +**Make learner standby failover node** --- A learner joins as a standby node, and gets automatically promoted when the cluster availability is affected. + +**Make learner read-only** --- A learner can serve as a read-only node that never gets promoted. In a weak consistency mode, learner only receives data from leader and never process writes. Serving reads locally without consensus overhead would greatly decrease the workloads to leader but may serve stale data. In a strong consistency mode, learner requests read index from leader to serve latest data, but still rejects writes. + +## Learner vs. mirror maker + +etcd implements “mirror maker” using watch API to continuously relay key creates and updates to a separate cluster. Mirroring usually has low latency overhead once it completes initial synchronization. Learner and mirroring overlap in that both can be used to replicate existing data for read-only. However, mirroring does not guarantee linearizability. During network disconnects, previous key-values might have been discarded, and clients are expected to verify watch responses for correct ordering. Thus, there is no ordering guarantee in mirror. Use mirror for minimum latency (e.g. cross data center) at the costs of consistency. Use learner to retain all historical data and its ordering. + +## Appendix: learner implementation in v3.4 + +### Expose "Learner" node type to "MemberAdd" API + +etcd client adds a flag to “MemberAdd” API for learner node. And etcd server handler applies membership change entry with `pb.ConfChangeAddLearnerNode` type. Once the command has been applied, a server joins the cluster with `etcd --initial-cluster-state=existing` flag. This learner node can neither vote nor count as quorum. + +etcd server must not transfer leadership to learner, since it may still lag behind and does not count as quorum. etcd server limits the number of learners that cluster can have to one: the more learners we have, the more data the leader has to propagate. Clients may talk to learner node, but learner rejects all requests other than serializable read and member status API. This is for simplicity of initial implementation. In the future, learner can be extended as a read-only server that continuously mirrors cluster data. Client balancer must provide helper function to exclude learner node endpoint. Otherwise, request sent to learner may fail. Client sync member call should factor into learner node type. So should client endpoints update call. + +`MemberList` and `MemberStatus` responses should indicate which node is learner. + +### Add "MemberPromote" API + +Internally in Raft, second `MemberAdd` call to learner node promotes it to a voting member. Leader maintains the progress of each follower and learner. If learner has not completed its snapshot message, reject promote request. Only accept promote request if and only if: The learner node is in a healthy state. The learner is in sync with leader or the delta is within the threshold (e.g. the number of entries to replicate to learner is less than 1/10 of snapshot count, which means it is less likely that even after promotion leader would not need send snapshot to the learner). All these logic are hard-coded in `etcdserver` package and not configurable. + +## Reference + +* Original GitHub issue ([issue #9161](https://github.com/etcd-io/etcd/issues/9161)) +* Use case ([issue #3715](https://github.com/etcd-io/etcd/issues/3715)) +* Use case ([issue #8888](https://github.com/etcd-io/etcd/issues/8888)) +* Use case ([issue #10114](https://github.com/etcd-io/etcd/issues/10114)) diff --git a/vendor/github.com/coreos/etcd/Documentation/learning/why.md b/vendor/github.com/coreos/etcd/Documentation/learning/why.md index 90769d808..0ce20a6c0 100644 --- a/vendor/github.com/coreos/etcd/Documentation/learning/why.md +++ b/vendor/github.com/coreos/etcd/Documentation/learning/why.md @@ -1,6 +1,8 @@ -# etcd versus other key-value stores +--- +title: etcd versus other key-value stores +--- -The name "etcd" originated from two ideas, the unix "/etc" folder and "d"istibuted systems. The "/etc" folder is a place to store configuration data for a single system whereas etcd stores configuration information for large scale distributed systems. Hence, a "d"istributed "/etc" is "etcd". +The name "etcd" originated from two ideas, the unix "/etc" folder and "d"istributed systems. The "/etc" folder is a place to store configuration data for a single system whereas etcd stores configuration information for large scale distributed systems. Hence, a "d"istributed "/etc" is "etcd". etcd is designed as a general substrate for large scale distributed systems. These are systems that will never tolerate split-brain operation and are willing to sacrifice availability to achieve this end. etcd stores metadata in a consistent and fault-tolerant way. An etcd cluster is meant to provide key-value storage with best of class stability, reliability, scalability and performance. @@ -76,18 +78,18 @@ In theory, it’s possible to build these primitives atop any storage systems pr For distributed coordination, choosing etcd can help prevent operational headaches and save engineering effort. [production-users]: ../production-users.md -[grpc]: http://www.grpc.io +[grpc]: https://www.grpc.io [consul-bulletproof]: https://www.consul.io/docs/internals/sessions.html [curator]: http://curator.apache.org/ [cockroach]: https://github.com/cockroachdb/cockroach [spanner]: https://cloud.google.com/spanner/ [tidb]: https://github.com/pingcap/tidb -[etcd-v3lock]: https://godoc.org/github.com/coreos/etcd/etcdserver/api/v3lock/v3lockpb -[etcd-v3election]: https://godoc.org/github.com/coreos/etcd/etcdserver/api/v3election/v3electionpb +[etcd-v3lock]: https://godoc.org/github.com/etcd-io/etcd/etcdserver/api/v3lock/v3lockpb +[etcd-v3election]: https://godoc.org/github.com/coreos/etcd-io/etcdserver/api/v3election/v3electionpb [etcd-etcdctl-lock]: ../../etcdctl/README.md#lock-lockname-command-arg1-arg2- [etcd-etcdctl-elect]: ../../etcdctl/README.md#elect-options-election-name-proposal [etcd-mvcc]: data_model.md -[etcd-recipe]: https://godoc.org/github.com/coreos/etcd/contrib/recipes +[etcd-recipe]: https://godoc.org/github.com/etcd-io/etcd/contrib/recipes [consul-lock]: https://www.consul.io/docs/commands/lock.html [newsql-leader]: http://dl.acm.org/citation.cfm?id=2960999 [etcd-reconfig]: ../op-guide/runtime-configuration.md @@ -112,5 +114,5 @@ For distributed coordination, choosing etcd can help prevent operational headach [zk-bindings]: https://zookeeper.apache.org/doc/r3.1.2/zookeeperProgrammers.html#ch_bindings [container-linux]: https://coreos.com/why [locksmith]: https://github.com/coreos/locksmith -[kubernetes]: http://kubernetes.io/docs/whatisk8s +[kubernetes]: https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/ [dbtester-comparison-results]: https://github.com/coreos/dbtester/tree/master/test-results/2018Q1-02-etcd-zookeeper-consul diff --git a/vendor/github.com/coreos/etcd/Documentation/metrics.md b/vendor/github.com/coreos/etcd/Documentation/metrics.md index 58e526394..125e6f68c 100644 --- a/vendor/github.com/coreos/etcd/Documentation/metrics.md +++ b/vendor/github.com/coreos/etcd/Documentation/metrics.md @@ -1,4 +1,7 @@ -# Metrics +--- +title: Metrics +weight: 3 +--- etcd uses [Prometheus][prometheus] for metrics reporting. The metrics can be used for real-time monitoring and debugging. etcd does not persist its metrics; if a member restarts, the metrics will be reset. @@ -99,7 +102,7 @@ Abnormally high snapshot duration (`snapshot_save_total_duration_seconds`) indic ## Prometheus supplied metrics -The Prometheus client library provides a number of metrics under the `go` and `process` namespaces. There are a few that are particlarly interesting. +The Prometheus client library provides a number of metrics under the `go` and `process` namespaces. There are a few that are particularly interesting. | Name | Description | Type | |-----------------------------------|--------------------------------------------|--------------| @@ -113,4 +116,4 @@ Heavy file descriptor (`process_open_fds`) usage (i.e., near the process's file [prometheus-getting-started]: http://prometheus.io/docs/introduction/getting_started/ [prometheus-naming]: http://prometheus.io/docs/practices/naming/ [v2-http-metrics]: v2/metrics.md#http-requests -[go-grpc-prometheus]: https://github.com/grpc-ecosystem/go-grpc-prometheus \ No newline at end of file +[go-grpc-prometheus]: https://github.com/grpc-ecosystem/go-grpc-prometheus diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/_index.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/_index.md new file mode 100644 index 000000000..34b93651f --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/_index.md @@ -0,0 +1,3 @@ +--- +title: Operations guide +--- \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/authentication.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/authentication.md index a528a8d04..13aaa37a8 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/authentication.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/authentication.md @@ -1,4 +1,6 @@ -# Role-based access control +--- +title: Role-based access control +--- ## Overview @@ -32,7 +34,7 @@ Creating a user is as easy as $ etcdctl user add myusername ``` -Creating a new user will prompt for a new password. The password can be supplied from standard input when an option `--interactive=false` is given. +Creating a new user will prompt for a new password. The password can be supplied from standard input when an option `--interactive=false` is given. `--new-user-password` can also be used for supplying the password. Roles can be granted and revoked for a user with: @@ -122,12 +124,12 @@ $ etcdctl role remove myrolename ## Enabling authentication -The minimal steps to enabling auth are as follows. The administrator can set up users and roles before or after enabling authentication, as a matter of preference. +The minimal steps to enabling auth are as follows. The administrator can set up users and roles before or after enabling authentication, as a matter of preference. Make sure the root user is created: ``` -$ etcdctl user add root +$ etcdctl user add root Password of root: ``` @@ -157,8 +159,18 @@ The password can be taken from a prompt: $ etcdctl --user user get foo ``` +The password can also be taken from a command line flag `--password`: + +``` +$ etcdctl --user user --password password get foo +``` + + Otherwise, all `etcdctl` commands remain the same. Users and roles can still be created and modified, but require authentication by a user with the root role. ## Using TLS Common Name +As of version v3.2 if an etcd server is launched with the option `--client-cert-auth=true`, the field of Common Name (CN) in the client's TLS cert will be used as an etcd user. In this case, the common name authenticates the user and the client does not need a password. Note that if both of 1. `--client-cert-auth=true` is passed and CN is provided by the client, and 2. username and password are provided by the client, the username and password based authentication is prioritized. Note that this feature cannot be used with gRPC-proxy and gRPC-gateway. This is because gRPC-proxy terminates TLS from its client so all the clients share a cert of the proxy. gRPC-gateway uses a TLS connection internally for transforming HTTP request to gRPC request so it shares the same limitation. Therefore the clients cannot provide their CN to the server correctly. gRPC-proxy will cause an error and stop if a given cert has non empty CN. gRPC-proxy returns an error which indicates that the client has an non empty CN in its cert. + +As of version v3.3 if an etcd server is launched with the option `--peer-cert-allowed-cn` filtering of CN inter-peer connections is enabled. Nodes can only join the etcd cluster if their CN match the allowed one. +See [etcd security page](https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/security.md) for more details. -If an etcd server is launched with the option `--client-cert-auth=true`, the field of Common Name (CN) in the client's TLS cert will be used as an etcd user. In this case, the common name authenticates the user and the client does not need a password. Note that if both of 1. `--client-cert-auth=true` is passed and CN is provided by the client, and 2. username and password are provided by the client, the username and password based authentication is prioritized. diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/clustering.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/clustering.md index 2e205beef..99d411441 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/clustering.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/clustering.md @@ -1,4 +1,6 @@ -# Clustering Guide +--- +title: Clustering Guide +--- ## Overview @@ -342,8 +344,8 @@ etcdserver: discovery token ignored since a cluster has already been initialized ### DNS discovery DNS [SRV records][rfc-srv] can be used as a discovery mechanism. -The `-discovery-srv` flag can be used to set the DNS domain name where the discovery SRV records can be found. -The following DNS SRV records are looked up in the listed order: +The `--discovery-srv` flag can be used to set the DNS domain name where the discovery SRV records can be found. +Setting `--discovery-srv example.com` causes DNS SRV records to be looked up in the listed order: * _etcd-server-ssl._tcp.example.com * _etcd-server._tcp.example.com @@ -357,8 +359,21 @@ To help clients discover the etcd cluster, the following DNS SRV records are loo If `_etcd-client-ssl._tcp.example.com` is found, clients will attempt to communicate with the etcd cluster over SSL/TLS. +If etcd is using TLS, the discovery SRV record (e.g. `example.com`) must be included in the SSL certificate DNS SAN along with the hostname, or clustering will fail with log messages like the following: + +``` +[...] rejected connection from "10.0.1.11:53162" (error "remote error: tls: bad certificate", ServerName "example.com") +``` + If etcd is using TLS without a custom certificate authority, the discovery domain (e.g., example.com) must match the SRV record domain (e.g., infra1.example.com). This is to mitigate attacks that forge SRV records to point to a different domain; the domain would have a valid certificate under PKI but be controlled by an unknown third party. +The `-discovery-srv-name` flag additionally configures a suffix to the SRV name that is queried during discovery. +Use this flag to differentiate between multiple etcd clusters under the same domain. +For example, if `discovery-srv=example.com` and `-discovery-srv-name=foo` are set, the following DNS SRV queries are made: + +* _etcd-server-ssl-foo._tcp.example.com +* _etcd-server-foo._tcp.example.com + #### Create DNS SRV records ``` @@ -384,7 +399,8 @@ infra2.example.com. 300 IN A 10.0.1.12 #### Bootstrap the etcd cluster using DNS -etcd cluster members can listen on domain names or IP address, the bootstrap process will resolve DNS A records. +etcd cluster members can advertise domain names or IP address, the bootstrap process will resolve DNS A records. +Since 3.2 (3.1 prints warnings) `--listen-peer-urls` and `--listen-client-urls` will reject domain name for the network interface binding. The resolved address in `--initial-advertise-peer-urls` *must match* one of the resolved addresses in the SRV targets. The etcd member reads the resolved address to find out if it belongs to the cluster defined in the SRV records. @@ -395,8 +411,8 @@ $ etcd --name infra0 \ --initial-cluster-token etcd-cluster-1 \ --initial-cluster-state new \ --advertise-client-urls http://infra0.example.com:2379 \ ---listen-client-urls http://infra0.example.com:2379 \ ---listen-peer-urls http://infra0.example.com:2380 +--listen-client-urls http://0.0.0.0:2379 \ +--listen-peer-urls http://0.0.0.0:2380 ``` ``` @@ -406,8 +422,8 @@ $ etcd --name infra1 \ --initial-cluster-token etcd-cluster-1 \ --initial-cluster-state new \ --advertise-client-urls http://infra1.example.com:2379 \ ---listen-client-urls http://infra1.example.com:2379 \ ---listen-peer-urls http://infra1.example.com:2380 +--listen-client-urls http://0.0.0.0:2379 \ +--listen-peer-urls http://0.0.0.0:2380 ``` ``` @@ -417,8 +433,8 @@ $ etcd --name infra2 \ --initial-cluster-token etcd-cluster-1 \ --initial-cluster-state new \ --advertise-client-urls http://infra2.example.com:2379 \ ---listen-client-urls http://infra2.example.com:2379 \ ---listen-peer-urls http://infra2.example.com:2380 +--listen-client-urls http://0.0.0.0:2379 \ +--listen-peer-urls http://0.0.0.0:2380 ``` The cluster can also bootstrap using IP addresses instead of domain names: diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/configuration.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/configuration.md index ef91845f2..d2ff02547 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/configuration.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/configuration.md @@ -1,4 +1,6 @@ -# Configuration flags +--- +title: Configuration flags +--- etcd is configurable through a configuration file, various command-line flags, and environment variables. @@ -47,14 +49,14 @@ To start etcd automatically using custom settings at startup in Linux, using a [ + env variable: ETCD_ELECTION_TIMEOUT ### --listen-peer-urls -+ List of URLs to listen on for peer traffic. This flag tells the etcd to accept incoming requests from its peers on the specified scheme://IP:port combinations. Scheme can be either http or https.If 0.0.0.0 is specified as the IP, etcd listens to the given port on all interfaces. If an IP address is given as well as a port, etcd will listen on the given port and interface. Multiple URLs may be used to specify a number of addresses and ports to listen on. The etcd will respond to requests from any of the listed addresses and ports. ++ List of URLs to listen on for peer traffic. This flag tells the etcd to accept incoming requests from its peers on the specified scheme://IP:port combinations. Scheme can be http or https. Alternatively, use `unix://` or `unixs://` for unix sockets. If 0.0.0.0 is specified as the IP, etcd listens to the given port on all interfaces. If an IP address is given as well as a port, etcd will listen on the given port and interface. Multiple URLs may be used to specify a number of addresses and ports to listen on. The etcd will respond to requests from any of the listed addresses and ports. + default: "http://localhost:2380" + env variable: ETCD_LISTEN_PEER_URLS + example: "http://10.0.0.1:2380" + invalid example: "http://example.com:2380" (domain name is invalid for binding) ### --listen-client-urls -+ List of URLs to listen on for client traffic. This flag tells the etcd to accept incoming requests from the clients on the specified scheme://IP:port combinations. Scheme can be either http or https. If 0.0.0.0 is specified as the IP, etcd listens to the given port on all interfaces. If an IP address is given as well as a port, etcd will listen on the given port and interface. Multiple URLs may be used to specify a number of addresses and ports to listen on. The etcd will respond to requests from any of the listed addresses and ports. ++ List of URLs to listen on for client traffic. This flag tells the etcd to accept incoming requests from the clients on the specified scheme://IP:port combinations. Scheme can be either http or https. Alternatively, use `unix://` or `unixs://` for unix sockets. If 0.0.0.0 is specified as the IP, etcd listens to the given port on all interfaces. If an IP address is given as well as a port, etcd will listen on the given port and interface. Multiple URLs may be used to specify a number of addresses and ports to listen on. The etcd will respond to requests from any of the listed addresses and ports. + default: "http://localhost:2379" + env variable: ETCD_LISTEN_CLIENT_URLS + example: "http://10.0.0.1:2379" @@ -82,6 +84,16 @@ To start etcd automatically using custom settings at startup in Linux, using a [ + default: 0 + env variable: ETCD_QUOTA_BACKEND_BYTES +### --backend-batch-limit ++ BackendBatchLimit is the maximum operations before commit the backend transaction. ++ default: 0 ++ env variable: ETCD_BACKEND_BATCH_LIMIT + +### --backend-batch-interval ++ BackendBatchInterval is the maximum time before commit the backend transaction. ++ default: 0 ++ env variable: ETCD_BACKEND_BATCH_INTERVAL + ### --max-txn-ops + Maximum number of operations permitted in a transaction. + default: 128 @@ -109,7 +121,7 @@ To start etcd automatically using custom settings at startup in Linux, using a [ ## Clustering flags -`--initial` prefix flags are used in bootstrapping ([static bootstrap][build-cluster], [discovery-service bootstrap][discovery] or [runtime reconfiguration][reconfig]) a new member, and ignored when restarting an existing member. +`--initial-advertise-peer-urls`, `--initial-cluster`, `--initial-cluster-state`, and `--initial-cluster-token` flags are used in bootstrapping ([static bootstrap][build-cluster], [discovery-service bootstrap][discovery] or [runtime reconfiguration][reconfig]) a new member, and ignored when restarting an existing member. `--discovery` prefix flags need to be set when using [discovery service][discovery]. @@ -155,6 +167,11 @@ To start etcd automatically using custom settings at startup in Linux, using a [ + default: "" + env variable: ETCD_DISCOVERY_SRV +### --discovery-srv-name ++ Suffix to the DNS srv name queried when bootstrapping using DNS. ++ default: "" ++ env variable: ETCD_DISCOVERY_SRV_NAME + ### --discovery-fallback + Expected behavior ("exit" or "proxy") when discovery services fails. "proxy" supports v2 API only. + default: "proxy" @@ -167,7 +184,7 @@ To start etcd automatically using custom settings at startup in Linux, using a [ ### --strict-reconfig-check + Reject reconfiguration requests that would cause quorum loss. -+ default: false ++ default: true + env variable: ETCD_STRICT_RECONFIG_CHECK ### --auto-compaction-retention @@ -176,7 +193,7 @@ To start etcd automatically using custom settings at startup in Linux, using a [ + env variable: ETCD_AUTO_COMPACTION_RETENTION ### --auto-compaction-mode -+ Interpret 'auto-compaction-retention' one of: periodic|revision. 'periodic' for duration based retention, defaulting to hours if no time unit is provided (e.g. '5m'). 'revision' for revision number based retention. ++ Interpret 'auto-compaction-retention' one of: 'periodic', 'revision'. 'periodic' for duration based retention, defaulting to hours if no time unit is provided (e.g. '5m'). 'revision' for revision number based retention. + default: periodic + env variable: ETCD_AUTO_COMPACTION_MODE @@ -246,6 +263,7 @@ The security flags help to [build a secure etcd cluster][security]. + Enable client cert authentication. + default: false + env variable: ETCD_CLIENT_CERT_AUTH ++ CN authentication is not supported by gRPC-gateway. ### --client-crl-file + Path to the client certificate revocation list file. @@ -305,8 +323,27 @@ The security flags help to [build a secure etcd cluster][security]. + default: none + env variable: ETCD_PEER_CERT_ALLOWED_CN +### --cipher-suites ++ Comma-separated list of supported TLS cipher suites between server/client and peers. ++ default: "" ++ env variable: ETCD_CIPHER_SUITES + ## Logging flags +### --logger + +**Available from v3.4** + ++ Specify 'zap' for structured logging or 'capnslog'. ++ default: capnslog ++ env variable: ETCD_LOGGER + +### --log-outputs ++ Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd, or list of comma separated output targets. ++ default: default ++ env variable: ETCD_LOG_OUTPUTS ++ 'default' use 'stderr' config for v3.4 during zap logger migraion + ### --debug + Drop the default log level to DEBUG for all subpackages. + default: false (INFO for all packages) @@ -324,7 +361,7 @@ For example, it may panic if other members in the cluster are still alive. Follow the instructions when using these flags. ### --force-new-cluster -+ Force to create a new one-member cluster. It commits configuration changes forcing to remove all existing members in the cluster and add itself. It needs to be set to [restore a backup][restore]. ++ Force to create a new one-member cluster. It commits configuration changes forcing to remove all existing members in the cluster and add itself, but is strongly discouraged. Please review the [disaster recovery][recovery] documentation for preferred v3 recovery procedures. + default: false + env variable: ETCD_FORCE_NEW_CLUSTER @@ -338,33 +375,50 @@ Follow the instructions when using these flags. + Load server configuration from a file. + default: "" + example: [sample configuration file][sample-config-file] ++ env variable: ETCD_CONFIG_FILE ## Profiling flags ### --enable-pprof + Enable runtime profiling data via HTTP server. Address is at client URL + "/debug/pprof/" + default: false ++ env variable: ETCD_ENABLE_PPROF ### --metrics + Set level of detail for exported metrics, specify 'extensive' to include histogram metrics. + default: basic ++ env variable: ETCD_METRICS ### --listen-metrics-urls -+ List of URLs to listen on for metrics. ++ List of additional URLs to listen on that will respond to both the `/metrics` and `/health` endpoints + default: "" ++ env variable: ETCD_LISTEN_METRICS_URLS ## Auth flags ### --auth-token -+ Specify a token type and token specific options, especially for JWT. Its format is "type,var1=val1,var2=val2,...". Possible type is 'simple' or 'jwt'. Possible variables are 'sign-method' for specifying a sign method of jwt (its possible values are 'ES256', 'ES384', 'ES512', 'HS256', 'HS384', 'HS512', 'RS256', 'RS384', 'RS512', 'PS256', 'PS384', or 'PS512'), 'pub-key' for specifying a path to a public key for verifying jwt, and 'priv-key' for specifying a path to a private key for signing jwt. -+ Example option of JWT: '--auth-token jwt,pub-key=app.rsa.pub,priv-key=app.rsa,sign-method=RS512' ++ Specify a token type and token specific options, especially for JWT. Its format is "type,var1=val1,var2=val2,...". Possible type is 'simple' or 'jwt'. Possible variables are 'sign-method' for specifying a sign method of jwt (its possible values are 'ES256', 'ES384', 'ES512', 'HS256', 'HS384', 'HS512', 'RS256', 'RS384', 'RS512', 'PS256', 'PS384', or 'PS512'), 'pub-key' for specifying a path to a public key for verifying jwt, 'priv-key' for specifying a path to a private key for signing jwt, and 'ttl' for specifying TTL of jwt tokens. ++ For asymmetric algorithms ('RS', 'PS', 'ES'), the public key is optional, as the private key contains enough information to both sign and verify tokens. ++ Example option of JWT: '--auth-token jwt,pub-key=app.rsa.pub,priv-key=app.rsa,sign-method=RS512,ttl=10m' + default: "simple" ++ env variable: ETCD_AUTH_TOKEN + +### --bcrypt-cost ++ Specify the cost / strength of the bcrypt algorithm for hashing auth passwords. Valid values are between 4 and 31. ++ default: 10 ++ env variable: (not supported) ## Experimental flags +### --experimental-backend-bbolt-freelist-type ++ The freelist type that etcd backend(bboltdb) uses (array and map are supported types). ++ default: array ++ env variable: ETCD_EXPERIMENTAL_BACKEND_BBOLT_FREELIST_TYPE + ### --experimental-corrupt-check-time + Duration of time between cluster corruption check passes + default: 0s ++ env variable: ETCD_EXPERIMENTAL_CORRUPT_CHECK_TIME [build-cluster]: clustering.md#static [reconfig]: runtime-configuration.md @@ -376,3 +430,4 @@ Follow the instructions when using these flags. [systemd-intro]: http://freedesktop.org/wiki/Software/systemd/ [tuning]: ../tuning.md#time-parameters [sample-config-file]: ../../etcd.conf.yml.sample +[recovery]: recovery.md#disaster-recovery diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/container.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/container.md index 197cff873..3c7693a25 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/container.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/container.md @@ -1,4 +1,6 @@ -# Run etcd clusters inside containers +--- +title: Run etcd clusters inside containers +--- The following guide shows how to run etcd with rkt and Docker using the [static bootstrap process](clustering.md#static). diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/etcd3_alert.rules b/vendor/github.com/coreos/etcd/Documentation/op-guide/etcd3_alert.rules index 919756dc2..98139115b 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/etcd3_alert.rules +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/etcd3_alert.rules @@ -79,47 +79,6 @@ ANNOTATIONS { description = "on etcd instance {{ $labels.instance }} gRPC requests to {{ $labels.grpc_method }} are slow", } -# HTTP requests alerts -# ==================== - -# alert if more than 1% of requests to an HTTP endpoint have failed within the last 5 minutes -ALERT HighNumberOfFailedHTTPRequests -IF 100 * (sum(rate(grpc_server_handled_total{grpc_code!="OK",job="etcd"}[5m])) BY (grpc_service, grpc_method) - / sum(rate(grpc_server_handled_total{job="etcd"}[5m])) BY (grpc_service, grpc_method)) > 1 -FOR 10m -LABELS { - severity = "warning" -} -ANNOTATIONS { - summary = "a high number of HTTP requests are failing", - description = "{{ $value }}% of requests for {{ $labels.method }} failed on etcd instance {{ $labels.instance }}", -} - -# alert if more than 5% of requests to an HTTP endpoint have failed within the last 5 minutes -ALERT HighNumberOfFailedHTTPRequests -IF 100 * (sum(rate(grpc_server_handled_total{grpc_code!="OK",job="etcd"}[5m])) BY (grpc_service, grpc_method) - / sum(rate(grpc_server_handled_total{job="etcd"}[5m])) BY (grpc_service, grpc_method)) > 5 -FOR 5m -LABELS { - severity = "critical" -} -ANNOTATIONS { - summary = "a high number of HTTP requests are failing", - description = "{{ $value }}% of requests for {{ $labels.method }} failed on etcd instance {{ $labels.instance }}", -} - -# alert if the 99th percentile of HTTP requests take more than 150ms -ALERT HTTPRequestsSlow -IF histogram_quantile(0.99, rate(etcd_http_successful_duration_seconds_bucket[5m])) > 0.15 -FOR 10m -LABELS { - severity = "warning" -} -ANNOTATIONS { - summary = "slow HTTP requests", - description = "on etcd instance {{ $labels.instance }} HTTP requests to {{ $labels.method }} are slow", -} - # file descriptor alerts # ====================== diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/etcd3_alert.rules.yml b/vendor/github.com/coreos/etcd/Documentation/op-guide/etcd3_alert.rules.yml index fbd12c7ec..17287172b 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/etcd3_alert.rules.yml +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/etcd3_alert.rules.yml @@ -1,143 +1,134 @@ +# these rules synced manually from https://github.com/etcd-io/etcd/blob/master/Documentation/etcd-mixin/mixin.libsonnet groups: -- name: etcd3_alert.rules +- name: etcd rules: - - alert: InsufficientMembers - expr: count(up{job="etcd"} == 0) > (count(up{job="etcd"}) / 2 - 1) + - alert: etcdInsufficientMembers + annotations: + message: 'etcd cluster "{{ $labels.job }}": insufficient members ({{ $value + }}).' + expr: | + sum(up{job=~".*etcd.*"} == bool 1) by (job) < ((count(up{job=~".*etcd.*"}) by (job) + 1) / 2) for: 3m labels: severity: critical + - alert: etcdNoLeader annotations: - description: If one more etcd member goes down the cluster will be unavailable - summary: etcd cluster insufficient members - - alert: NoLeader - expr: etcd_server_has_leader{job="etcd"} == 0 + message: 'etcd cluster "{{ $labels.job }}": member {{ $labels.instance }} has + no leader.' + expr: | + etcd_server_has_leader{job=~".*etcd.*"} == 0 for: 1m labels: severity: critical + - alert: etcdHighNumberOfLeaderChanges annotations: - description: etcd member {{ $labels.instance }} has no leader - summary: etcd member has no leader - - alert: HighNumberOfLeaderChanges - expr: increase(etcd_server_leader_changes_seen_total{job="etcd"}[1h]) > 3 + message: 'etcd cluster "{{ $labels.job }}": instance {{ $labels.instance }} + has seen {{ $value }} leader changes within the last hour.' + expr: | + rate(etcd_server_leader_changes_seen_total{job=~".*etcd.*"}[15m]) > 3 + for: 15m labels: severity: warning + - alert: etcdHighNumberOfFailedGRPCRequests annotations: - description: etcd instance {{ $labels.instance }} has seen {{ $value }} leader - changes within the last hour - summary: a high number of leader changes within the etcd cluster are happening - - alert: HighNumberOfFailedGRPCRequests - expr: 100 * (sum(rate(grpc_server_handled_total{grpc_code!="OK",job="etcd"}[5m])) BY (grpc_service, grpc_method) - / sum(rate(grpc_server_handled_total{job="etcd"}[5m])) BY (grpc_service, grpc_method)) > 1 + message: 'etcd cluster "{{ $labels.job }}": {{ $value }}% of requests for {{ + $labels.grpc_method }} failed on etcd instance {{ $labels.instance }}.' + expr: | + 100 * sum(rate(grpc_server_handled_total{job=~".*etcd.*", grpc_code!="OK"}[5m])) BY (job, instance, grpc_service, grpc_method) + / + sum(rate(grpc_server_handled_total{job=~".*etcd.*"}[5m])) BY (job, instance, grpc_service, grpc_method) + > 1 for: 10m labels: severity: warning + - alert: etcdHighNumberOfFailedGRPCRequests annotations: - description: '{{ $value }}% of requests for {{ $labels.grpc_method }} failed - on etcd instance {{ $labels.instance }}' - summary: a high number of gRPC requests are failing - - alert: HighNumberOfFailedGRPCRequests - expr: 100 * (sum(rate(grpc_server_handled_total{grpc_code!="OK",job="etcd"}[5m])) BY (grpc_service, grpc_method) - / sum(rate(grpc_server_handled_total{job="etcd"}[5m])) BY (grpc_service, grpc_method)) > 5 + message: 'etcd cluster "{{ $labels.job }}": {{ $value }}% of requests for {{ + $labels.grpc_method }} failed on etcd instance {{ $labels.instance }}.' + expr: | + 100 * sum(rate(grpc_server_handled_total{job=~".*etcd.*", grpc_code!="OK"}[5m])) BY (job, instance, grpc_service, grpc_method) + / + sum(rate(grpc_server_handled_total{job=~".*etcd.*"}[5m])) BY (job, instance, grpc_service, grpc_method) + > 5 for: 5m labels: severity: critical + - alert: etcdGRPCRequestsSlow annotations: - description: '{{ $value }}% of requests for {{ $labels.grpc_method }} failed - on etcd instance {{ $labels.instance }}' - summary: a high number of gRPC requests are failing - - alert: GRPCRequestsSlow - expr: histogram_quantile(0.99, sum(rate(grpc_server_handling_seconds_bucket{job="etcd",grpc_type="unary"}[5m])) by (grpc_service, grpc_method, le)) + message: 'etcd cluster "{{ $labels.job }}": gRPC requests to {{ $labels.grpc_method + }} are taking {{ $value }}s on etcd instance {{ $labels.instance }}.' + expr: | + histogram_quantile(0.99, sum(rate(grpc_server_handling_seconds_bucket{job=~".*etcd.*", grpc_type="unary"}[5m])) by (job, instance, grpc_service, grpc_method, le)) > 0.15 for: 10m labels: severity: critical + - alert: etcdMemberCommunicationSlow annotations: - description: on etcd instance {{ $labels.instance }} gRPC requests to {{ $labels.grpc_method - }} are slow - summary: slow gRPC requests - - alert: HighNumberOfFailedHTTPRequests - expr: 100 * (sum(rate(etcd_http_failed_total{job="etcd"}[5m])) BY (method) / sum(rate(etcd_http_received_total{job="etcd"}[5m])) - BY (method)) > 1 - for: 10m - labels: - severity: warning - annotations: - description: '{{ $value }}% of requests for {{ $labels.method }} failed on etcd - instance {{ $labels.instance }}' - summary: a high number of HTTP requests are failing - - alert: HighNumberOfFailedHTTPRequests - expr: 100 * (sum(rate(etcd_http_failed_total{job="etcd"}[5m])) BY (method) / sum(rate(etcd_http_received_total{job="etcd"}[5m])) - BY (method)) > 5 - for: 5m - labels: - severity: critical - annotations: - description: '{{ $value }}% of requests for {{ $labels.method }} failed on etcd - instance {{ $labels.instance }}' - summary: a high number of HTTP requests are failing - - alert: HTTPRequestsSlow - expr: histogram_quantile(0.99, rate(etcd_http_successful_duration_seconds_bucket[5m])) + message: 'etcd cluster "{{ $labels.job }}": member communication with {{ $labels.To + }} is taking {{ $value }}s on etcd instance {{ $labels.instance }}.' + expr: | + histogram_quantile(0.99, rate(etcd_network_peer_round_trip_time_seconds_bucket{job=~".*etcd.*"}[5m])) > 0.15 for: 10m labels: severity: warning + - alert: etcdHighNumberOfFailedProposals annotations: - description: on etcd instance {{ $labels.instance }} HTTP requests to {{ $labels.method - }} are slow - summary: slow HTTP requests - - record: instance:fd_utilization - expr: process_open_fds / process_max_fds - - alert: FdExhaustionClose - expr: predict_linear(instance:fd_utilization[1h], 3600 * 4) > 1 - for: 10m + message: 'etcd cluster "{{ $labels.job }}": {{ $value }} proposal failures within + the last hour on etcd instance {{ $labels.instance }}.' + expr: | + rate(etcd_server_proposals_failed_total{job=~".*etcd.*"}[15m]) > 5 + for: 15m labels: severity: warning + - alert: etcdHighFsyncDurations annotations: - description: '{{ $labels.job }} instance {{ $labels.instance }} will exhaust - its file descriptors soon' - summary: file descriptors soon exhausted - - alert: FdExhaustionClose - expr: predict_linear(instance:fd_utilization[10m], 3600) > 1 + message: 'etcd cluster "{{ $labels.job }}": 99th percentile fync durations are + {{ $value }}s on etcd instance {{ $labels.instance }}.' + expr: | + histogram_quantile(0.99, rate(etcd_disk_wal_fsync_duration_seconds_bucket{job=~".*etcd.*"}[5m])) + > 0.5 for: 10m labels: - severity: critical + severity: warning + - alert: etcdHighCommitDurations annotations: - description: '{{ $labels.job }} instance {{ $labels.instance }} will exhaust - its file descriptors soon' - summary: file descriptors soon exhausted - - alert: EtcdMemberCommunicationSlow - expr: histogram_quantile(0.99, rate(etcd_network_peer_round_trip_time_seconds_bucket[5m])) - > 0.15 + message: 'etcd cluster "{{ $labels.job }}": 99th percentile commit durations + {{ $value }}s on etcd instance {{ $labels.instance }}.' + expr: | + histogram_quantile(0.99, rate(etcd_disk_backend_commit_duration_seconds_bucket{job=~".*etcd.*"}[5m])) + > 0.25 for: 10m labels: severity: warning + - alert: etcdHighNumberOfFailedHTTPRequests annotations: - description: etcd instance {{ $labels.instance }} member communication with - {{ $labels.To }} is slow - summary: etcd member communication is slow - - alert: HighNumberOfFailedProposals - expr: increase(etcd_server_proposals_failed_total{job="etcd"}[1h]) > 5 + message: '{{ $value }}% of requests for {{ $labels.method }} failed on etcd + instance {{ $labels.instance }}' + expr: | + sum(rate(etcd_http_failed_total{job=~".*etcd.*", code!="404"}[5m])) BY (method) / sum(rate(etcd_http_received_total{job=~".*etcd.*"}[5m])) + BY (method) > 0.01 + for: 10m labels: severity: warning + - alert: etcdHighNumberOfFailedHTTPRequests annotations: - description: etcd instance {{ $labels.instance }} has seen {{ $value }} proposal - failures within the last hour - summary: a high number of proposals within the etcd cluster are failing - - alert: HighFsyncDurations - expr: histogram_quantile(0.99, rate(etcd_disk_wal_fsync_duration_seconds_bucket[5m])) - > 0.5 + message: '{{ $value }}% of requests for {{ $labels.method }} failed on etcd + instance {{ $labels.instance }}.' + expr: | + sum(rate(etcd_http_failed_total{job=~".*etcd.*", code!="404"}[5m])) BY (method) / sum(rate(etcd_http_received_total{job=~".*etcd.*"}[5m])) + BY (method) > 0.05 for: 10m labels: - severity: warning + severity: critical + - alert: etcdHTTPRequestsSlow annotations: - description: etcd instance {{ $labels.instance }} fync durations are high - summary: high fsync durations - - alert: HighCommitDurations - expr: histogram_quantile(0.99, rate(etcd_disk_backend_commit_duration_seconds_bucket[5m])) - > 0.25 + message: etcd instance {{ $labels.instance }} HTTP requests to {{ $labels.method + }} are slow. + expr: | + histogram_quantile(0.99, rate(etcd_http_successful_duration_seconds_bucket[5m])) + > 0.15 for: 10m labels: severity: warning - annotations: - description: etcd instance {{ $labels.instance }} commit durations are high - summary: high commit durations diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/failures.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/failures.md index 6139e05fc..c60e7ec49 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/failures.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/failures.md @@ -1,4 +1,6 @@ -# Failure modes +--- +title: Failure modes +--- Failures are common in a large deployment of machines. A machine fails when its hardware or software malfunctions. Multiple machines fail together when there are power failures or network issues. Multiple kinds of failures can also happen at once; it is almost impossible to enumerate all possible failure cases. diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/gateway.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/gateway.md index 10fe5d0c3..8240d3c54 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/gateway.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/gateway.md @@ -1,10 +1,12 @@ -# etcd gateway +--- +title: etcd gateway +--- ## What is etcd gateway etcd gateway is a simple TCP proxy that forwards network data to the etcd cluster. The gateway is stateless and transparent; it neither inspects client requests nor interferes with cluster responses. -The gateway supports multiple etcd server endpoints and works on a simple round-robin policy. It only routes to available enpoints and hides failures from its clients. Other retry policies, such as weighted round-robin, may be supported in the future. +The gateway supports multiple etcd server endpoints and works on a simple round-robin policy. It only routes to available endpoints and hides failures from its clients. Other retry policies, such as weighted round-robin, may be supported in the future. ## When to use etcd gateway @@ -60,7 +62,7 @@ infra2.example.com. 300 IN A 10.0.1.12 Start the etcd gateway to fetch the endpoints from the DNS SRV entries with the command: ```bash -$ etcd gateway --discovery-srv=example.com +$ etcd gateway start --discovery-srv=example.com 2016-08-16 11:21:18.867350 I | tcpproxy: ready to proxy client requests to [...] ``` diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/grafana.json b/vendor/github.com/coreos/etcd/Documentation/op-guide/grafana.json index 4b7a432ea..c405fdfee 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/grafana.json +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/grafana.json @@ -1,1015 +1,1225 @@ { - "id": 6, - "title": "test-etcd", - "description": "etcd sample Grafana dashboard with Prometheus", - "tags": [], - "style": "dark", - "timezone": "browser", - "editable": true, - "hideControls": false, - "sharedCrosshair": false, - "rows": [{ - "collapse": false, - "editable": true, - "height": "250px", - "panels": [{ - "cacheTimeout": null, - "colorBackground": false, - "colorValue": false, - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], - "datasource": "test-etcd", - "editable": true, - "error": false, - "format": "none", - "gauge": { - "maxValue": 100, - "minValue": 0, - "show": false, - "thresholdLabels": false, - "thresholdMarkers": true - }, - "id": 28, - "interval": null, - "isNew": true, - "links": [], - "mappingType": 1, - "mappingTypes": [{ - "name": "value to text", - "value": 1 - }, - { - "name": "range to text", - "value": 2 - } - ], - "maxDataPoints": 100, - "nullPointMode": "connected", - "nullText": null, - "postfix": "", - "postfixFontSize": "50%", - "prefix": "", - "prefixFontSize": "50%", - "rangeMaps": [{ - "from": "null", - "text": "N/A", - "to": "null" - }], - "span": 3, - "sparkline": { - "fillColor": "rgba(31, 118, 189, 0.18)", - "full": false, - "lineColor": "rgb(31, 120, 193)", - "show": false - }, - "targets": [{ - "expr": "sum(etcd_server_has_leader)", - "intervalFactor": 2, - "legendFormat": "", - "metric": "etcd_server_has_leader", - "refId": "A", - "step": 20 - }], - "thresholds": "", - "title": "Up", - "type": "singlestat", - "valueFontSize": "200%", - "valueMaps": [{ - "op": "=", - "text": "N/A", - "value": "null" - }], - "valueName": "avg" - }, - { - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "editable": true, - "error": false, - "fill": 0, - "id": 23, - "isNew": true, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": false, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 5, - "stack": false, - "steppedLine": false, - "targets": [ - { - "expr": "sum(rate(grpc_server_started_total{grpc_type=\"unary\"}[5m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "RPC Rate", - "metric": "grpc_server_started_total", - "refId": "A", - "step": 2 - }, - { - "expr": "sum(rate(grpc_server_handled_total{grpc_type=\"unary\",grpc_code!=\"OK\"}[5m]))", - "format": "time_series", - "intervalFactor": 2, - "legendFormat": "RPC Failed Rate", - "metric": "grpc_server_handled_total", - "refId": "B", - "step": 2 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "RPC Rate", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [{ - "format": "ops", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - }, - { - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "editable": true, - "error": false, - "fill": 0, - "id": 41, - "isNew": true, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": false, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 4, - "stack": true, - "steppedLine": false, - "targets": [{ - "expr": "sum(grpc_server_started_total{grpc_service=\"etcdserverpb.Watch\",grpc_type=\"bidi_stream\"}) - sum(grpc_server_handled_total{grpc_service=\"etcdserverpb.Watch\",grpc_type=\"bidi_stream\"})", - "intervalFactor": 2, - "legendFormat": "Watch Streams", - "metric": "grpc_server_handled_total", - "refId": "A", - "step": 4 - }, - { - "expr": "sum(grpc_server_started_total{grpc_service=\"etcdserverpb.Lease\",grpc_type=\"bidi_stream\"}) - sum(grpc_server_handled_total{grpc_service=\"etcdserverpb.Lease\",grpc_type=\"bidi_stream\"})", - "intervalFactor": 2, - "legendFormat": "Lease Streams", - "metric": "grpc_server_handled_total", - "refId": "B", - "step": 4 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Active Streams", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [{ - "format": "short", - "label": "", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - } - ], - "showTitle": false, - "title": "Row" + "etcd.json": { + "annotations": { + "list": [ + + ] }, - { - "collapse": false, - "editable": true, - "height": "250px", - "panels": [{ - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "decimals": null, - "editable": true, - "error": false, - "fill": 0, - "grid": {}, - "id": 1, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": false, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [{ - "expr": "etcd_debugging_mvcc_db_total_size_in_bytes", - "hide": false, - "interval": "", - "intervalFactor": 2, - "legendFormat": "{{instance}} DB Size", - "metric": "", - "refId": "A", - "step": 4 - }], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "DB Size", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [{ - "format": "bytes", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": false - } - ] - }, - { - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "editable": true, - "error": false, - "fill": 0, - "grid": {}, - "id": 3, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": false, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 1, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 4, - "stack": false, - "steppedLine": true, - "targets": [{ - "expr": "histogram_quantile(0.99, sum(rate(etcd_disk_wal_fsync_duration_seconds_bucket[5m])) by (instance, le))", - "hide": false, - "intervalFactor": 2, - "legendFormat": "{{instance}} WAL fsync", - "metric": "etcd_disk_wal_fsync_duration_seconds_bucket", - "refId": "A", - "step": 4 - }, - { - "expr": "histogram_quantile(0.99, sum(rate(etcd_disk_backend_commit_duration_seconds_bucket[5m])) by (instance, le))", - "intervalFactor": 2, - "legendFormat": "{{instance}} DB fsync", - "metric": "etcd_disk_backend_commit_duration_seconds_bucket", - "refId": "B", - "step": 4 - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Disk Sync Duration", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [{ - "format": "s", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, + "description": "etcd sample Grafana dashboard with Prometheus", + "editable": true, + "gnetId": null, + "hideControls": false, + "id": 6, + "links": [ + + ], + "refresh": false, + "rows": [ + { + "collapse": false, + "editable": true, + "height": "250px", + "panels": [ + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "datasource": "$datasource", + "editable": true, + "error": false, + "format": "none", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "id": 28, + "interval": null, + "isNew": true, + "links": [ + + ], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "span": 3, + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", "show": false - } - ] - }, - { - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "editable": true, - "error": false, - "fill": 0, - "id": 29, - "isNew": true, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": false, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 4, - "stack": false, - "steppedLine": false, - "targets": [{ - "expr": "process_resident_memory_bytes", - "intervalFactor": 2, - "legendFormat": "{{instance}} Resident Memory", - "metric": "process_resident_memory_bytes", - "refId": "A", - "step": 4 - }], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Memory", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [{ - "format": "bytes", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - } - ], - "title": "New row" - }, - { - "collapse": false, - "editable": true, - "height": "250px", - "panels": [{ - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "editable": true, - "error": false, - "fill": 5, - "id": 22, - "isNew": true, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": false, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 3, - "stack": true, - "steppedLine": false, - "targets": [{ - "expr": "rate(etcd_network_client_grpc_received_bytes_total[5m])", - "intervalFactor": 2, - "legendFormat": "{{instance}} Client Traffic In", - "metric": "etcd_network_client_grpc_received_bytes_total", - "refId": "A", - "step": 4 - }], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Client Traffic In", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" + }, + "targets": [ + { + "expr": "sum(etcd_server_has_leader{job=\"$cluster\"})", + "intervalFactor": 2, + "legendFormat": "", + "metric": "etcd_server_has_leader", + "refId": "A", + "step": 20 + } + ], + "thresholds": "", + "title": "Up", + "type": "singlestat", + "valueFontSize": "200%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "editable": true, + "error": false, + "fill": 0, + "id": 23, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 5, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(grpc_server_started_total{job=\"$cluster\",grpc_type=\"unary\"}[5m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "RPC Rate", + "metric": "grpc_server_started_total", + "refId": "A", + "step": 2 + }, + { + "expr": "sum(rate(grpc_server_handled_total{job=\"$cluster\",grpc_type=\"unary\",grpc_code!=\"OK\"}[5m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "RPC Failed Rate", + "metric": "grpc_server_handled_total", + "refId": "B", + "step": 2 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "RPC Rate", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "ops", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] }, - "yaxes": [{ - "format": "Bps", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - }, - { - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "editable": true, - "error": false, - "fill": 5, - "id": 21, - "isNew": true, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": false, - "total": false, - "values": false + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "editable": true, + "error": false, + "fill": 0, + "id": 41, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 4, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "sum(grpc_server_started_total{job=\"$cluster\",grpc_service=\"etcdserverpb.Watch\",grpc_type=\"bidi_stream\"}) - sum(grpc_server_handled_total{job=\"$cluster\",grpc_service=\"etcdserverpb.Watch\",grpc_type=\"bidi_stream\"})", + "intervalFactor": 2, + "legendFormat": "Watch Streams", + "metric": "grpc_server_handled_total", + "refId": "A", + "step": 4 + }, + { + "expr": "sum(grpc_server_started_total{job=\"$cluster\",grpc_service=\"etcdserverpb.Lease\",grpc_type=\"bidi_stream\"}) - sum(grpc_server_handled_total{job=\"$cluster\",grpc_service=\"etcdserverpb.Lease\",grpc_type=\"bidi_stream\"})", + "intervalFactor": 2, + "legendFormat": "Lease Streams", + "metric": "grpc_server_handled_total", + "refId": "B", + "step": 4 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "Active Streams", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + } + ], + "showTitle": false, + "title": "Row" + }, + { + "collapse": false, + "editable": true, + "height": "250px", + "panels": [ + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "decimals": null, + "editable": true, + "error": false, + "fill": 0, + "grid": { + + }, + "id": 1, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "etcd_mvcc_db_total_size_in_bytes{job=\"$cluster\"}", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{instance}} DB Size", + "metric": "", + "refId": "A", + "step": 4 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "DB Size", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 3, - "stack": true, - "steppedLine": false, - "targets": [{ - "expr": "rate(etcd_network_client_grpc_sent_bytes_total[5m])", - "intervalFactor": 2, - "legendFormat": "{{instance}} Client Traffic Out", - "metric": "etcd_network_client_grpc_sent_bytes_total", - "refId": "A", - "step": 4 - }], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Client Traffic Out", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "editable": true, + "error": false, + "fill": 0, + "grid": { + + }, + "id": 3, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 1, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 4, + "stack": false, + "steppedLine": true, + "targets": [ + { + "expr": "histogram_quantile(0.99, sum(rate(etcd_disk_wal_fsync_duration_seconds_bucket{job=\"$cluster\"}[5m])) by (instance, le))", + "hide": false, + "intervalFactor": 2, + "legendFormat": "{{instance}} WAL fsync", + "metric": "etcd_disk_wal_fsync_duration_seconds_bucket", + "refId": "A", + "step": 4 + }, + { + "expr": "histogram_quantile(0.99, sum(rate(etcd_disk_backend_commit_duration_seconds_bucket{job=\"$cluster\"}[5m])) by (instance, le))", + "intervalFactor": 2, + "legendFormat": "{{instance}} DB fsync", + "metric": "etcd_disk_backend_commit_duration_seconds_bucket", + "refId": "B", + "step": 4 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "Disk Sync Duration", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "s", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ] }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "editable": true, + "error": false, + "fill": 0, + "id": 29, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "process_resident_memory_bytes{job=\"$cluster\"}", + "intervalFactor": 2, + "legendFormat": "{{instance}} Resident Memory", + "metric": "process_resident_memory_bytes", + "refId": "A", + "step": 4 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "Memory", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + } + ], + "title": "New row" + }, + { + "collapse": false, + "editable": true, + "height": "250px", + "panels": [ + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "editable": true, + "error": false, + "fill": 5, + "id": 22, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 3, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "rate(etcd_network_client_grpc_received_bytes_total{job=\"$cluster\"}[5m])", + "intervalFactor": 2, + "legendFormat": "{{instance}} Client Traffic In", + "metric": "etcd_network_client_grpc_received_bytes_total", + "refId": "A", + "step": 4 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "Client Traffic In", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] }, - "yaxes": [{ - "format": "Bps", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - }, - { - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "editable": true, - "error": false, - "fill": 0, - "id": 20, - "isNew": true, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": false, - "total": false, - "values": false + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "editable": true, + "error": false, + "fill": 5, + "id": 21, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 3, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "rate(etcd_network_client_grpc_sent_bytes_total{job=\"$cluster\"}[5m])", + "intervalFactor": 2, + "legendFormat": "{{instance}} Client Traffic Out", + "metric": "etcd_network_client_grpc_sent_bytes_total", + "refId": "A", + "step": 4 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "Client Traffic Out", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 3, - "stack": false, - "steppedLine": false, - "targets": [{ - "expr": "sum(rate(etcd_network_peer_received_bytes_total[5m])) by (instance)", - "intervalFactor": 2, - "legendFormat": "{{instance}} Peer Traffic In", - "metric": "etcd_network_peer_received_bytes_total", - "refId": "A", - "step": 4 - }], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Peer Traffic In", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "editable": true, + "error": false, + "fill": 0, + "id": 20, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(etcd_network_peer_received_bytes_total{job=\"$cluster\"}[5m])) by (instance)", + "intervalFactor": 2, + "legendFormat": "{{instance}} Peer Traffic In", + "metric": "etcd_network_peer_received_bytes_total", + "refId": "A", + "step": 4 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "Peer Traffic In", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "decimals": null, + "editable": true, + "error": false, + "fill": 0, + "grid": { + + }, + "id": 16, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 3, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(etcd_network_peer_sent_bytes_total{job=\"$cluster\"}[5m])) by (instance)", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{instance}} Peer Traffic Out", + "metric": "etcd_network_peer_sent_bytes_total", + "refId": "A", + "step": 4 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "Peer Traffic Out", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "Bps", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + } + ], + "title": "New row" + }, + { + "collapse": false, + "editable": true, + "height": "250px", + "panels": [ + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "editable": true, + "error": false, + "fill": 0, + "id": 40, + "isNew": true, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 6, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(etcd_server_proposals_failed_total{job=\"$cluster\"}[5m]))", + "intervalFactor": 2, + "legendFormat": "Proposal Failure Rate", + "metric": "etcd_server_proposals_failed_total", + "refId": "A", + "step": 2 + }, + { + "expr": "sum(etcd_server_proposals_pending{job=\"$cluster\"})", + "intervalFactor": 2, + "legendFormat": "Proposal Pending Total", + "metric": "etcd_server_proposals_pending", + "refId": "B", + "step": 2 + }, + { + "expr": "sum(rate(etcd_server_proposals_committed_total{job=\"$cluster\"}[5m]))", + "intervalFactor": 2, + "legendFormat": "Proposal Commit Rate", + "metric": "etcd_server_proposals_committed_total", + "refId": "C", + "step": 2 + }, + { + "expr": "sum(rate(etcd_server_proposals_applied_total{job=\"$cluster\"}[5m]))", + "intervalFactor": 2, + "legendFormat": "Proposal Apply Rate", + "refId": "D", + "step": 2 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "Raft Proposals", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] }, - "yaxes": [{ - "format": "Bps", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - }, + { + "aliasColors": { + + }, + "bars": false, + "datasource": "$datasource", + "decimals": 0, + "editable": true, + "error": false, + "fill": 0, + "id": 19, + "isNew": true, + "legend": { + "alignAsTable": false, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [ + + ], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + + ], + "span": 6, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "changes(etcd_server_leader_changes_seen_total{job=\"$cluster\"}[1d])", + "intervalFactor": 2, + "legendFormat": "{{instance}} Total Leader Elections Per Day", + "metric": "etcd_server_leader_changes_seen_total", + "refId": "A", + "step": 2 + } + ], + "thresholds": [ + + ], + "timeFrom": null, + "timeShift": null, + "title": "Total Leader Elections Per Day", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "name": null, + "show": true, + "values": [ + + ] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + } + ], + "title": "New row" + } + ], + "schemaVersion": 13, + "sharedCrosshair": false, + "style": "dark", + "tags": [ + + ], + "templating": { + "list": [ { - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "decimals": null, - "editable": true, - "error": false, - "fill": 0, - "grid": {}, - "id": 16, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": false, - "total": false, - "values": false + "current": { + "text": "Prometheus", + "value": "Prometheus" }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 3, - "stack": false, - "steppedLine": false, - "targets": [{ - "expr": "sum(rate(etcd_network_peer_sent_bytes_total[5m])) by (instance)", - "hide": false, - "interval": "", - "intervalFactor": 2, - "legendFormat": "{{instance}} Peer Traffic Out", - "metric": "etcd_network_peer_sent_bytes_total", - "refId": "A", - "step": 4 - }], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Peer Traffic Out", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [{ - "format": "Bps", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] - } - ], - "title": "New row" - }, - { - "collapse": false, - "editable": true, - "height": "250px", - "panels": [{ - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "editable": true, - "error": false, - "fill": 0, - "id": 40, - "isNew": true, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": false, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 6, - "stack": false, - "steppedLine": false, - "targets": [{ - "expr": "sum(rate(etcd_server_proposals_failed_total[5m]))", - "intervalFactor": 2, - "legendFormat": "Proposal Failure Rate", - "metric": "etcd_server_proposals_failed_total", - "refId": "A", - "step": 2 - }, - { - "expr": "sum(etcd_server_proposals_pending)", - "intervalFactor": 2, - "legendFormat": "Proposal Pending Total", - "metric": "etcd_server_proposals_pending", - "refId": "B", - "step": 2 - }, - { - "expr": "sum(rate(etcd_server_proposals_committed_total[5m]))", - "intervalFactor": 2, - "legendFormat": "Proposal Commit Rate", - "metric": "etcd_server_proposals_committed_total", - "refId": "C", - "step": 2 - }, - { - "expr": "sum(rate(etcd_server_proposals_applied_total[5m]))", - "intervalFactor": 2, - "legendFormat": "Proposal Apply Rate", - "refId": "D", - "step": 2 - } + "hide": 0, + "label": null, + "name": "datasource", + "options": [ + ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Raft Proposals", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [{ - "format": "short", - "label": "", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] + "query": "prometheus", + "refresh": 1, + "regex": "", + "type": "datasource" }, { - "aliasColors": {}, - "bars": false, - "datasource": "test-etcd", - "decimals": 0, - "editable": true, - "error": false, - "fill": 0, - "id": 19, - "isNew": true, - "legend": { - "alignAsTable": false, - "avg": false, - "current": false, - "max": false, - "min": false, - "rightSide": false, - "show": false, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "span": 6, - "stack": false, - "steppedLine": false, - "targets": [{ - "expr": "changes(etcd_server_leader_changes_seen_total[1d])", - "intervalFactor": 2, - "legendFormat": "{{instance}} Total Leader Elections Per Day", - "metric": "etcd_server_leader_changes_seen_total", - "refId": "A", - "step": 2 - }], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Total Leader Elections Per Day", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "name": null, - "show": true, - "values": [] + "allValue": null, + "current": { + "text": "prod", + "value": "prod" }, - "yaxes": [{ - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ] + "datasource": "$datasource", + "hide": 0, + "includeAll": false, + "label": "cluster", + "multi": false, + "name": "cluster", + "options": [ + + ], + "query": "label_values(etcd_server_has_leader, job)", + "refresh": 1, + "regex": "", + "sort": 2, + "tagValuesQuery": "", + "tags": [ + + ], + "tagsQuery": "", + "type": "query", + "useTags": false } + ] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": { + "now": true, + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" ], - "title": "New row" - } - ], - "time": { - "from": "now-15m", - "to": "now" - }, - "timepicker": { - "now": true, - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ], - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ] - }, - "templating": { - "list": [] - }, - "annotations": { - "list": [] - }, - "refresh": false, - "schemaVersion": 13, - "version": 215, - "links": [], - "gnetId": null + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "browser", + "title": "etcd", + "version": 215 + } } diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/grpc_proxy.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/grpc_proxy.md index 6183e179e..d06577122 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/grpc_proxy.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/grpc_proxy.md @@ -1,4 +1,6 @@ -# gRPC proxy +--- +title: gRPC proxy +--- The gRPC proxy is a stateless etcd reverse proxy operating at the gRPC layer (L7). The proxy is designed to reduce the total processing load on the core etcd cluster. For horizontal scalability, it coalesces watch and lease API requests. To protect the cluster against abusive clients, it caches key range requests. @@ -85,7 +87,7 @@ Start the etcd gRPC proxy to use these static endpoints with the command: $ etcd grpc-proxy start --endpoints=infra0.example.com,infra1.example.com,infra2.example.com --listen-addr=127.0.0.1:2379 ``` -The etcd gRPC proxy starts and listens on port 8080. It forwards client requests to one of the three endpoints provided above. +The etcd gRPC proxy starts and listens on port 2379. It forwards client requests to one of the three endpoints provided above. Sending requests through the proxy: @@ -194,7 +196,7 @@ $ ETCDCTL_API=3 etcdctl --endpoints=localhost:2379 get my-prefix/my-key ## TLS termination -Terminate TLS from a secure etcd cluster with the grpc proxy by serving an unencrypted local endpoint. +Terminate TLS from a secure etcd cluster with the gRPC proxy by serving an unencrypted local endpoint. To try it out, start a single member etcd cluster with client https: @@ -211,7 +213,7 @@ $ ETCDCTL_API=3 etcdctl --endpoints=http://localhost:2379 endpoint status $ ETCDCTL_API=3 etcdctl --endpoints=https://localhost:2379 --cert=client.crt --key=client.key --cacert=ca.crt endpoint status ``` -Next, start a grpc proxy on `localhost:12379` by connecting to the etcd endpoint `https://localhost:2379` using the client certificates: +Next, start a gRPC proxy on `localhost:12379` by connecting to the etcd endpoint `https://localhost:2379` using the client certificates: ```sh $ etcd grpc-proxy start --endpoints=https://localhost:2379 --listen-addr localhost:12379 --cert client.crt --key client.key --cacert=ca.crt --insecure-skip-tls-verify & @@ -223,3 +225,28 @@ Finally, test the TLS termination by putting a key into the proxy over http: $ ETCDCTL_API=3 etcdctl --endpoints=http://localhost:12379 put abc def # OK ``` + +## Metrics and Health + +The gRPC proxy exposes `/health` and Prometheus `/metrics` endpoints for the etcd members defined by `--endpoints`. An alternative define an additional URL that will respond to both the `/metrics` and `/health` endpoints with the `--metrics-addr` flag. + +```bash +$ etcd grpc-proxy start \ + --endpoints https://localhost:2379 \ + --metrics-addr https://0.0.0.0:4443 \ + --listen-addr 127.0.0.1:23790 \ + --key client.key \ + --key-file proxy-server.key \ + --cert client.crt \ + --cert-file proxy-server.crt \ + --cacert ca.pem \ + --trusted-ca-file proxy-ca.pem + ``` + +### Known issue + +The main interface of the proxy serves both HTTP2 and HTTP/1.1. If proxy is setup with TLS as show in the above example, when using a client such as cURL against the listening interface will require explicitly setting the protocol to HTTP/1.1 on the request to return `/metrics` or `/health`. By using the `--metrics-addr` flag the secondary interface will not have this requirement. + +```bash + $ curl --cacert proxy-ca.pem --key proxy-client.key --cert proxy-client.crt https://127.0.0.1:23790/metrics --http1.1 +``` diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/hardware.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/hardware.md index ff946cd9b..90a6b03e2 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/hardware.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/hardware.md @@ -1,4 +1,6 @@ -# Hardware recommendations +--- +title: Hardware recommendations +--- etcd usually runs well with limited resources for development or testing purposes; it’s common to develop with etcd on a laptop or a cheap cloud machine. However, when running etcd clusters in production, some hardware guidelines are useful for proper administration. These suggestions are not hard rules; they serve as a good starting point for a robust production deployment. As always, deployments should be tested with simulated workloads before running in production. diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/maintenance.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/maintenance.md index 85a822ef9..843ee6572 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/maintenance.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/maintenance.md @@ -1,4 +1,6 @@ -# Maintenance +--- +title: Maintenance +--- ## Overview @@ -6,25 +8,27 @@ An etcd cluster needs periodic maintenance to remain reliable. Depending on an e All etcd maintenance manages storage resources consumed by the etcd keyspace. Failure to adequately control the keyspace size is guarded by storage space quotas; if an etcd member runs low on space, a quota will trigger cluster-wide alarms which will put the system into a limited-operation maintenance mode. To avoid running out of space for writes to the keyspace, the etcd keyspace history must be compacted. Storage space itself may be reclaimed by defragmenting etcd members. Finally, periodic snapshot backups of etcd member state makes it possible to recover any unintended logical data loss or corruption caused by operational error. -## History compaction +## Raft log retention -Since etcd keeps an exact history of its keyspace, this history should be periodically compacted to avoid performance degradation and eventual storage space exhaustion. Compacting the keyspace history drops all information about keys superseded prior to a given keyspace revision. The space used by these keys then becomes available for additional writes to the keyspace. +`etcd --snapshot-count` configures the number of applied Raft entries to hold in-memory before compaction. When `--snapshot-count` reaches, server first persists snapshot data onto disk, and then truncates old entries. When a slow follower requests logs before a compacted index, leader sends the snapshot forcing the follower to overwrite its state. -The keyspace can be compacted automatically with `etcd`'s time windowed history retention policy, or manually with `etcdctl`. The `etcdctl` method provides fine-grained control over the compacting process whereas automatic compacting fits applications that only need key history for some length of time. +Higher `--snapshot-count` holds more Raft entries in memory until snapshot, thus causing [recurrent higher memory usage](https://github.com/kubernetes/kubernetes/issues/60589#issuecomment-371977156). Since leader retains latest Raft entries for longer, a slow follower has more time to catch up before leader snapshot. `--snapshot-count` is a tradeoff between higher memory usage and better availabilities of slow followers. -`etcd` can be set to automatically compact the keyspace with the `--auto-compaction` option with a period of hours: +Since v3.2, the default value of `--snapshot-count` has [changed from from 10,000 to 100,000](https://github.com/etcd-io/etcd/pull/7160). -```sh -# keep one hour of history -$ etcd --auto-compaction-retention=1 -``` +In performance-wise, `--snapshot-count` greater than 100,000 may impact the write throughput. Higher number of in-memory objects can slow down [Go GC mark phase `runtime.scanobject`](https://golang.org/src/runtime/mgc.go), and infrequent memory reclamation makes allocation slow. Performance varies depending on the workloads and system environments. However, in general, too frequent compaction affects cluster availabilities and write throughputs. Too infrequent compaction is also harmful placing too much pressure on Go garbage collector. See https://www.slideshare.net/mitakeh/understanding-performance-aspects-of-etcd-and-raft for more research results. + +## History compaction: v3 API Key-Value Database + +Since etcd keeps an exact history of its keyspace, this history should be periodically compacted to avoid performance degradation and eventual storage space exhaustion. Compacting the keyspace history drops all information about keys superseded prior to a given keyspace revision. The space used by these keys then becomes available for additional writes to the keyspace. + +The keyspace can be compacted automatically with `etcd`'s time windowed history retention policy, or manually with `etcdctl`. The `etcdctl` method provides fine-grained control over the compacting process whereas automatic compacting fits applications that only need key history for some length of time. An `etcdctl` initiated compaction works as follows: ```sh # compact up to revision 3 $ etcdctl compact 3 - ``` Revisions prior to the compaction revision become inaccessible: @@ -34,6 +38,38 @@ $ etcdctl get --rev=2 somekey Error: rpc error: code = 11 desc = etcdserver: mvcc: required revision has been compacted ``` +### Auto Compaction + +`etcd` can be set to automatically compact the keyspace with the `--auto-compaction-*` option with a period of hours: + +```sh +# keep one hour of history +$ etcd --auto-compaction-retention=1 +``` + +[v3.0.0](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.0.md) and [v3.1.0](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.1.md) with `--auto-compaction-retention=10` run periodic compaction on v3 key-value store for every 10-hour. Compactor only supports periodic compaction. Compactor records latest revisions every 5-minute, until it reaches the first compaction period (e.g. 10-hour). In order to retain key-value history of last compaction period, it uses the last revision that was fetched before compaction period, from the revision records that were collected every 5-minute. When `--auto-compaction-retention=10`, compactor uses revision 100 for compact revision where revision 100 is the latest revision fetched from 10 hours ago. If compaction succeeds or requested revision has already been compacted, it resets period timer and starts over with new historical revision records (e.g. restart revision collect and compact for the next 10-hour period). If compaction fails, it retries in 5 minutes. + +[v3.2.0](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.2.md) compactor runs [every hour](https://github.com/etcd-io/etcd/pull/7875). Compactor only supports periodic compaction. Compactor continues to record latest revisions every 5-minute. For every hour, it uses the last revision that was fetched before compaction period, from the revision records that were collected every 5-minute. That is, for every hour, compactor discards historical data created before compaction period. The retention window of compaction period moves to next hour. For instance, when hourly writes are 100 and `--auto-compaction-retention=10`, v3.1 compacts revision 1000, 2000, and 3000 for every 10-hour, while v3.2.x, v3.3.0, v3.3.1, and v3.3.2 compact revision 1000, 1100, and 1200 for every 1-hour. If compaction succeeds or requested revision has already been compacted, it resets period timer and removes used compacted revision from historical revision records (e.g. start next revision collect and compaction from previously collected revisions). If compaction fails, it retries in 5 minutes. + +In [v3.3.0](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.3.md), [v3.3.1](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.3.md), and [v3.3.2](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.3.md), `--auto-compaction-mode=revision --auto-compaction-retention=1000` automatically `Compact` on `"latest revision" - 1000` every 5-minute (when latest revision is 30000, compact on revision 29000). For instance, `--auto-compaction-mode=periodic --auto-compaction-retention=72h` automatically `Compact` with 72-hour retention windown, for every 7.2-hour. For instance, `--auto-compaction-mode=periodic --auto-compaction-retention=30m` automatically `Compact` with 30-minute retention windown, for every 3-minute. Periodic compactor continues to record latest revisions for every 1/10 of given compaction period (e.g. 1-hour when `--auto-compaction-mode=periodic --auto-compaction-retention=10h`). For every 1/10 of given compaction period, compactor uses the last revision that was fetched before compaction period, to discard historical data. The retention window of compaction period moves for every 1/10 of given compaction period. For instance, when hourly writes are 100 and `--auto-compaction-retention=10`, v3.1 compacts revision 1000, 2000, and 3000 for every 10-hour, while v3.2.x, v3.3.0, v3.3.1, and v3.3.2 compact revision 1000, 1100, and 1200 for every 1-hour. Futhermore, when writes per minute are 1000, v3.3.0, v3.3.1, and v3.3.2 with `--auto-compaction-mode=periodic --auto-compaction-retention=30m` compact revision 30000, 33000, and 36000, for every 3-minute with more finer granularity. + +When `--auto-compaction-retention=10h`, etcd first waits 10-hour for the first compaction, and then does compaction every hour (1/10 of 10-hour) afterwards like this: + +``` +0Hr (rev = 1) +1hr (rev = 10) +... +8hr (rev = 80) +9hr (rev = 90) +10hr (rev = 100, Compact(1)) +11hr (rev = 110, Compact(10)) +... +``` + +Whether compaction succeeds or not, this process repeats for every 1/10 of given compaction period. If compaction succeeds, it just removes compacted revision from historical revision records. + +In [v3.3.3](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.3.md), `--auto-compaction-mode=revision --auto-compaction-retention=1000` automatically `Compact` on `"latest revision" - 1000` every 5-minute (when latest revision is 30000, compact on revision 29000). Previously, `--auto-compaction-mode=periodic --auto-compaction-retention=72h` automatically `Compact` with 72-hour retention windown for every 7.2-hour. **Now, `Compact` happens, for every 1-hour but still with 72-hour retention window.** Previously, `--auto-compaction-mode=periodic --auto-compaction-retention=30m` automatically `Compact` with 30-minute retention windown for every 3-minute. **Now, `Compact` happens, for every 30-minute but still with 30-minute retention window.** Periodic compactor keeps recording latest revisions for every compaction period when given period is less than 1-hour, or for every 1-hour when given compaction period is greater than 1-hour (e.g. 1-hour when `--auto-compaction-mode=periodic --auto-compaction-retention=24h`). For every compaction period or 1-hour, compactor uses the last revision that was fetched before compaction period, to discard historical data. The retention window of compaction period moves for every given compaction period or hour. For instance, when hourly writes are 100 and `--auto-compaction-mode=periodic --auto-compaction-retention=24h`, `v3.2.x`, `v3.3.0`, `v3.3.1`, and `v3.3.2` compact revision 2400, 2640, and 2880 for every 2.4-hour, while `v3.3.3` *or later* compacts revision 2400, 2500, 2600 for every 1-hour. Furthermore, when `--auto-compaction-mode=periodic --auto-compaction-retention=30m` and writes per minute are about 1000, `v3.3.0`, `v3.3.1`, and `v3.3.2` compact revision 30000, 33000, and 36000, for every 3-minute, while `v3.3.3` *or later* compacts revision 30000, 60000, and 90000, for every 30-minute. + ## Defragmentation After compacting the keyspace, the backend database may exhibit internal fragmentation. Any internal fragmentation is space that is free to use by the backend but still consumes storage space. Compacting old revisions internally fragments `etcd` by leaving gaps in backend database. Fragmented space is available for use by `etcd` but unavailable to the host filesystem. In other words, deleting application data does not reclaim the space on disk. @@ -49,7 +85,16 @@ Finished defragmenting etcd member[127.0.0.1:2379] **Note that defragmentation to a live member blocks the system from reading and writing data while rebuilding its states**. -**Note that defragmentation request does not get replicated over cluster. That is, the request is only applied to the local node. Specify all members in `--endpoints` flag.** +**Note that defragmentation request does not get replicated over cluster. That is, the request is only applied to the local node. Specify all members in `--endpoints` flag or `--cluster` flag to automatically find all cluster members.** + +Run defragment operations for all endpoints in the cluster associated with the default endpoint: + +```bash +$ etcdctl defrag --cluster +Finished defragmenting etcd member[http://127.0.0.1:2379] +Finished defragmenting etcd member[http://127.0.0.1:22379] +Finished defragmenting etcd member[http://127.0.0.1:32379] +``` To defragment an etcd data directory directly, while etcd is not running, use the command: @@ -106,6 +151,10 @@ $ ETCDCTL_API=3 etcdctl put newkey 123 OK ``` +The metric `etcd_mvcc_db_total_size_in_use_in_bytes` indicates the actual database usage after a history compaction, while `etcd_debugging_mvcc_db_total_size_in_bytes` shows the database size including free space waiting for defragmentation. The latter increases only when the former is close to it, meaning when both of these metrics are close to the quota, a history compaction is required to avoid triggering the space quota. + +`etcd_debugging_mvcc_db_total_size_in_bytes` is renamed to `etcd_mvcc_db_total_size_in_bytes` from v3.4. + ## Snapshot backup Snapshotting the `etcd` cluster on a regular basis serves as a durable backup for an etcd keyspace. By taking periodic snapshots of an etcd member's backend database, an `etcd` cluster can be recovered to a point in time with a known good state. @@ -120,5 +169,4 @@ $ etcdctl --write-out=table snapshot status backup.db +----------+----------+------------+------------+ | fe01cf57 | 10 | 7 | 2.1 MB | +----------+----------+------------+------------+ - ``` diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/monitoring.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/monitoring.md index 04e717df0..4c2e7e4d4 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/monitoring.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/monitoring.md @@ -1,4 +1,6 @@ -# Monitoring etcd +--- +title: Monitoring etcd +--- Each etcd server provides local monitoring information on its client port through http endpoints. The monitoring data is useful for both system health checking and cluster debugging. @@ -20,14 +22,14 @@ Showing top 10 nodes out of 157 (cum >= 10ms) flat flat% sum% cum cum% 130ms 27.08% 27.08% 130ms 27.08% runtime.futex 70ms 14.58% 41.67% 70ms 14.58% syscall.Syscall - 20ms 4.17% 45.83% 20ms 4.17% github.com/coreos/etcd/cmd/vendor/golang.org/x/net/http2/hpack.huffmanDecode + 20ms 4.17% 45.83% 20ms 4.17% github.com/coreos/etcd/vendor/golang.org/x/net/http2/hpack.huffmanDecode 20ms 4.17% 50.00% 30ms 6.25% runtime.pcvalue 20ms 4.17% 54.17% 50ms 10.42% runtime.schedule - 10ms 2.08% 56.25% 10ms 2.08% github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/etcdserver.(*EtcdServer).AuthInfoFromCtx - 10ms 2.08% 58.33% 10ms 2.08% github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/etcdserver.(*EtcdServer).Lead - 10ms 2.08% 60.42% 10ms 2.08% github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/pkg/wait.(*timeList).Trigger - 10ms 2.08% 62.50% 10ms 2.08% github.com/coreos/etcd/cmd/vendor/github.com/prometheus/client_golang/prometheus.(*MetricVec).hashLabelValues - 10ms 2.08% 64.58% 10ms 2.08% github.com/coreos/etcd/cmd/vendor/golang.org/x/net/http2.(*Framer).WriteHeaders + 10ms 2.08% 56.25% 10ms 2.08% github.com/coreos/etcd/vendor/github.com/coreos/etcd/etcdserver.(*EtcdServer).AuthInfoFromCtx + 10ms 2.08% 58.33% 10ms 2.08% github.com/coreos/etcd/vendor/github.com/coreos/etcd/etcdserver.(*EtcdServer).Lead + 10ms 2.08% 60.42% 10ms 2.08% github.com/coreos/etcd/vendor/github.com/coreos/etcd/pkg/wait.(*timeList).Trigger + 10ms 2.08% 62.50% 10ms 2.08% github.com/coreos/etcd/vendor/github.com/prometheus/client_golang/prometheus.(*MetricVec).hashLabelValues + 10ms 2.08% 64.58% 10ms 2.08% github.com/coreos/etcd/vendor/golang.org/x/net/http2.(*Framer).WriteHeaders ``` The `/debug/requests` endpoint gives gRPC traces and performance statistics through a web browser. For example, here is a `Range` request for the key `abc`: @@ -43,7 +45,7 @@ When Elapsed (s) ## Metrics endpoint -Each etcd server exports metrics under the `/metrics` path on its client port and optionally on interfaces given by `--listen-metrics-urls`. +Each etcd server exports metrics under the `/metrics` path on its client port and optionally on locations given by `--listen-metrics-urls`. The metrics can be fetched with `curl`: @@ -59,6 +61,10 @@ etcd_disk_backend_commit_duration_seconds_bucket{le="0.016"} 406464 ... ``` +## Health Check + +Since v3.3.0, in addition to responding to the `/metrics` endpoint, any locations specified by `--listen-metrics-urls` will also respond to the `/health` endpoint. This can be useful if the standard endpoint is configured with mutual (client) TLS authentication, but a load balancer or monitoring service still needs access to the health check. + ## Prometheus Running a [Prometheus][prometheus] monitoring service is the easiest way to ingest and record etcd's metrics. @@ -117,8 +123,6 @@ Access: proxy Then import the default [etcd dashboard template][template] and customize. For instance, if Prometheus data source name is `my-etcd`, the `datasource` field values in JSON also need to be `my-etcd`. -See the [demo][demo]. - Sample dashboard: ![](./etcd-sample-grafana.png) @@ -127,4 +131,3 @@ Sample dashboard: [prometheus]: https://prometheus.io/ [grafana]: http://grafana.org/ [template]: ./grafana.json -[demo]: http://dash.etcd.io/dashboard/db/test-etcd-kubernetes diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/performance.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/performance.md index 926caf327..40bb7f956 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/performance.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/performance.md @@ -1,10 +1,12 @@ -# Performance +--- +title: Performance +--- ## Understanding performance etcd provides stable, sustained high performance. Two factors define performance: latency and throughput. Latency is the time taken to complete an operation. Throughput is the total operations completed within some time period. Usually average latency increases as the overall throughput increases when etcd accepts concurrent client requests. In common cloud environments, like a standard `n-4` on Google Compute Engine (GCE) or a comparable machine type on AWS, a three member etcd cluster finishes a request in less than one millisecond under light load, and can complete more than 30,000 requests per second under heavy load. -etcd uses the Raft consensus algorithm to replicate requests among members and reach agreement. Consensus performance, especially commit latency, is limited by two physical constraints: network IO latency and disk IO latency. The minimum time to finish an etcd request is the network Round Trip Time (RTT) between members, plus the time `fdatasync` requires to commit the data to permanant storage. The RTT within a datacenter may be as long as several hundred microseconds. A typical RTT within the United States is around 50ms, and can be as slow as 400ms between continents. The typical fdatasync latency for a spinning disk is about 10ms. For SSDs, the latency is often lower than 1ms. To increase throughput, etcd batches multiple requests together and submits them to Raft. This batching policy lets etcd attain high throughput despite heavy load. +etcd uses the Raft consensus algorithm to replicate requests among members and reach agreement. Consensus performance, especially commit latency, is limited by two physical constraints: network IO latency and disk IO latency. The minimum time to finish an etcd request is the network Round Trip Time (RTT) between members, plus the time `fdatasync` requires to commit the data to permanent storage. The RTT within a datacenter may be as long as several hundred microseconds. A typical RTT within the United States is around 50ms, and can be as slow as 400ms between continents. The typical fdatasync latency for a spinning disk is about 10ms. For SSDs, the latency is often lower than 1ms. To increase throughput, etcd batches multiple requests together and submits them to Raft. This batching policy lets etcd attain high throughput despite heavy load. There are other sub-systems which impact the overall performance of etcd. Each serialized etcd request must run through etcd’s boltdb-backed MVCC storage engine, which usually takes tens of microseconds to finish. Periodically etcd incrementally snapshots its recently applied requests, merging them back with the previous on-disk snapshot. This process may lead to a latency spike. Although this is usually not a problem on SSDs, it may double the observed latency on HDD. Likewise, inflight compactions can impact etcd’s performance. Fortunately, the impact is often insignificant since the compaction is staggered so it does not compete for resources with regular requests. The RPC system, gRPC, gives etcd a well-defined, extensible API, but it also introduces additional latency, especially for local reads. diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/recovery.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/recovery.md index bb4a9a4ae..e20e14010 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/recovery.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/recovery.md @@ -1,4 +1,6 @@ -# Disaster recovery +--- +title: Disaster recovery +--- etcd is designed to withstand machine failures. An etcd cluster automatically recovers from temporary failures (e.g., machine reboots) and tolerates up to *(N-1)/2* permanent failures for a cluster of N members. When a member permanently fails, whether due to hardware failure or disk corruption, it loses access to the cluster. If the cluster permanently loses more than *(N-1)/2* members then it disastrously fails, irrevocably losing quorum. Once quorum is lost, the cluster cannot reach consensus and therefore cannot continue accepting updates. @@ -61,3 +63,9 @@ $ etcd \ ``` Now the restored etcd cluster should be available and serving the keyspace given by the snapshot. + +## Restoring a cluster from membership mis-reconfiguration with wrong URLs + +Previously, etcd panics on [membership mis-reconfiguration with wrong URLs](https://github.com/etcd-io/etcd/issues/9173) (v3.2.15 or later returns [error early in client-side](https://github.com/etcd-io/etcd/pull/9174) before etcd server panic). + +Recommended way is restore from [snapshot](#snapshotting-the-keyspace). `--force-new-cluster` can be used to overwrite cluster membership while keeping existing application data, but is strongly discouraged because it will panic if other members from previous cluster are still alive. Make sure to save snapshot periodically. diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/runtime-configuration.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/runtime-configuration.md index 678e40d1e..969667072 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/runtime-configuration.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/runtime-configuration.md @@ -1,4 +1,6 @@ -# Runtime reconfiguration +--- +title: Runtime reconfiguration +--- etcd comes with support for incremental runtime reconfiguration, which allows users to update the membership of the cluster at run time. @@ -100,7 +102,7 @@ Adding a member is a two step process: `etcdctl` adds a new member to the cluster by specifying the member's [name][conf-name] and [advertised peer URLs][conf-adv-peer]: ```sh -$ etcdctl member add infra3 http://10.0.1.13:2380 +$ etcdctl member add infra3 --peer-urls=http://10.0.1.13:2380 added member 9bf1b35fc7761a23 to cluster ETCD_NAME="infra3" diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/runtime-reconf-design.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/runtime-reconf-design.md index 3632301c4..a3a0a68ee 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/runtime-reconf-design.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/runtime-reconf-design.md @@ -1,4 +1,6 @@ -# Design of runtime reconfiguration +--- +title: Design of runtime reconfiguration +--- Runtime reconfiguration is one of the hardest and most error prone features in a distributed system, especially in a consensus based system like etcd. @@ -6,11 +8,11 @@ Read on to learn about the design of etcd's runtime reconfiguration commands and ## Two phase config changes keep the cluster safe -In etcd, every runtime reconfiguration has to go through [two phases][add-member] for safety reasons. For example, to add a member, first inform cluster of new configuration and then start the new member. +In etcd, every runtime reconfiguration has to go through [two phases][add-member] for safety reasons. For example, to add a member, first inform the cluster of the new configuration and then start the new member. Phase 1 - Inform cluster of new configuration -To add a member into etcd cluster, make an API call to request a new member to be added to the cluster. This is the only way to add a new member into an existing cluster. The API call returns when the cluster agrees on the configuration change. +To add a member into an etcd cluster, make an API call to request a new member to be added to the cluster. This is the only way to add a new member into an existing cluster. The API call returns when the cluster agrees on the configuration change. Phase 2 - Start new member @@ -28,19 +30,19 @@ If a cluster permanently loses a majority of its members, a new cluster will nee It is entirely possible to force removing the failed members from the existing cluster to recover. However, we decided not to support this method since it bypasses the normal consensus committing phase, which is unsafe. If the member to remove is not actually dead or force removed through different members in the same cluster, etcd will end up with a diverged cluster with same clusterID. This is very dangerous and hard to debug/fix afterwards. -With a correct deployment, the possibility of permanent majority lose is very low. But it is a severe enough problem that worth special care. We strongly suggest reading the [disaster recovery documentation][disaster-recovery] and preparing for permanent majority lose before putting etcd into production. +With a correct deployment, the possibility of permanent majority loss is very low. But it is a severe enough problem that is worth special care. We strongly suggest reading the [disaster recovery documentation][disaster-recovery] and preparing for permanent majority loss before putting etcd into production. ## Do not use public discovery service for runtime reconfiguration -The public discovery service should only be used for bootstrapping a cluster. To join member into an existing cluster, use runtime reconfiguration API. +The public discovery service should only be used for bootstrapping a cluster. To join member into an existing cluster, use the runtime reconfiguration API. -Discovery service is designed for bootstrapping an etcd cluster in the cloud environment, when the IP addresses of all the members are not known beforehand. After successfully bootstrapping a cluster, the IP addresses of all the members are known. Technically, the discovery service should no longer be needed. +The discovery service is designed for bootstrapping an etcd cluster in a cloud environment, when the IP addresses of all the members are not known beforehand. After successfully bootstrapping a cluster, the IP addresses of all the members are known. Technically, the discovery service should no longer be needed. It seems that using public discovery service is a convenient way to do runtime reconfiguration, after all discovery service already has all the cluster configuration information. However relying on public discovery service brings troubles: 1. it introduces external dependencies for the entire life-cycle of the cluster, not just bootstrap time. If there is a network issue between the cluster and public discovery service, the cluster will suffer from it. -2. public discovery service must reflect correct runtime configuration of the cluster during it life-cycle. It has to provide security mechanism to avoid bad actions, and it is hard. +2. public discovery service must reflect correct runtime configuration of the cluster during its life-cycle. It has to provide security mechanisms to avoid bad actions, and it is hard. 3. public discovery service has to keep tens of thousands of cluster configurations. Our public discovery service backend is not ready for that workload. diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/security.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/security.md index 8cb199196..305cbb2fe 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/security.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/security.md @@ -1,4 +1,6 @@ -# Transport security model +--- +title: Transport security model +--- etcd supports automatic TLS as well as authentication through client certificates for both clients to server as well as peer (server to server / cluster) communication. @@ -38,6 +40,8 @@ The peer options work the same way as the client-to-server options: If either a client-to-server or peer certificate is supplied the key must also be set. All of these configuration options are also available through the environment variables, `ETCD_CA_FILE`, `ETCD_PEER_CA_FILE` and so on. +`--cipher-suites`: Comma-separated list of supported TLS cipher suites between server/client and peers (empty will be auto-populated by Go). Available from v3.2.22+, v3.3.7+, and v3.4+. + ## Example 1: Client-to-server transport security with HTTPS For this, have a CA certificate (`ca.crt`) and signed key pair (`server.crt`, `server.key`) ready. @@ -122,6 +126,49 @@ And also the response from the server: } ``` +Specify cipher suites to block [weak TLS cipher suites](https://github.com/etcd-io/etcd/issues/8320). + +TLS handshake would fail when client hello is requested with invalid cipher suites. + +For instance: + +```bash +$ etcd \ + --cert-file ./server.crt \ + --key-file ./server.key \ + --trusted-ca-file ./ca.crt \ + --cipher-suites TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 +``` + +Then, client requests must specify one of the cipher suites specified in the server: + +```bash +# valid cipher suite +$ curl \ + --cacert ./ca.crt \ + --cert ./server.crt \ + --key ./server.key \ + -L [CLIENT-URL]/metrics \ + --ciphers ECDHE-RSA-AES128-GCM-SHA256 + +# request succeeds +etcd_server_version{server_version="3.2.22"} 1 +... +``` + +```bash +# invalid cipher suite +$ curl \ + --cacert ./ca.crt \ + --cert ./server.crt \ + --key ./server.key \ + -L [CLIENT-URL]/metrics \ + --ciphers ECDHE-RSA-DES-CBC3-SHA + +# request fails with +(35) error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure +``` + ## Example 3: Transport security & client certificates in a cluster etcd supports the same model as above for **peer communication**, that means the communication between etcd members in a cluster. @@ -195,9 +242,9 @@ When client authentication is enabled for an etcd member, the administrator must ## Notes for TLS authentication -Since [v3.2.0](https://github.com/coreos/etcd/blob/master/CHANGELOG-3.2.md#v320-2017-06-09), [TLS certificates get reloaded on every client connection](https://github.com/coreos/etcd/pull/7829). This is useful when replacing expiry certs without stopping etcd servers; it can be done by overwriting old certs with new ones. Refreshing certs for every connection should not have too much overhead, but can be improved in the future, with caching layer. Example tests can be found [here](https://github.com/coreos/etcd/blob/b041ce5d514a4b4aaeefbffb008f0c7570a18986/integration/v3_grpc_test.go#L1601-L1757). +Since [v3.2.0](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.2.md#v320-2017-06-09), [TLS certificates get reloaded on every client connection](https://github.com/etcd-io/etcd/pull/7829). This is useful when replacing expiry certs without stopping etcd servers; it can be done by overwriting old certs with new ones. Refreshing certs for every connection should not have too much overhead, but can be improved in the future, with caching layer. Example tests can be found [here](https://github.com/coreos/etcd/blob/b041ce5d514a4b4aaeefbffb008f0c7570a18986/integration/v3_grpc_test.go#L1601-L1757). -Since [v3.2.0](https://github.com/coreos/etcd/blob/master/CHANGELOG-3.2.md#v320-2017-06-09), [server denies incoming peer certs with wrong IP `SAN`](https://github.com/coreos/etcd/pull/7687). For instance, if peer cert contains any IP addresses in Subject Alternative Name (SAN) field, server authenticates a peer only when the remote IP address matches one of those IP addresses. This is to prevent unauthorized endpoints from joining the cluster. For example, peer B's CSR (with `cfssl`) is: +Since [v3.2.0](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.2.md#v320-2017-06-09), [server denies incoming peer certs with wrong IP `SAN`](https://github.com/etcd-io/etcd/pull/7687). For instance, if peer cert contains any IP addresses in Subject Alternative Name (SAN) field, server authenticates a peer only when the remote IP address matches one of those IP addresses. This is to prevent unauthorized endpoints from joining the cluster. For example, peer B's CSR (with `cfssl`) is: ```json { @@ -223,7 +270,7 @@ Since [v3.2.0](https://github.com/coreos/etcd/blob/master/CHANGELOG-3.2.md#v320- when peer B's actual IP address is `10.138.0.2`, not `10.138.0.27`. When peer B tries to join the cluster, peer A will reject B with the error `x509: certificate is valid for 10.138.0.27, not 10.138.0.2`, because B's remote IP address does not match the one in Subject Alternative Name (SAN) field. -Since [v3.2.0](https://github.com/coreos/etcd/blob/master/CHANGELOG-3.2.md#v320-2017-06-09), [server resolves TLS `DNSNames` when checking `SAN`](https://github.com/coreos/etcd/pull/7767). For instance, if peer cert contains only DNS names (no IP addresses) in Subject Alternative Name (SAN) field, server authenticates a peer only when forward-lookups (`dig b.com`) on those DNS names have matching IP with the remote IP address. For example, peer B's CSR (with `cfssl`) is: +Since [v3.2.0](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.2.md#v320-2017-06-09), [server resolves TLS `DNSNames` when checking `SAN`](https://github.com/etcd-io/etcd/pull/7767). For instance, if peer cert contains only DNS names (no IP addresses) in Subject Alternative Name (SAN) field, server authenticates a peer only when forward-lookups (`dig b.com`) on those DNS names have matching IP with the remote IP address. For example, peer B's CSR (with `cfssl`) is: ```json { @@ -235,7 +282,7 @@ Since [v3.2.0](https://github.com/coreos/etcd/blob/master/CHANGELOG-3.2.md#v320- when peer B's remote IP address is `10.138.0.2`. When peer B tries to join the cluster, peer A looks up the incoming host `b.com` to get the list of IP addresses (e.g. `dig b.com`). And rejects B if the list does not contain the IP `10.138.0.2`, with the error `tls: 10.138.0.2 does not match any of DNSNames ["b.com"]`. -Since [v3.2.2](https://github.com/coreos/etcd/blob/master/CHANGELOG-3.2.md#v322-2017-07-07), [server accepts connections if IP matches, without checking DNS entries](https://github.com/coreos/etcd/pull/8223). For instance, if peer cert contains IP addresses and DNS names in Subject Alternative Name (SAN) field, and the remote IP address matches one of those IP addresses, server just accepts connection without further checking the DNS names. For example, peer B's CSR (with `cfssl`) is: +Since [v3.2.2](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.2.md#v322-2017-07-07), [server accepts connections if IP matches, without checking DNS entries](https://github.com/etcd-io/etcd/pull/8223). For instance, if peer cert contains IP addresses and DNS names in Subject Alternative Name (SAN) field, and the remote IP address matches one of those IP addresses, server just accepts connection without further checking the DNS names. For example, peer B's CSR (with `cfssl`) is: ```json { @@ -246,9 +293,9 @@ Since [v3.2.2](https://github.com/coreos/etcd/blob/master/CHANGELOG-3.2.md#v322- ], ``` -when peer B's remote IP address is `10.138.0.2` and `invalid.domain` is a invalid host. When peer B tries to join the cluster, peer A successfully authenticates B, since Subject Alternative Name (SAN) field has a valid matching IP address. See [issue#8206](https://github.com/coreos/etcd/issues/8206) for more detail. +when peer B's remote IP address is `10.138.0.2` and `invalid.domain` is a invalid host. When peer B tries to join the cluster, peer A successfully authenticates B, since Subject Alternative Name (SAN) field has a valid matching IP address. See [issue#8206](https://github.com/etcd-io/etcd/issues/8206) for more detail. -Since [v3.2.5](https://github.com/coreos/etcd/blob/master/CHANGELOG-3.2.md#v325-2017-08-04), [server supports reverse-lookup on wildcard DNS `SAN`](https://github.com/coreos/etcd/pull/8281). For instance, if peer cert contains only DNS names (no IP addresses) in Subject Alternative Name (SAN) field, server first reverse-lookups the remote IP address to get a list of names mapping to that address (e.g. `nslookup IPADDR`). Then accepts the connection if those names have a matching name with peer cert's DNS names (either by exact or wildcard match). If none is matched, server forward-lookups each DNS entry in peer cert (e.g. look up `example.default.svc` when the entry is `*.example.default.svc`), and accepts connection only when the host's resolved addresses have the matching IP address with the peer's remote IP address. For example, peer B's CSR (with `cfssl`) is: +Since [v3.2.5](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.2.md#v325-2017-08-04), [server supports reverse-lookup on wildcard DNS `SAN`](https://github.com/etcd-io/etcd/pull/8281). For instance, if peer cert contains only DNS names (no IP addresses) in Subject Alternative Name (SAN) field, server first reverse-lookups the remote IP address to get a list of names mapping to that address (e.g. `nslookup IPADDR`). Then accepts the connection if those names have a matching name with peer cert's DNS names (either by exact or wildcard match). If none is matched, server forward-lookups each DNS entry in peer cert (e.g. look up `example.default.svc` when the entry is `*.example.default.svc`), and accepts connection only when the host's resolved addresses have the matching IP address with the peer's remote IP address. For example, peer B's CSR (with `cfssl`) is: ```json { @@ -259,9 +306,9 @@ Since [v3.2.5](https://github.com/coreos/etcd/blob/master/CHANGELOG-3.2.md#v325- ], ``` -when peer B's remote IP address is `10.138.0.2`. When peer B tries to join the cluster, peer A reverse-lookup the IP `10.138.0.2` to get the list of host names. And either exact or wildcard match the host names with peer B's cert DNS names in Subject Alternative Name (SAN) field. If none of reverse/forward lookups worked, it returns an error `"tls: "10.138.0.2" does not match any of DNSNames ["*.example.default.svc","*.example.default.svc.cluster.local"]`. See [issue#8268](https://github.com/coreos/etcd/issues/8268) for more detail. +when peer B's remote IP address is `10.138.0.2`. When peer B tries to join the cluster, peer A reverse-lookup the IP `10.138.0.2` to get the list of host names. And either exact or wildcard match the host names with peer B's cert DNS names in Subject Alternative Name (SAN) field. If none of reverse/forward lookups worked, it returns an error `"tls: "10.138.0.2" does not match any of DNSNames ["*.example.default.svc","*.example.default.svc.cluster.local"]`. See [issue#8268](https://github.com/etcd-io/etcd/issues/8268) for more detail. -[v3.3.0](https://github.com/coreos/etcd/blob/master/CHANGELOG-3.3.md) adds [`etcd --peer-cert-allowed-cn`](https://github.com/coreos/etcd/pull/8616) flag to support [CN(Common Name)-based auth for inter-peer connections](https://github.com/coreos/etcd/issues/8262). Kubernetes TLS bootstrapping involves generating dynamic certificates for etcd members and other system components (e.g. API server, kubelet, etc.). Maintaining different CAs for each component provides tighter access control to etcd cluster but often tedious. When `--peer-cert-allowed-cn` flag is specified, node can only join with matching common name even with shared CAs. For example, each member in 3-node cluster is set up with CSRs (with `cfssl`) as below: +[v3.3.0](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.3.md) adds [`etcd --peer-cert-allowed-cn`](https://github.com/etcd-io/etcd/pull/8616) flag to support [CN(Common Name)-based auth for inter-peer connections](https://github.com/etcd-io/etcd/issues/8262). Kubernetes TLS bootstrapping involves generating dynamic certificates for etcd members and other system components (e.g. API server, kubelet, etc.). Maintaining different CAs for each component provides tighter access control to etcd cluster but often tedious. When `--peer-cert-allowed-cn` flag is specified, node can only join with matching common name even with shared CAs. For example, each member in 3-node cluster is set up with CSRs (with `cfssl`) as below: ```json { @@ -321,6 +368,35 @@ I | embed: serving client requests on 127.0.0.1:22379 I | embed: serving client requests on 127.0.0.1:2379 ``` +[v3.2.19](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.2.md) and [v3.3.4](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.3.md) fixes TLS reload when [certificate SAN field only includes IP addresses but no domain names](https://github.com/etcd-io/etcd/issues/9541). For example, a member is set up with CSRs (with `cfssl`) as below: + +```json +{ + "CN": "etcd.local", + "hosts": [ + "127.0.0.1" + ], +``` + +In Go, server calls `(*tls.Config).GetCertificate` for TLS reload if and only if server's `(*tls.Config).Certificates` field is not empty, or `(*tls.ClientHelloInfo).ServerName` is not empty with a valid SNI from the client. Previously, etcd always populates `(*tls.Config).Certificates` on the initial client TLS handshake, as non-empty. Thus, client was always expected to supply a matching SNI in order to pass the TLS verification and to trigger `(*tls.Config).GetCertificate` to reload TLS assets. + +However, a certificate whose SAN field does [not include any domain names but only IP addresses](https://github.com/etcd-io/etcd/issues/9541) would request `*tls.ClientHelloInfo` with an empty `ServerName` field, thus failing to trigger the TLS reload on initial TLS handshake; this becomes a problem when expired certificates need to be replaced online. + +Now, `(*tls.Config).Certificates` is created empty on initial TLS client handshake, first to trigger `(*tls.Config).GetCertificate`, and then to populate rest of the certificates on every new TLS connection, even when client SNI is empty (e.g. cert only includes IPs). + +## Notes for Host Whitelist + +`etcd --host-whitelist` flag specifies acceptable hostnames from HTTP client requests. Client origin policy protects against ["DNS Rebinding"](https://en.wikipedia.org/wiki/DNS_rebinding) attacks to insecure etcd servers. That is, any website can simply create an authorized DNS name, and direct DNS to `"localhost"` (or any other address). Then, all HTTP endpoints of etcd server listening on `"localhost"` becomes accessible, thus vulnerable to DNS rebinding attacks. See [CVE-2018-5702](https://bugs.chromium.org/p/project-zero/issues/detail?id=1447#c2) for more detail. + +Client origin policy works as follows: + +1. If client connection is secure via HTTPS, allow any hostnames. +2. If client connection is not secure and `"HostWhitelist"` is not empty, only allow HTTP requests whose Host field is listed in whitelist. + +Note that the client origin policy is enforced whether authentication is enabled or not, for tighter controls. + +By default, `etcd --host-whitelist` and `embed.Config.HostWhitelist` are set *empty* to allow all hostnames. Note that when specifying hostnames, loopback addresses are not added automatically. To allow loopback interfaces, add them to whitelist manually (e.g. `"localhost"`, `"127.0.0.1"`, etc.). + ## Frequently asked questions ### I'm seeing a SSLv3 alert handshake failure when using TLS client authentication? diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/supported-platform.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/supported-platform.md index 37affd7c9..31df649fe 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/supported-platform.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/supported-platform.md @@ -1,4 +1,6 @@ -# Supported systems +--- +title: Supported systems +--- ## Current support @@ -6,7 +8,7 @@ The following table lists etcd support status for common architectures and opera | Architecture | Operating System | Status | Maintainers | | ------------ | ---------------- | ------------ | --------------------------- | -| amd64 | Darwin | Experimental | etcd maintainers | +| amd64 | Darwin | Experimental | etcd maintainers | | amd64 | Linux | Stable | etcd maintainers | | amd64 | Windows | Experimental | | | arm64 | Linux | Experimental | @glevand | @@ -14,7 +16,7 @@ The following table lists etcd support status for common architectures and opera | 386 | Linux | Unstable | | | ppc64le | Linux | Stable | etcd maintainers, @mkumatag | -* etcd-maintainers are listed in https://github.com/coreos/etcd/blob/master/MAINTAINERS. +* etcd-maintainers are listed in https://github.com/etcd-io/etcd/blob/master/MAINTAINERS. Experimental platforms appear to work in practice and have some platform specific code in etcd, but do not fully conform to the stable support policy. Unstable platforms have been lightly tested, but less than experimental. Unlisted architecture and operating system pairs are currently unsupported; caveat emptor. diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/v2-migration.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/v2-migration.md index 632a79893..981ace24f 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/v2-migration.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/v2-migration.md @@ -1,4 +1,6 @@ -# Migrate applications from using API v2 to API v3 +--- +title: Migrate applications from using API v2 to API v3 +--- The data store v2 is still accessible from the API v2 after upgrading to etcd3. Thus, it will work as before and require no application changes. With etcd 3, applications use the new grpc API v3 to access the mvcc store, which provides more features and improved performance. The mvcc store and the old store v2 are separate and isolated; writes to the store v2 will not affect the mvcc store and, similarly, writes to the mvcc store will not affect the store v2. diff --git a/vendor/github.com/coreos/etcd/Documentation/op-guide/versioning.md b/vendor/github.com/coreos/etcd/Documentation/op-guide/versioning.md index 192a39ac6..0ee0edec2 100644 --- a/vendor/github.com/coreos/etcd/Documentation/op-guide/versioning.md +++ b/vendor/github.com/coreos/etcd/Documentation/op-guide/versioning.md @@ -1,4 +1,6 @@ -# Versioning +--- +title: Versioning +--- ## Service versioning diff --git a/vendor/github.com/coreos/etcd/Documentation/platforms/_index.md b/vendor/github.com/coreos/etcd/Documentation/platforms/_index.md new file mode 100644 index 000000000..64b52761c --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/platforms/_index.md @@ -0,0 +1,3 @@ +--- +title: Platforms +--- \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/Documentation/platforms/aws.md b/vendor/github.com/coreos/etcd/Documentation/platforms/aws.md index 071b225ef..546df3fae 100644 --- a/vendor/github.com/coreos/etcd/Documentation/platforms/aws.md +++ b/vendor/github.com/coreos/etcd/Documentation/platforms/aws.md @@ -1,4 +1,6 @@ -# Amazon Web Services +--- +title: Amazon Web Services +--- This guide assumes operational knowledge of Amazon Web Services (AWS), specifically Amazon Elastic Compute Cloud (EC2). This guide provides an introduction to design considerations when designing an etcd deployment on AWS EC2 and how AWS specific features may be utilized in that context. diff --git a/vendor/github.com/coreos/etcd/Documentation/platforms/container-linux-systemd.md b/vendor/github.com/coreos/etcd/Documentation/platforms/container-linux-systemd.md index b9d964038..d29cef937 100644 --- a/vendor/github.com/coreos/etcd/Documentation/platforms/container-linux-systemd.md +++ b/vendor/github.com/coreos/etcd/Documentation/platforms/container-linux-systemd.md @@ -1,4 +1,6 @@ -# Container Linux with systemd +--- +title: Container Linux with systemd +--- The following guide shows how to run etcd with [systemd][systemd-docs] under [Container Linux][container-linux-docs]. diff --git a/vendor/github.com/coreos/etcd/Documentation/platforms/freebsd.md b/vendor/github.com/coreos/etcd/Documentation/platforms/freebsd.md index f781a96ad..353bba254 100644 --- a/vendor/github.com/coreos/etcd/Documentation/platforms/freebsd.md +++ b/vendor/github.com/coreos/etcd/Documentation/platforms/freebsd.md @@ -1,4 +1,6 @@ -# FreeBSD +--- +title: FreeBSD +--- Starting with version 0.1.2 both etcd and etcdctl have been ported to FreeBSD and can be installed either via packages or ports system. Their versions have been recently updated to 0.2.0 so now etcd and etcdctl can be enjoyed on FreeBSD 10.0 (RC4 as of now) and 9.x, where they have been tested. They might also work when installed from ports on earlier versions of FreeBSD, but it is untested; caveat emptor. diff --git a/vendor/github.com/coreos/etcd/Documentation/production-users.md b/vendor/github.com/coreos/etcd/Documentation/production-users.md index 08a6b21bc..c6c294637 100644 --- a/vendor/github.com/coreos/etcd/Documentation/production-users.md +++ b/vendor/github.com/coreos/etcd/Documentation/production-users.md @@ -1,4 +1,6 @@ -# Production users +--- +title: Production users +--- This document tracks people and use cases for etcd in production. By creating a list of production use cases we hope to build a community of advisors that we can reach out to with experience using various etcd applications, operation environments, and cluster sizes. The etcd development team may reach out periodically to check-in on how etcd is working in the field and update this list. @@ -237,3 +239,12 @@ At [Branch][branch], we use kubernetes heavily as our core microservice platform - *Environment*: Bare Metal - *Backups*: None, all data is considered ephemeral. +## Transwarp + +- *Application*: Transwarp Data Cloud, Transwarp Operating System, Transwarp Data Hub, Sophon +- *Launched*: January 2016 +- *Cluster Size*: Multiple clusters, multiple sizes +- *Order of Data Size*: Megabytes +- *Operator*: Trasnwarp Operating System +- *Environment*: Bare Metal, Container +- *Backups*: backup scripts diff --git a/vendor/github.com/coreos/etcd/Documentation/reporting_bugs.md b/vendor/github.com/coreos/etcd/Documentation/reporting_bugs.md index d9284368a..c64ebf3b0 100644 --- a/vendor/github.com/coreos/etcd/Documentation/reporting_bugs.md +++ b/vendor/github.com/coreos/etcd/Documentation/reporting_bugs.md @@ -1,4 +1,6 @@ -# Reporting bugs +--- +title: Reporting bugs +--- If any part of the etcd project has bugs or documentation mistakes, please let us know by [opening an issue][etcd-issue]. We treat bugs and mistakes very seriously and believe no issue is too small. Before creating a bug report, please check that an issue reporting the same problem does not already exist. @@ -41,5 +43,5 @@ $ sudo journalctl -u etcd2 Due to an upstream systemd bug, journald may miss the last few log lines when its processes exit. If journalctl says etcd stopped without fatal or panic message, try `sudo journalctl -f -t etcd2` to get full log. -[etcd-issue]: https://github.com/coreos/etcd/issues/new +[etcd-issue]: https://github.com/etcd-io/etcd/issues/new [filing-good-bugs]: http://fantasai.inkedblade.net/style/talks/filing-good-bugs/ diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/rfc/v3api.md b/vendor/github.com/coreos/etcd/Documentation/rfc/_index.md similarity index 93% rename from vendor/github.com/coreos/etcd/Documentation/v2/rfc/v3api.md rename to vendor/github.com/coreos/etcd/Documentation/rfc/_index.md index 18567d36b..37b08181a 100644 --- a/vendor/github.com/coreos/etcd/Documentation/v2/rfc/v3api.md +++ b/vendor/github.com/coreos/etcd/Documentation/rfc/_index.md @@ -1,9 +1,6 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -# Overview +--- +title: etcd v3 API +--- The etcd v3 API is designed to give users a more efficient and cleaner abstraction compared to etcd v2. There are a number of semantic and protocol changes in this new API. For an overview [see Xiang Li's video](https://youtu.be/J5AioGtEPeQ?t=211). @@ -57,6 +54,7 @@ the size in the future a little bit or make it configurable. ## Examples ### Put a key (foo=bar) + ``` // A put is always successful Put( PutRequest { key = foo, value = bar } ) @@ -212,5 +210,5 @@ WatchResponse { ``` -[api-protobuf]: https://github.com/coreos/etcd/blob/release-2.3/etcdserver/etcdserverpb/rpc.proto -[kv-protobuf]: https://github.com/coreos/etcd/blob/release-2.3/storage/storagepb/kv.proto +[api-protobuf]: https://github.com/etcd-io/etcd/blob/master/etcdserver/etcdserverpb/rpc.proto +[kv-protobuf]: https://github.com/etcd-io/etcd/blob/master/mvcc/mvccpb/kv.proto diff --git a/vendor/github.com/coreos/etcd/Documentation/rfc/v3api.md b/vendor/github.com/coreos/etcd/Documentation/rfc/v3api.md deleted file mode 100644 index 1371347e1..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/rfc/v3api.md +++ /dev/null @@ -1,211 +0,0 @@ -# Overview - -The etcd v3 API is designed to give users a more efficient and cleaner abstraction compared to etcd v2. There are a number of semantic and protocol changes in this new API. For an overview [see Xiang Li's video](https://youtu.be/J5AioGtEPeQ?t=211). - -To prove out the design of the v3 API the team has also built [a number of example recipes](https://github.com/coreos/etcd/tree/master/contrib/recipes), there is a [video discussing these recipes too](https://www.youtube.com/watch?v=fj-2RY-3yVU&feature=youtu.be&t=590). - -# Design - -1. Flatten binary key-value space - -2. Keep the event history until compaction - - access to old version of keys - - user controlled history compaction - -3. Support range query - - Pagination support with limit argument - - Support consistency guarantee across multiple range queries - -4. Replace TTL key with Lease - - more efficient/ low cost keep alive - - a logical group of TTL keys - -5. Replace CAS/CAD with multi-object Txn - - MUCH MORE powerful and flexible - -6. Support efficient watching with multiple ranges - -7. RPC API supports the completed set of APIs. - - more efficient than JSON/HTTP - - additional txn/lease support - -8. HTTP API supports a subset of APIs. - - easy for people to try out etcd - - easy for people to write simple etcd application - - -## Notes - -### Request Size Limitation - -The max request size is around 1MB. Since etcd replicates requests in a streaming fashion, a very large -request might block other requests for a long time. The use case for etcd is to store small configuration -values, so we prevent user from submitting large requests. This also applies to Txn requests. We might loosen -the size in the future a little bit or make it configurable. - -## Protobuf Defined API - -[api protobuf][api-protobuf] - -[kv protobuf][kv-protobuf] - -## Examples - -### Put a key (foo=bar) -``` -// A put is always successful -Put( PutRequest { key = foo, value = bar } ) - -PutResponse { - cluster_id = 0x1000, - member_id = 0x1, - revision = 1, - raft_term = 0x1, -} -``` - -### Get a key (assume we have foo=bar) -``` -Get ( RangeRequest { key = foo } ) - -RangeResponse { - cluster_id = 0x1000, - member_id = 0x1, - revision = 1, - raft_term = 0x1, - kvs = { - { - key = foo, - value = bar, - create_revision = 1, - mod_revision = 1, - version = 1; - }, - }, -} -``` - -### Range over a key space (assume we have foo0=bar0… foo100=bar100) -``` -Range ( RangeRequest { key = foo, end_key = foo80, limit = 30 } ) - -RangeResponse { - cluster_id = 0x1000, - member_id = 0x1, - revision = 100, - raft_term = 0x1, - kvs = { - { - key = foo0, - value = bar0, - create_revision = 1, - mod_revision = 1, - version = 1; - }, - ..., - { - key = foo30, - value = bar30, - create_revision = 30, - mod_revision = 30, - version = 1; - }, - }, -} -``` - -### Finish a txn (assume we have foo0=bar0, foo1=bar1) -``` -Txn(TxnRequest { - // mod_revision of foo0 is equal to 1, mod_revision of foo1 is greater than 1 - compare = { - {compareType = equal, key = foo0, mod_revision = 1}, - {compareType = greater, key = foo1, mod_revision = 1}} - }, - // if the comparison succeeds, put foo2 = bar2 - success = {PutRequest { key = foo2, value = success }}, - // if the comparison fails, put foo2=fail - failure = {PutRequest { key = foo2, value = failure }}, -) - -TxnResponse { - cluster_id = 0x1000, - member_id = 0x1, - revision = 3, - raft_term = 0x1, - succeeded = true, - responses = { - // response of PUT foo2=success - { - cluster_id = 0x1000, - member_id = 0x1, - revision = 3, - raft_term = 0x1, - } - } -} -``` - -### Watch on a key/range - -``` -Watch( WatchRequest{ - key = foo, - end_key = fop, // prefix foo - start_revision = 20, - end_revision = 10000, - // server decided notification frequency - progress_notification = true, - } - … // this can be a watch request stream - ) - -// put (foo0=bar0) event at 3 -WatchResponse { - cluster_id = 0x1000, - member_id = 0x1, - revision = 3, - raft_term = 0x1, - event_type = put, - kv = { - key = foo0, - value = bar0, - create_revision = 1, - mod_revision = 1, - version = 1; - }, - } - … - - // a notification at 2000 - WatchResponse { - cluster_id = 0x1000, - member_id = 0x1, - revision = 2000, - raft_term = 0x1, - // nil event as notification - } - - … - - // put (foo0=bar3000) event at 3000 - WatchResponse { - cluster_id = 0x1000, - member_id = 0x1, - revision = 3000, - raft_term = 0x1, - event_type = put, - kv = { - key = foo0, - value = bar3000, - create_revision = 1, - mod_revision = 3000, - version = 2; - }, - } - … - -``` - -[api-protobuf]: https://github.com/coreos/etcd/blob/master/etcdserver/etcdserverpb/rpc.proto -[kv-protobuf]: https://github.com/coreos/etcd/blob/master/mvcc/mvccpb/kv.proto diff --git a/vendor/github.com/coreos/etcd/Documentation/tuning.md b/vendor/github.com/coreos/etcd/Documentation/tuning.md index 087d39d18..87e016db8 100644 --- a/vendor/github.com/coreos/etcd/Documentation/tuning.md +++ b/vendor/github.com/coreos/etcd/Documentation/tuning.md @@ -1,4 +1,6 @@ -# Tuning +--- +title: Tuning +--- The default settings in etcd should work well for installations on a local network where the average network latency is low. However, when using etcd across multiple data centers or over networks with high latency, the heartbeat interval and election timeout settings may need tuning. @@ -71,12 +73,12 @@ dropped MsgAppResp to 247ae21ff9436b2d since streamMsg's sending buffer is full These errors may be resolved by prioritizing etcd's peer traffic over its client traffic. On Linux, peer traffic can be prioritized by using the traffic control mechanism: -``` +```sh tc qdisc add dev eth0 root handle 1: prio bands 3 tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip sport 2380 0xffff flowid 1:1 tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dport 2380 0xffff flowid 1:1 -tc filter add dev eth0 parent 1: protocol ip prio 2 u32 match ip sport 2739 0xffff flowid 1:1 -tc filter add dev eth0 parent 1: protocol ip prio 2 u32 match ip dport 2739 0xffff flowid 1:1 +tc filter add dev eth0 parent 1: protocol ip prio 2 u32 match ip sport 2379 0xffff flowid 1:1 +tc filter add dev eth0 parent 1: protocol ip prio 2 u32 match ip dport 2379 0xffff flowid 1:1 ``` [ping]: https://en.wikipedia.org/wiki/Ping_(networking_utility) diff --git a/vendor/github.com/coreos/etcd/Documentation/upgrades/_index.md b/vendor/github.com/coreos/etcd/Documentation/upgrades/_index.md new file mode 100644 index 000000000..ab2858c3b --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/upgrades/_index.md @@ -0,0 +1,3 @@ +--- +title: Upgrading +--- \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_0.md b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_0.md index 7455426b3..36fc061e8 100644 --- a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_0.md +++ b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_0.md @@ -1,4 +1,6 @@ -## Upgrade etcd from 2.3 to 3.0 +--- +title: Upgrade etcd from 2.3 to 3.0 +--- In the general case, upgrading from etcd 2.3 to 3.0 can be a zero-downtime, rolling upgrade: - one by one, stop the etcd v2.3 processes and replace them with etcd v3.0 processes @@ -8,7 +10,7 @@ Before [starting an upgrade](#upgrade-procedure), read through the rest of this ### Upgrade checklists -**NOTE:** When [migrating from v2 with no v3 data](https://github.com/coreos/etcd/issues/9480), etcd server v3.2+ panics when etcd restores from existing snapshots but no v3 `ETCD_DATA_DIR/member/snap/db` file. This happens when the server had migrated from v2 with no previous v3 data. This also prevents accidental v3 data loss (e.g. `db` file might have been moved). etcd requires that post v3 migration can only happen with v3 data. Do not upgrade to newer v3 versions until v3.0 server contains v3 data. +**NOTE:** When [migrating from v2 with no v3 data](https://github.com/etcd-io/etcd/issues/9480), etcd server v3.2+ panics when etcd restores from existing snapshots but no v3 `ETCD_DATA_DIR/member/snap/db` file. This happens when the server had migrated from v2 with no previous v3 data. This also prevents accidental v3 data loss (e.g. `db` file might have been moved). etcd requires that post v3 migration can only happen with v3 data. Do not upgrade to newer v3 versions until v3.0 server contains v3 data. #### Upgrade requirements @@ -124,8 +126,8 @@ $ ETCDCTL_API=3 etcdctl endpoint health ## Known Issues -- etcd < v3.1 does not work properly if built with Go > v1.7. See [Issue 6951](https://github.com/coreos/etcd/issues/6951) for additional information. +- etcd < v3.1 does not work properly if built with Go > v1.7. See [Issue 6951](https://github.com/etcd-io/etcd/issues/6951) for additional information. - If an error such as `transport: http2Client.notifyError got notified that the client transport was broken unexpected EOF.` shows up in the etcd server logs, be sure etcd is a pre-built release or built with (etcd v3.1+ & go v1.7+) or (etcd <v3.1 & go v1.6.x). -- Adding a v3 node to v2.3 cluster during upgrades is not supported and could trigger panics. See [Issue 7249](https://github.com/coreos/etcd/issues/7429) for additional information. Mixed versions of etcd members are only allowed during v3 migration. Finish upgrades before making any membership changes. +- Adding a v3 node to v2.3 cluster during upgrades is not supported and could trigger panics. See [Issue 7249](https://github.com/etcd-io/etcd/issues/7429) for additional information. Mixed versions of etcd members are only allowed during v3 migration. Finish upgrades before making any membership changes. [etcd-contact]: https://groups.google.com/forum/#!forum/etcd-dev diff --git a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_1.md b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_1.md index 823fa1b2f..5ab096cbe 100644 --- a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_1.md +++ b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_1.md @@ -1,4 +1,6 @@ -## Upgrade etcd from 3.0 to 3.1 +--- +title: Upgrade etcd from 3.0 to 3.1 +--- In the general case, upgrading from etcd 3.0 to 3.1 can be a zero-downtime, rolling upgrade: - one by one, stop the etcd v3.0 processes and replace them with etcd v3.1 processes @@ -8,7 +10,7 @@ Before [starting an upgrade](#upgrade-procedure), read through the rest of this ### Upgrade checklists -**NOTE:** When [migrating from v2 with no v3 data](https://github.com/coreos/etcd/issues/9480), etcd server v3.2+ panics when etcd restores from existing snapshots but no v3 `ETCD_DATA_DIR/member/snap/db` file. This happens when the server had migrated from v2 with no previous v3 data. This also prevents accidental v3 data loss (e.g. `db` file might have been moved). etcd requires that post v3 migration can only happen with v3 data. Do not upgrade to newer v3 versions until v3.0 server contains v3 data. +**NOTE:** When [migrating from v2 with no v3 data](https://github.com/etcd-io/etcd/issues/9480), etcd server v3.2+ panics when etcd restores from existing snapshots but no v3 `ETCD_DATA_DIR/member/snap/db` file. This happens when the server had migrated from v2 with no previous v3 data. This also prevents accidental v3 data loss (e.g. `db` file might have been moved). etcd requires that post v3 migration can only happen with v3 data. Do not upgrade to newer v3 versions until v3.0 server contains v3 data. #### Monitoring diff --git a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_2.md b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_2.md index f1b0a8c9f..f99a2afef 100644 --- a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_2.md +++ b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_2.md @@ -1,4 +1,6 @@ -## Upgrade etcd from 3.1 to 3.2 +--- +title: Upgrade etcd from 3.1 to 3.2 +--- In the general case, upgrading from etcd 3.1 to 3.2 can be a zero-downtime, rolling upgrade: - one by one, stop the etcd v3.1 processes and replace them with etcd v3.2 processes @@ -8,19 +10,21 @@ Before [starting an upgrade](#upgrade-procedure), read through the rest of this ### Upgrade checklists -**NOTE:** When [migrating from v2 with no v3 data](https://github.com/coreos/etcd/issues/9480), etcd server v3.2+ panics when etcd restores from existing snapshots but no v3 `ETCD_DATA_DIR/member/snap/db` file. This happens when the server had migrated from v2 with no previous v3 data. This also prevents accidental v3 data loss (e.g. `db` file might have been moved). etcd requires that post v3 migration can only happen with v3 data. Do not upgrade to newer v3 versions until v3.0 server contains v3 data. +**NOTE:** When [migrating from v2 with no v3 data](https://github.com/etcd-io/etcd/issues/9480), etcd server v3.2+ panics when etcd restores from existing snapshots but no v3 `ETCD_DATA_DIR/member/snap/db` file. This happens when the server had migrated from v2 with no previous v3 data. This also prevents accidental v3 data loss (e.g. `db` file might have been moved). etcd requires that post v3 migration can only happen with v3 data. Do not upgrade to newer v3 versions until v3.0 server contains v3 data. Highlighted breaking changes in 3.2. -#### Change in default `snapshot-count` value +#### Changed default `snapshot-count` value -The default value of `--snapshot-count` has [changed from from 10,000 to 100,000](https://github.com/coreos/etcd/pull/7160). Higher snapshot count means it holds Raft entries in memory for longer before discarding old entries. It is a trade-off between less frequent snapshotting and [higher memory usage](https://github.com/kubernetes/kubernetes/issues/60589#issuecomment-371977156). Higher `--snapshot-count` will be manifested with higher memory usage, while retaining more Raft entries helps with the availabilities of slow followers: leader is still able to replicate its logs to followers, rather than forcing followers to rebuild its stores from leader snapshots. +Higher `--snapshot-count` holds more Raft entries in memory until snapshot, thus causing [recurrent higher memory usage](https://github.com/kubernetes/kubernetes/issues/60589#issuecomment-371977156). Since leader retains latest Raft entries for longer, a slow follower has more time to catch up before leader snapshot. `--snapshot-count` is a tradeoff between higher memory usage and better availabilities of slow followers. -#### Change in gRPC dependency (>=3.2.10) +Since v3.2, the default value of `--snapshot-count` has [changed from from 10,000 to 100,000](https://github.com/etcd-io/etcd/pull/7160). + +#### Changed gRPC dependency (>=3.2.10) 3.2.10 or later now requires [grpc/grpc-go](https://github.com/grpc/grpc-go/releases) `v1.7.5` (<=3.2.9 requires `v1.2.1`). -##### Deprecate `grpclog.Logger` +##### Deprecated `grpclog.Logger` `grpclog.Logger` has been deprecated in favor of [`grpclog.LoggerV2`](https://github.com/grpc/grpc-go/blob/master/grpclog/loggerv2.go). `clientv3.Logger` is now `grpclog.LoggerV2`. @@ -41,9 +45,9 @@ clientv3.SetLogger(grpclog.NewLoggerV2(os.Stderr, os.Stderr, os.Stderr)) // log.New above cannot be used (not implement grpclog.LoggerV2 interface) ``` -##### Deprecate `grpc.ErrClientConnTimeout` +##### Deprecated `grpc.ErrClientConnTimeout` -Previously, `grpc.ErrClientConnTimeout` error is returned on client dial time-outs. 3.2 instead returns `context.DeadlineExceeded` (see [#8504](https://github.com/coreos/etcd/issues/8504)). +Previously, `grpc.ErrClientConnTimeout` error is returned on client dial time-outs. 3.2 instead returns `context.DeadlineExceeded` (see [#8504](https://github.com/etcd-io/etcd/issues/8504)). Before @@ -70,7 +74,7 @@ if err == context.DeadlineExceeded { } ``` -#### Change in maximum request size limits (>=3.2.10) +#### Changed maximum request size limits (>=3.2.10) 3.2.10 and 3.2.11 allow custom request size limits in server side. >=3.2.12 allows custom request size limits for both server and **client side**. In previous versions(v3.2.10, v3.2.11), client response size was limited to only 4 MiB. @@ -143,9 +147,9 @@ err.Error() == "rpc error: code = ResourceExhausted desc = grpc: received messag **If not specified, client-side send limit defaults to 2 MiB (1.5 MiB + gRPC overhead bytes) and receive limit to `math.MaxInt32`**. Please see [clientv3 godoc](https://godoc.org/github.com/coreos/etcd/clientv3#Config) for more detail. -#### Change in raw gRPC client wrappers +#### Changed raw gRPC client wrappers -3.2.12 or later changes the function signatures of `clientv3` gRPC client wrapper. This change was needed to support [custom `grpc.CallOption` on message size limits](https://github.com/coreos/etcd/pull/9047). +3.2.12 or later changes the function signatures of `clientv3` gRPC client wrapper. This change was needed to support [custom `grpc.CallOption` on message size limits](https://github.com/etcd-io/etcd/pull/9047). Before and after @@ -166,9 +170,9 @@ Before and after +func NewWatchFromWatchClient(wc pb.WatchClient, c *Client) Watcher { ``` -#### Change in `clientv3.Lease.TimeToLive` API +#### Changed `clientv3.Lease.TimeToLive` API -Previously, `clientv3.Lease.TimeToLive` API returned `lease.ErrLeaseNotFound` on non-existent lease ID. 3.2 instead returns TTL=-1 in its response and no error (see [#7305](https://github.com/coreos/etcd/pull/7305)). +Previously, `clientv3.Lease.TimeToLive` API returned `lease.ErrLeaseNotFound` on non-existent lease ID. 3.2 instead returns TTL=-1 in its response and no error (see [#7305](https://github.com/etcd-io/etcd/pull/7305)). Before @@ -188,7 +192,7 @@ resp.TTL == -1 err == nil ``` -#### Change in `clientv3.NewFromConfigFile` +#### Moved `clientv3.NewFromConfigFile` to `clientv3.yaml.NewConfig` `clientv3.NewFromConfigFile` is moved to `yaml.NewConfig`. @@ -210,7 +214,7 @@ clientv3yaml.NewConfig 3.2 now rejects domains names for `--listen-peer-urls` and `--listen-client-urls` (3.1 only prints out warnings), since domain name is invalid for network interface binding. Make sure that those URLs are properly formated as `scheme://IP:port`. -See [issue #6336](https://github.com/coreos/etcd/issues/6336) for more contexts. +See [issue #6336](https://github.com/etcd-io/etcd/issues/6336) for more contexts. ### Server upgrade checklists diff --git a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_3.md b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_3.md index 057051dee..85e60805e 100644 --- a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_3.md +++ b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_3.md @@ -1,4 +1,6 @@ -## Upgrade etcd from 3.2 to 3.3 +--- +title: Upgrade etcd from 3.2 to 3.3 +--- In the general case, upgrading from etcd 3.2 to 3.3 can be a zero-downtime, rolling upgrade: - one by one, stop the etcd v3.2 processes and replace them with etcd v3.3 processes @@ -8,11 +10,24 @@ Before [starting an upgrade](#upgrade-procedure), read through the rest of this ### Upgrade checklists -**NOTE:** When [migrating from v2 with no v3 data](https://github.com/coreos/etcd/issues/9480), etcd server v3.2+ panics when etcd restores from existing snapshots but no v3 `ETCD_DATA_DIR/member/snap/db` file. This happens when the server had migrated from v2 with no previous v3 data. This also prevents accidental v3 data loss (e.g. `db` file might have been moved). etcd requires that post v3 migration can only happen with v3 data. Do not upgrade to newer v3 versions until v3.0 server contains v3 data. +**NOTE:** When [migrating from v2 with no v3 data](https://github.com/etcd-io/etcd/issues/9480), etcd server v3.2+ panics when etcd restores from existing snapshots but no v3 `ETCD_DATA_DIR/member/snap/db` file. This happens when the server had migrated from v2 with no previous v3 data. This also prevents accidental v3 data loss (e.g. `db` file might have been moved). etcd requires that post v3 migration can only happen with v3 data. Do not upgrade to newer v3 versions until v3.0 server contains v3 data. Highlighted breaking changes in 3.3. -#### Change in `etcdserver.EtcdServer` struct +#### Changed value type of `etcd --auto-compaction-retention` flag to `string` + +Changed `--auto-compaction-retention` flag to [accept string values](https://github.com/etcd-io/etcd/pull/8563) with [finer granularity](https://github.com/etcd-io/etcd/issues/8503). Now that `--auto-compaction-retention` accepts string values, etcd configuration YAML file `auto-compaction-retention` field must be changed to `string` type. Previously, `--config-file etcd.config.yaml` can have `auto-compaction-retention: 24` field, now must be `auto-compaction-retention: "24"` or `auto-compaction-retention: "24h"`. If configured as `--auto-compaction-mode periodic --auto-compaction-retention "24h"`, the time duration value for `--auto-compaction-retention` flag must be valid for [`time.ParseDuration`](https://golang.org/pkg/time/#ParseDuration) function in Go. + +```diff +# etcd.config.yaml ++auto-compaction-mode: periodic +-auto-compaction-retention: 24 ++auto-compaction-retention: "24" ++# Or ++auto-compaction-retention: "24h" +``` + +#### Changed `etcdserver.EtcdServer.ServerConfig` to `*etcdserver.EtcdServer.ServerConfig` `etcdserver.EtcdServer` has changed the type of its member field `*etcdserver.ServerConfig` to `etcdserver.ServerConfig`. And `etcdserver.NewServer` now takes `etcdserver.ServerConfig`, instead of `*etcdserver.ServerConfig`. @@ -42,7 +57,9 @@ func (e *EtcdServer) Start() error { ... ``` -#### Change in `embed.EtcdServer` struct +#### Added `embed.Config.LogOutput` struct + +**Note that this field has been renamed to `embed.Config.LogOutputs` in `[]string` type in v3.4. Please see [v3.4 upgrade guide](https://github.com/etcd-io/etcd/blob/master/Documentation/upgrades/upgrade_3_4.md) for more details.** Field `LogOutput` is added to `embed.Config`: @@ -65,6 +82,8 @@ WARNING: 2017/11/02 11:35:51 grpc: addrConn.resetTransport failed to create clie From v3.3, gRPC server logs are disabled by default. +**Note that `embed.Config.SetupLogging` method has been deprecated in v3.4. Please see [v3.4 upgrade guide](https://github.com/etcd-io/etcd/blob/master/Documentation/upgrades/upgrade_3_4.md) for more details.** + ```go import "github.com/coreos/etcd/embed" @@ -74,7 +93,7 @@ cfg.SetupLogging() Set `embed.Config.Debug` field to `true` to enable gRPC server logs. -#### Change in `/health` endpoint response +#### Changed `/health` endpoint response Previously, `[endpoint]:[client-port]/health` returned manually marshaled JSON value. 3.3 now defines [`etcdhttp.Health`](https://godoc.org/github.com/coreos/etcd/etcdserver/api/etcdhttp#Health) struct. @@ -85,25 +104,25 @@ $ curl http://localhost:2379/health {"health":"true"} ``` -#### Change in gRPC gateway HTTP endpoints (replaced `/v3alpha` with `/v3beta`) +#### Changed gRPC gateway HTTP endpoints (replaced `/v3alpha` with `/v3beta`) Before ```bash curl -L http://localhost:2379/v3alpha/kv/put \ - -X POST -d '{"key": "Zm9v", "value": "YmFy"}' + -X POST -d '{"key": "Zm9v", "value": "YmFy"}' ``` After ```bash curl -L http://localhost:2379/v3beta/kv/put \ - -X POST -d '{"key": "Zm9v", "value": "YmFy"}' + -X POST -d '{"key": "Zm9v", "value": "YmFy"}' ``` Requests to `/v3alpha` endpoints will redirect to `/v3beta`, and `/v3alpha` will be removed in 3.4 release. -#### Change in maximum request size limits +#### Changed maximum request size limits 3.3 now allows custom request size limits for both server and **client side**. In previous versions(v3.2.10, v3.2.11), client response size was limited to only 4 MiB. @@ -176,9 +195,9 @@ err.Error() == "rpc error: code = ResourceExhausted desc = grpc: received messag **If not specified, client-side send limit defaults to 2 MiB (1.5 MiB + gRPC overhead bytes) and receive limit to `math.MaxInt32`**. Please see [clientv3 godoc](https://godoc.org/github.com/coreos/etcd/clientv3#Config) for more detail. -#### Change in raw gRPC client wrappers +#### Changed raw gRPC client wrapper function signatures -3.3 changes the function signatures of `clientv3` gRPC client wrapper. This change was needed to support [custom `grpc.CallOption` on message size limits](https://github.com/coreos/etcd/pull/9047). +3.3 changes the function signatures of `clientv3` gRPC client wrapper. This change was needed to support [custom `grpc.CallOption` on message size limits](https://github.com/etcd-io/etcd/pull/9047). Before and after @@ -199,7 +218,7 @@ Before and after +func NewWatchFromWatchClient(wc pb.WatchClient, c *Client) Watcher { ``` -#### Change in clientv3 `Snapshot` API error type +#### Changed clientv3 `Snapshot` API error type Previously, clientv3 `Snapshot` API returned raw [`grpc/*status.statusError`] type error. v3.3 now translates those errors to corresponding public error types, to be consistent with other APIs. @@ -245,7 +264,7 @@ _, err = io.Copy(f, rc) err == context.DeadlineExceeded ``` -#### Change in `etcdctl lease timetolive` command output +#### Changed `etcdctl lease timetolive` command output Previously, `lease timetolive LEASE_ID` command on expired lease prints `-1s` for remaining seconds. 3.3 now outputs clearer messages. @@ -262,7 +281,7 @@ After lease 2d8257079fa1bc0c already expired ``` -#### Change in `golang.org/x/net/context` imports +#### Changed `golang.org/x/net/context` imports `clientv3` has deprecated `golang.org/x/net/context`. If a project vendors `golang.org/x/net/context` in other code (e.g. etcd generated protocol buffer code) and imports `github.com/coreos/etcd/clientv3`, it requires Go 1.9+ to compile. @@ -280,11 +299,11 @@ import "context" cli.Put(context.Background(), "f", "v") ``` -#### Change in gRPC dependency +#### Changed gRPC dependency 3.3 now requires [grpc/grpc-go](https://github.com/grpc/grpc-go/releases) `v1.7.5`. -##### Deprecate `grpclog.Logger` +##### Deprecated `grpclog.Logger` `grpclog.Logger` has been deprecated in favor of [`grpclog.LoggerV2`](https://github.com/grpc/grpc-go/blob/master/grpclog/loggerv2.go). `clientv3.Logger` is now `grpclog.LoggerV2`. @@ -305,9 +324,9 @@ clientv3.SetLogger(grpclog.NewLoggerV2(os.Stderr, os.Stderr, os.Stderr)) // log.New above cannot be used (not implement grpclog.LoggerV2 interface) ``` -##### Deprecate `grpc.ErrClientConnTimeout` +##### Deprecated `grpc.ErrClientConnTimeout` -Previously, `grpc.ErrClientConnTimeout` error is returned on client dial time-outs. 3.3 instead returns `context.DeadlineExceeded` (see [#8504](https://github.com/coreos/etcd/issues/8504)). +Previously, `grpc.ErrClientConnTimeout` error is returned on client dial time-outs. 3.3 instead returns `context.DeadlineExceeded` (see [#8504](https://github.com/etcd-io/etcd/issues/8504)). Before @@ -334,7 +353,7 @@ if err == context.DeadlineExceeded { } ``` -#### Change in official container registry +#### Changed official container registry etcd now uses [`gcr.io/etcd-development/etcd`](https://gcr.io/etcd-development/etcd) as a primary container registry, and [`quay.io/coreos/etcd`](https://quay.io/coreos/etcd) as secondary. @@ -350,6 +369,52 @@ After docker pull gcr.io/etcd-development/etcd:v3.3.0 ``` +### Upgrades to >= v3.3.14 + +[v3.3.14](https://github.com/etcd-io/etcd/releases/tag/v3.3.14) had to include some features from 3.4, while trying to minimize the difference between client balancer implementation. This release fixes ["kube-apiserver 1.13.x refuses to work when first etcd-server is not available" (kubernetes#72102)](https://github.com/kubernetes/kubernetes/issues/72102). + +`grpc.ErrClientConnClosing` has been [deprecated in gRPC >= 1.10](https://github.com/grpc/grpc-go/pull/1854). + +```diff +import ( ++ "go.etcd.io/etcd/clientv3" + + "google.golang.org/grpc" ++ "google.golang.org/grpc/codes" ++ "google.golang.org/grpc/status" +) + +_, err := kvc.Get(ctx, "a") +-if err == grpc.ErrClientConnClosing { ++if clientv3.IsConnCanceled(err) { + +// or ++s, ok := status.FromError(err) ++if ok { ++ if s.Code() == codes.Canceled +``` + +[The new client balancer](https://github.com/etcd-io/etcd/blob/master/Documentation/learning/design-client.md) uses an asynchronous resolver to pass endpoints to the gRPC dial function. As a result, [v3.3.14](https://github.com/etcd-io/etcd/releases/tag/v3.3.14) or later requires `grpc.WithBlock` dial option to wait until the underlying connection is up. + +```diff +import ( + "time" + "go.etcd.io/etcd/clientv3" ++ "google.golang.org/grpc" +) + ++// "grpc.WithBlock()" to block until the underlying connection is up +ccfg := clientv3.Config{ + Endpoints: []string{"localhost:2379"}, + DialTimeout: time.Second, ++ DialOptions: []grpc.DialOption{grpc.WithBlock()}, + DialKeepAliveTime: time.Second, + DialKeepAliveTimeout: 500 * time.Millisecond, +} +``` + +Please see [CHANGELOG](https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.3.md) for a full list of changes. + ### Server upgrade checklists #### Upgrade requirements diff --git a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_4.md b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_4.md deleted file mode 100644 index 3c0c2ffb3..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_4.md +++ /dev/null @@ -1,171 +0,0 @@ -## Upgrade etcd from 3.3 to 3.4 - -In the general case, upgrading from etcd 3.3 to 3.4 can be a zero-downtime, rolling upgrade: - - one by one, stop the etcd v3.3 processes and replace them with etcd v3.4 processes - - after running all v3.4 processes, new features in v3.4 are available to the cluster - -Before [starting an upgrade](#upgrade-procedure), read through the rest of this guide to prepare. - -### Upgrade checklists - -**NOTE:** When [migrating from v2 with no v3 data](https://github.com/coreos/etcd/issues/9480), etcd server v3.2+ panics when etcd restores from existing snapshots but no v3 `ETCD_DATA_DIR/member/snap/db` file. This happens when the server had migrated from v2 with no previous v3 data. This also prevents accidental v3 data loss (e.g. `db` file might have been moved). etcd requires that post v3 migration can only happen with v3 data. Do not upgrade to newer v3 versions until v3.0 server contains v3 data. - -Highlighted breaking changes in 3.4. - -#### Change in `etcd` flags - -`--ca-file` and `--peer-ca-file` flags are deprecated; they have been deprecated since v2.1. - -```diff --etcd --ca-file ca-client.crt -+etcd --trusted-ca-file ca-client.crt -``` - -```diff --etcd --peer-ca-file ca-peer.crt -+etcd --peer-trusted-ca-file ca-peer.crt -``` - -#### Change in ``pkg/transport` - -Deprecated `pkg/transport.TLSInfo.CAFile` field. - -```diff -import "github.com/coreos/etcd/pkg/transport" - -tlsInfo := transport.TLSInfo{ - CertFile: "/tmp/test-certs/test.pem", - KeyFile: "/tmp/test-certs/test-key.pem", -- CAFile: "/tmp/test-certs/trusted-ca.pem", -+ TrustedCAFile: "/tmp/test-certs/trusted-ca.pem", -} -tlsConfig, err := tlsInfo.ClientConfig() -if err != nil { - panic(err) -} -``` - -### Server upgrade checklists - -#### Upgrade requirements - -To upgrade an existing etcd deployment to 3.4, the running cluster must be 3.3 or greater. If it's before 3.3, please [upgrade to 3.3](upgrade_3_3.md) before upgrading to 3.4. - -Also, to ensure a smooth rolling upgrade, the running cluster must be healthy. Check the health of the cluster by using the `etcdctl endpoint health` command before proceeding. - -#### Preparation - -Before upgrading etcd, always test the services relying on etcd in a staging environment before deploying the upgrade to the production environment. - -Before beginning, [backup the etcd data](../op-guide/maintenance.md#snapshot-backup). Should something go wrong with the upgrade, it is possible to use this backup to [downgrade](#downgrade) back to existing etcd version. Please note that the `snapshot` command only backs up the v3 data. For v2 data, see [backing up v2 datastore](../v2/admin_guide.md#backing-up-the-datastore). - -#### Mixed versions - -While upgrading, an etcd cluster supports mixed versions of etcd members, and operates with the protocol of the lowest common version. The cluster is only considered upgraded once all of its members are upgraded to version 3.4. Internally, etcd members negotiate with each other to determine the overall cluster version, which controls the reported version and the supported features. - -#### Limitations - -Note: If the cluster only has v3 data and no v2 data, it is not subject to this limitation. - -If the cluster is serving a v2 data set larger than 50MB, each newly upgraded member may take up to two minutes to catch up with the existing cluster. Check the size of a recent snapshot to estimate the total data size. In other words, it is safest to wait for 2 minutes between upgrading each member. - -For a much larger total data size, 100MB or more , this one-time process might take even more time. Administrators of very large etcd clusters of this magnitude can feel free to contact the [etcd team][etcd-contact] before upgrading, and we'll be happy to provide advice on the procedure. - -#### Downgrade - -If all members have been upgraded to v3.4, the cluster will be upgraded to v3.4, and downgrade from this completed state is **not possible**. If any single member is still v3.3, however, the cluster and its operations remains "v3.3", and it is possible from this mixed cluster state to return to using a v3.3 etcd binary on all members. - -Please [backup the data directory](../op-guide/maintenance.md#snapshot-backup) of all etcd members to make downgrading the cluster possible even after it has been completely upgraded. - -### Upgrade procedure - -This example shows how to upgrade a 3-member v3.3 ectd cluster running on a local machine. - -#### 1. Check upgrade requirements - -Is the cluster healthy and running v3.3.x? - -``` -$ ETCDCTL_API=3 etcdctl endpoint health --endpoints=localhost:2379,localhost:22379,localhost:32379 -localhost:2379 is healthy: successfully committed proposal: took = 6.600684ms -localhost:22379 is healthy: successfully committed proposal: took = 8.540064ms -localhost:32379 is healthy: successfully committed proposal: took = 8.763432ms - -$ curl http://localhost:2379/version -{"etcdserver":"3.3.0","etcdcluster":"3.3.0"} -``` - -#### 2. Stop the existing etcd process - -When each etcd process is stopped, expected errors will be logged by other cluster members. This is normal since a cluster member connection has been (temporarily) broken: - -``` -14:13:31.491746 I | raft: c89feb932daef420 [term 3] received MsgTimeoutNow from 6d4f535bae3ab960 and starts an election to get leadership. -14:13:31.491769 I | raft: c89feb932daef420 became candidate at term 4 -14:13:31.491788 I | raft: c89feb932daef420 received MsgVoteResp from c89feb932daef420 at term 4 -14:13:31.491797 I | raft: c89feb932daef420 [logterm: 3, index: 9] sent MsgVote request to 6d4f535bae3ab960 at term 4 -14:13:31.491805 I | raft: c89feb932daef420 [logterm: 3, index: 9] sent MsgVote request to 9eda174c7df8a033 at term 4 -14:13:31.491815 I | raft: raft.node: c89feb932daef420 lost leader 6d4f535bae3ab960 at term 4 -14:13:31.524084 I | raft: c89feb932daef420 received MsgVoteResp from 6d4f535bae3ab960 at term 4 -14:13:31.524108 I | raft: c89feb932daef420 [quorum:2] has received 2 MsgVoteResp votes and 0 vote rejections -14:13:31.524123 I | raft: c89feb932daef420 became leader at term 4 -14:13:31.524136 I | raft: raft.node: c89feb932daef420 elected leader c89feb932daef420 at term 4 -14:13:31.592650 W | rafthttp: lost the TCP streaming connection with peer 6d4f535bae3ab960 (stream MsgApp v2 reader) -14:13:31.592825 W | rafthttp: lost the TCP streaming connection with peer 6d4f535bae3ab960 (stream Message reader) -14:13:31.693275 E | rafthttp: failed to dial 6d4f535bae3ab960 on stream Message (dial tcp [::1]:2380: getsockopt: connection refused) -14:13:31.693289 I | rafthttp: peer 6d4f535bae3ab960 became inactive -14:13:31.936678 W | rafthttp: lost the TCP streaming connection with peer 6d4f535bae3ab960 (stream Message writer) -``` - -It's a good idea at this point to [backup the etcd data](../op-guide/maintenance.md#snapshot-backup) to provide a downgrade path should any problems occur: - -``` -$ etcdctl snapshot save backup.db -``` - -#### 3. Drop-in etcd v3.4 binary and start the new etcd process - -The new v3.4 etcd will publish its information to the cluster: - -``` -14:14:25.363225 I | etcdserver: published {Name:s1 ClientURLs:[http://localhost:2379]} to cluster a9ededbffcb1b1f1 -``` - -Verify that each member, and then the entire cluster, becomes healthy with the new v3.4 etcd binary: - -``` -$ ETCDCTL_API=3 /etcdctl endpoint health --endpoints=localhost:2379,localhost:22379,localhost:32379 -localhost:22379 is healthy: successfully committed proposal: took = 5.540129ms -localhost:32379 is healthy: successfully committed proposal: took = 7.321771ms -localhost:2379 is healthy: successfully committed proposal: took = 10.629901ms -``` - -Upgraded members will log warnings like the following until the entire cluster is upgraded. This is expected and will cease after all etcd cluster members are upgraded to v3.4: - -``` -14:15:17.071804 W | etcdserver: member c89feb932daef420 has a higher version 3.4.0 -14:15:21.073110 W | etcdserver: the local etcd version 3.3.0 is not up-to-date -14:15:21.073142 W | etcdserver: member 6d4f535bae3ab960 has a higher version 3.4.0 -14:15:21.073157 W | etcdserver: the local etcd version 3.3.0 is not up-to-date -14:15:21.073164 W | etcdserver: member c89feb932daef420 has a higher version 3.4.0 -``` - -#### 4. Repeat step 2 to step 3 for all other members - -#### 5. Finish - -When all members are upgraded, the cluster will report upgrading to 3.4 successfully: - -``` -14:15:54.536901 N | etcdserver/membership: updated the cluster version from 3.3 to 3.4 -14:15:54.537035 I | etcdserver/api: enabled capabilities for version 3.4 -``` - -``` -$ ETCDCTL_API=3 /etcdctl endpoint health --endpoints=localhost:2379,localhost:22379,localhost:32379 -localhost:2379 is healthy: successfully committed proposal: took = 2.312897ms -localhost:22379 is healthy: successfully committed proposal: took = 2.553476ms -localhost:32379 is healthy: successfully committed proposal: took = 2.517902ms -``` - -[etcd-contact]: https://groups.google.com/forum/#!forum/etcd-dev \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_5.md b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_5.md new file mode 100644 index 000000000..291916404 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Documentation/upgrades/upgrade_3_5.md @@ -0,0 +1,343 @@ +--- +title: Upgrade etcd from 3.4 to 3.5 +--- + +In the general case, upgrading from etcd 3.4 to 3.5 can be a zero-downtime, rolling upgrade: + - one by one, stop the etcd v3.4 processes and replace them with etcd v3.5 processes + - after running all v3.5 processes, new features in v3.5 are available to the cluster + +Before [starting an upgrade](#upgrade-procedure), read through the rest of this guide to prepare. + + + +### Upgrade checklists + +**NOTE:** When [migrating from v2 with no v3 data](https://github.com/etcd-io/etcd/issues/9480), etcd server v3.2+ panics when etcd restores from existing snapshots but no v3 `ETCD_DATA_DIR/member/snap/db` file. This happens when the server had migrated from v2 with no previous v3 data. This also prevents accidental v3 data loss (e.g. `db` file might have been moved). etcd requires that post v3 migration can only happen with v3 data. Do not upgrade to newer v3 versions until v3.0 server contains v3 data. + +Highlighted breaking changes in 3.5. + +#### Deprecate `etcd_debugging_mvcc_db_total_size_in_bytes` Prometheus metrics + +v3.4 promoted `etcd_debugging_mvcc_db_total_size_in_bytes` Prometheus metrics to `etcd_mvcc_db_total_size_in_bytes`, in order to encourage etcd storage monitoring. And v3.5 completely deprcates `etcd_debugging_mvcc_db_total_size_in_bytes`. + +```diff +-etcd_debugging_mvcc_db_total_size_in_bytes ++etcd_mvcc_db_total_size_in_bytes +``` + +Note that `etcd_debugging_*` namespace metrics have been marked as experimental. As we improve monitoring guide, we will promote more metrics. + +#### Deprecated in `etcd --logger capnslog` + +v3.4 defaults to `--logger=zap` in order to support multiple log outputs and structured logging. + +**`etcd --logger=capnslog` has been deprecated in v3.5**, and now `--logger=zap` is the default. + +```diff +-etcd --logger=capnslog ++etcd --logger=zap --log-outputs=stderr + ++# to write logs to stderr and a.log file at the same time ++etcd --logger=zap --log-outputs=stderr,a.log +``` + +TODO(add more monitoring guides); v3.4 adds `etcd --logger=zap` support for structured logging and multiple log outputs. Main motivation is to promote automated etcd monitoring, rather than looking back server logs when it starts breaking. Future development will make etcd log as few as possible, and make etcd easier to monitor with metrics and alerts. **`etcd --logger=capnslog` will be deprecated in v3.5.** + +#### Deprecated in `etcd --log-output` + +v3.4 renamed [`etcd --log-output` to `--log-outputs`](https://github.com/etcd-io/etcd/pull/9624) to support multiple log outputs. + +**`etcd --log-output` has been deprecated in v3.5.** + +```diff +-etcd --log-output=stderr ++etcd --log-outputs=stderr +``` + +#### Deprecated `etcd --log-package-levels` + +**`etcd --log-package-levels` flag for `capnslog` has been deprecated.** + +Now, **`etcd --logger=zap`** is the default. + +```diff +-etcd --log-package-levels 'etcdmain=CRITICAL,etcdserver=DEBUG' ++etcd --logger=zap --log-outputs=stderr +``` + +#### Deprecated `[CLIENT-URL]/config/local/log` + +**`/config/local/log` endpoint is being deprecated in v3.5, as is `etcd --log-package-levels` flag.** + +```diff +-$ curl http://127.0.0.1:2379/config/local/log -XPUT -d '{"Level":"DEBUG"}' +-# debug logging enabled +``` + +#### Changed gRPC gateway HTTP endpoints (deprecated `/v3beta`) + +Before + +```bash +curl -L http://localhost:2379/v3beta/kv/put \ + -X POST -d '{"key": "Zm9v", "value": "YmFy"}' +``` + +After + +```bash +curl -L http://localhost:2379/v3/kv/put \ + -X POST -d '{"key": "Zm9v", "value": "YmFy"}' +``` + +`/v3beta` has been removed in 3.5 release. + + + +### Server upgrade checklists + +#### Upgrade requirements + +To upgrade an existing etcd deployment to 3.5, the running cluster must be 3.4 or greater. If it's before 3.4, please [upgrade to 3.4](upgrade_3_3.md) before upgrading to 3.5. + +Also, to ensure a smooth rolling upgrade, the running cluster must be healthy. Check the health of the cluster by using the `etcdctl endpoint health` command before proceeding. + +#### Preparation + +Before upgrading etcd, always test the services relying on etcd in a staging environment before deploying the upgrade to the production environment. + +Before beginning, [download the snapshot backup](../op-guide/maintenance.md#snapshot-backup). Should something go wrong with the upgrade, it is possible to use this backup to [downgrade](#downgrade) back to existing etcd version. Please note that the `snapshot` command only backs up the v3 data. For v2 data, see [backing up v2 datastore](../v2/admin_guide.md#backing-up-the-datastore). + +#### Mixed versions + +While upgrading, an etcd cluster supports mixed versions of etcd members, and operates with the protocol of the lowest common version. The cluster is only considered upgraded once all of its members are upgraded to version 3.5. Internally, etcd members negotiate with each other to determine the overall cluster version, which controls the reported version and the supported features. + +#### Limitations + +Note: If the cluster only has v3 data and no v2 data, it is not subject to this limitation. + +If the cluster is serving a v2 data set larger than 50MB, each newly upgraded member may take up to two minutes to catch up with the existing cluster. Check the size of a recent snapshot to estimate the total data size. In other words, it is safest to wait for 2 minutes between upgrading each member. + +For a much larger total data size, 100MB or more , this one-time process might take even more time. Administrators of very large etcd clusters of this magnitude can feel free to contact the [etcd team][etcd-contact] before upgrading, and we'll be happy to provide advice on the procedure. + +#### Downgrade + +If all members have been upgraded to v3.5, the cluster will be upgraded to v3.5, and downgrade from this completed state is **not possible**. If any single member is still v3.4, however, the cluster and its operations remains "v3.4", and it is possible from this mixed cluster state to return to using a v3.4 etcd binary on all members. + +Please [download the snapshot backup](../op-guide/maintenance.md#snapshot-backup) to make downgrading the cluster possible even after it has been completely upgraded. + +### Upgrade procedure + +This example shows how to upgrade a 3-member v3.4 ectd cluster running on a local machine. + +#### Step 1: check upgrade requirements + +Is the cluster healthy and running v3.4.x? + +```bash +etcdctl --endpoints=localhost:2379,localhost:22379,localhost:32379 endpoint health +<127.0.0.1:32380: use of closed network connection"} +{"level":"info","ts":1526587299.1778402,"caller":"rafthttp/stream.go:459","msg":"stopped stream reader with remote peer","stream-reader-type":"stream MsgApp v2","local-member-id":"7339c4e5e833c029","remote-peer-id":"b548c2511513015"} +{"level":"warn","ts":1526587299.1780295,"caller":"rafthttp/stream.go:436","msg":"lost TCP streaming connection with remote peer","stream-reader-type":"stream Message","local-member-id":"7339c4e5e833c029","remote-peer-id":"b548c2511513015","error":"read tcp 127.0.0.1:34634->127.0.0.1:32380: use of closed network connection"} +{"level":"info","ts":1526587299.1780987,"caller":"rafthttp/stream.go:459","msg":"stopped stream reader with remote peer","stream-reader-type":"stream Message","local-member-id":"7339c4e5e833c029","remote-peer-id":"b548c2511513015"} +{"level":"info","ts":1526587299.1781602,"caller":"rafthttp/peer.go:340","msg":"stopped remote peer","remote-peer-id":"b548c2511513015"} +{"level":"info","ts":1526587299.1781986,"caller":"rafthttp/peer.go:333","msg":"stopping remote peer","remote-peer-id":"729934363faa4a24"} +{"level":"warn","ts":1526587299.1802843,"caller":"rafthttp/stream.go:291","msg":"closed TCP streaming connection with remote peer","stream-writer-type":"stream MsgApp v2","remote-peer-id":"729934363faa4a24"} +{"level":"warn","ts":1526587299.1803446,"caller":"rafthttp/stream.go:301","msg":"stopped TCP streaming connection with remote peer","stream-writer-type":"stream MsgApp v2","remote-peer-id":"729934363faa4a24"} +{"level":"warn","ts":1526587299.1824749,"caller":"rafthttp/stream.go:291","msg":"closed TCP streaming connection with remote peer","stream-writer-type":"stream Message","remote-peer-id":"729934363faa4a24"} +{"level":"warn","ts":1526587299.18255,"caller":"rafthttp/stream.go:301","msg":"stopped TCP streaming connection with remote peer","stream-writer-type":"stream Message","remote-peer-id":"729934363faa4a24"} +{"level":"info","ts":1526587299.18261,"caller":"rafthttp/pipeline.go:86","msg":"stopped HTTP pipelining with remote peer","local-member-id":"7339c4e5e833c029","remote-peer-id":"729934363faa4a24"} +{"level":"warn","ts":1526587299.1827736,"caller":"rafthttp/stream.go:436","msg":"lost TCP streaming connection with remote peer","stream-reader-type":"stream MsgApp v2","local-member-id":"7339c4e5e833c029","remote-peer-id":"729934363faa4a24","error":"read tcp 127.0.0.1:51482->127.0.0.1:22380: use of closed network connection"} +{"level":"info","ts":1526587299.182845,"caller":"rafthttp/stream.go:459","msg":"stopped stream reader with remote peer","stream-reader-type":"stream MsgApp v2","local-member-id":"7339c4e5e833c029","remote-peer-id":"729934363faa4a24"} +{"level":"warn","ts":1526587299.1830168,"caller":"rafthttp/stream.go:436","msg":"lost TCP streaming connection with remote peer","stream-reader-type":"stream Message","local-member-id":"7339c4e5e833c029","remote-peer-id":"729934363faa4a24","error":"context canceled"} +{"level":"warn","ts":1526587299.1831107,"caller":"rafthttp/peer_status.go:65","msg":"peer became inactive","peer-id":"729934363faa4a24","error":"failed to read 729934363faa4a24 on stream Message (context canceled)"} +{"level":"info","ts":1526587299.1831737,"caller":"rafthttp/stream.go:459","msg":"stopped stream reader with remote peer","stream-reader-type":"stream Message","local-member-id":"7339c4e5e833c029","remote-peer-id":"729934363faa4a24"} +{"level":"info","ts":1526587299.1832306,"caller":"rafthttp/peer.go:340","msg":"stopped remote peer","remote-peer-id":"729934363faa4a24"} +{"level":"warn","ts":1526587299.1837125,"caller":"rafthttp/http.go:424","msg":"failed to find remote peer in cluster","local-member-id":"7339c4e5e833c029","remote-peer-id-stream-handler":"7339c4e5e833c029","remote-peer-id-from":"b548c2511513015","cluster-id":"7dee9ba76d59ed53"} +{"level":"warn","ts":1526587299.1840093,"caller":"rafthttp/http.go:424","msg":"failed to find remote peer in cluster","local-member-id":"7339c4e5e833c029","remote-peer-id-stream-handler":"7339c4e5e833c029","remote-peer-id-from":"b548c2511513015","cluster-id":"7dee9ba76d59ed53"} +{"level":"warn","ts":1526587299.1842315,"caller":"rafthttp/http.go:424","msg":"failed to find remote peer in cluster","local-member-id":"7339c4e5e833c029","remote-peer-id-stream-handler":"7339c4e5e833c029","remote-peer-id-from":"729934363faa4a24","cluster-id":"7dee9ba76d59ed53"} +{"level":"warn","ts":1526587299.1844475,"caller":"rafthttp/http.go:424","msg":"failed to find remote peer in cluster","local-member-id":"7339c4e5e833c029","remote-peer-id-stream-handler":"7339c4e5e833c029","remote-peer-id-from":"729934363faa4a24","cluster-id":"7dee9ba76d59ed53"} +{"level":"info","ts":1526587299.2056687,"caller":"embed/etcd.go:473","msg":"stopping serving peer traffic","address":"127.0.0.1:2380"} +{"level":"info","ts":1526587299.205819,"caller":"embed/etcd.go:480","msg":"stopped serving peer traffic","address":"127.0.0.1:2380"} +{"level":"info","ts":1526587299.2058413,"caller":"embed/etcd.go:289","msg":"closed etcd server","name":"s1","data-dir":"/tmp/etcd/s1","advertise-peer-urls":["http://localhost:2380"],"advertise-client-urls":["http://localhost:2379"]} +``` + +#### Step 4: restart the etcd server with same configuration + +Restart the etcd server with same configuration but with the new etcd binary. + +```diff +-etcd-old --name s1 \ ++etcd-new --name s1 \ + --data-dir /tmp/etcd/s1 \ + --listen-client-urls http://localhost:2379 \ + --advertise-client-urls http://localhost:2379 \ + --listen-peer-urls http://localhost:2380 \ + --initial-advertise-peer-urls http://localhost:2380 \ + --initial-cluster s1=http://localhost:2380,s2=http://localhost:22380,s3=http://localhost:32380 \ + --initial-cluster-token tkn \ + --initial-cluster-state new +``` + +The new v3.5 etcd will publish its information to the cluster. At this point, cluster still operates as v3.4 protocol, which is the lowest common version. + +> `{"level":"info","ts":1526586617.1647713,"caller":"membership/cluster.go:485","msg":"set initial cluster version","cluster-id":"7dee9ba76d59ed53","local-member-id":"7339c4e5e833c029","cluster-version":"3.0"}` + +> `{"level":"info","ts":1526586617.1648536,"caller":"api/capability.go:76","msg":"enabled capabilities for version","cluster-version":"3.0"}` + +> `{"level":"info","ts":1526586617.1649303,"caller":"membership/cluster.go:473","msg":"updated cluster version","cluster-id":"7dee9ba76d59ed53","local-member-id":"7339c4e5e833c029","from":"3.0","from":"3.4"}` + +> `{"level":"info","ts":1526586617.1649797,"caller":"api/capability.go:76","msg":"enabled capabilities for version","cluster-version":"3.4"}` + +> `{"level":"info","ts":1526586617.2107732,"caller":"etcdserver/server.go:1770","msg":"published local member to cluster through raft","local-member-id":"7339c4e5e833c029","local-member-attributes":"{Name:s1 ClientURLs:[http://localhost:2379]}","request-path":"/0/members/7339c4e5e833c029/attributes","cluster-id":"7dee9ba76d59ed53","publish-timeout":7}` + +Verify that each member, and then the entire cluster, becomes healthy with the new v3.5 etcd binary: + +```bash +etcdctl endpoint health --endpoints=localhost:2379,localhost:22379,localhost:32379 +< `{"level":"info","ts":1526586949.0920913,"caller":"api/capability.go:76","msg":"enabled capabilities for version","cluster-version":"3.5"}` +> `{"level":"info","ts":1526586949.0921566,"caller":"etcdserver/server.go:2272","msg":"cluster version is updated","cluster-version":"3.5"}` + +Member 2: + +> `{"level":"info","ts":1526586949.092117,"caller":"membership/cluster.go:473","msg":"updated cluster version","cluster-id":"7dee9ba76d59ed53","local-member-id":"729934363faa4a24","from":"3.4","from":"3.5"}` +> `{"level":"info","ts":1526586949.0923078,"caller":"api/capability.go:76","msg":"enabled capabilities for version","cluster-version":"3.5"}` + +Member 3: + +> `{"level":"info","ts":1526586949.0921423,"caller":"membership/cluster.go:473","msg":"updated cluster version","cluster-id":"7dee9ba76d59ed53","local-member-id":"b548c2511513015","from":"3.4","from":"3.5"}` +> `{"level":"info","ts":1526586949.0922918,"caller":"api/capability.go:76","msg":"enabled capabilities for version","cluster-version":"3.5"}` + + +```bash +endpoint health --endpoints=localhost:2379,localhost:22379,localhost:32379 +< backup.snap -``` - -Now, import the snapshot into your new cluster: - -``` -etcdctl --endpoint new_cluster.example.com import --snap backup.snap -``` - -If you have a large amount of data, you can specify more concurrent works to copy data in parallel by using `-c` flag. -If you have hidden keys to copy, you can use `--hidden` flag to specify. For example fleet uses `/_coreos.com/fleet` so to import those keys use `--hidden /_coreos.com`. - -And the data will quickly copy into the new cluster: - -``` -entering dir: / -entering dir: /foo -entering dir: /foo/bar -copying key: /foo/bar/1 1 -entering dir: / -entering dir: /foo2 -entering dir: /foo2/bar2 -copying key: /foo2/bar2/2 2 -``` diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/README.md b/vendor/github.com/coreos/etcd/Documentation/v2/README.md deleted file mode 100644 index 76e54ff64..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# Documentation - -etcd is a distributed key-value store designed to reliably and quickly preserve and provide access to critical data. It enables reliable distributed coordination through distributed locking, leader elections, and write barriers. An etcd cluster is intended for high availability and permanent data storage and retrieval. - -This is the etcd v2 documentation set. For more recent versions, please see the [etcd v3 guides][etcd-v3]. - -## Communicating with etcd v2 - -Reading and writing into the etcd keyspace is done via a simple, RESTful HTTP API, or using language-specific libraries that wrap the HTTP API with higher level primitives. - -### Reading and Writing - - - [Client API Documentation][api] - - [Libraries, Tools, and Language Bindings][libraries] - - [Admin API Documentation][admin-api] - - [Members API][members-api] - -### Security, Auth, Access control - - - [Security Model][security] - - [Auth and Security][auth_api] - - [Authentication Guide][authentication] - -## etcd v2 Cluster Administration - -Configuration values are distributed within the cluster for your applications to read. Values can be changed programmatically and smart applications can reconfigure automatically. You'll never again have to run a configuration management tool on every machine in order to change a single config value. - -### General Info - - - [etcd Proxies][proxy] - - [Production Users][production-users] - - [Admin Guide][admin_guide] - - [Configuration Flags][configuration] - - [Frequently Asked Questions][faq] - -### Initial Setup - - - [Tuning etcd Clusters][tuning] - - [Discovery Service Protocol][discovery_protocol] - - [Running etcd under Docker][docker_guide] - -### Live Reconfiguration - - - [Runtime Configuration][runtime-configuration] - -### Debugging etcd - - - [Metrics Collection][metrics] - - [Error Code][errorcode] - - [Reporting Bugs][reporting_bugs] - -### Migration - - - [Upgrade etcd to 2.3][upgrade_2_3] - - [Upgrade etcd to 2.2][upgrade_2_2] - - [Upgrade to etcd 2.1][upgrade_2_1] - - [Snapshot Migration (0.4.x to 2.x)][04_to_2_snapshot_migration] - - [Backward Compatibility][backward_compatibility] - - -[etcd-v3]: ../docs.md -[api]: api.md -[libraries]: libraries-and-tools.md -[admin-api]: other_apis.md -[members-api]: members_api.md -[security]: security.md -[auth_api]: auth_api.md -[authentication]: authentication.md -[proxy]: proxy.md -[production-users]: production-users.md -[admin_guide]: admin_guide.md -[configuration]: configuration.md -[faq]: faq.md -[tuning]: tuning.md -[discovery_protocol]: discovery_protocol.md -[docker_guide]: docker_guide.md -[runtime-configuration]: runtime-configuration.md -[metrics]: metrics.md -[errorcode]: errorcode.md -[reporting_bugs]: reporting_bugs.md -[upgrade_2_3]: upgrade_2_3.md -[upgrade_2_2]: upgrade_2_2.md -[upgrade_2_1]: upgrade_2_1.md -[04_to_2_snapshot_migration]: 04_to_2_snapshot_migration.md -[backward_compatibility]: backward_compatibility.md diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/admin_guide.md b/vendor/github.com/coreos/etcd/Documentation/v2/admin_guide.md deleted file mode 100644 index b09a2ffba..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/admin_guide.md +++ /dev/null @@ -1,317 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Administration - -## Data Directory - -### Lifecycle - -When first started, etcd stores its configuration into a data directory specified by the data-dir configuration parameter. -Configuration is stored in the write ahead log and includes: the local member ID, cluster ID, and initial cluster configuration. -The write ahead log and snapshot files are used during member operation and to recover after a restart. - -Having a dedicated disk to store wal files can improve the throughput and stabilize the cluster. -It is highly recommended to dedicate a wal disk and set `--wal-dir` to point to a directory on that device for a production cluster deployment. - -If a member’s data directory is ever lost or corrupted then the user should [remove][remove-a-member] the etcd member from the cluster using `etcdctl` tool. - -A user should avoid restarting an etcd member with a data directory from an out-of-date backup. -Using an out-of-date data directory can lead to inconsistency as the member had agreed to store information via raft then re-joins saying it needs that information again. -For maximum safety, if an etcd member suffers any sort of data corruption or loss, it must be removed from the cluster. -Once removed the member can be re-added with an empty data directory. - -### Contents - -The data directory has two sub-directories in it: - -1. wal: write ahead log files are stored here. For details see the [wal package documentation][wal-pkg] -2. snap: log snapshots are stored here. For details see the [snap package documentation][snap-pkg] - -If `--wal-dir` flag is set, etcd will write the write ahead log files to the specified directory instead of data directory. - -## Cluster Management - -### Lifecycle - -If you are spinning up multiple clusters for testing it is recommended that you specify a unique initial-cluster-token for the different clusters. -This can protect you from cluster corruption in case of mis-configuration because two members started with different cluster tokens will refuse members from each other. - -### Monitoring - -It is important to monitor your production etcd cluster for healthy information and runtime metrics. - -#### Health Monitoring - -At lowest level, etcd exposes health information via HTTP at `/health` in JSON format. If it returns `{"health":"true"}`, then the cluster is healthy. - -``` -$ curl -L http://127.0.0.1:2379/health - -{"health":"true"} -``` - -You can also use etcdctl to check the cluster-wide health information. It will contact all the members of the cluster and collect the health information for you. - -``` -$./etcdctl cluster-health -member 8211f1d0f64f3269 is healthy: got healthy result from http://127.0.0.1:12379 -member 91bc3c398fb3c146 is healthy: got healthy result from http://127.0.0.1:22379 -member fd422379fda50e48 is healthy: got healthy result from http://127.0.0.1:32379 -cluster is healthy -``` - -#### Runtime Metrics - -etcd uses [Prometheus][prometheus] for metrics reporting in the server. You can read more through the runtime metrics [doc][metrics]. - -### Debugging - -Debugging a distributed system can be difficult. etcd provides several ways to make debug -easier. - -#### Enabling Debug Logging - -When you want to debug etcd without stopping it, you can enable debug logging at runtime. -etcd exposes logging configuration at `/config/local/log`. - -``` -$ curl http://127.0.0.1:2379/config/local/log -XPUT -d '{"Level":"DEBUG"}' -$ # debug logging enabled -$ -$ curl http://127.0.0.1:2379/config/local/log -XPUT -d '{"Level":"INFO"}' -$ # debug logging disabled -``` - -#### Debugging Variables - -Debug variables are exposed for real-time debugging purposes. Developers who are familiar with etcd can utilize these variables to debug unexpected behavior. etcd exposes debug variables via HTTP at `/debug/vars` in JSON format. The debug variables contains -`cmdline`, `file_descriptor_limit`, `memstats` and `raft.status`. - -`cmdline` is the command line arguments passed into etcd. - -`file_descriptor_limit` is the max number of file descriptors etcd can utilize. - -`memstats` is explained in detail in the [Go runtime documentation][golang-memstats]. - -`raft.status` is useful when you want to debug low level raft issues if you are familiar with raft internals. In most cases, you do not need to check `raft.status`. - -```json -{ -"cmdline": ["./etcd"], -"file_descriptor_limit": 0, -"memstats": {"Alloc":4105744,"TotalAlloc":42337320,"Sys":12560632,"...":"..."}, -"raft.status": {"id":"ce2a822cea30bfca","term":5,"vote":"ce2a822cea30bfca","commit":23509,"lead":"ce2a822cea30bfca","raftState":"StateLeader","progress":{"ce2a822cea30bfca":{"match":23509,"next":23510,"state":"ProgressStateProbe"}}} -} -``` - -### Optimal Cluster Size - -The recommended etcd cluster size is 3, 5 or 7, which is decided by the fault tolerance requirement. A 7-member cluster can provide enough fault tolerance in most cases. While larger cluster provides better fault tolerance the write performance reduces since data needs to be replicated to more machines. - -#### Fault Tolerance Table - -It is recommended to have an odd number of members in a cluster. Having an odd cluster size doesn't change the number needed for majority, but you gain a higher tolerance for failure by adding the extra member. You can see this in practice when comparing even and odd sized clusters: - -| Cluster Size | Majority | Failure Tolerance | -|--------------|------------|-------------------| -| 1 | 1 | 0 | -| 2 | 2 | 0 | -| 3 | 2 | **1** | -| 4 | 3 | 1 | -| 5 | 3 | **2** | -| 6 | 4 | 2 | -| 7 | 4 | **3** | -| 8 | 5 | 3 | -| 9 | 5 | **4** | - -As you can see, adding another member to bring the size of cluster up to an odd size is always worth it. During a network partition, an odd number of members also guarantees that there will almost always be a majority of the cluster that can continue to operate and be the source of truth when the partition ends. - -#### Changing Cluster Size - -After your cluster is up and running, adding or removing members is done via [runtime reconfiguration][runtime-reconfig], which allows the cluster to be modified without downtime. The `etcdctl` tool has `member list`, `member add` and `member remove` commands to complete this process. - -### Member Migration - -When there is a scheduled machine maintenance or retirement, you might want to migrate an etcd member to another machine without losing the data and changing the member ID. - -The data directory contains all the data to recover a member to its point-in-time state. To migrate a member: - -* Stop the member process. -* Copy the data directory of the now-idle member to the new machine. -* Update the peer URLs for the replaced member to reflect the new machine according to the [runtime reconfiguration instructions][update-a-member]. -* Start etcd on the new machine, using the same configuration and the copy of the data directory. - -This example will walk you through the process of migrating the infra1 member to a new machine: - -|Name|Peer URL| -|------|--------------| -|infra0|10.0.1.10:2380| -|infra1|10.0.1.11:2380| -|infra2|10.0.1.12:2380| - -```sh -$ export ETCDCTL_ENDPOINT=http://10.0.1.10:2379,http://10.0.1.11:2379,http://10.0.1.12:2379 -``` - -```sh -$ etcdctl member list -84194f7c5edd8b37: name=infra0 peerURLs=http://10.0.1.10:2380 clientURLs=http://127.0.0.1:2379,http://10.0.1.10:2379 -b4db3bf5e495e255: name=infra1 peerURLs=http://10.0.1.11:2380 clientURLs=http://127.0.0.1:2379,http://10.0.1.11:2379 -bc1083c870280d44: name=infra2 peerURLs=http://10.0.1.12:2380 clientURLs=http://127.0.0.1:2379,http://10.0.1.12:2379 -``` - -#### Stop the member etcd process - -```sh -$ ssh 10.0.1.11 -``` - -```sh -$ kill `pgrep etcd` -``` - -#### Copy the data directory of the now-idle member to the new machine - -``` -$ tar -cvzf infra1.etcd.tar.gz %data_dir% -``` - -```sh -$ scp infra1.etcd.tar.gz 10.0.1.13:~/ -``` - -#### Update the peer URLs for that member to reflect the new machine - -```sh -$ curl http://10.0.1.10:2379/v2/members/b4db3bf5e495e255 -XPUT \ --H "Content-Type: application/json" -d '{"peerURLs":["http://10.0.1.13:2380"]}' -``` - -Or use `etcdctl member update` command - -```sh -$ etcdctl member update b4db3bf5e495e255 http://10.0.1.13:2380 -``` - -#### Start etcd on the new machine, using the same configuration and the copy of the data directory - -```sh -$ ssh 10.0.1.13 -``` - -```sh -$ tar -xzvf infra1.etcd.tar.gz -C %data_dir% -``` - -``` -etcd -name infra1 \ --listen-peer-urls http://10.0.1.13:2380 \ --listen-client-urls http://10.0.1.13:2379,http://127.0.0.1:2379 \ --advertise-client-urls http://10.0.1.13:2379,http://127.0.0.1:2379 -``` - -### Disaster Recovery - -etcd is designed to be resilient to machine failures. An etcd cluster can automatically recover from any number of temporary failures (for example, machine reboots), and a cluster of N members can tolerate up to _(N-1)/2_ permanent failures (where a member can no longer access the cluster, due to hardware failure or disk corruption). However, in extreme circumstances, a cluster might permanently lose enough members such that quorum is irrevocably lost. For example, if a three-node cluster suffered two simultaneous and unrecoverable machine failures, it would be normally impossible for the cluster to restore quorum and continue functioning. - -To recover from such scenarios, etcd provides functionality to backup and restore the datastore and recreate the cluster without data loss. - -#### Backing up the datastore - -**Note:** Windows users must stop etcd before running the backup command. - -The first step of the recovery is to backup the data directory and wal directory, if stored separately, on a functioning etcd node. To do this, use the `etcdctl backup` command, passing in the original data (and wal) directory used by etcd. For example: - -```sh - etcdctl backup \ - --data-dir %data_dir% \ - [--wal-dir %wal_dir%] \ - --backup-dir %backup_data_dir% - [--backup-wal-dir %backup_wal_dir%] -``` - -This command will rewrite some of the metadata contained in the backup (specifically, the node ID and cluster ID), which means that the node will lose its former identity. In order to recreate a cluster from the backup, you will need to start a new, single-node cluster. The metadata is rewritten to prevent the new node from inadvertently being joined onto an existing cluster. - -#### Restoring a backup - -To restore a backup using the procedure created above, start etcd with the `-force-new-cluster` option and pointing to the backup directory. This will initialize a new, single-member cluster with the default advertised peer URLs, but preserve the entire contents of the etcd data store. Continuing from the previous example: - -```sh - etcd \ - -data-dir=%backup_data_dir% \ - [-wal-dir=%backup_wal_dir%] \ - -force-new-cluster \ - ... -``` - -Now etcd should be available on this node and serving the original datastore. - -Once you have verified that etcd has started successfully, shut it down and move the data and wal, if stored separately, back to the previous location (you may wish to make another copy as well to be safe): - -```sh - pkill etcd - rm -fr %data_dir% - rm -fr %wal_dir% - mv %backup_data_dir% %data_dir% - mv %backup_wal_dir% %wal_dir% - etcd \ - -data-dir=%data_dir% \ - [-wal-dir=%wal_dir%] \ - ... -``` - -#### Restoring the cluster - -Now that the node is running successfully, [change its advertised peer URLs][update-a-member], as the `--force-new-cluster` option has set the peer URL to the default listening on localhost. - -You can then add more nodes to the cluster and restore resiliency. See the [add a new member][add-a-member] guide for more details. - -**Note:** If you are trying to restore your cluster using old failed etcd nodes, please make sure you have stopped old etcd instances and removed their old data directories specified by the data-dir configuration parameter. - -### Client Request Timeout - -etcd sets different timeouts for various types of client requests. The timeout value is not tunable now, which will be improved soon (https://github.com/coreos/etcd/issues/2038). - -#### Get requests - -Timeout is not set for get requests, because etcd serves the result locally in a non-blocking way. - -**Note**: QuorumGet request is a different type, which is mentioned in the following sections. - -#### Watch requests - -Timeout is not set for watch requests. etcd will not stop a watch request until client cancels it, or the connection is broken. - -#### Delete, Put, Post, QuorumGet requests - -The default timeout is 5 seconds. It should be large enough to allow all key modifications if the majority of cluster is functioning. - -If the request times out, it indicates two possibilities: - -1. the server the request sent to was not functioning at that time. -2. the majority of the cluster is not functioning. - -If timeout happens several times continuously, administrators should check status of cluster and resolve it as soon as possible. - -### Best Practices - -#### Maximum OS threads - -By default, etcd uses the default configuration of the Go 1.4 runtime, which means that at most one operating system thread will be used to execute code simultaneously. (Note that this default behavior [has changed in Go 1.5][golang1.5-runtime]). - -When using etcd in heavy-load scenarios on machines with multiple cores it will usually be desirable to increase the number of threads that etcd can utilize. To do this, simply set the environment variable GOMAXPROCS to the desired number when starting etcd. For more information on this variable, see the [Go runtime documentation][golang-runtime]. - -[add-a-member]: runtime-configuration.md#add-a-new-member -[golang1.5-runtime]: https://golang.org/doc/go1.5#runtime -[golang-memstats]: https://golang.org/pkg/runtime/#MemStats -[golang-runtime]: https://golang.org/pkg/runtime -[metrics]: metrics.md -[prometheus]: http://prometheus.io/ -[remove-a-member]: runtime-configuration.md#remove-a-member -[runtime-reconfig]: runtime-configuration.md#cluster-reconfiguration-operations -[snap-pkg]: http://godoc.org/github.com/coreos/etcd/snap -[update-a-member]: runtime-configuration.md#update-a-member -[wal-pkg]: http://godoc.org/github.com/coreos/etcd/wal diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/api.md b/vendor/github.com/coreos/etcd/Documentation/v2/api.md deleted file mode 100644 index 367873df0..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/api.md +++ /dev/null @@ -1,1155 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# etcd API - -## Running a Single Machine Cluster - -These examples will use a single member cluster to show you the basics of the etcd REST API. -Let's start etcd: - -```sh -./bin/etcd -``` - -This will bring up etcd listening on the IANA assigned ports and listening on localhost. -The IANA assigned ports for etcd are 2379 for client communication and 2380 for server-to-server communication. - -## Getting the etcd version - -The etcd version of a specific instance can be obtained from the `/version` endpoint. - -```sh -curl -L http://127.0.0.1:2379/version -``` - -## Key Space Operations - -The primary API of etcd is a hierarchical key space. -The key space consists of directories and keys which are generically referred to as "nodes". - -### Setting the value of a key - -Let's set the first key-value pair in the datastore. -In this case the key is `/message` and the value is `Hello world`. - -```sh -curl http://127.0.0.1:2379/v2/keys/message -XPUT -d value="Hello world" -``` - -```json -{ - "action": "set", - "node": { - "createdIndex": 2, - "key": "/message", - "modifiedIndex": 2, - "value": "Hello world" - } -} -``` - -The response object contains several attributes: - -1. `action`: the action of the request that was just made. -The request attempted to modify `node.value` via a `PUT` HTTP request, thus the value of action is `set`. - -2. `node.key`: the HTTP path to which the request was made. -We set `/message` to `Hello world`, so the key field is `/message`. -etcd uses a file-system-like structure to represent the key-value pairs, therefore all keys start with `/`. - -3. `node.value`: the value of the key after resolving the request. -In this case, a successful request was made that attempted to change the node's value to `Hello world`. - -4. `node.createdIndex`: an index is a unique, monotonically-incrementing integer created for each change to etcd. -This specific index reflects the point in the etcd state member at which a given key was created. -You may notice that in this example the index is `2` even though it is the first request you sent to the server. -This is because there are internal commands that also change the state behind the scenes, like adding and syncing servers. - -5. `node.modifiedIndex`: like `node.createdIndex`, this attribute is also an etcd index. -Actions that cause the value to change include `set`, `delete`, `update`, `create`, `compareAndSwap` and `compareAndDelete`. -Since the `get` and `watch` commands do not change state in the store, they do not change the value of `node.modifiedIndex`. - - -### Response Headers - -etcd includes a few HTTP headers in responses that provide global information about the etcd cluster that serviced a request: - -``` -X-Etcd-Index: 35 -X-Raft-Index: 5398 -X-Raft-Term: 1 -``` - -* `X-Etcd-Index` is the current etcd index as explained above. When request is a watch on key space, `X-Etcd-Index` is the current etcd index when the watch starts, which means that the watched event may happen after `X-Etcd-Index`. -* `X-Raft-Index` is similar to the etcd index but is for the underlying raft protocol. -* `X-Raft-Term` is an integer that will increase whenever an etcd master election happens in the cluster. If this number is increasing rapidly, you may need to tune the election timeout. See the [tuning][tuning] section for details. - -### Get the value of a key - -We can get the value that we just set in `/message` by issuing a `GET` request: - -```sh -curl http://127.0.0.1:2379/v2/keys/message -``` - -```json -{ - "action": "get", - "node": { - "createdIndex": 2, - "key": "/message", - "modifiedIndex": 2, - "value": "Hello world" - } -} -``` - - -### Changing the value of a key - -You can change the value of `/message` from `Hello world` to `Hello etcd` with another `PUT` request to the key: - -```sh -curl http://127.0.0.1:2379/v2/keys/message -XPUT -d value="Hello etcd" -``` - -```json -{ - "action": "set", - "node": { - "createdIndex": 3, - "key": "/message", - "modifiedIndex": 3, - "value": "Hello etcd" - }, - "prevNode": { - "createdIndex": 2, - "key": "/message", - "value": "Hello world", - "modifiedIndex": 2 - } -} -``` - -Here we introduce a new field: `prevNode`. The `prevNode` field represents what the state of a given node was before resolving the request at hand. The `prevNode` field follows the same format as the `node`, and is omitted in the event that there was no previous state for a given node. - -### Deleting a key - -You can remove the `/message` key with a `DELETE` request: - -```sh -curl http://127.0.0.1:2379/v2/keys/message -XDELETE -``` - -```json -{ - "action": "delete", - "node": { - "createdIndex": 3, - "key": "/message", - "modifiedIndex": 4 - }, - "prevNode": { - "key": "/message", - "value": "Hello etcd", - "modifiedIndex": 3, - "createdIndex": 3 - } -} -``` - - -### Using key TTL - -Keys in etcd can be set to expire after a specified number of seconds. -You can do this by setting a TTL (time to live) on the key when sending a `PUT` request: - -```sh -curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -d ttl=5 -``` - -```json -{ - "action": "set", - "node": { - "createdIndex": 5, - "expiration": "2013-12-04T12:01:21.874888581-08:00", - "key": "/foo", - "modifiedIndex": 5, - "ttl": 5, - "value": "bar" - } -} -``` - -Note the two new fields in response: - -1. The `expiration` is the time at which this key will expire and be deleted. - -2. The `ttl` is the specified time to live for the key, in seconds. - -_NOTE_: Keys can only be expired by a cluster leader, so if a member gets disconnected from the cluster, its keys will not expire until it rejoins. - -Now you can try to get the key by sending a `GET` request: - -```sh -curl http://127.0.0.1:2379/v2/keys/foo -``` - -If the TTL has expired, the key will have been deleted, and you will be returned a 100. - -```json -{ - "cause": "/foo", - "errorCode": 100, - "index": 6, - "message": "Key not found" -} -``` - -The TTL can be unset to avoid expiration through update operation: - -```sh -curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -d ttl= -d prevExist=true -``` - -```json -{ - "action": "update", - "node": { - "createdIndex": 5, - "key": "/foo", - "modifiedIndex": 6, - "value": "bar" - }, - "prevNode": { - "createdIndex": 5, - "expiration": "2013-12-04T12:01:21.874888581-08:00", - "key": "/foo", - "modifiedIndex": 5, - "ttl": 3, - "value": "bar" - } -} -``` - -### Refreshing key TTL - -Keys in etcd can be refreshed without notifying current watchers. - -This can be achieved by setting the refresh to true when updating a TTL. - -You cannot update the value of a key when refreshing it. - -```sh -curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -d ttl=5 -curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d ttl=5 -d refresh=true -d prevExist=true -``` - -```json -{ - "action": "set", - "node": { - "createdIndex": 5, - "expiration": "2013-12-04T12:01:21.874888581-08:00", - "key": "/foo", - "modifiedIndex": 5, - "ttl": 5, - "value": "bar" - } -} -{ - "action":"update", - "node":{ - "key":"/foo", - "value":"bar", - "expiration": "2013-12-04T12:01:26.874888581-08:00", - "ttl":5, - "modifiedIndex":6, - "createdIndex":5 - }, - "prevNode":{ - "key":"/foo", - "value":"bar", - "expiration":"2013-12-04T12:01:21.874888581-08:00", - "ttl":3, - "modifiedIndex":5, - "createdIndex":5 - } -} -``` - -### Waiting for a change - -We can watch for a change on a key and receive a notification by using long polling. -This also works for child keys by passing `recursive=true` in curl. - -In one terminal, we send a `GET` with `wait=true` : - -```sh -curl http://127.0.0.1:2379/v2/keys/foo?wait=true -``` - -Now we are waiting for any changes at path `/foo`. - -In another terminal, we set a key `/foo` with value `bar`: - -```sh -curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -``` - -The first terminal should get the notification and return with the same response as the set request: - -```json -{ - "action": "set", - "node": { - "createdIndex": 7, - "key": "/foo", - "modifiedIndex": 7, - "value": "bar" - }, - "prevNode": { - "createdIndex": 6, - "key": "/foo", - "modifiedIndex": 6, - "value": "bar" - } -} -``` - -However, the watch command can do more than this. -Using the index, we can watch for commands that have happened in the past. -This is useful for ensuring you don't miss events between watch commands. -Typically, we watch again from the `modifiedIndex` + 1 of the node we got. - -Let's try to watch for the set command of index 7 again: - -```sh -curl 'http://127.0.0.1:2379/v2/keys/foo?wait=true&waitIndex=7' -``` - -The watch command returns immediately with the same response as previously. - -If we were to restart the watch from index 8 with: - -```sh -curl 'http://127.0.0.1:2379/v2/keys/foo?wait=true&waitIndex=8' -``` - -Then even if etcd is on index 9 or 800, the first event to occur to the `/foo` -key between 8 and the current index will be returned. - -**Note**: etcd only keeps the responses of the most recent 1000 events across all etcd keys. -It is recommended to send the response to another thread to process immediately -instead of blocking the watch while processing the result. - -#### Watch from cleared event index - -If we miss all the 1000 events, we need to recover the current state of the -watching key space through a get and then start to watch from the -`X-Etcd-Index` + 1. - -For example, we set `/other="bar"` for 2000 times and try to wait from index 8. - -```sh -curl 'http://127.0.0.1:2379/v2/keys/foo?wait=true&waitIndex=8' -``` - -We get the index is outdated response, since we miss the 1000 events kept in etcd. - -``` -{"errorCode":401,"message":"The event in requested index is outdated and cleared","cause":"the requested history has been cleared [1008/8]","index":2007} -``` - -To start watch, first we need to fetch the current state of key `/foo`: - -```sh -curl 'http://127.0.0.1:2379/v2/keys/foo' -vv -``` - -``` -< HTTP/1.1 200 OK -< Content-Type: application/json -< X-Etcd-Cluster-Id: 7e27652122e8b2ae -< X-Etcd-Index: 2007 -< X-Raft-Index: 2615 -< X-Raft-Term: 2 -< Date: Mon, 05 Jan 2015 18:54:43 GMT -< Transfer-Encoding: chunked -< -{"action":"get","node":{"key":"/foo","value":"bar","modifiedIndex":7,"createdIndex":7}} -``` - -Unlike watches we use the `X-Etcd-Index` + 1 of the response as a `waitIndex` -instead of the node's `modifiedIndex` + 1 for two reasons: - -1. The `X-Etcd-Index` is always greater than or equal to the `modifiedIndex` when - getting a key because `X-Etcd-Index` is the current etcd index, and the `modifiedIndex` - is the index of an event already stored in etcd. -2. None of the events represented by indexes between `modifiedIndex` and - `X-Etcd-Index` will be related to the key being fetched. - -Using the `modifiedIndex` + 1 is functionally equivalent for subsequent -watches, but since it is smaller than the `X-Etcd-Index` + 1, we may receive a -`401 EventIndexCleared` error immediately. - -So the first watch after the get should be: - -```sh -curl 'http://127.0.0.1:2379/v2/keys/foo?wait=true&waitIndex=2008' -``` - -#### Connection being closed prematurely - -The server may close a long polling connection before emitting any events. -This can happen due to a timeout or the server being shutdown. -Since the HTTP header is sent immediately upon accepting the connection, the response will be seen as empty: `200 OK` and empty body. -The clients should be prepared to deal with this scenario and retry the watch. - -### Atomically Creating In-Order Keys - -Using `POST` on a directory, you can create keys with key names that are created in-order. -This can be used in a variety of useful patterns, like implementing queues of keys which need to be processed in strict order. -An example use case would be ensuring clients get fair access to a mutex. - -Creating an in-order key is easy: - -```sh -curl http://127.0.0.1:2379/v2/keys/queue -XPOST -d value=Job1 -``` - -```json -{ - "action": "create", - "node": { - "createdIndex": 6, - "key": "/queue/00000000000000000006", - "modifiedIndex": 6, - "value": "Job1" - } -} -``` - -If you create another entry some time later, it is guaranteed to have a key name that is greater than the previous key. -Also note the key names use the global etcd index, so the next key can be more than `previous + 1`. - -```sh -curl http://127.0.0.1:2379/v2/keys/queue -XPOST -d value=Job2 -``` - -```json -{ - "action": "create", - "node": { - "createdIndex": 29, - "key": "/queue/00000000000000000029", - "modifiedIndex": 29, - "value": "Job2" - } -} -``` - -To enumerate the in-order keys as a sorted list, use the "sorted" parameter. - -```sh -curl -s 'http://127.0.0.1:2379/v2/keys/queue?recursive=true&sorted=true' -``` - -```json -{ - "action": "get", - "node": { - "createdIndex": 2, - "dir": true, - "key": "/queue", - "modifiedIndex": 2, - "nodes": [ - { - "createdIndex": 2, - "key": "/queue/00000000000000000002", - "modifiedIndex": 2, - "value": "Job1" - }, - { - "createdIndex": 3, - "key": "/queue/00000000000000000003", - "modifiedIndex": 3, - "value": "Job2" - } - ] - } -} -``` - - -### Using a directory TTL - -Like keys, directories in etcd can be set to expire after a specified number of seconds. -You can do this by setting a TTL (time to live) on a directory when it is created with a `PUT`: - -```sh -curl http://127.0.0.1:2379/v2/keys/dir -XPUT -d ttl=30 -d dir=true -``` - -```json -{ - "action": "set", - "node": { - "createdIndex": 17, - "dir": true, - "expiration": "2013-12-11T10:37:33.689275857-08:00", - "key": "/dir", - "modifiedIndex": 17, - "ttl": 30 - } -} -``` - -The directory's TTL can be refreshed by making an update. -You can do this by making a PUT with `prevExist=true` and a new TTL. - -```sh -curl http://127.0.0.1:2379/v2/keys/dir -XPUT -d ttl=30 -d dir=true -d prevExist=true -``` - -Keys that are under this directory work as usual, but when the directory expires, a watcher on a key under the directory will get an expire event: - -```sh -curl 'http://127.0.0.1:2379/v2/keys/dir?wait=true' -``` - -```json -{ - "action": "expire", - "node": { - "createdIndex": 8, - "key": "/dir", - "modifiedIndex": 15 - }, - "prevNode": { - "createdIndex": 8, - "key": "/dir", - "dir":true, - "modifiedIndex": 17, - "expiration": "2013-12-11T10:39:35.689275857-08:00" - } -} -``` - - -### Atomic Compare-and-Swap - -etcd can be used as a centralized coordination service in a cluster, and `CompareAndSwap` (CAS) is the most basic operation used to build a distributed lock service. - -This command will set the value of a key only if the client-provided conditions are equal to the current conditions. - -*Note that `CompareAndSwap` does not work with [directories][directories]. If an attempt is made to `CompareAndSwap` a directory, a 102 "Not a file" error will be returned.* - -The current comparable conditions are: - -1. `prevValue` - checks the previous value of the key. - -2. `prevIndex` - checks the previous modifiedIndex of the key. - -3. `prevExist` - checks existence of the key: if `prevExist` is true, it is an `update` request; if `prevExist` is `false`, it is a `create` request. - -Here is a simple example. -Let's create a key-value pair first: `foo=one`. - -```sh -curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=one -``` - -```json -{ - "action":"set", - "node":{ - "key":"/foo", - "value":"one", - "modifiedIndex":4, - "createdIndex":4 - } -} -``` - -Specifying `noValueOnSuccess` option skips returning the node as value. - -```sh -curl http://127.0.0.1:2379/v2/keys/foo?noValueOnSuccess=true -XPUT -d value=one -# {"action":"set"} -``` - -Now let's try some invalid `CompareAndSwap` commands. - -Trying to set this existing key with `prevExist=false` fails as expected: -```sh -curl http://127.0.0.1:2379/v2/keys/foo?prevExist=false -XPUT -d value=three -``` - -The error code explains the problem: - -```json -{ - "cause": "/foo", - "errorCode": 105, - "index": 39776, - "message": "Key already exists" -} -``` - -Now let's provide a `prevValue` parameter: - -```sh -curl http://127.0.0.1:2379/v2/keys/foo?prevValue=two -XPUT -d value=three -``` - -This will try to compare the previous value of the key and the previous value we provided. If they are equal, the value of the key will change to three. - -```json -{ - "cause": "[two != one]", - "errorCode": 101, - "index": 8, - "message": "Compare failed" -} -``` - -which means `CompareAndSwap` failed. `cause` explains why the test failed. -Note: the condition prevIndex=0 always passes. - -Let's try a valid condition: - -```sh -curl http://127.0.0.1:2379/v2/keys/foo?prevValue=one -XPUT -d value=two -``` - -The response should be: - -```json -{ - "action": "compareAndSwap", - "node": { - "createdIndex": 8, - "key": "/foo", - "modifiedIndex": 9, - "value": "two" - }, - "prevNode": { - "createdIndex": 8, - "key": "/foo", - "modifiedIndex": 8, - "value": "one" - } -} -``` - -We successfully changed the value from "one" to "two" since we gave the correct previous value. - -### Atomic Compare-and-Delete - -This command will delete a key only if the client-provided conditions are equal to the current conditions. - -*Note that `CompareAndDelete` does not work with [directories]. If an attempt is made to `CompareAndDelete` a directory, a 102 "Not a file" error will be returned.* - -The current comparable conditions are: - -1. `prevValue` - checks the previous value of the key. - -2. `prevIndex` - checks the previous modifiedIndex of the key. - -Here is a simple example. Let's first create a key: `foo=one`. - -```sh -curl http://127.0.0.1:2379/v2/keys/foo -XPUT -d value=one -``` - -Now let's try some `CompareAndDelete` commands. - -Trying to delete the key with `prevValue=two` fails as expected: -```sh -curl http://127.0.0.1:2379/v2/keys/foo?prevValue=two -XDELETE -``` - -The error code explains the problem: - -```json -{ - "errorCode": 101, - "message": "Compare failed", - "cause": "[two != one]", - "index": 8 -} -``` - -As does a `CompareAndDelete` with a mismatched `prevIndex`: - -```sh -curl http://127.0.0.1:2379/v2/keys/foo?prevIndex=1 -XDELETE -``` - -```json -{ - "errorCode": 101, - "message": "Compare failed", - "cause": "[1 != 8]", - "index": 8 -} -``` - -And now a valid `prevValue` condition: - -```sh -curl http://127.0.0.1:2379/v2/keys/foo?prevValue=one -XDELETE -``` - -The successful response will look something like: - -```json -{ - "action": "compareAndDelete", - "node": { - "key": "/foo", - "modifiedIndex": 9, - "createdIndex": 8 - }, - "prevNode": { - "key": "/foo", - "value": "one", - "modifiedIndex": 8, - "createdIndex": 8 - } -} -``` - -### Creating Directories - -In most cases, directories for a key are automatically created. -But there are cases where you will want to create a directory or remove one. - -Creating a directory is just like a key except you cannot provide a value and must add the `dir=true` parameter. - -```sh -curl http://127.0.0.1:2379/v2/keys/dir -XPUT -d dir=true -``` -```json -{ - "action": "set", - "node": { - "createdIndex": 30, - "dir": true, - "key": "/dir", - "modifiedIndex": 30 - } -} -``` - - -### Listing a directory - -In etcd we can store two types of things: keys and directories. -Keys store a single string value. -Directories store a set of keys and/or other directories. - -In this example, let's first create some keys: - -We already have `/foo=two` so now we'll create another one called `/foo_dir/foo` with the value of `bar`: - -```sh -curl http://127.0.0.1:2379/v2/keys/foo_dir/foo -XPUT -d value=bar -``` - -```json -{ - "action": "set", - "node": { - "createdIndex": 2, - "key": "/foo_dir/foo", - "modifiedIndex": 2, - "value": "bar" - } -} -``` - -Now we can list the keys under root `/`: - -```sh -curl http://127.0.0.1:2379/v2/keys/ -``` - -We should see the response as an array of items: - -```json -{ - "action": "get", - "node": { - "key": "/", - "dir": true, - "nodes": [ - { - "key": "/foo_dir", - "dir": true, - "modifiedIndex": 2, - "createdIndex": 2 - }, - { - "key": "/foo", - "value": "two", - "modifiedIndex": 1, - "createdIndex": 1 - } - ] - } -} -``` - -Here we can see `/foo` is a key-value pair under `/` and `/foo_dir` is a directory. -We can also recursively get all the contents under a directory by adding `recursive=true`. - -```sh -curl http://127.0.0.1:2379/v2/keys/?recursive=true -``` - -```json -{ - "action": "get", - "node": { - "key": "/", - "dir": true, - "nodes": [ - { - "key": "/foo_dir", - "dir": true, - "nodes": [ - { - "key": "/foo_dir/foo", - "value": "bar", - "modifiedIndex": 2, - "createdIndex": 2 - } - ], - "modifiedIndex": 2, - "createdIndex": 2 - }, - { - "key": "/foo", - "value": "two", - "modifiedIndex": 1, - "createdIndex": 1 - } - ] - } -} -``` - - -### Deleting a Directory - -Now let's try to delete the directory `/foo_dir`. - -You can remove an empty directory using the `DELETE` verb and the `dir=true` parameter. - -```sh -curl 'http://127.0.0.1:2379/v2/keys/foo_dir?dir=true' -XDELETE -``` -```json -{ - "action": "delete", - "node": { - "createdIndex": 30, - "dir": true, - "key": "/foo_dir", - "modifiedIndex": 31 - }, - "prevNode": { - "createdIndex": 30, - "key": "/foo_dir", - "dir": true, - "modifiedIndex": 30 - } -} -``` - -To delete a directory that holds keys, you must add `recursive=true`. - -```sh -curl http://127.0.0.1:2379/v2/keys/dir?recursive=true -XDELETE -``` - -```json -{ - "action": "delete", - "node": { - "createdIndex": 10, - "dir": true, - "key": "/dir", - "modifiedIndex": 11 - }, - "prevNode": { - "createdIndex": 10, - "dir": true, - "key": "/dir", - "modifiedIndex": 10 - } -} -``` - - -### Creating a hidden node - -We can create a hidden key-value pair or directory by add a `_` prefix. -The hidden item will not be listed when sending a `GET` request for a directory. - -First we'll add a hidden key named `/_message`: - -```sh -curl http://127.0.0.1:2379/v2/keys/_message -XPUT -d value="Hello hidden world" -``` - -```json -{ - "action": "set", - "node": { - "createdIndex": 3, - "key": "/_message", - "modifiedIndex": 3, - "value": "Hello hidden world" - } -} -``` - -Next we'll add a regular key named `/message`: - -```sh -curl http://127.0.0.1:2379/v2/keys/message -XPUT -d value="Hello world" -``` - -```json -{ - "action": "set", - "node": { - "createdIndex": 4, - "key": "/message", - "modifiedIndex": 4, - "value": "Hello world" - } -} -``` - -Now let's try to get a listing of keys under the root directory, `/`: - -```sh -curl http://127.0.0.1:2379/v2/keys/ -``` - -```json -{ - "action": "get", - "node": { - "dir": true, - "key": "/", - "nodes": [ - { - "createdIndex": 2, - "dir": true, - "key": "/foo_dir", - "modifiedIndex": 2 - }, - { - "createdIndex": 4, - "key": "/message", - "modifiedIndex": 4, - "value": "Hello world" - } - ] - } -} -``` - -Here we see the `/message` key but our hidden `/_message` key is not returned. - -### Setting a key from a file - -You can also use etcd to store small configuration files, JSON documents, XML documents, etc directly. -For example you can use curl to upload a simple text file and encode it: - -``` -echo "Hello\nWorld" > afile.txt -curl http://127.0.0.1:2379/v2/keys/afile -XPUT --data-urlencode value@afile.txt -``` - -```json -{ - "action": "get", - "node": { - "createdIndex": 2, - "key": "/afile", - "modifiedIndex": 2, - "value": "Hello\nWorld\n" - } -} -``` - -### Read Linearization - -If you want a read that is fully linearized you can use a `quorum=true` GET. -The read will take a very similar path to a write and will have a similar -speed. If you are unsure if you need this feature feel free to email etcd-dev -for advice. - -## Statistics - -An etcd cluster keeps track of a number of statistics including latency, bandwidth and uptime. -These are exposed via the statistics endpoint to understand the internal health of a cluster. - -### Leader Statistics - -The leader has a view of the entire cluster and keeps track of two interesting statistics: latency to each peer in the cluster, and the number of failed and successful Raft RPC requests. -You can grab these statistics from the `/v2/stats/leader` endpoint: - -```sh -curl http://127.0.0.1:2379/v2/stats/leader -``` - -```json -{ - "followers": { - "6e3bd23ae5f1eae0": { - "counts": { - "fail": 0, - "success": 745 - }, - "latency": { - "average": 0.017039507382550306, - "current": 0.000138, - "maximum": 1.007649, - "minimum": 0, - "standardDeviation": 0.05289178277920594 - } - }, - "a8266ecf031671f3": { - "counts": { - "fail": 0, - "success": 735 - }, - "latency": { - "average": 0.012124141496598642, - "current": 0.000559, - "maximum": 0.791547, - "minimum": 0, - "standardDeviation": 0.04187900156583733 - } - } - }, - "leader": "924e2e83e93f2560" -} -``` - - -### Self Statistics - -Each node keeps a number of internal statistics: - -- `id`: the unique identifier for the member -- `leaderInfo.leader`: id of the current leader member -- `leaderInfo.uptime`: amount of time the leader has been leader -- `name`: this member's name -- `recvAppendRequestCnt`: number of append requests this node has processed -- `recvBandwidthRate`: number of bytes per second this node is receiving (follower only) -- `recvPkgRate`: number of requests per second this node is receiving (follower only) -- `sendAppendRequestCnt`: number of requests that this node has sent -- `sendBandwidthRate`: number of bytes per second this node is sending (leader only). This value is undefined on single member clusters. -- `sendPkgRate`: number of requests per second this node is sending (leader only). This value is undefined on single member clusters. -- `state`: either leader or follower -- `startTime`: the time when this node was started - -This is an example response from a follower member: - -```sh -curl http://127.0.0.1:2379/v2/stats/self -``` - -```json -{ - "id": "eca0338f4ea31566", - "leaderInfo": { - "leader": "8a69d5f6b7814500", - "startTime": "2014-10-24T13:15:51.186620747-07:00", - "uptime": "10m59.322358947s" - }, - "name": "node3", - "recvAppendRequestCnt": 5944, - "recvBandwidthRate": 570.6254930219969, - "recvPkgRate": 9.00892789741075, - "sendAppendRequestCnt": 0, - "startTime": "2014-10-24T13:15:50.072007085-07:00", - "state": "StateFollower" -} -``` - -And this is an example response from a leader member: - -```sh -curl http://127.0.0.1:2379/v2/stats/self -``` - -```json -{ - "id": "924e2e83e93f2560", - "leaderInfo": { - "leader": "924e2e83e93f2560", - "startTime": "2015-02-09T11:38:30.177534688-08:00", - "uptime": "9m33.891343412s" - }, - "name": "infra3", - "recvAppendRequestCnt": 0, - "sendAppendRequestCnt": 6535, - "sendBandwidthRate": 824.1758351191694, - "sendPkgRate": 11.111234716807138, - "startTime": "2015-02-09T11:38:28.972034204-08:00", - "state": "StateLeader" -} -``` - - -### Store Statistics - -The store statistics include information about the operations that this node has handled. -Note that v2 `store Statistics` is stored in-memory. When a member stops, store statistics will reset on restart. - -Operations that modify the store's state like create, delete, set and update are seen by the entire cluster and the number will increase on all nodes. -Operations like get and watch are node local and will only be seen on this node. - -```sh -curl http://127.0.0.1:2379/v2/stats/store -``` - -```json -{ - "compareAndSwapFail": 0, - "compareAndSwapSuccess": 0, - "createFail": 0, - "createSuccess": 2, - "deleteFail": 0, - "deleteSuccess": 0, - "expireCount": 0, - "getsFail": 4, - "getsSuccess": 75, - "setsFail": 2, - "setsSuccess": 4, - "updateFail": 0, - "updateSuccess": 0, - "watchers": 0 -} -``` - -## Cluster Config - -See the [members API][members-api] for details on the cluster management. - -[directories]: #listing-a-directory -[members-api]: members_api.md -[tuning]: tuning.md diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/api_v3.md b/vendor/github.com/coreos/etcd/Documentation/v2/api_v3.md deleted file mode 100644 index e59a04e75..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/api_v3.md +++ /dev/null @@ -1,97 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# etcd3 API - -TODO: API doc - -## Data Model - -etcd is designed to reliably store infrequently updated data and provide reliable watch queries. etcd exposes previous versions of key-value pairs to support inexpensive snapshots and watch history events (“time travel queries”). A persistent, multi-version, concurrency-control data model is a good fit for these use cases. - -etcd stores data in a multiversion [persistent][persistent-ds] key-value store. The persistent key-value store preserves the previous version of a key-value pair when its value is superseded with new data. The key-value store is effectively immutable; its operations do not update the structure in-place, but instead always generates a new updated structure. All past versions of keys are still accessible and watchable after modification. To prevent the data store from growing indefinitely over time from maintaining old versions, the store may be compacted to shed the oldest versions of superseded data. - -### Logical View - -The store’s logical view is a flat binary key space. The key space has a lexically sorted index on byte string keys so range queries are inexpensive. - -The key space maintains multiple revisions. Each atomic mutative operation (e.g., a transaction operation may contain multiple operations) creates a new revision on the key space. All data held by previous revisions remains unchanged. Old versions of key can still be accessed through previous revisions. Likewise, revisions are indexed as well; ranging over revisions with watchers is efficient. If the store is compacted to recover space, revisions before the compact revision will be removed. - -A key’s lifetime spans a generation. Each key may have one or multiple generations. Creating a key increments the generation of that key, starting at 1 if the key never existed. Deleting a key generates a key tombstone, concluding the key’s current generation. Each modification of a key creates a new version of the key. Once a compaction happens, any generation ended before the given revision will be removed and values set before the compaction revision except the latest one will be removed. - -### Physical View - -etcd stores the physical data as key-value pairs in a persistent [b+tree][b+tree]. Each revision of the store’s state only contains the delta from its previous revision to be efficient. A single revision may correspond to multiple keys in the tree. - -The key of key-value pair is a 3-tuple (major, sub, type). Major is the store revision holding the key. Sub differentiates among keys within the same revision. Type is an optional suffix for special value (e.g., `t` if the value contains a tombstone). The value of the key-value pair contains the modification from previous revision, thus one delta from previous revision. The b+tree is ordered by key in lexical byte-order. Ranged lookups over revision deltas are fast; this enables quickly finding modifications from one specific revision to another. Compaction removes out-of-date keys-value pairs. - -etcd also keeps a secondary in-memory [btree][btree] index to speed up range queries over keys. The keys in the btree index are the keys of the store exposed to user. The value is a pointer to the modification of the persistent b+tree. Compaction removes dead pointers. - -## KV API Guarantees - -etcd is a consistent and durable key value store with mini-transaction(TODO: link to txn doc when we have it) support. The key value store is exposed through the KV APIs. etcd tries to ensure the strongest consistency and durability guarantees for a distributed system. This specification enumerates the KV API guarantees made by etcd. - -### APIs to consider - -* Read APIs - * range - * watch -* Write APIs - * put - * delete -* Combination (read-modify-write) APIs - * txn - -### etcd Specific Definitions - -#### operation completed - -An etcd operation is considered complete when it is committed through consensus, and therefore “executed” -- permanently stored -- by the etcd storage engine. The client knows an operation is completed when it receives a response from the etcd server. Note that the client may be uncertain about the status of an operation if it times out, or there is a network disruption between the client and the etcd member. etcd may also abort operations when there is a leader election. etcd does not send `abort` responses to clients’ outstanding requests in this event. - -#### revision - -An etcd operation that modifies the key value store is assigned with a single increasing revision. A transaction operation might modify the key value store multiple times, but only one revision is assigned. The revision attribute of a key value pair that modified by the operation has the same value as the revision of the operation. The revision can be used as a logical clock for key value store. A key value pair that has a larger revision is modified after a key value pair with a smaller revision. Two key value pairs that have the same revision are modified by an operation "concurrently". - -### Guarantees Provided - -#### Atomicity - -All API requests are atomic; an operation either completes entirely or not at all. For watch requests, all events generated by one operation will be in one watch response. Watch never observes partial events for a single operation. - -#### Consistency - -All API calls ensure [sequential consistency][seq_consistency], the strongest consistency guarantee available from distributed systems. No matter which etcd member server a client makes requests to, a client reads the same events in the same order. If two members complete the same number of operations, the state of the two members is consistent. - -For watch operations, etcd guarantees to return the same value for the same key across all members for the same revision. For range operations, etcd has a similar guarantee for [linearized][Linearizability] access; serialized access may be behind the quorum state, so that the later revision is not yet available. - -As with all distributed systems, it is impossible for etcd to ensure [strict consistency][strict_consistency]. etcd does not guarantee that it will return to a read the “most recent” value (as measured by a wall clock when a request is completed) available on any cluster member. - -#### Isolation - -etcd ensures [serializable isolation][serializable_isolation], which is the highest isolation level available in distributed systems. Read operations will never observe any intermediate data. - -#### Durability - -Any completed operations are durable. All accessible data is also durable data. A read will never return data that has not been made durable. - -#### Linearizability - -Linearizability (also known as Atomic Consistency or External Consistency) is a consistency level between strict consistency and sequential consistency. - -For linearizability, suppose each operation receives a timestamp from a loosely synchronized global clock. Operations are linearized if and only if they always complete as though they were executed in a sequential order and each operation appears to complete in the order specified by the program. Likewise, if an operation’s timestamp precedes another, that operation must also precede the other operation in the sequence. - -For example, consider a client completing a write at time point 1 (*t1*). A client issuing a read at *t2* (for *t2* > *t1*) should receive a value at least as recent as the previous write, completed at *t1*. However, the read might actually complete only by *t3*, and the returned value, current at *t2* when the read began, might be "stale" by *t3*. - -etcd does not ensure linearizability for watch operations. Users are expected to verify the revision of watch responses to ensure correct ordering. - -etcd ensures linearizability for all other operations by default. Linearizability comes with a cost, however, because linearized requests must go through the Raft consensus process. To obtain lower latencies and higher throughput for read requests, clients can configure a request’s consistency mode to `serializable`, which may access stale data with respect to quorum, but removes the performance penalty of linearized accesses' reliance on live consensus. - -[persistent-ds]: https://en.wikipedia.org/wiki/Persistent_data_structure -[btree]: https://en.wikipedia.org/wiki/B-tree -[b+tree]: https://en.wikipedia.org/wiki/B%2B_tree -[seq_consistency]: https://en.wikipedia.org/wiki/Consistency_model#Sequential_consistency -[strict_consistency]: https://en.wikipedia.org/wiki/Consistency_model#Strict_consistency -[serializable_isolation]: https://en.wikipedia.org/wiki/Isolation_(database_systems)#Serializable -[Linearizability]: #linearizability diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/auth_api.md b/vendor/github.com/coreos/etcd/Documentation/v2/auth_api.md deleted file mode 100644 index 225ba3a63..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/auth_api.md +++ /dev/null @@ -1,516 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# v2 Auth and Security - -## etcd Resources -There are three types of resources in etcd - -1. permission resources: users and roles in the user store -2. key-value resources: key-value pairs in the key-value store -3. settings resources: security settings, auth settings, and dynamic etcd cluster settings (election/heartbeat) - -### Permission Resources - -#### Users -A user is an identity to be authenticated. Each user can have multiple roles. The user has a capability (such as reading or writing) on the resource if one of the roles has that capability. - -A user named `root` is required before authentication can be enabled, and it always has the ROOT role. The ROOT role can be granted to multiple users, but `root` is required for recovery purposes. - -#### Roles -Each role has exact one associated Permission List. An permission list exists for each permission on key-value resources. - -The special static ROOT (named `root`) role has a full permissions on all key-value resources, the permission to manage user resources and settings resources. Only the ROOT role has the permission to manage user resources and modify settings resources. The ROOT role is built-in and does not need to be created. - -There is also a special GUEST role, named 'guest'. These are the permissions given to unauthenticated requests to etcd. This role will be created automatically, and by default allows access to the full keyspace due to backward compatibility. (etcd did not previously authenticate any actions.). This role can be modified by a ROOT role holder at any time, to reduce the capabilities of unauthenticated users. - -#### Permissions - -There are two types of permissions, `read` and `write`. All management and settings require the ROOT role. - -A Permission List is a list of allowed patterns for that particular permission (read or write). Only ALLOW prefixes are supported. DENY becomes more complicated and is TBD. - -### Key-Value Resources -A key-value resource is a key-value pairs in the store. Given a list of matching patterns, permission for any given key in a request is granted if any of the patterns in the list match. - -Only prefixes or exact keys are supported. A prefix permission string ends in `*`. -A permission on `/foo` is for that exact key or directory, not its children or recursively. `/foo*` is a prefix that matches `/foo` recursively, and all keys thereunder, and keys with that prefix (eg. `/foobar`. Contrast to the prefix `/foo/*`). `*` alone is permission on the full keyspace. - -### Settings Resources - -Specific settings for the cluster as a whole. This can include adding and removing cluster members, enabling or disabling authentication, replacing certificates, and any other dynamic configuration by the administrator (holder of the ROOT role). - -## v2 Auth - -### Basic Auth -We only support [Basic Auth][basic-auth] for the first version. Client needs to attach the basic auth to the HTTP Authorization Header. - -### Authorization field for operations -Added to requests to /v2/keys, /v2/auth -Add code 401 Unauthorized to the set of responses from the v2 API -Authorization: Basic {encoded string} - -### Future Work -Other types of auth can be considered for the future (eg, signed certs, public keys) but the `Authorization:` header allows for other such types - -### Things out of Scope for etcd Permissions - -* Pluggable AUTH backends like LDAP (other Authorization tokens generated by LDAP et al may be a possibility) -* Very fine-grained access controls (eg: users modifying keys outside work hours) - - - -## API endpoints - -An Error JSON corresponds to: -{ - "name": "ErrErrorName", - "description" : "The longer helpful description of the error." -} - -#### Enable and Disable Authentication - -**Get auth status** - -GET /v2/auth/enable - - Sent Headers: - Possible Status Codes: - 200 OK - 200 Body: - { - "enabled": true - } - - -**Enable auth** - -PUT /v2/auth/enable - - Sent Headers: - Put Body: (empty) - Possible Status Codes: - 200 OK - 400 Bad Request (if root user has not been created) - 409 Conflict (already enabled) - 200 Body: (empty) - -**Disable auth** - -DELETE /v2/auth/enable - - Sent Headers: - Authorization: Basic - Possible Status Codes: - 200 OK - 401 Unauthorized (if not a root user) - 409 Conflict (already disabled) - 200 Body: (empty) - - -#### Users - -The User JSON object is formed as follows: - -``` -{ - "user": "userName", - "password": "password", - "roles": [ - "role1", - "role2" - ], - "grant": [], - "revoke": [] -} -``` - -Password is only passed when necessary. - -**Get a List of Users** - -GET/HEAD /v2/auth/users - - Sent Headers: - Authorization: Basic - Possible Status Codes: - 200 OK - 401 Unauthorized - 200 Headers: - Content-type: application/json - 200 Body: - { - "users": [ - { - "user": "alice", - "roles": [ - { - "role": "root", - "permissions": { - "kv": { - "read": ["/*"], - "write": ["/*"] - } - } - } - ] - }, - { - "user": "bob", - "roles": [ - { - "role": "guest", - "permissions": { - "kv": { - "read": ["/*"], - "write": ["/*"] - } - } - } - ] - } - ] - } - -**Get User Details** - -GET/HEAD /v2/auth/users/alice - - Sent Headers: - Authorization: Basic - Possible Status Codes: - 200 OK - 401 Unauthorized - 404 Not Found - 200 Headers: - Content-type: application/json - 200 Body: - { - "user" : "alice", - "roles" : [ - { - "role": "fleet", - "permissions" : { - "kv" : { - "read": [ "/fleet/" ], - "write": [ "/fleet/" ] - } - } - }, - { - "role": "etcd", - "permissions" : { - "kv" : { - "read": [ "/*" ], - "write": [ "/*" ] - } - } - } - ] - } - -**Create Or Update A User** - -A user can be created with initial roles, if filled in. However, no roles are required; only the username and password fields - -PUT /v2/auth/users/charlie - - Sent Headers: - Authorization: Basic - Put Body: - JSON struct, above, matching the appropriate name - * Starting password and roles when creating. - * Grant/Revoke/Password filled in when updating (to grant roles, revoke roles, or change the password). - Possible Status Codes: - 200 OK - 201 Created - 400 Bad Request - 401 Unauthorized - 404 Not Found (update non-existent users) - 409 Conflict (when granting duplicated roles or revoking non-existent roles) - 200 Headers: - Content-type: application/json - 200 Body: - JSON state of the user - -**Remove A User** - -DELETE /v2/auth/users/charlie - - Sent Headers: - Authorization: Basic - Possible Status Codes: - 200 OK - 401 Unauthorized - 403 Forbidden (remove root user when auth is enabled) - 404 Not Found - 200 Headers: - 200 Body: (empty) - -#### Roles - -A full role structure may look like this. A Permission List structure is used for the "permissions", "grant", and "revoke" keys. -``` -{ - "role" : "fleet", - "permissions" : { - "kv" : { - "read" : [ "/fleet/" ], - "write": [ "/fleet/" ] - } - }, - "grant" : {"kv": {...}}, - "revoke": {"kv": {...}} -} -``` - -**Get Role Details** - -GET/HEAD /v2/auth/roles/fleet - - Sent Headers: - Authorization: Basic - Possible Status Codes: - 200 OK - 401 Unauthorized - 404 Not Found - 200 Headers: - Content-type: application/json - 200 Body: - { - "role" : "fleet", - "permissions" : { - "kv" : { - "read": [ "/fleet/" ], - "write": [ "/fleet/" ] - } - } - } - -**Get a list of Roles** - -GET/HEAD /v2/auth/roles - - Sent Headers: - Authorization: Basic - Possible Status Codes: - 200 OK - 401 Unauthorized - 200 Headers: - Content-type: application/json - 200 Body: - { - "roles": [ - { - "role": "fleet", - "permissions": { - "kv": { - "read": ["/fleet/"], - "write": ["/fleet/"] - } - } - }, - { - "role": "etcd", - "permissions": { - "kv": { - "read": ["/*"], - "write": ["/*"] - } - } - }, - { - "role": "quay", - "permissions": { - "kv": { - "read": ["/*"], - "write": ["/*"] - } - } - } - ] - } - -**Create Or Update A Role** - -PUT /v2/auth/roles/rkt - - Sent Headers: - Authorization: Basic - Put Body: - Initial desired JSON state, including the role name for verification and: - * Starting permission set if creating - * Granted/Revoked permission set if updating - Possible Status Codes: - 200 OK - 201 Created - 400 Bad Request - 401 Unauthorized - 404 Not Found (update non-existent roles) - 409 Conflict (when granting duplicated permission or revoking non-existent permission) - 200 Body: - JSON state of the role - -**Remove A Role** - -DELETE /v2/auth/roles/rkt - - Sent Headers: - Authorization: Basic - Possible Status Codes: - 200 OK - 401 Unauthorized - 403 Forbidden (remove root) - 404 Not Found - 200 Headers: - 200 Body: (empty) - - -## Example Workflow - -Let's walk through an example to show two tenants (applications, in our case) using etcd permissions. - -### Create root role - -``` -PUT /v2/auth/users/root - Put Body: - {"user" : "root", "password": "betterRootPW!"} -``` - -### Enable auth - -``` -PUT /v2/auth/enable -``` - -### Modify guest role (revoke write permission) - -``` -PUT /v2/auth/roles/guest - Headers: - Authorization: Basic - Put Body: - { - "role" : "guest", - "revoke" : { - "kv" : { - "write": [ - "/*" - ] - } - } - } -``` - - -### Create Roles for the Applications - -Create the rkt role fully specified: - -``` -PUT /v2/auth/roles/rkt - Headers: - Authorization: Basic - Body: - { - "role" : "rkt", - "permissions" : { - "kv": { - "read": [ - "/rkt/*" - ], - "write": [ - "/rkt/*" - ] - } - } - } -``` - -But let's make fleet just a basic role for now: - -``` -PUT /v2/auth/roles/fleet - Headers: - Authorization: Basic - Body: - { - "role" : "fleet" - } -``` - -### Optional: Grant some permissions to the roles - -Well, we finally figured out where we want fleet to live. Let's fix it. -(Note that we avoided this in the rkt case. So this step is optional.) - - -``` -PUT /v2/auth/roles/fleet - Headers: - Authorization: Basic - Put Body: - { - "role" : "fleet", - "grant" : { - "kv" : { - "read": [ - "/rkt/fleet", - "/fleet/*" - ] - } - } - } -``` - -### Create Users - -Same as before, let's use rocket all at once and fleet separately - -``` -PUT /v2/auth/users/rktuser - Headers: - Authorization: Basic - Body: - {"user" : "rktuser", "password" : "rktpw", "roles" : ["rkt"]} -``` - -``` -PUT /v2/auth/users/fleetuser - Headers: - Authorization: Basic - Body: - {"user" : "fleetuser", "password" : "fleetpw"} -``` - -### Optional: Grant Roles to Users - -Likewise, let's explicitly grant fleetuser access. - -``` -PUT /v2/auth/users/fleetuser - Headers: - Authorization: Basic - Body: - {"user": "fleetuser", "grant": ["fleet"]} -``` - -#### Start to use fleetuser and rktuser - - -For example: - -``` -PUT /v2/keys/rkt/RktData - Headers: - Authorization: Basic - Body: - value=launch -``` - -Reads and writes outside the prefixes granted will fail with a 401 Unauthorized. - -[basic-auth]: https://en.wikipedia.org/wiki/Basic_access_authentication diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/authentication.md b/vendor/github.com/coreos/etcd/Documentation/v2/authentication.md deleted file mode 100644 index 05adf0600..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/authentication.md +++ /dev/null @@ -1,185 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Authentication Guide - -## Overview - -Authentication -- having users and roles in etcd -- was added in etcd 2.1. This guide will help you set up basic authentication in etcd. - -etcd before 2.1 was a completely open system; anyone with access to the API could change keys. In order to preserve backward compatibility and upgradability, this feature is off by default. - -For a full discussion of the RESTful API, see [the authentication API documentation][auth-api] - -## Special Users and Roles - -There is one special user, `root`, and there are two special roles, `root` and `guest`. - -### User `root` - -User `root` must be created before security can be activated. It has the `root` role and allows for the changing of anything inside etcd. The idea behind the `root` user is for recovery purposes -- a password is generated and stored somewhere -- and the root role is granted to the administrator accounts on the system. In the future, for troubleshooting and recovery, we will need to assume some access to the system, and future documentation will assume this root user (though anyone with the role will suffice). - -### Role `root` - -Role `root` cannot be modified, but it may be granted to any user. Having access via the root role not only allows global read-write access (as was the case before 2.1) but allows modification of the authentication policy and all administrative things, like modifying the cluster membership. - -### Role `guest` - -The `guest` role defines the permissions granted to any request that does not provide an authentication. This will be created on security activation (if it doesn't already exist) to have full access to all keys, as was true in etcd 2.0. It may be modified at any time, and cannot be removed. - -## Working with users - -The `user` subcommand for `etcdctl` handles all things having to do with user accounts. - -A listing of users can be found with - -``` -$ etcdctl user list -``` - -Creating a user is as easy as - -``` -$ etcdctl user add myusername -``` - -And there will be prompt for a new password. - -Roles can be granted and revoked for a user with - -``` -$ etcdctl user grant myusername -roles foo,bar,baz -$ etcdctl user revoke myusername -roles bar,baz -``` - -We can look at this user with - -``` -$ etcdctl user get myusername -``` - -And the password for a user can be changed with - -``` -$ etcdctl user passwd myusername -``` - -Which will prompt again for a new password. - -To delete an account, there's always -``` -$ etcdctl user remove myusername -``` - - -## Working with roles - -The `role` subcommand for `etcdctl` handles all things having to do with access controls for particular roles, as were granted to individual users. - -A listing of roles can be found with - -``` -$ etcdctl role list -``` - -A new role can be created with - -``` -$ etcdctl role add myrolename -``` - -A role has no password; we are merely defining a new set of access rights. - -Roles are granted access to various parts of the keyspace, a single path at a time. - -Reading a path is simple; if the path ends in `*`, that key **and all keys prefixed with it**, are granted to holders of this role. If it does not end in `*`, only that key and that key alone is granted. - -Access can be granted as either read, write, or both, as in the following examples: - -``` -# Give read access to keys under the /foo directory -$ etcdctl role grant myrolename -path '/foo/*' -read - -# Give write-only access to the key at /foo/bar -$ etcdctl role grant myrolename -path '/foo/bar' -write - -# Give full access to keys under /pub -$ etcdctl role grant myrolename -path '/pub/*' -readwrite -``` - -Beware that - -``` -# Give full access to keys under /pub?? -$ etcdctl role grant myrolename -path '/pub*' -readwrite -``` - -Without the slash may include keys under `/publishing`, for example. To do both, grant `/pub` and `/pub/*` - -To see what's granted, we can look at the role at any time: - -``` -$ etcdctl role get myrolename -``` - -Revocation of permissions is done the same logical way: - -``` -$ etcdctl role revoke myrolename -path '/foo/bar' -write -``` - -As is removing a role entirely - -``` -$ etcdctl role remove myrolename -``` - -## Enabling authentication - -The minimal steps to enabling auth are as follows. The administrator can set up users and roles before or after enabling authentication, as a matter of preference. - -Make sure the root user is created: - -``` -$ etcdctl user add root -New password: -``` - -And enable authentication - -``` -$ etcdctl auth enable -``` - -After this, etcd is running with authentication enabled. To disable it for any reason, use the reciprocal command: - -``` -$ etcdctl -u root:rootpw auth disable -``` - -It would also be good to check what guests (unauthenticated users) are allowed to do: -``` -$ etcdctl -u root:rootpw role get guest -``` - -And modify this role appropriately, depending on your policies. - -## Using `etcdctl` to authenticate - -`etcdctl` supports a similar flag as `curl` for authentication. - -``` -$ etcdctl -u user:password get foo -``` - -or if you prefer to be prompted: - -``` -$ etcdctl -u user get foo -``` - -Otherwise, all `etcdctl` commands remain the same. Users and roles can still be created and modified, but require authentication by a user with the root role. - -[auth-api]: auth_api.md diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/backward_compatibility.md b/vendor/github.com/coreos/etcd/Documentation/v2/backward_compatibility.md deleted file mode 100644 index 3704325e7..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/backward_compatibility.md +++ /dev/null @@ -1,77 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Backward Compatibility - -The main goal of etcd 2.0 release is to improve cluster safety around bootstrapping and dynamic reconfiguration. To do this, we deprecated the old error-prone APIs and provide a new set of APIs. - -The other main focus of this release was a more reliable Raft implementation, but as this change is internal it should not have any notable effects to users. - -## Command Line Flags Changes - -The major flag changes are to mostly related to bootstrapping. The `initial-*` flags provide an improved way to specify the required criteria to start the cluster. The advertised URLs now support a list of values instead of a single value, which allows etcd users to gracefully migrate to the new set of IANA-assigned ports (2379/client and 2380/peers) while maintaining backward compatibility with the old ports. - - - `-addr` is replaced by `-advertise-client-urls`. - - `-bind-addr` is replaced by `-listen-client-urls`. - - `-peer-addr` is replaced by `-initial-advertise-peer-urls`. - - `-peer-bind-addr` is replaced by `-listen-peer-urls`. - - `-peers` is replaced by `-initial-cluster`. - - `-peers-file` is replaced by `-initial-cluster`. - - `-peer-heartbeat-interval` is replaced by `-heartbeat-interval`. - - `-peer-election-timeout` is replaced by `-election-timeout`. - -The documentation of new command line flags can be found at -https://github.com/coreos/etcd/blob/master/Documentation/v2/configuration.md. - -## Data Directory Naming - -The default data dir location has changed from {$hostname}.etcd to {name}.etcd. - -## Key-Value API - -### Read consistency flag - -The consistent flag for read operations is removed in etcd 2.0.0. The normal read operations provides the same consistency guarantees with the 0.4.6 read operations with consistent flag set. - -The read consistency guarantees are: - -The consistent read guarantees the sequential consistency within one client that talks to one etcd server. Read/Write from one client to one etcd member should be observed in order. If one client write a value to an etcd server successfully, it should be able to get the value out of the server immediately. - -Each etcd member will proxy the request to leader and only return the result to user after the result is applied on the local member. Thus after the write succeed, the user is guaranteed to see the value on the member it sent the request to. - -Reads do not provide linearizability. If you want linearizable read, you need to set quorum option to true. - -**Previous behavior** - -We added an option for a consistent read in the old version of etcd since etcd 0.x redirects the write request to the leader. When the user get back the result from the leader, the member it sent the request to originally might not apply the write request yet. With the consistent flag set to true, the client will always send read request to the leader. So one client should be able to see its last write when consistent=true is enabled. There is no order guarantees among different clients. - - -## Standby - -etcd 0.4’s standby mode has been deprecated. [Proxy mode][proxymode] is introduced to solve a subset of problems standby was solving. - -Standby mode was intended for large clusters that had a subset of the members acting in the consensus process. Overall this process was too magical and allowed for operators to back themselves into a corner. - -Proxy mode in 2.0 will provide similar functionality, and with improved control over which machines act as proxies due to the operator specifically configuring them. Proxies also support read only or read/write modes for increased security and durability. - -[proxymode]: proxy.md - -## Discovery Service - -A size key needs to be provided inside a [discovery token][discoverytoken]. - -[discoverytoken]: clustering.md#custom-etcd-discovery-service - -## HTTP Admin API - -`v2/admin` on peer url and `v2/keys/_etcd` are unified under the new [v2/members API][members-api] to better explain which machines are part of an etcd cluster, and to simplify the keyspace for all your use cases. - -[members-api]: members_api.md - -## HTTP Key Value API -- The follower can now transparently proxy write requests to the leader. Clients will no longer see 307 redirections to the leader from etcd. - -- Expiration time is in UTC instead of local time. - diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/README.md b/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/README.md deleted file mode 100644 index 881641a79..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/README.md +++ /dev/null @@ -1,23 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -# Benchmarks - -etcd benchmarks will be published regularly and tracked for each release below: - -- [etcd v2.1.0-alpha][2.1] -- [etcd v2.2.0-rc][2.2] -- [etcd v3 demo][3.0] - -# Memory Usage Benchmarks - -It records expected memory usage in different scenarios. - -- [etcd v2.2.0-rc][2.2-mem] - -[2.1]: etcd-2-1-0-alpha-benchmarks.md -[2.2]: etcd-2-2-0-rc-benchmarks.md -[2.2-mem]: etcd-2-2-0-rc-memory-benchmarks.md -[3.0]: etcd-3-demo-benchmarks.md diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-1-0-alpha-benchmarks.md b/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-1-0-alpha-benchmarks.md deleted file mode 100644 index 1fc808ec4..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-1-0-alpha-benchmarks.md +++ /dev/null @@ -1,57 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -## Physical machines - -GCE n1-highcpu-2 machine type - -- 1x dedicated local SSD mounted under /var/lib/etcd -- 1x dedicated slow disk for the OS -- 1.8 GB memory -- 2x CPUs -- etcd version 2.1.0 alpha - -## etcd Cluster - -3 etcd members, each runs on a single machine - -## Testing - -Bootstrap another machine and use the [boom HTTP benchmark tool][boom] to send requests to each etcd member. Check the [benchmark hacking guide][hack-benchmark] for detailed instructions. - -## Performance - -### reading one single key - -| key size in bytes | number of clients | target etcd server | read QPS | 90th Percentile Latency (ms) | -|-------------------|-------------------|--------------------|----------|---------------| -| 64 | 1 | leader only | 1534 | 0.7 | -| 64 | 64 | leader only | 10125 | 9.1 | -| 64 | 256 | leader only | 13892 | 27.1 | -| 256 | 1 | leader only | 1530 | 0.8 | -| 256 | 64 | leader only | 10106 | 10.1 | -| 256 | 256 | leader only | 14667 | 27.0 | -| 64 | 64 | all servers | 24200 | 3.9 | -| 64 | 256 | all servers | 33300 | 11.8 | -| 256 | 64 | all servers | 24800 | 3.9 | -| 256 | 256 | all servers | 33000 | 11.5 | - -### writing one single key - -| key size in bytes | number of clients | target etcd server | write QPS | 90th Percentile Latency (ms) | -|-------------------|-------------------|--------------------|-----------|---------------| -| 64 | 1 | leader only | 60 | 21.4 | -| 64 | 64 | leader only | 1742 | 46.8 | -| 64 | 256 | leader only | 3982 | 90.5 | -| 256 | 1 | leader only | 58 | 20.3 | -| 256 | 64 | leader only | 1770 | 47.8 | -| 256 | 256 | leader only | 4157 | 105.3 | -| 64 | 64 | all servers | 1028 | 123.4 | -| 64 | 256 | all servers | 3260 | 123.8 | -| 256 | 64 | all servers | 1033 | 121.5 | -| 256 | 256 | all servers | 3061 | 119.3 | - -[boom]: https://github.com/rakyll/boom -[hack-benchmark]: ../../../hack/benchmark/ diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-2-0-benchmarks.md b/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-2-0-benchmarks.md deleted file mode 100644 index 2989c1a7d..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-2-0-benchmarks.md +++ /dev/null @@ -1,77 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -# Benchmarking etcd v2.2.0 - -## Physical Machines - -GCE n1-highcpu-2 machine type - -- 1x dedicated local SSD mounted as etcd data directory -- 1x dedicated slow disk for the OS -- 1.8 GB memory -- 2x CPUs - -## etcd Cluster - -3 etcd 2.2.0 members, each runs on a single machine. - -Detailed versions: - -``` -etcd Version: 2.2.0 -Git SHA: e4561dd -Go Version: go1.5 -Go OS/Arch: linux/amd64 -``` - -## Testing - -Bootstrap another machine, outside of the etcd cluster, and run the [`boom` HTTP benchmark tool][boom] with a connection reuse patch to send requests to each etcd cluster member. See the [benchmark instructions][hack] for the patch and the steps to reproduce our procedures. - -The performance is calulated through results of 100 benchmark rounds. - -## Performance - -### Single Key Read Performance - -| key size in bytes | number of clients | target etcd server | average read QPS | read QPS stddev | average 90th Percentile Latency (ms) | latency stddev | -|-------------------|-------------------|--------------------|------------------|-----------------|--------------------------------------|----------------| -| 64 | 1 | leader only | 2303 | 200 | 0.49 | 0.06 | -| 64 | 64 | leader only | 15048 | 685 | 7.60 | 0.46 | -| 64 | 256 | leader only | 14508 | 434 | 29.76 | 1.05 | -| 256 | 1 | leader only | 2162 | 214 | 0.52 | 0.06 | -| 256 | 64 | leader only | 14789 | 792 | 7.69| 0.48 | -| 256 | 256 | leader only | 14424 | 512 | 29.92 | 1.42 | -| 64 | 64 | all servers | 45752 | 2048 | 2.47 | 0.14 | -| 64 | 256 | all servers | 46592 | 1273 | 10.14 | 0.59 | -| 256 | 64 | all servers | 45332 | 1847 | 2.48| 0.12 | -| 256 | 256 | all servers | 46485 | 1340 | 10.18 | 0.74 | - -### Single Key Write Performance - -| key size in bytes | number of clients | target etcd server | average write QPS | write QPS stddev | average 90th Percentile Latency (ms) | latency stddev | -|-------------------|-------------------|--------------------|------------------|-----------------|--------------------------------------|----------------| -| 64 | 1 | leader only | 55 | 4 | 24.51 | 13.26 | -| 64 | 64 | leader only | 2139 | 125 | 35.23 | 3.40 | -| 64 | 256 | leader only | 4581 | 581 | 70.53 | 10.22 | -| 256 | 1 | leader only | 56 | 4 | 22.37| 4.33 | -| 256 | 64 | leader only | 2052 | 151 | 36.83 | 4.20 | -| 256 | 256 | leader only | 4442 | 560 | 71.59 | 10.03 | -| 64 | 64 | all servers | 1625 | 85 | 58.51 | 5.14 | -| 64 | 256 | all servers | 4461 | 298 | 89.47 | 36.48 | -| 256 | 64 | all servers | 1599 | 94 | 60.11| 6.43 | -| 256 | 256 | all servers | 4315 | 193 | 88.98 | 7.01 | - -## Performance Changes - -- Because etcd now records metrics for each API call, read QPS performance seems to see a minor decrease in most scenarios. This minimal performance impact was judged a reasonable investment for the breadth of monitoring and debugging information returned. - -- Write QPS to cluster leaders seems to be increased by a small margin. This is because the main loop and entry apply loops were decoupled in the etcd raft logic, eliminating several blocks between them. - -- Write QPS to all members seems to be increased by a significant margin, because followers now receive the latest commit index sooner, and commit proposals more quickly. - -[boom]: https://github.com/rakyll/boom -[hack]: ../../../hack/benchmark/ diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-2-0-rc-benchmarks.md b/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-2-0-rc-benchmarks.md deleted file mode 100644 index 9170a644b..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-2-0-rc-benchmarks.md +++ /dev/null @@ -1,77 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -## Physical machines - -GCE n1-highcpu-2 machine type - -- 1x dedicated local SSD mounted under /var/lib/etcd -- 1x dedicated slow disk for the OS -- 1.8 GB memory -- 2x CPUs - -## etcd Cluster - -3 etcd 2.2.0-rc members, each runs on a single machine. - -Detailed versions: - -``` -etcd Version: 2.2.0-alpha.1+git -Git SHA: 59a5a7e -Go Version: go1.4.2 -Go OS/Arch: linux/amd64 -``` - -Also, we use 3 etcd 2.1.0 alpha-stage members to form cluster to get base performance. etcd's commit head is at [c7146bd5][c7146bd5], which is the same as the one that we use in [etcd 2.1 benchmark][etcd-2.1-benchmark]. - -## Testing - -Bootstrap another machine and use the [boom HTTP benchmark tool][boom] to send requests to each etcd member. Check the [benchmark hacking guide][hack-benchmark] for detailed instructions. - -## Performance - -### reading one single key - -| key size in bytes | number of clients | target etcd server | read QPS | 90th Percentile Latency (ms) | -|-------------------|-------------------|--------------------|----------|---------------| -| 64 | 1 | leader only | 2804 (-5%) | 0.4 (+0%) | -| 64 | 64 | leader only | 17816 (+0%) | 5.7 (-6%) | -| 64 | 256 | leader only | 18667 (-6%) | 20.4 (+2%) | -| 256 | 1 | leader only | 2181 (-15%) | 0.5 (+25%) | -| 256 | 64 | leader only | 17435 (-7%) | 6.0 (+9%) | -| 256 | 256 | leader only | 18180 (-8%) | 21.3 (+3%) | -| 64 | 64 | all servers | 46965 (-4%) | 2.1 (+0%) | -| 64 | 256 | all servers | 55286 (-6%) | 7.4 (+6%) | -| 256 | 64 | all servers | 46603 (-6%) | 2.1 (+5%) | -| 256 | 256 | all servers | 55291 (-6%) | 7.3 (+4%) | - -### writing one single key - -| key size in bytes | number of clients | target etcd server | write QPS | 90th Percentile Latency (ms) | -|-------------------|-------------------|--------------------|-----------|---------------| -| 64 | 1 | leader only | 76 (+22%) | 19.4 (-15%) | -| 64 | 64 | leader only | 2461 (+45%) | 31.8 (-32%) | -| 64 | 256 | leader only | 4275 (+1%) | 69.6 (-10%) | -| 256 | 1 | leader only | 64 (+20%) | 16.7 (-30%) | -| 256 | 64 | leader only | 2385 (+30%) | 31.5 (-19%) | -| 256 | 256 | leader only | 4353 (-3%) | 74.0 (+9%) | -| 64 | 64 | all servers | 2005 (+81%) | 49.8 (-55%) | -| 64 | 256 | all servers | 4868 (+35%) | 81.5 (-40%) | -| 256 | 64 | all servers | 1925 (+72%) | 47.7 (-59%) | -| 256 | 256 | all servers | 4975 (+36%) | 70.3 (-36%) | - -### performance changes explanation - -- read QPS in most scenarios is decreased by 5~8%. The reason is that etcd records store metrics for each store operation. The metrics is important for monitoring and debugging, so this is acceptable. - -- write QPS to leader is increased by 20~30%. This is because we decouple raft main loop and entry apply loop, which avoids them blocking each other. - -- write QPS to all servers is increased by 30~80% because follower could receive latest commit index earlier and commit proposals faster. - -[boom]: https://github.com/rakyll/boom -[c7146bd5]: https://github.com/coreos/etcd/commits/c7146bd5f2c73716091262edc638401bb8229144 -[etcd-2.1-benchmark]: etcd-2-1-0-alpha-benchmarks.md -[hack-benchmark]: ../../../hack/benchmark/ diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-2-0-rc-memory-benchmarks.md b/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-2-0-rc-memory-benchmarks.md deleted file mode 100644 index 40c220eaa..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-2-2-0-rc-memory-benchmarks.md +++ /dev/null @@ -1,52 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -## Physical machine - -GCE n1-standard-2 machine type - -- 1x dedicated local SSD mounted under /var/lib/etcd -- 1x dedicated slow disk for the OS -- 7.5 GB memory -- 2x CPUs - -## etcd - -``` -etcd Version: 2.2.0-rc.0+git -Git SHA: 103cb5c -Go Version: go1.5 -Go OS/Arch: linux/amd64 -``` - -## Testing - -Start 3-member etcd cluster, each of which uses 2 cores. - -The length of key name is always 64 bytes, which is a reasonable length of average key bytes. - -## Memory Maximal Usage - -- etcd may use maximal memory if one follower is dead and the leader keeps sending snapshots. -- `max RSS` is the maximal memory usage recorded in 3 runs. - -| value bytes | key number | data size(MB) | max RSS(MB) | max RSS/data rate on leader | -|-------------|-------------|---------------|-------------|-----------------------------| -| 128 | 50000 | 6 | 433 | 72x | -| 128 | 100000 | 12 | 659 | 54x | -| 128 | 200000 | 24 | 1466 | 61x | -| 1024 | 50000 | 48 | 1253 | 26x | -| 1024 | 100000 | 96 | 2344 | 24x | -| 1024 | 200000 | 192 | 4361 | 22x | - -## Data Size Threshold - -- When etcd reaches data size threshold, it may trigger leader election easily and drop part of proposals. -- At most cases, etcd cluster should work smoothly if it doesn't hit the threshold. If it doesn't work well due to insufficient resources, you need to decrease its data size. - -| value bytes | key number limitation | suggested data size threshold(MB) | consumed RSS(MB) | -|-------------|-----------------------|-----------------------------------|------------------| -| 128 | 400K | 48 | 2400 | -| 1024 | 300K | 292 | 6500 | diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-3-demo-benchmarks.md b/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-3-demo-benchmarks.md deleted file mode 100644 index cb59d173c..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-3-demo-benchmarks.md +++ /dev/null @@ -1,47 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -## Physical machines - -GCE n1-highcpu-2 machine type - -- 1x dedicated local SSD mounted under /var/lib/etcd -- 1x dedicated slow disk for the OS -- 1.8 GB memory -- 2x CPUs -- etcd version 2.2.0 - -## etcd Cluster - -1 etcd member running in v3 demo mode - -## Testing - -Use [etcd v3 benchmark tool][etcd-v3-benchmark]. - -## Performance - -### reading one single key - -| key size in bytes | number of clients | read QPS | 90th Percentile Latency (ms) | -|-------------------|-------------------|----------|---------------| -| 256 | 1 | 2716 | 0.4 | -| 256 | 64 | 16623 | 6.1 | -| 256 | 256 | 16622 | 21.7 | - -The performance is nearly the same as the one with empty server handler. - -### reading one single key after putting - -| key size in bytes | number of clients | read QPS | 90th Percentile Latency (ms) | -|-------------------|-------------------|----------|---------------| -| 256 | 1 | 2269 | 0.5 | -| 256 | 64 | 13582 | 8.6 | -| 256 | 256 | 13262 | 47.5 | - -The performance with empty server handler is not affected by one put. So the -performance downgrade should be caused by storage package. - -[etcd-v3-benchmark]: ../../../tools/benchmark/ diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-3-watch-memory-benchmark.md b/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-3-watch-memory-benchmark.md deleted file mode 100644 index 56ae1a239..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-3-watch-memory-benchmark.md +++ /dev/null @@ -1,82 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -# Watch Memory Usage Benchmark - -*NOTE*: The watch features are under active development, and their memory usage may change as that development progresses. We do not expect it to significantly increase beyond the figures stated below. - -A primary goal of etcd is supporting a very large number of watchers doing a massively large amount of watching. etcd aims to support O(10k) clients, O(100K) watch streams (O(10) streams per client) and O(10M) total watchings (O(100) watching per stream). The memory consumed by each individual watching accounts for the largest portion of etcd's overall usage, and is therefore the focus of current and future optimizations. - - -Three related components of etcd watch consume physical memory: each `grpc.Conn`, each watch stream, and each instance of the watching activity. `grpc.Conn` maintains the actual TCP connection and other gRPC connection state. Each `grpc.Conn` consumes O(10kb) of memory, and might have multiple watch streams attached. - -Each watch stream is an independent HTTP2 connection which consumes another O(10kb) of memory. -Multiple watchings might share one watch stream. - -Watching is the actual struct that tracks the changes on the key-value store. Each watching should only consume < O(1kb). - -``` - +-------+ - | watch | - +---------> | foo | - | +-------+ - +------+-----+ - | stream | - +--------------> | | - | +------+-----+ +-------+ - | | | watch | - | +---------> | bar | -+-----+------+ +-------+ -| | +------------+ -| conn +-------> | stream | -| | | | -+-----+------+ +------------+ - | - | - | - | +------------+ - +--------------> | stream | - | | - +------------+ -``` - -The theoretical memory consumption of watch can be approximated with the formula: -`memory = c1 * number_of_conn + c2 * avg_number_of_stream_per_conn + c3 * avg_number_of_watch_stream` - -## Testing Environment - -etcd version -- git head https://github.com/coreos/etcd/commit/185097ffaa627b909007e772c175e8fefac17af3 - -GCE n1-standard-2 machine type -- 7.5 GB memory -- 2x CPUs - -## Overall memory usage - -The overall memory usage captures how much [RSS][rss] etcd consumes with the client watchers. While the result may vary by as much as 10%, it is still meaningful, since the goal is to learn about the rough memory usage and the pattern of allocations. - -With the benchmark result, we can calculate roughly that `c1 = 17kb`, `c2 = 18kb` and `c3 = 350bytes`. So each additional client connection consumes 17kb of memory and each additional stream consumes 18kb of memory, and each additional watching only cause 350bytes. A single etcd server can maintain millions of watchings with a few GB of memory in normal case. - - -| clients | streams per client | watchings per stream | total watching | memory usage | -|---------|---------|-----------|----------------|--------------| -| 1k | 1 | 1 | 1k | 50MB | -| 2k | 1 | 1 | 2k | 90MB | -| 5k | 1 | 1 | 5k | 200MB | -| 1k | 10 | 1 | 10k | 217MB | -| 2k | 10 | 1 | 20k | 417MB | -| 5k | 10 | 1 | 50k | 980MB | -| 1k | 50 | 1 | 50k | 1001MB | -| 2k | 50 | 1 | 100k | 1960MB | -| 5k | 50 | 1 | 250k | 4700MB | -| 1k | 50 | 10 | 500k | 1171MB | -| 2k | 50 | 10 | 1M | 2371MB | -| 5k | 50 | 10 | 2.5M | 5710MB | -| 1k | 50 | 100 | 5M | 2380MB | -| 2k | 50 | 100 | 10M | 4672MB | -| 5k | 50 | 100 | 50M | *OOM* | - -[rss]: https://en.wikipedia.org/wiki/Resident_set_size diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-storage-memory-benchmark.md b/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-storage-memory-benchmark.md deleted file mode 100644 index 3f75b7920..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/benchmarks/etcd-storage-memory-benchmark.md +++ /dev/null @@ -1,103 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -# Storage Memory Usage Benchmark - - -Two components of etcd storage consume physical memory. The etcd process allocates an *in-memory index* to speed key lookup. The process's *page cache*, managed by the operating system, stores recently-accessed data from disk for quick re-use. - -The in-memory index holds all the keys in a [B-tree][btree] data structure, along with pointers to the on-disk data (the values). Each key in the B-tree may contain multiple pointers, pointing to different versions of its values. The theoretical memory consumption of the in-memory index can hence be approximated with the formula: - -`N * (c1 + avg_key_size) + N * (avg_versions_of_key) * (c2 + size_of_pointer)` - -where `c1` is the key metadata overhead and `c2` is the version metadata overhead. - -The graph shows the detailed structure of the in-memory index B-tree. - -``` - - - In mem index - - +------------+ - | key || ... | - +--------------+ | || | - | | +------------+ - | | | v1 || ... | - | disk <----------------| || | Tree Node - | | +------------+ - | | | v2 || ... | - | <----------------+ || | - | | +------------+ - +--------------+ +-----+ | | | - | | | | | - | +------------+ - | - | - ^ - ------+ - | ... | - | | - +-----+ - | ... | Tree Node - | | - +-----+ - | ... | - | | - ------+ -``` - -[Page cache memory][pagecache] is managed by the operating system and is not covered in detail in this document. - -## Testing Environment - -etcd version -- git head https://github.com/coreos/etcd/commit/776e9fb7be7eee5e6b58ab977c8887b4fe4d48db - -GCE n1-standard-2 machine type - -- 7.5 GB memory -- 2x CPUs - -## In-memory index memory usage - -In this test, we only benchmark the memory usage of the in-memory index. The goal is to find `c1` and `c2` mentioned above and to understand the hard limit of memory consumption of the storage. - -We calculate the memory usage consumption via the Go runtime.ReadMemStats. We calculate the total allocated bytes difference before creating the index and after creating the index. It cannot perfectly reflect the memory usage of the in-memory index itself but can show the rough consumption pattern. - -| N | versions | key size | memory usage | -|------|----------|----------|--------------| -| 100K | 1 | 64bytes | 22MB | -| 100K | 5 | 64bytes | 39MB | -| 1M | 1 | 64bytes | 218MB | -| 1M | 5 | 64bytes | 432MB | -| 100K | 1 | 256bytes | 41MB | -| 100K | 5 | 256bytes | 65MB | -| 1M | 1 | 256bytes | 409MB | -| 1M | 5 | 256bytes | 506MB | - - -Based on the result, we can calculate `c1=120bytes`, `c2=30bytes`. We only need two sets of data to calculate `c1` and `c2`, since they are the only unknown variable in the formula. The `c1=120bytes` and `c2=30bytes` are the average value of the 4 sets of `c1` and `c2` we calculated. The key metadata overhead is still relatively nontrivial (50%) for small key-value pairs. However, this is a significant improvement over the old store, which had at least 1000% overhead. - -## Overall memory usage - -The overall memory usage captures how much RSS etcd consumes with the storage. The value size should have very little impact on the overall memory usage of etcd, since we keep values on disk and only retain hot values in memory, managed by the OS page cache. - -| N | versions | key size | value size | memory usage | -|------|----------|----------|------------|--------------| -| 100K | 1 | 64bytes | 256bytes | 40MB | -| 100K | 5 | 64bytes | 256bytes | 89MB | -| 1M | 1 | 64bytes | 256bytes | 470MB | -| 1M | 5 | 64bytes | 256bytes | 880MB | -| 100K | 1 | 64bytes | 1KB | 102MB | -| 100K | 5 | 64bytes | 1KB | 164MB | -| 1M | 1 | 64bytes | 1KB | 587MB | -| 1M | 5 | 64bytes | 1KB | 836MB | - -Based on the result, we know the value size does not significantly impact the memory consumption. There is some minor increase due to more data held in the OS page cache. - -[btree]: https://en.wikipedia.org/wiki/B-tree -[pagecache]: https://en.wikipedia.org/wiki/Page_cache - diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/branch_management.md b/vendor/github.com/coreos/etcd/Documentation/v2/branch_management.md deleted file mode 100644 index 45b273542..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/branch_management.md +++ /dev/null @@ -1,31 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Branch Management - -## Guide - -* New development occurs on the [master branch][master]. -* Master branch should always have a green build! -* Backwards-compatible bug fixes should target the master branch and subsequently be ported to stable branches. -* Once the master branch is ready for release, it will be tagged and become the new stable branch. - -The etcd team has adopted a *rolling release model* and supports one stable version of etcd. - -### Master branch - -The `master` branch is our development branch. All new features land here first. - -If you want to try new features, pull `master` and play with it. Note that `master` may not be stable because new features may introduce bugs. - -Before the release of the next stable version, feature PRs will be frozen. We will focus on the testing, bug-fix and documentation for one to two weeks. - -### Stable branches - -All branches with prefix `release-` are considered _stable_ branches. - -After every minor release (http://semver.org/), we will have a new stable branch for that release. We will keep fixing the backwards-compatible bugs for the latest stable release, but not previous releases. The _patch_ release, incorporating any bug fixes, will be once every two weeks, given any patches. - -[master]: https://github.com/coreos/etcd/tree/master diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/clustering.md b/vendor/github.com/coreos/etcd/Documentation/v2/clustering.md deleted file mode 100644 index f9c3e08f7..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/clustering.md +++ /dev/null @@ -1,440 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Clustering Guide - -## Overview - -Starting an etcd cluster statically requires that each member knows another in the cluster. In a number of cases, you might not know the IPs of your cluster members ahead of time. In these cases, you can bootstrap an etcd cluster with the help of a discovery service. - -Once an etcd cluster is up and running, adding or removing members is done via [runtime reconfiguration][runtime-conf]. To better understand the design behind runtime reconfiguration, we suggest you read [the runtime configuration design document][runtime-reconf-design]. - -This guide will cover the following mechanisms for bootstrapping an etcd cluster: - -* [Static](#static) -* [etcd Discovery](#etcd-discovery) -* [DNS Discovery](#dns-discovery) - -Each of the bootstrapping mechanisms will be used to create a three machine etcd cluster with the following details: - -|Name|Address|Hostname| -|------|---------|------------------| -|infra0|10.0.1.10|infra0.example.com| -|infra1|10.0.1.11|infra1.example.com| -|infra2|10.0.1.12|infra2.example.com| - -## Static - -As we know the cluster members, their addresses and the size of the cluster before starting, we can use an offline bootstrap configuration by setting the `initial-cluster` flag. Each machine will get either the following command line or environment variables: - -``` -ETCD_INITIAL_CLUSTER="infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380" -ETCD_INITIAL_CLUSTER_STATE=new -``` - -``` ---initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ ---initial-cluster-state new -``` - -Note that the URLs specified in `initial-cluster` are the _advertised peer URLs_, i.e. they should match the value of `initial-advertise-peer-urls` on the respective nodes. - -If you are spinning up multiple clusters (or creating and destroying a single cluster) with same configuration for testing purpose, it is highly recommended that you specify a unique `initial-cluster-token` for the different clusters. By doing this, etcd can generate unique cluster IDs and member IDs for the clusters even if they otherwise have the exact same configuration. This can protect you from cross-cluster-interaction, which might corrupt your clusters. - -etcd listens on [`listen-client-urls`][conf-listen-client] to accept client traffic. etcd member advertises the URLs specified in [`advertise-client-urls`][conf-adv-client] to other members, proxies, clients. Please make sure the `advertise-client-urls` are reachable from intended clients. A common mistake is setting `advertise-client-urls` to localhost or leave it as default when you want the remote clients to reach etcd. - -On each machine you would start etcd with these flags: - -``` -$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ - --listen-peer-urls http://10.0.1.10:2380 \ - --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.10:2379 \ - --initial-cluster-token etcd-cluster-1 \ - --initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ - --initial-cluster-state new -``` -``` -$ etcd --name infra1 --initial-advertise-peer-urls http://10.0.1.11:2380 \ - --listen-peer-urls http://10.0.1.11:2380 \ - --listen-client-urls http://10.0.1.11:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.11:2379 \ - --initial-cluster-token etcd-cluster-1 \ - --initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ - --initial-cluster-state new -``` -``` -$ etcd --name infra2 --initial-advertise-peer-urls http://10.0.1.12:2380 \ - --listen-peer-urls http://10.0.1.12:2380 \ - --listen-client-urls http://10.0.1.12:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.12:2379 \ - --initial-cluster-token etcd-cluster-1 \ - --initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ - --initial-cluster-state new -``` - -The command line parameters starting with `--initial-cluster` will be ignored on subsequent runs of etcd. You are free to remove the environment variables or command line flags after the initial bootstrap process. If you need to make changes to the configuration later (for example, adding or removing members to/from the cluster), see the [runtime configuration][runtime-conf] guide. - -### Error Cases - -In the following example, we have not included our new host in the list of enumerated nodes. If this is a new cluster, the node _must_ be added to the list of initial cluster members. - -``` -$ etcd --name infra1 --initial-advertise-peer-urls http://10.0.1.11:2380 \ - --listen-peer-urls https://10.0.1.11:2380 \ - --listen-client-urls http://10.0.1.11:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.11:2379 \ - --initial-cluster infra0=http://10.0.1.10:2380 \ - --initial-cluster-state new -etcd: infra1 not listed in the initial cluster config -exit 1 -``` - -In this example, we are attempting to map a node (infra0) on a different address (127.0.0.1:2380) than its enumerated address in the cluster list (10.0.1.10:2380). If this node is to listen on multiple addresses, all addresses _must_ be reflected in the "initial-cluster" configuration directive. - -``` -$ etcd --name infra0 --initial-advertise-peer-urls http://127.0.0.1:2380 \ - --listen-peer-urls http://10.0.1.10:2380 \ - --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.10:2379 \ - --initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ - --initial-cluster-state=new -etcd: error setting up initial cluster: infra0 has different advertised URLs in the cluster and advertised peer URLs list -exit 1 -``` - -If you configure a peer with a different set of configuration and attempt to join this cluster you will get a cluster ID mismatch and etcd will exit. - -``` -$ etcd --name infra3 --initial-advertise-peer-urls http://10.0.1.13:2380 \ - --listen-peer-urls http://10.0.1.13:2380 \ - --listen-client-urls http://10.0.1.13:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.13:2379 \ - --initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra3=http://10.0.1.13:2380 \ - --initial-cluster-state=new -etcd: conflicting cluster ID to the target cluster (c6ab534d07e8fcc4 != bc25ea2a74fb18b0). Exiting. -exit 1 -``` - -## Discovery - -In a number of cases, you might not know the IPs of your cluster peers ahead of time. This is common when utilizing cloud providers or when your network uses DHCP. In these cases, rather than specifying a static configuration, you can use an existing etcd cluster to bootstrap a new one. We call this process "discovery". - -There two methods that can be used for discovery: - -* etcd discovery service -* DNS SRV records - -### etcd Discovery - -To better understand the design about discovery service protocol, we suggest you read [this][discovery-proto]. - -#### Lifetime of a Discovery URL - -A discovery URL identifies a unique etcd cluster. Instead of reusing a discovery URL, you should always create discovery URLs for new clusters. - -Moreover, discovery URLs should ONLY be used for the initial bootstrapping of a cluster. To change cluster membership after the cluster is already running, see the [runtime reconfiguration][runtime-conf] guide. - -#### Custom etcd Discovery Service - -Discovery uses an existing cluster to bootstrap itself. If you are using your own etcd cluster you can create a URL like so: - -``` -$ curl -X PUT https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83/_config/size -d value=3 -``` - -By setting the size key to the URL, you create a discovery URL with an expected cluster size of 3. - -If you bootstrap an etcd cluster using discovery service with more than the expected number of etcd members, the extra etcd processes will [fall back][fall-back] to being [proxies][proxy] by default. - -The URL you will use in this case will be `https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83` and the etcd members will use the `https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83` directory for registration as they start. - -**Each member must have a different name flag specified. `Hostname` or `machine-id` can be a good choice. Or discovery will fail due to duplicated name.** - -Now we start etcd with those relevant flags for each member: - -``` -$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ - --listen-peer-urls http://10.0.1.10:2380 \ - --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.10:2379 \ - --discovery https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83 -``` -``` -$ etcd --name infra1 --initial-advertise-peer-urls http://10.0.1.11:2380 \ - --listen-peer-urls http://10.0.1.11:2380 \ - --listen-client-urls http://10.0.1.11:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.11:2379 \ - --discovery https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83 -``` -``` -$ etcd --name infra2 --initial-advertise-peer-urls http://10.0.1.12:2380 \ - --listen-peer-urls http://10.0.1.12:2380 \ - --listen-client-urls http://10.0.1.12:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.12:2379 \ - --discovery https://myetcd.local/v2/keys/discovery/6c007a14875d53d9bf0ef5a6fc0257c817f0fb83 -``` - -This will cause each member to register itself with the custom etcd discovery service and begin the cluster once all machines have been registered. - -#### Public etcd Discovery Service - -If you do not have access to an existing cluster, you can use the public discovery service hosted at `discovery.etcd.io`. You can create a private discovery URL using the "new" endpoint like so: - -``` -$ curl https://discovery.etcd.io/new?size=3 -https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de -``` - -This will create the cluster with an initial expected size of 3 members. If you do not specify a size, a default of 3 will be used. - -If you bootstrap an etcd cluster using discovery service with more than the expected number of etcd members, the extra etcd processes will [fall back][fall-back] to being [proxies][proxy] by default. - -``` -ETCD_DISCOVERY=https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de -``` - -``` --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de -``` - -**Each member must have a different name flag specified. `Hostname` or `machine-id` can be a good choice. Or discovery will fail due to duplicated name.** - -Now we start etcd with those relevant flags for each member: - -``` -$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ - --listen-peer-urls http://10.0.1.10:2380 \ - --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.10:2379 \ - --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de -``` -``` -$ etcd --name infra1 --initial-advertise-peer-urls http://10.0.1.11:2380 \ - --listen-peer-urls http://10.0.1.11:2380 \ - --listen-client-urls http://10.0.1.11:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.11:2379 \ - --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de -``` -``` -$ etcd --name infra2 --initial-advertise-peer-urls http://10.0.1.12:2380 \ - --listen-peer-urls http://10.0.1.12:2380 \ - --listen-client-urls http://10.0.1.12:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.12:2379 \ - --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de -``` - -This will cause each member to register itself with the discovery service and begin the cluster once all members have been registered. - -You can use the environment variable `ETCD_DISCOVERY_PROXY` to cause etcd to use an HTTP proxy to connect to the discovery service. - -#### Error and Warning Cases - -##### Discovery Server Errors - - -``` -$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ - --listen-peer-urls http://10.0.1.10:2380 \ - --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.10:2379 \ - --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de -etcd: error: the cluster doesn’t have a size configuration value in https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de/_config -exit 1 -``` - -##### User Errors - -This error will occur if the discovery cluster already has the configured number of members, and `discovery-fallback` is explicitly disabled - -``` -$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ - --listen-peer-urls http://10.0.1.10:2380 \ - --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.10:2379 \ - --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de \ - --discovery-fallback exit -etcd: discovery: cluster is full -exit 1 -``` - -##### Warnings - -This is a harmless warning notifying you that the discovery URL will be -ignored on this machine. - -``` -$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 \ - --listen-peer-urls http://10.0.1.10:2380 \ - --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:2379 \ - --advertise-client-urls http://10.0.1.10:2379 \ - --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de -etcdserver: discovery token ignored since a cluster has already been initialized. Valid log found at /var/lib/etcd -``` - -### DNS Discovery - -DNS [SRV records][rfc-srv] can be used as a discovery mechanism. -The `-discovery-srv` flag can be used to set the DNS domain name where the discovery SRV records can be found. -The following DNS SRV records are looked up in the listed order: - -* _etcd-server-ssl._tcp.example.com -* _etcd-server._tcp.example.com - -If `_etcd-server-ssl._tcp.example.com` is found then etcd will attempt the bootstrapping process over SSL. - -To help clients discover the etcd cluster, the following DNS SRV records are looked up in the listed order: - -* _etcd-client._tcp.example.com -* _etcd-client-ssl._tcp.example.com - -If `_etcd-client-ssl._tcp.example.com` is found, clients will attempt to communicate with the etcd cluster over SSL. - -#### Create DNS SRV records - -``` -$ dig +noall +answer SRV _etcd-server._tcp.example.com -_etcd-server._tcp.example.com. 300 IN SRV 0 0 2380 infra0.example.com. -_etcd-server._tcp.example.com. 300 IN SRV 0 0 2380 infra1.example.com. -_etcd-server._tcp.example.com. 300 IN SRV 0 0 2380 infra2.example.com. -``` - -``` -$ dig +noall +answer SRV _etcd-client._tcp.example.com -_etcd-client._tcp.example.com. 300 IN SRV 0 0 2379 infra0.example.com. -_etcd-client._tcp.example.com. 300 IN SRV 0 0 2379 infra1.example.com. -_etcd-client._tcp.example.com. 300 IN SRV 0 0 2379 infra2.example.com. -``` - -``` -$ dig +noall +answer infra0.example.com infra1.example.com infra2.example.com -infra0.example.com. 300 IN A 10.0.1.10 -infra1.example.com. 300 IN A 10.0.1.11 -infra2.example.com. 300 IN A 10.0.1.12 -``` - -#### Bootstrap the etcd cluster using DNS - -etcd cluster members can listen on domain names or IP address, the bootstrap process will resolve DNS A records. - -The resolved address in `--initial-advertise-peer-urls` *must match* one of the resolved addresses in the SRV targets. The etcd member reads the resolved address to find out if it belongs to the cluster defined in the SRV records. - -``` -$ etcd --name infra0 \ ---discovery-srv example.com \ ---initial-advertise-peer-urls http://infra0.example.com:2380 \ ---initial-cluster-token etcd-cluster-1 \ ---initial-cluster-state new \ ---advertise-client-urls http://infra0.example.com:2379 \ ---listen-client-urls http://infra0.example.com:2379 \ ---listen-peer-urls http://infra0.example.com:2380 -``` - -``` -$ etcd --name infra1 \ ---discovery-srv example.com \ ---initial-advertise-peer-urls http://infra1.example.com:2380 \ ---initial-cluster-token etcd-cluster-1 \ ---initial-cluster-state new \ ---advertise-client-urls http://infra1.example.com:2379 \ ---listen-client-urls http://infra1.example.com:2379 \ ---listen-peer-urls http://infra1.example.com:2380 -``` - -``` -$ etcd --name infra2 \ ---discovery-srv example.com \ ---initial-advertise-peer-urls http://infra2.example.com:2380 \ ---initial-cluster-token etcd-cluster-1 \ ---initial-cluster-state new \ ---advertise-client-urls http://infra2.example.com:2379 \ ---listen-client-urls http://infra2.example.com:2379 \ ---listen-peer-urls http://infra2.example.com:2380 -``` - -You can also bootstrap the cluster using IP addresses instead of domain names: - -``` -$ etcd --name infra0 \ ---discovery-srv example.com \ ---initial-advertise-peer-urls http://10.0.1.10:2380 \ ---initial-cluster-token etcd-cluster-1 \ ---initial-cluster-state new \ ---advertise-client-urls http://10.0.1.10:2379 \ ---listen-client-urls http://10.0.1.10:2379 \ ---listen-peer-urls http://10.0.1.10:2380 -``` - -``` -$ etcd --name infra1 \ ---discovery-srv example.com \ ---initial-advertise-peer-urls http://10.0.1.11:2380 \ ---initial-cluster-token etcd-cluster-1 \ ---initial-cluster-state new \ ---advertise-client-urls http://10.0.1.11:2379 \ ---listen-client-urls http://10.0.1.11:2379 \ ---listen-peer-urls http://10.0.1.11:2380 -``` - -``` -$ etcd --name infra2 \ ---discovery-srv example.com \ ---initial-advertise-peer-urls http://10.0.1.12:2380 \ ---initial-cluster-token etcd-cluster-1 \ ---initial-cluster-state new \ ---advertise-client-urls http://10.0.1.12:2379 \ ---listen-client-urls http://10.0.1.12:2379 \ ---listen-peer-urls http://10.0.1.12:2380 -``` - -#### etcd proxy configuration - -DNS SRV records can also be used to configure the list of peers for an etcd server running in proxy mode: - -``` -$ etcd --proxy on --discovery-srv example.com -``` - -#### etcd client configuration - -DNS SRV records can also be used to help clients discover the etcd cluster. - -The official [etcd/client][client] supports [DNS Discovery][client-discoverer]. - -`etcdctl` also supports DNS Discovery by specifying the `--discovery-srv` option. - -``` -$ etcdctl --discovery-srv example.com set foo bar -``` - -#### Error Cases - -You might see an error like `cannot find local etcd $name from SRV records.`. That means the etcd member fails to find itself from the cluster defined in SRV records. The resolved address in `--initial-advertise-peer-urls` *must match* one of the resolved addresses in the SRV targets. - -# 0.4 to 2.0+ Migration Guide - -In etcd 2.0 we introduced the ability to listen on more than one address and to advertise multiple addresses. This makes using etcd easier when you have complex networking, such as private and public networks on various cloud providers. - -To make understanding this feature easier, we changed the naming of some flags, but we support the old flags to make the migration from the old to new version easier. - -|Old Flag |New Flag |Migration Behavior | -|-----------------------|-----------------------|---------------------------------------------------------------------------------------| -|-peer-addr |--initial-advertise-peer-urls |If specified, peer-addr will be used as the only peer URL. Error if both flags specified.| -|-addr |--advertise-client-urls |If specified, addr will be used as the only client URL. Error if both flags specified.| -|-peer-bind-addr |--listen-peer-urls |If specified, peer-bind-addr will be used as the only peer bind URL. Error if both flags specified.| -|-bind-addr |--listen-client-urls |If specified, bind-addr will be used as the only client bind URL. Error if both flags specified.| -|-peers |none |Deprecated. The --initial-cluster flag provides a similar concept with different semantics. Please read this guide on cluster startup.| -|-peers-file |none |Deprecated. The --initial-cluster flag provides a similar concept with different semantics. Please read this guide on cluster startup.| - -[client]: ../../client -[client-discoverer]: https://godoc.org/github.com/coreos/etcd/client#Discoverer -[conf-adv-client]: configuration.md#-advertise-client-urls -[conf-listen-client]: configuration.md#-listen-client-urls -[discovery-proto]: discovery_protocol.md -[fall-back]: proxy.md#fallback-to-proxy-mode-with-discovery-service -[proxy]: proxy.md -[rfc-srv]: http://www.ietf.org/rfc/rfc2052.txt -[runtime-conf]: runtime-configuration.md -[runtime-reconf-design]: runtime-reconf-design.md diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/configuration.md b/vendor/github.com/coreos/etcd/Documentation/v2/configuration.md deleted file mode 100644 index 655fced2b..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/configuration.md +++ /dev/null @@ -1,293 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Configuration Flags - -etcd is configurable through command-line flags and environment variables. Options set on the command line take precedence over those from the environment. - -The format of environment variable for flag `--my-flag` is `ETCD_MY_FLAG`. It applies to all flags. - -The [official etcd ports][iana-ports] are 2379 for client requests, and 2380 for peer communication. Some legacy code and documentation still references ports 4001 and 7001, but all new etcd use and discussion should adopt the assigned ports. - -To start etcd automatically using custom settings at startup in Linux, using a [systemd][systemd-intro] unit is highly recommended. - -[systemd-intro]: http://freedesktop.org/wiki/Software/systemd/ - -## Member Flags - -### --name -+ Human-readable name for this member. -+ default: "default" -+ env variable: ETCD_NAME -+ This value is referenced as this node's own entries listed in the `--initial-cluster` flag (Ex: `default=http://localhost:2380` or `default=http://localhost:2380,default=http://localhost:7001`). This needs to match the key used in the flag if you're using [static bootstrapping][build-cluster]. When using discovery, each member must have a unique name. `Hostname` or `machine-id` can be a good choice. - -### --data-dir -+ Path to the data directory. -+ default: "${name}.etcd" -+ env variable: ETCD_DATA_DIR - -### --wal-dir -+ Path to the dedicated wal directory. If this flag is set, etcd will write the WAL files to the walDir rather than the dataDir. This allows a dedicated disk to be used, and helps avoid io competition between logging and other IO operations. -+ default: "" -+ env variable: ETCD_WAL_DIR - -### --snapshot-count -+ Number of committed transactions to trigger a snapshot to disk. -+ default: "10000" -+ env variable: ETCD_SNAPSHOT_COUNT - -### --heartbeat-interval -+ Time (in milliseconds) of a heartbeat interval. -+ default: "100" -+ env variable: ETCD_HEARTBEAT_INTERVAL - -### --election-timeout -+ Time (in milliseconds) for an election to timeout. See [tuning.md](tuning.md#time-parameters) for details. -+ default: "1000" -+ env variable: ETCD_ELECTION_TIMEOUT - -### --listen-peer-urls -+ List of URLs to listen on for peer traffic. This flag tells the etcd to accept incoming requests from its peers on the specified scheme://IP:port combinations. Scheme can be either http or https.If 0.0.0.0 is specified as the IP, etcd listens to the given port on all interfaces. If an IP address is given as well as a port, etcd will listen on the given port and interface. Multiple URLs may be used to specify a number of addresses and ports to listen on. The etcd will respond to requests from any of the listed addresses and ports. -+ default: "http://localhost:2380,http://localhost:7001" -+ env variable: ETCD_LISTEN_PEER_URLS -+ example: "http://10.0.0.1:2380" -+ invalid example: "http://example.com:2380" (domain name is invalid for binding) - -### --listen-client-urls -+ List of URLs to listen on for client traffic. This flag tells the etcd to accept incoming requests from the clients on the specified scheme://IP:port combinations. Scheme can be either http or https. If 0.0.0.0 is specified as the IP, etcd listens to the given port on all interfaces. If an IP address is given as well as a port, etcd will listen on the given port and interface. Multiple URLs may be used to specify a number of addresses and ports to listen on. The etcd will respond to requests from any of the listed addresses and ports. -+ default: "http://localhost:2379,http://localhost:4001" -+ env variable: ETCD_LISTEN_CLIENT_URLS -+ example: "http://10.0.0.1:2379" -+ invalid example: "http://example.com:2379" (domain name is invalid for binding) - -### --max-snapshots -+ Maximum number of snapshot files to retain (0 is unlimited) -+ default: 5 -+ env variable: ETCD_MAX_SNAPSHOTS -+ The default for users on Windows is unlimited, and manual purging down to 5 (or your preference for safety) is recommended. - -### --max-wals -+ Maximum number of wal files to retain (0 is unlimited) -+ default: 5 -+ env variable: ETCD_MAX_WALS -+ The default for users on Windows is unlimited, and manual purging down to 5 (or your preference for safety) is recommended. - -### --cors -+ Comma-separated white list of origins for CORS (cross-origin resource sharing). -+ default: none -+ env variable: ETCD_CORS - -## Clustering Flags - -`--initial` prefix flags are used in bootstrapping ([static bootstrap][build-cluster], [discovery-service bootstrap][discovery] or [runtime reconfiguration][reconfig]) a new member, and ignored when restarting an existing member. - -`--discovery` prefix flags need to be set when using [discovery service][discovery]. - -### --initial-advertise-peer-urls - -+ List of this member's peer URLs to advertise to the rest of the cluster. These addresses are used for communicating etcd data around the cluster. At least one must be routable to all cluster members. These URLs can contain domain names. -+ default: "http://localhost:2380,http://localhost:7001" -+ env variable: ETCD_INITIAL_ADVERTISE_PEER_URLS -+ example: "http://example.com:2380, http://10.0.0.1:2380" - -### --initial-cluster -+ Initial cluster configuration for bootstrapping. -+ default: "default=http://localhost:2380,default=http://localhost:7001" -+ env variable: ETCD_INITIAL_CLUSTER -+ The key is the value of the `--name` flag for each node provided. The default uses `default` for the key because this is the default for the `--name` flag. - -### --initial-cluster-state -+ Initial cluster state ("new" or "existing"). Set to `new` for all members present during initial static or DNS bootstrapping. If this option is set to `existing`, etcd will attempt to join the existing cluster. If the wrong value is set, etcd will attempt to start but fail safely. -+ default: "new" -+ env variable: ETCD_INITIAL_CLUSTER_STATE - -[static bootstrap]: clustering.md#static - -### --initial-cluster-token -+ Initial cluster token for the etcd cluster during bootstrap. -+ default: "etcd-cluster" -+ env variable: ETCD_INITIAL_CLUSTER_TOKEN - -### --advertise-client-urls -+ List of this member's client URLs to advertise to the rest of the cluster. These URLs can contain domain names. -+ default: "http://localhost:2379,http://localhost:4001" -+ env variable: ETCD_ADVERTISE_CLIENT_URLS -+ example: "http://example.com:2379, http://10.0.0.1:2379" -+ Be careful if you are advertising URLs such as http://localhost:2379 from a cluster member and are using the proxy feature of etcd. This will cause loops, because the proxy will be forwarding requests to itself until its resources (memory, file descriptors) are eventually depleted. - -### --discovery -+ Discovery URL used to bootstrap the cluster. -+ default: none -+ env variable: ETCD_DISCOVERY - -### --discovery-srv -+ DNS srv domain used to bootstrap the cluster. -+ default: none -+ env variable: ETCD_DISCOVERY_SRV - -### --discovery-fallback -+ Expected behavior ("exit" or "proxy") when discovery services fails. -+ default: "proxy" -+ env variable: ETCD_DISCOVERY_FALLBACK - -### --discovery-proxy -+ HTTP proxy to use for traffic to discovery service. -+ default: none -+ env variable: ETCD_DISCOVERY_PROXY - -### --strict-reconfig-check -+ Reject reconfiguration requests that would cause quorum loss. -+ default: false -+ env variable: ETCD_STRICT_RECONFIG_CHECK - -## Proxy Flags - -`--proxy` prefix flags configures etcd to run in [proxy mode][proxy]. - -### --proxy -+ Proxy mode setting ("off", "readonly" or "on"). -+ default: "off" -+ env variable: ETCD_PROXY - -### --proxy-failure-wait -+ Time (in milliseconds) an endpoint will be held in a failed state before being reconsidered for proxied requests. -+ default: 5000 -+ env variable: ETCD_PROXY_FAILURE_WAIT - -### --proxy-refresh-interval -+ Time (in milliseconds) of the endpoints refresh interval. -+ default: 30000 -+ env variable: ETCD_PROXY_REFRESH_INTERVAL - -### --proxy-dial-timeout -+ Time (in milliseconds) for a dial to timeout or 0 to disable the timeout -+ default: 1000 -+ env variable: ETCD_PROXY_DIAL_TIMEOUT - -### --proxy-write-timeout -+ Time (in milliseconds) for a write to timeout or 0 to disable the timeout. -+ default: 5000 -+ env variable: ETCD_PROXY_WRITE_TIMEOUT - -### --proxy-read-timeout -+ Time (in milliseconds) for a read to timeout or 0 to disable the timeout. -+ Don't change this value if you use watches because they are using long polling requests. -+ default: 0 -+ env variable: ETCD_PROXY_READ_TIMEOUT - -## Security Flags - -The security flags help to [build a secure etcd cluster][security]. - -### --ca-file - -**DEPRECATED** - -+ Path to the client server TLS CA file. `--ca-file ca.crt` could be replaced by `--trusted-ca-file ca.crt --client-cert-auth` and etcd will perform the same. -+ default: none -+ env variable: ETCD_CA_FILE - -### --cert-file -+ Path to the client server TLS cert file. -+ default: none -+ env variable: ETCD_CERT_FILE - -### --key-file -+ Path to the client server TLS key file. -+ default: none -+ env variable: ETCD_KEY_FILE - -### --client-cert-auth -+ Enable client cert authentication. -+ default: false -+ env variable: ETCD_CLIENT_CERT_AUTH - -### --trusted-ca-file -+ Path to the client server TLS trusted CA cert file. -+ default: none -+ env variable: ETCD_TRUSTED_CA_FILE - -### --peer-ca-file - -**DEPRECATED** - -+ Path to the peer server TLS CA file. `--peer-ca-file ca.crt` could be replaced by `--peer-trusted-ca-file ca.crt --peer-client-cert-auth` and etcd will perform the same. -+ default: none -+ env variable: ETCD_PEER_CA_FILE - -### --peer-cert-file -+ Path to the peer server TLS cert file. -+ default: none -+ env variable: ETCD_PEER_CERT_FILE - -### --peer-key-file -+ Path to the peer server TLS key file. -+ default: none -+ env variable: ETCD_PEER_KEY_FILE - -### --peer-client-cert-auth -+ Enable peer client cert authentication. -+ default: false -+ env variable: ETCD_PEER_CLIENT_CERT_AUTH - -### --peer-trusted-ca-file -+ Path to the peer server TLS trusted CA file. -+ default: none -+ env variable: ETCD_PEER_TRUSTED_CA_FILE - -## Logging Flags - -### --debug -+ Drop the default log level to DEBUG for all subpackages. -+ default: false (INFO for all packages) -+ env variable: ETCD_DEBUG - -### --log-package-levels -+ Set individual etcd subpackages to specific log levels. An example being `etcdserver=WARNING,security=DEBUG` -+ default: none (INFO for all packages) -+ env variable: ETCD_LOG_PACKAGE_LEVELS - - -## Unsafe Flags - -Please be CAUTIOUS when using unsafe flags because it will break the guarantees given by the consensus protocol. -For example, it may panic if other members in the cluster are still alive. -Follow the instructions when using these flags. - -### --force-new-cluster -+ Force to create a new one-member cluster. It commits configuration changes forcing to remove all existing members in the cluster and add itself. It needs to be set to [restore a backup][restore]. -+ default: false -+ env variable: ETCD_FORCE_NEW_CLUSTER - -## Experimental Flags - -### --experimental-v3demo -+ Enable experimental [v3 demo API][rfc-v3]. -+ default: false -+ env variable: ETCD_EXPERIMENTAL_V3DEMO - -## Miscellaneous Flags - -### --version -+ Print the version and exit. -+ default: false - -## Profiling flags - -### --enable-pprof -+ Enable runtime profiling data via HTTP server. Address is at client URL + "/debug/pprof/" -+ default: false - -[build-cluster]: clustering.md#static -[reconfig]: runtime-configuration.md -[discovery]: clustering.md#discovery -[iana-ports]: http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt -[proxy]: proxy.md -[reconfig]: runtime-configuration.md -[restore]: admin_guide.md#restoring-a-backup -[rfc-v3]: rfc/v3api.md -[security]: security.md -[systemd-intro]: http://freedesktop.org/wiki/Software/systemd/ -[tuning]: tuning.md#time-parameters diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/dev/release.md b/vendor/github.com/coreos/etcd/Documentation/v2/dev/release.md deleted file mode 100644 index bbf061da7..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/dev/release.md +++ /dev/null @@ -1,115 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -# etcd release guide - -The guide talks about how to release a new version of etcd. - -The procedure includes some manual steps for sanity checking but it can probably be further scripted. Please keep this document up-to-date if you want to make changes to the release process. - -## Prepare Release - -Set desired version as environment variable for following steps. Here is an example to release 2.1.3: - -``` -export VERSION=v2.1.3 -export PREV_VERSION=v2.1.2 -``` - -All releases version numbers follow the format of [semantic versioning 2.0.0](http://semver.org/). - -### Major, Minor Version Release, or its Pre-release - -- Ensure the relevant milestone on GitHub is complete. All referenced issues should be closed, or moved elsewhere. -- Remove this release from [roadmap](https://github.com/coreos/etcd/blob/master/ROADMAP.md), if necessary. -- Ensure the latest upgrade documentation is available. -- Bump [hardcoded MinClusterVerion in the repository](https://github.com/coreos/etcd/blob/master/version/version.go#L29), if necessary. -- Add feature capability maps for the new version, if necessary. - -### Patch Version Release - -- Discuss about commits that are backported to the patch release. The commits should not include merge commits. -- Cherry-pick these commits starting from the oldest one into stable branch. - -## Write Release Note - - -- Write introduction for the new release. For example, what major bug we fix, what new features we introduce or what performance improvement we make. -- Write changelog for the last release. ChangeLog should be straightforward and easy to understand for the end-user. -- Put `[GH XXXX]` at the head of change line to reference Pull Request that introduces the change. Moreover, add a link on it to jump to the Pull Request. - -## Tag Version - -- Bump [hardcoded Version in the repository](https://github.com/coreos/etcd/blob/master/version/version.go#L30) to the latest version `${VERSION}`. -- Ensure all tests on CI system are passed. -- Manually check etcd is buildable in Linux, Darwin and Windows. -- Manually check upgrade etcd cluster of previous minor version works well. -- Manually check new features work well. -- Add a signed tag through `git tag -s ${VERSION}`. -- Sanity check tag correctness through `git show tags/$VERSION`. -- Push the tag to GitHub through `git push origin tags/$VERSION`. This assumes `origin` corresponds to "https://github.com/coreos/etcd". - -## Build Release Binaries and Images - -- Ensure `acbuild` is available. -- Ensure `docker` is available. - -Run release script in root directory: - -``` -./scripts/release.sh ${VERSION} -``` - -It generates all release binaries and images under directory ./release. - -## Sign Binaries and Images - -Choose appropriate private key to sign the generated binaries and images. - -The following commands are used for public release sign: - -``` -cd release -# personal GPG is okay for now -for i in etcd-*{.zip,.tar.gz}; do gpg --sign ${i}; done -# use `CoreOS ACI Builder ` secret key -for aci in etcd-${VERSION}.*.aci; do gpg -u 88182190 -a --output ${aci}.asc --detach-sig ${aci}; done -``` - -## Publish Release Page in GitHub - -- Set release title as the version name. -- Follow the format of previous release pages. -- Attach the generated binaries, aci image and signatures. -- Select whether it is a pre-release. -- Publish the release! - -## Publish Docker Image in Quay.io - -- Push docker image: - -``` -docker login quay.io -docker push quay.io/coreos/etcd:${VERSION} -docker push quay.io/coreos/etcd:${VERSION}-${arch} -``` - -- Add `latest` tag to the new image on [quay.io](https://quay.io/repository/coreos/etcd?tag=latest&tab=tags) if this is a stable release. - -## Announce to etcd-dev Googlegroup - -- Follow the format of [previous release emails](https://groups.google.com/forum/#!forum/etcd-dev). -- Make sure to include a list of authors that contributed since the previous release - something like the following might be handy: - -``` -git log ...${PREV_VERSION} --pretty=format:"%an" | sort | uniq | tr '\n' ',' | sed -e 's#,#, #g' -e 's#, $##' -``` - -- Send email to etcd-dev@googlegroups.com - -## Post Release - -- Create new stable branch through `git push origin ${VERSION_MAJOR}.${VERSION_MINOR}` if this is a major stable release. This assumes `origin` corresponds to "https://github.com/coreos/etcd". -- Bump [hardcoded Version in the repository](https://github.com/coreos/etcd/blob/master/version/version.go#L30) to the version `${VERSION}+git`. diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/discovery_protocol.md b/vendor/github.com/coreos/etcd/Documentation/v2/discovery_protocol.md deleted file mode 100644 index b9479ac39..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/discovery_protocol.md +++ /dev/null @@ -1,119 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Discovery Service Protocol - -Discovery service protocol helps new etcd member to discover all other members in cluster bootstrap phase using a shared discovery URL. - -Discovery service protocol is _only_ used in cluster bootstrap phase, and cannot be used for runtime reconfiguration or cluster monitoring. - -The protocol uses a new discovery token to bootstrap one _unique_ etcd cluster. Remember that one discovery token can represent only one etcd cluster. As long as discovery protocol on this token starts, even if it fails halfway, it must not be used to bootstrap another etcd cluster. - -The rest of this article will walk through the discovery process with examples that correspond to a self-hosted discovery cluster. The public discovery service, discovery.etcd.io, functions the same way, but with a layer of polish to abstract away ugly URLs, generate UUIDs automatically, and provide some protections against excessive requests. At its core, the public discovery service still uses an etcd cluster as the data store as described in this document. - -## The Protocol Workflow - -The idea of discovery protocol is to use an internal etcd cluster to coordinate bootstrap of a new cluster. First, all new members interact with discovery service and help to generate the expected member list. Then each new member bootstraps its server using this list, which performs the same functionality as -initial-cluster flag. - -In the following example workflow, we will list each step of protocol in curl format for ease of understanding. - -By convention the etcd discovery protocol uses the key prefix `_etcd/registry`. If `http://example.com` hosts an etcd cluster for discovery service, a full URL to discovery keyspace will be `http://example.com/v2/keys/_etcd/registry`. We will use this as the URL prefix in the example. - -### Creating a New Discovery Token - -Generate a unique token that will identify the new cluster. This will be used as a unique prefix in discovery keyspace in the following steps. An easy way to do this is to use `uuidgen`: - -``` -UUID=$(uuidgen) -``` - -### Specifying the Expected Cluster Size - -You need to specify the expected cluster size for this discovery token. The size is used by the discovery service to know when it has found all members that will initially form the cluster. - -``` -curl -X PUT http://example.com/v2/keys/_etcd/registry/${UUID}/_config/size -d value=${cluster_size} -``` - -Usually the cluster size is 3, 5 or 7. Check [optimal cluster size][cluster-size] for more details. - -### Bringing up etcd Processes - -Now that you have your discovery URL, you can use it as `-discovery` flag and bring up etcd processes. Every etcd process will follow this next few steps internally if given a `-discovery` flag. - -### Registering itself - -The first thing for etcd process is to register itself into the discovery URL as a member. This is done by creating member ID as a key in the discovery URL. - -``` -curl -X PUT http://example.com/v2/keys/_etcd/registry/${UUID}/${member_id}?prevExist=false -d value="${member_name}=${member_peer_url_1}&${member_name}=${member_peer_url_2}" -``` - -### Checking the Status - -It checks the expected cluster size and registration status in discovery URL, and decides what the next action is. - -``` -curl -X GET http://example.com/v2/keys/_etcd/registry/${UUID}/_config/size -curl -X GET http://example.com/v2/keys/_etcd/registry/${UUID} -``` - -If registered members are still not enough, it will wait for left members to appear. - -If the number of registered members is bigger than the expected size N, it treats the first N registered members as the member list for the cluster. If the member itself is in the member list, the discovery procedure succeeds and it fetches all peers through the member list. If it is not in the member list, the discovery procedure finishes with the failure that the cluster has been full. - -In etcd implementation, the member may check the cluster status even before registering itself. So it could fail quickly if the cluster has been full. - -### Waiting for All Members - - -The wait process is described in detail in the [etcd API documentation][api]. - -``` -curl -X GET http://example.com/v2/keys/_etcd/registry/${UUID}?wait=true&waitIndex=${current_etcd_index} -``` - -It keeps waiting until finding all members. - -## Public Discovery Service - -CoreOS Inc. hosts a public discovery service at https://discovery.etcd.io/ , which provides some nice features for ease of use. - -### Mask Key Prefix - -Public discovery service will redirect `https://discovery.etcd.io/${UUID}` to etcd cluster behind for the key at `/v2/keys/_etcd/registry`. It masks register key prefix for short and readable discovery url. - -### Get new token - -``` -GET /new - -Sent query: - size=${cluster_size} -Possible status codes: - 200 OK - 400 Bad Request -200 Body: - generated discovery url -``` - -The generation process in the service follows the steps from [Creating a New Discovery Token][new-discovery-token] to [Specifying the Expected Cluster Size][expected-cluster-size]. - -### Check Discovery Status - -``` -GET /${UUID} -``` - -You can check the status for this discovery token, including the machines that have been registered, by requesting the value of the UUID. - -### Open-source repository - -The repository is located at https://github.com/coreos/discovery.etcd.io. You could use it to build your own public discovery service. - -[api]: api.md#waiting-for-a-change -[cluster-size]: admin_guide.md#optimal-cluster-size -[expected-cluster-size]: #specifying-the-expected-cluster-size -[new-discovery-token]: #creating-a-new-discovery-token diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/docker_guide.md b/vendor/github.com/coreos/etcd/Documentation/v2/docker_guide.md deleted file mode 100644 index 74dd90688..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/docker_guide.md +++ /dev/null @@ -1,101 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Running etcd under Docker - -The following guide will show you how to run etcd under Docker using the [static bootstrap process](clustering.md#static). - -## Running etcd in standalone mode - -In order to expose the etcd API to clients outside of the Docker host you'll need use the host IP address when configuring etcd. - -``` -export HostIP="192.168.12.50" -``` - -The following `docker run` command will expose the etcd client API over ports 4001 and 2379, and expose the peer port over 2380. - -This will run the latest release version of etcd. You can specify version if needed (e.g. `quay.io/coreos/etcd:v2.2.0`). - -``` -docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs -p 4001:4001 -p 2380:2380 -p 2379:2379 \ - --name etcd quay.io/coreos/etcd:v2.3.8 \ - -name etcd0 \ - -advertise-client-urls http://${HostIP}:2379,http://${HostIP}:4001 \ - -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ - -initial-advertise-peer-urls http://${HostIP}:2380 \ - -listen-peer-urls http://0.0.0.0:2380 \ - -initial-cluster-token etcd-cluster-1 \ - -initial-cluster etcd0=http://${HostIP}:2380 \ - -initial-cluster-state new -``` - -Configure etcd clients to use the Docker host IP and one of the listening ports from above. - -``` -etcdctl -C http://192.168.12.50:2379 member list -``` - -``` -etcdctl -C http://192.168.12.50:4001 member list -``` - -## Running a 3 node etcd cluster - -Using Docker to setup a multi-node cluster is very similar to the standalone mode configuration. -The main difference being the value used for the `-initial-cluster` flag, which must contain the peer urls for each etcd member in the cluster. - -**Although the following commands look very similar, note that `-name`, `-advertise-client-urls` and `-initial-advertise-peer-urls` differ for each cluster member** - -### etcd0 - -``` -docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs -p 4001:4001 -p 2380:2380 -p 2379:2379 \ - --name etcd quay.io/coreos/etcd:v2.3.8 \ - -name etcd0 \ - -advertise-client-urls http://192.168.12.50:2379,http://192.168.12.50:4001 \ - -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ - -initial-advertise-peer-urls http://192.168.12.50:2380 \ - -listen-peer-urls http://0.0.0.0:2380 \ - -initial-cluster-token etcd-cluster-1 \ - -initial-cluster etcd0=http://192.168.12.50:2380,etcd1=http://192.168.12.51:2380,etcd2=http://192.168.12.52:2380 \ - -initial-cluster-state new -``` - -### etcd1 - -``` -docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs -p 4001:4001 -p 2380:2380 -p 2379:2379 \ - --name etcd quay.io/coreos/etcd:v2.3.8 \ - -name etcd1 \ - -advertise-client-urls http://192.168.12.51:2379,http://192.168.12.51:4001 \ - -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ - -initial-advertise-peer-urls http://192.168.12.51:2380 \ - -listen-peer-urls http://0.0.0.0:2380 \ - -initial-cluster-token etcd-cluster-1 \ - -initial-cluster etcd0=http://192.168.12.50:2380,etcd1=http://192.168.12.51:2380,etcd2=http://192.168.12.52:2380 \ - -initial-cluster-state new -``` - -### etcd2 - -``` -docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs -p 4001:4001 -p 2380:2380 -p 2379:2379 \ - --name etcd quay.io/coreos/etcd:v2.3.8 \ - -name etcd2 \ - -advertise-client-urls http://192.168.12.52:2379,http://192.168.12.52:4001 \ - -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ - -initial-advertise-peer-urls http://192.168.12.52:2380 \ - -listen-peer-urls http://0.0.0.0:2380 \ - -initial-cluster-token etcd-cluster-1 \ - -initial-cluster etcd0=http://192.168.12.50:2380,etcd1=http://192.168.12.51:2380,etcd2=http://192.168.12.52:2380 \ - -initial-cluster-state new -``` - -Once the cluster has been bootstrapped etcd clients can be configured with a list of etcd members: - -``` -etcdctl -C http://192.168.12.50:2379,http://192.168.12.51:2379,http://192.168.12.52:2379 member list -``` diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/errorcode.md b/vendor/github.com/coreos/etcd/Documentation/v2/errorcode.md deleted file mode 100644 index 4caf22a5b..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/errorcode.md +++ /dev/null @@ -1,47 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Error Code -====== - -This document describes the error code used in key space '/v2/keys'. Feel free to import 'github.com/coreos/etcd/error' to use. - -It's categorized into four groups: - -- Command Related Error - -| name | code | strerror | -|----------------------|------|-----------------------| -| EcodeKeyNotFound | 100 | "Key not found" | -| EcodeTestFailed | 101 | "Compare failed" | -| EcodeNotFile | 102 | "Not a file" | -| EcodeNotDir | 104 | "Not a directory" | -| EcodeNodeExist | 105 | "Key already exists" | -| EcodeRootROnly | 107 | "Root is read only" | -| EcodeDirNotEmpty | 108 | "Directory not empty" | - -- Post Form Related Error - -| name | code | strerror | -|--------------------------|------|------------------------------------------------| -| EcodePrevValueRequired | 201 | "PrevValue is Required in POST form" | -| EcodeTTLNaN | 202 | "The given TTL in POST form is not a number" | -| EcodeIndexNaN | 203 | "The given index in POST form is not a number" | -| EcodeInvalidField | 209 | "Invalid field" | -| EcodeInvalidForm | 210 | "Invalid POST form" | - -- Raft Related Error - -| name | code | strerror | -|-------------------|------|--------------------------| -| EcodeRaftInternal | 300 | "Raft Internal Error" | -| EcodeLeaderElect | 301 | "During Leader Election" | - -- Etcd Related Error - -| name | code | strerror | -|-------------------------|------|--------------------------------------------------------| -| EcodeWatcherCleared | 400 | "watcher is cleared due to etcd recovery" | -| EcodeEventIndexCleared | 401 | "The event in requested index is outdated and cleared" | diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/etcd_alert.rules b/vendor/github.com/coreos/etcd/Documentation/v2/etcd_alert.rules deleted file mode 100644 index 5493c56b6..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/etcd_alert.rules +++ /dev/null @@ -1,121 +0,0 @@ -### General cluster availability ### - -# alert if another failed member will result in an unavailable cluster -ALERT InsufficientMembers - IF count(up{job="etcd"} == 0) > (count(up{job="etcd"}) / 2 - 1) - FOR 3m - LABELS { - severity = "critical" - } - ANNOTATIONS { - summary = "etcd cluster insufficient members", - description = "If one more etcd member goes down the cluster will be unavailable", - } - -### HTTP requests alerts ### - -# alert if more than 1% of requests to an HTTP endpoint have failed with a non 4xx response -ALERT HighNumberOfFailedHTTPRequests - IF sum by(method) (rate(etcd_http_failed_total{job="etcd", code!~"4[0-9]{2}"}[5m])) - / sum by(method) (rate(etcd_http_received_total{job="etcd"}[5m])) > 0.01 - FOR 10m - LABELS { - severity = "warning" - } - ANNOTATIONS { - summary = "a high number of HTTP requests are failing", - description = "{{ $value }}% of requests for {{ $labels.method }} failed on etcd instance {{ $labels.instance }}", - } - -# alert if more than 5% of requests to an HTTP endpoint have failed with a non 4xx response -ALERT HighNumberOfFailedHTTPRequests - IF sum by(method) (rate(etcd_http_failed_total{job="etcd", code!~"4[0-9]{2}"}[5m])) - / sum by(method) (rate(etcd_http_received_total{job="etcd"}[5m])) > 0.05 - FOR 5m - LABELS { - severity = "critical" - } - ANNOTATIONS { - summary = "a high number of HTTP requests are failing", - description = "{{ $value }}% of requests for {{ $labels.method }} failed on etcd instance {{ $labels.instance }}", - } - -# alert if 50% of requests get a 4xx response -ALERT HighNumberOfFailedHTTPRequests - IF sum by(method) (rate(etcd_http_failed_total{job="etcd", code=~"4[0-9]{2}"}[5m])) - / sum by(method) (rate(etcd_http_received_total{job="etcd"}[5m])) > 0.5 - FOR 10m - LABELS { - severity = "critical" - } - ANNOTATIONS { - summary = "a high number of HTTP requests are failing", - description = "{{ $value }}% of requests for {{ $labels.method }} failed with 4xx responses on etcd instance {{ $labels.instance }}", - } - -# alert if the 99th percentile of HTTP requests take more than 150ms -ALERT HTTPRequestsSlow - IF histogram_quantile(0.99, rate(etcd_http_successful_duration_second_bucket[5m])) > 0.15 - FOR 10m - LABELS { - severity = "warning" - } - ANNOTATIONS { - summary = "slow HTTP requests", - description = "on etcd instance {{ $labels.instance }} HTTP requests to {{ $labels.method }} are slow", - } - -### File descriptor alerts ### - -instance:fd_utilization = process_open_fds / process_max_fds - -# alert if file descriptors are likely to exhaust within the next 4 hours -ALERT FdExhaustionClose - IF predict_linear(instance:fd_utilization[1h], 3600 * 4) > 1 - FOR 10m - LABELS { - severity = "warning" - } - ANNOTATIONS { - summary = "file descriptors soon exhausted", - description = "{{ $labels.job }} instance {{ $labels.instance }} will exhaust its file descriptors soon", - } - -# alert if file descriptors are likely to exhaust within the next hour -ALERT FdExhaustionClose - IF predict_linear(instance:fd_utilization[10m], 3600) > 1 - FOR 10m - LABELS { - severity = "critical" - } - ANNOTATIONS { - summary = "file descriptors soon exhausted", - description = "{{ $labels.job }} instance {{ $labels.instance }} will exhaust its file descriptors soon", - } - -### etcd proposal alerts ### - -# alert if there are several failed proposals within an hour -ALERT HighNumberOfFailedProposals - IF increase(etcd_server_proposal_failed_total{job="etcd"}[1h]) > 5 - LABELS { - severity = "warning" - } - ANNOTATIONS { - summary = "a high number of proposals within the etcd cluster are failing", - description = "etcd instance {{ $labels.instance }} has seen {{ $value }} proposal failures within the last hour", - } - -### etcd disk io latency alerts ### - -# alert if 99th percentile of fsync durations is higher than 500ms -ALERT HighFsyncDurations - IF histogram_quantile(0.99, rate(etcd_wal_fsync_durations_seconds_bucket[5m])) > 0.5 - FOR 10m - LABELS { - severity = "warning" - } - ANNOTATIONS { - summary = "high fsync durations", - description = "etcd instance {{ $labels.instance }} fync durations are high", - } diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/etcd_alert.rules.yml b/vendor/github.com/coreos/etcd/Documentation/v2/etcd_alert.rules.yml deleted file mode 100644 index c9f8686be..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/etcd_alert.rules.yml +++ /dev/null @@ -1,91 +0,0 @@ -groups: -- name: etcd_alert.rules - rules: - - alert: InsufficientMembers - expr: count(up{job="etcd"} == 0) > (count(up{job="etcd"}) / 2 - 1) - for: 3m - labels: - severity: critical - annotations: - description: If one more etcd member goes down the cluster will be unavailable - summary: etcd cluster insufficient members - - alert: HighNumberOfFailedHTTPRequests - expr: sum(rate(etcd_http_failed_total{code!~"^(?:4[0-9]{2})$",job="etcd"}[5m])) - BY (method) / sum(rate(etcd_http_received_total{job="etcd"}[5m])) BY (method) - > 0.01 - for: 10m - labels: - severity: warning - annotations: - description: '{{ $value }}% of requests for {{ $labels.method }} failed on etcd - instance {{ $labels.instance }}' - summary: a high number of HTTP requests are failing - - alert: HighNumberOfFailedHTTPRequests - expr: sum(rate(etcd_http_failed_total{code!~"^(?:4[0-9]{2})$",job="etcd"}[5m])) - BY (method) / sum(rate(etcd_http_received_total{job="etcd"}[5m])) BY (method) - > 0.05 - for: 5m - labels: - severity: critical - annotations: - description: '{{ $value }}% of requests for {{ $labels.method }} failed on etcd - instance {{ $labels.instance }}' - summary: a high number of HTTP requests are failing - - alert: HighNumberOfFailedHTTPRequests - expr: sum(rate(etcd_http_failed_total{code=~"^(?:4[0-9]{2})$",job="etcd"}[5m])) - BY (method) / sum(rate(etcd_http_received_total{job="etcd"}[5m])) BY (method) - > 0.5 - for: 10m - labels: - severity: critical - annotations: - description: '{{ $value }}% of requests for {{ $labels.method }} failed with - 4xx responses on etcd instance {{ $labels.instance }}' - summary: a high number of HTTP requests are failing - - alert: HTTPRequestsSlow - expr: histogram_quantile(0.99, rate(etcd_http_successful_duration_second_bucket[5m])) - > 0.15 - for: 10m - labels: - severity: warning - annotations: - description: on etcd instance {{ $labels.instance }} HTTP requests to {{ $labels.method - }} are slow - summary: slow HTTP requests - - record: instance:fd_utilization - expr: process_open_fds / process_max_fds - - alert: FdExhaustionClose - expr: predict_linear(instance:fd_utilization[1h], 3600 * 4) > 1 - for: 10m - labels: - severity: warning - annotations: - description: '{{ $labels.job }} instance {{ $labels.instance }} will exhaust - its file descriptors soon' - summary: file descriptors soon exhausted - - alert: FdExhaustionClose - expr: predict_linear(instance:fd_utilization[10m], 3600) > 1 - for: 10m - labels: - severity: critical - annotations: - description: '{{ $labels.job }} instance {{ $labels.instance }} will exhaust - its file descriptors soon' - summary: file descriptors soon exhausted - - alert: HighNumberOfFailedProposals - expr: increase(etcd_server_proposal_failed_total{job="etcd"}[1h]) > 5 - labels: - severity: warning - annotations: - description: etcd instance {{ $labels.instance }} has seen {{ $value }} proposal - failures within the last hour - summary: a high number of proposals within the etcd cluster are failing - - alert: HighFsyncDurations - expr: histogram_quantile(0.99, rate(etcd_wal_fsync_durations_seconds_bucket[5m])) - > 0.5 - for: 10m - labels: - severity: warning - annotations: - description: etcd instance {{ $labels.instance }} fync durations are high - summary: high fsync durations diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/faq.md b/vendor/github.com/coreos/etcd/Documentation/v2/faq.md deleted file mode 100644 index c0faa41e0..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/faq.md +++ /dev/null @@ -1,89 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# FAQ - -## 1) Why can an etcd client read an old version of data when a majority of the etcd cluster members are down? - -In situations where a client connects to a minority, etcd -favors by default availability over consistency. This means that even though -data might be “out of date”, it is still better to return something versus -nothing. - -In order to confirm that a read is up to date with a majority of the cluster, -the client can use the `quorum=true` parameter on reads of keys. This means -that a majority of the cluster is checked on reads before returning the data, -otherwise the read will timeout and fail. - -## 2) With quorum=false, doesn’t this mean that if my client switched the member it was connected to, that it could experience a logical ordering where the cluster goes backwards in time? - -Yes, but this could be handled at the etcd client implementation via -remembering the last seen index. The “index” is the cluster's single -irrevocable sequence of the entire modification history. The client could -remember the last seen index, and determine via comparing the index returned on -the GET whether or not the state of the key-value pair is before or after its -last seen state. - -## 3) What happens if a watch is registered on a minority member? - -The watch will stay untriggered, even as modifications are occurring in the -majority quorum. This is an open issue, and is being addressed in v3. There are -multiple ways to work around the watch trigger not firing. - -1) build a signaling mechanism independent of etcd. This could be as simple as -a “pulse” to the client to reissue a GET with quorum=true for the most recent -version of the data. - -2) poll on the `/v2/keys` endpoint and check that the raft-index is increasing every -timeout. - -## 4) What is a proxy used for? - -A proxy is a redirection server to the etcd cluster. The proxy handles the -redirection of a client to the current configuration of the etcd cluster. A -typical use case is to start a proxy on a machine, and on first boot up of the -proxy specify both the `--proxy` flag and the `--initial-cluster` flag. - -From there, any etcdctl client that starts up automatically speaks to the local -proxy and the proxy redirects operations to the current configuration of the -cluster it was originally paired with. - -In the v2 spec of etcd, proxies cannot be promoted to members of the cluster. -They also cannot be promoted to followers or at any point become part of the -replication of the etcd cluster itself. - -## 5) How is cluster membership and health handled in etcd v2? - -The design goal of etcd is that reconfiguration is simply an API, and health -monitoring and addition/removal of members is up to the individual application -and their integration with the reconfiguration API. - -Thus, a member that is down, even infinitely, will never be automatically -removed from the etcd cluster member list. - -This makes sense because it's usually an application level / administrative -action to determine whether a reconfiguration should happen based on health. - -For more information, refer to the [runtime reconfiguration design document][runtime-reconf-design]. - -## 6) how does --endpoint work with etcdctl? - -The `--endpoint` flag can specify any number of etcd cluster members in a comma -separated list. This list might be a subset, equal to, or more than the actual -etcd cluster member list itself. - -If only one peer is specified via the `--endpoint` flag, the etcdctl discovers the -rest of the cluster via the member list of that one peer, and then it randomly -chooses a member to use. Again, the client can use the `quorum=true` flag on -reads, which will always fail when using a member in the minority. - -If peers from multiple clusters are specified via the `--endpoint` flag, etcdctl -will randomly choose a peer, and the request will simply get routed to one of -the clusters. This is probably not what you want. - -Note: --peers flag is now deprecated and --endpoint should be used instead, -as it might confuse users to give etcdctl a peerURL. - -[runtime-reconf-design]: runtime-reconf-design.md diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/glossary.md b/vendor/github.com/coreos/etcd/Documentation/v2/glossary.md deleted file mode 100644 index 70c2d40ee..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/glossary.md +++ /dev/null @@ -1,40 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Glossary - -This document defines the various terms used in etcd documentation, command line and source code. - -## Node - -Node is an instance of raft state machine. - -It has a unique identification, and records other nodes' progress internally when it is the leader. - -## Member - -Member is an instance of etcd. It hosts a node, and provides service to clients. - -## Cluster - -Cluster consists of several members. - -The node in each member follows raft consensus protocol to replicate logs. Cluster receives proposals from members, commits them and apply to local store. - -## Peer - -Peer is another member of the same cluster. - -## Proposal - -A proposal is a request (for example a write request, a configuration change request) that needs to go through raft protocol. - -## Client - -Client is a caller of the cluster's HTTP API. - -## Machine (deprecated) - -The alternative of Member in etcd before 2.0 diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/internal-protocol-versioning.md b/vendor/github.com/coreos/etcd/Documentation/v2/internal-protocol-versioning.md deleted file mode 100644 index 68d716e5f..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/internal-protocol-versioning.md +++ /dev/null @@ -1,66 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Versioning - -Goal: We want to be able to upgrade an individual peer in an etcd cluster to a newer version of etcd. -The process will take the form of individual followers upgrading to the latest version until the entire cluster is on the new version. - -Immediate need: etcd is moving too fast to version the internal API right now. -But, we need to keep mixed version clusters from being started by a rolling upgrade process (e.g. the CoreOS developer alpha). - -Longer term need: Having a mixed version cluster where all peers are not running the exact same version of etcd itself but are able to speak one version of the internal protocol. - -Solution: The internal protocol needs to be versioned just as the client protocol is. -Initially during the 0.\*.\* series of etcd releases we won't allow mixed versions at all. - -## Join Control - -We will add a version field to the join command. -But, who decides whether a newly upgraded follower should be able to join a cluster? - -### Leader Controlled - -If the leader controls the version of followers joining the cluster then it compares its version to the version number presented by the follower in the JoinCommand and rejects the join if the number is less than the leader's version number. - -Advantages - -- Leader controls all cluster decisions still - -Disadvantages - -- Follower knows better what versions of the internal protocol it can talk than the leader - - -### Follower Controlled - -A newly upgraded follower should be able to figure out the leaders internal version from a defined internal backwards compatible API endpoint and figure out if it can join the cluster. -If it cannot join the cluster then it simply exits. - -Advantages - -- The follower is running newer code and knows better if it can talk older protocols - -Disadvantages - -- This cluster decision isn't made by the leader - -## Recommendation - -To solve the immediate need and to plan for the future lets do the following: - -- Add Version field to JoinCommand -- Have a joining follower read the Version field of the leader and if its own version doesn't match the leader then sleep for some random interval and retry later to see if the leader has upgraded. - -# Research - -## Zookeeper versioning - -Zookeeper very recently added versioning into the protocol and it doesn't seem to have seen any use yet. -https://issues.apache.org/jira/browse/ZOOKEEPER-1633 - -## doozerd - -doozerd stores the version number of the peers in the datastore for other clients to check, no decisions are made off of this number currently. diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/libraries-and-tools.md b/vendor/github.com/coreos/etcd/Documentation/v2/libraries-and-tools.md deleted file mode 100644 index 806a5d902..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/libraries-and-tools.md +++ /dev/null @@ -1,131 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Libraries and Tools - -**Tools** - -- [etcdctl](https://github.com/coreos/etcd/tree/master/etcdctl) - A command line client for etcd -- [etcd-backup](https://github.com/fanhattan/etcd-backup) - A powerful command line utility for dumping/restoring etcd - Supports v2 -- [etcd-dump](https://npmjs.org/package/etcd-dump) - Command line utility for dumping/restoring etcd. -- [etcd-fs](https://github.com/xetorthio/etcd-fs) - FUSE filesystem for etcd -- [etcddir](https://github.com/rekby/etcddir) - Realtime sync etcd and local directory. Work with windows and linux. -- [etcd-browser](https://github.com/henszey/etcd-browser) - A web-based key/value editor for etcd using AngularJS -- [etcd-lock](https://github.com/datawisesystems/etcd-lock) - Master election & distributed r/w lock implementation using etcd - Supports v2 -- [etcd-console](https://github.com/matishsiao/etcd-console) - A web-base key/value editor for etcd using PHP -- [etcd-viewer](https://github.com/nikfoundas/etcd-viewer) - An etcd key-value store editor/viewer written in Java -- [etcdtool](https://github.com/mickep76/etcdtool) - Export/Import/Edit etcd directory as JSON/YAML/TOML and Validate directory using JSON schema -- [etcd-rest](https://github.com/mickep76/etcd-rest) - Create generic REST API in Go using etcd as a backend with validation using JSON schema -- [etcdsh](https://github.com/kamilhark/etcdsh) - A command line client with support of command history and tab completion. Supports v2 - -**Go libraries** - -- [etcd/client](https://github.com/coreos/etcd/blob/master/client) - the officially maintained Go client -- [go-etcd](https://github.com/coreos/go-etcd) - the deprecated official client. May be useful for older (<2.0.0) versions of etcd. - -**Java libraries** - -- [boonproject/etcd](https://github.com/boonproject/boon/blob/master/etcd/README.md) - Supports v2, Async/Sync and waits -- [justinsb/jetcd](https://github.com/justinsb/jetcd) -- [diwakergupta/jetcd](https://github.com/diwakergupta/jetcd) - Supports v2 -- [jurmous/etcd4j](https://github.com/jurmous/etcd4j) - Supports v2, Async/Sync, waits and SSL -- [AdoHe/etcd4j](http://github.com/AdoHe/etcd4j) - Supports v2 (enhance for real production cluster) - -**Python libraries** - -- [jplana/python-etcd](https://github.com/jplana/python-etcd) - Supports v2 -- [russellhaering/txetcd](https://github.com/russellhaering/txetcd) - a Twisted Python library -- [cholcombe973/autodock](https://github.com/cholcombe973/autodock) - A docker deployment automation tool -- [lisael/aioetcd](https://github.com/lisael/aioetcd) - (Python 3.4+) Asyncio coroutines client (Supports v2) - -**Node libraries** - -- [stianeikeland/node-etcd](https://github.com/stianeikeland/node-etcd) - Supports v2 (w Coffeescript) -- [lavagetto/nodejs-etcd](https://github.com/lavagetto/nodejs-etcd) - Supports v2 -- [deedubs/node-etcd-config](https://github.com/deedubs/node-etcd-config) - Supports v2 - -**Ruby libraries** - -- [iconara/etcd-rb](https://github.com/iconara/etcd-rb) -- [jpfuentes2/etcd-ruby](https://github.com/jpfuentes2/etcd-ruby) -- [ranjib/etcd-ruby](https://github.com/ranjib/etcd-ruby) - Supports v2 - -**C libraries** - -- [jdarcy/etcd-api](https://github.com/jdarcy/etcd-api) - Supports v2 -- [shafreeck/cetcd](https://github.com/shafreeck/cetcd) - Supports v2 - -**C++ libraries** - -- [edwardcapriolo/etcdcpp](https://github.com/edwardcapriolo/etcdcpp) - Supports v2 -- [suryanathan/etcdcpp](https://github.com/suryanathan/etcdcpp) - Supports v2 (with waits) -- [nokia/etcd-cpp-api](https://github.com/nokia/etcd-cpp-api) - Supports v2 -- [nokia/etcd-cpp-apiv3](https://github.com/nokia/etcd-cpp-apiv3) - -**Clojure libraries** - -- [aterreno/etcd-clojure](https://github.com/aterreno/etcd-clojure) -- [dwwoelfel/cetcd](https://github.com/dwwoelfel/cetcd) - Supports v2 -- [rthomas/clj-etcd](https://github.com/rthomas/clj-etcd) - Supports v2 - -**Erlang libraries** - -- [marshall-lee/etcd.erl](https://github.com/marshall-lee/etcd.erl) - -**.Net Libraries** - -- [wangjia184/etcdnet](https://github.com/wangjia184/etcdnet) - Supports v2 -- [drusellers/etcetera](https://github.com/drusellers/etcetera) - -**PHP Libraries** - -- [linkorb/etcd-php](https://github.com/linkorb/etcd-php) - -**Haskell libraries** - -- [wereHamster/etcd-hs](https://github.com/wereHamster/etcd-hs) - -**R libraries** - -- [ropensci/etseed](https://github.com/ropensci/etseed) - -**Tcl libraries** - -- [efrecon/etcd-tcl](https://github.com/efrecon/etcd-tcl) - Supports v2, except wait. - -**Chef Integration** - -- [coderanger/etcd-chef](https://github.com/coderanger/etcd-chef) - -**Chef Cookbook** - -- [spheromak/etcd-cookbook](https://github.com/spheromak/etcd-cookbook) - -**BOSH Releases** - -- [cloudfoundry-community/etcd-boshrelease](https://github.com/cloudfoundry-community/etcd-boshrelease) -- [cloudfoundry/cf-release](https://github.com/cloudfoundry/cf-release/tree/master/jobs/etcd) - -**Projects using etcd** - -- [binocarlos/yoda](https://github.com/binocarlos/yoda) - etcd + ZeroMQ -- [calavera/active-proxy](https://github.com/calavera/active-proxy) - HTTP Proxy configured with etcd -- [derekchiang/etcdplus](https://github.com/derekchiang/etcdplus) - A set of distributed synchronization primitives built upon etcd -- [go-discover](https://github.com/flynn/go-discover) - service discovery in Go -- [gleicon/goreman](https://github.com/gleicon/goreman/tree/etcd) - Branch of the Go Foreman clone with etcd support -- [garethr/hiera-etcd](https://github.com/garethr/hiera-etcd) - Puppet hiera backend using etcd -- [mattn/etcd-vim](https://github.com/mattn/etcd-vim) - SET and GET keys from inside vim -- [mattn/etcdenv](https://github.com/mattn/etcdenv) - "env" shebang with etcd integration -- [kelseyhightower/confd](https://github.com/kelseyhightower/confd) - Manage local app config files using templates and data from etcd -- [configdb](https://git.autistici.org/ai/configdb/tree/master) - A REST relational abstraction on top of arbitrary database backends, aimed at storing configs and inventories. -- [fleet](https://github.com/coreos/fleet) - Distributed init system -- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) - Container cluster manager introduced by Google. -- [mailgun/vulcand](https://github.com/mailgun/vulcand) - HTTP proxy that uses etcd as a configuration backend. -- [duedil-ltd/discodns](https://github.com/duedil-ltd/discodns) - Simple DNS nameserver using etcd as a database for names and records. -- [skynetservices/skydns](https://github.com/skynetservices/skydns) - RFC compliant DNS server -- [xordataexchange/crypt](https://github.com/xordataexchange/crypt) - Securely store values in etcd using GPG encryption -- [spf13/viper](https://github.com/spf13/viper) - Go configuration library, reads values from ENV, pflags, files, and etcd with optional encryption -- [lytics/metafora](https://github.com/lytics/metafora) - Go distributed task library -- [ryandoyle/nss-etcd](https://github.com/ryandoyle/nss-etcd) - A GNU libc NSS module for resolving names from etcd. diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/members_api.md b/vendor/github.com/coreos/etcd/Documentation/v2/members_api.md deleted file mode 100644 index a9ff6a043..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/members_api.md +++ /dev/null @@ -1,125 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Members API - -* [List members](#list-members) -* [Add a member](#add-a-member) -* [Delete a member](#delete-a-member) -* [Change the peer urls of a member](#change-the-peer-urls-of-a-member) - -## List members - -Return an HTTP 200 OK response code and a representation of all members in the etcd cluster. - -### Request - -``` -GET /v2/members HTTP/1.1 -``` - -### Example - -```sh -curl http://10.0.0.10:2379/v2/members -``` - -```json -{ - "members": [ - { - "id": "272e204152", - "name": "infra1", - "peerURLs": [ - "http://10.0.0.10:2380" - ], - "clientURLs": [ - "http://10.0.0.10:2379" - ] - }, - { - "id": "2225373f43", - "name": "infra2", - "peerURLs": [ - "http://10.0.0.11:2380" - ], - "clientURLs": [ - "http://10.0.0.11:2379" - ] - }, - ] -} -``` - -## Add a member - -Returns an HTTP 201 response code and the representation of added member with a newly generated a memberID when successful. Returns a string describing the failure condition when unsuccessful. - -If the POST body is malformed an HTTP 400 will be returned. If the member exists in the cluster or existed in the cluster at some point in the past an HTTP 409 will be returned. If any of the given peerURLs exists in the cluster an HTTP 409 will be returned. If the cluster fails to process the request within timeout an HTTP 500 will be returned, though the request may be processed later. - -### Request - -``` -POST /v2/members HTTP/1.1 - -{"peerURLs": ["http://10.0.0.10:2380"]} -``` - -### Example - -```sh -curl http://10.0.0.10:2379/v2/members -XPOST \ --H "Content-Type: application/json" -d '{"peerURLs":["http://10.0.0.10:2380"]}' -``` - -```json -{ - "id": "3777296169", - "peerURLs": [ - "http://10.0.0.10:2380" - ] -} -``` - -## Delete a member - -Remove a member from the cluster. The member ID must be a hex-encoded uint64. -Returns 204 with empty content when successful. Returns a string describing the failure condition when unsuccessful. - -If the member does not exist in the cluster an HTTP 500(TODO: fix this) will be returned. If the cluster fails to process the request within timeout an HTTP 500 will be returned, though the request may be processed later. - -### Request - -``` -DELETE /v2/members/ HTTP/1.1 -``` - -### Example - -```sh -curl http://10.0.0.10:2379/v2/members/272e204152 -XDELETE -``` - -## Change the peer urls of a member - -Change the peer urls of a given member. The member ID must be a hex-encoded uint64. Returns 204 with empty content when successful. Returns a string describing the failure condition when unsuccessful. - -If the POST body is malformed an HTTP 400 will be returned. If the member does not exist in the cluster an HTTP 404 will be returned. If any of the given peerURLs exists in the cluster an HTTP 409 will be returned. If the cluster fails to process the request within timeout an HTTP 500 will be returned, though the request may be processed later. - -### Request - -``` -PUT /v2/members/ HTTP/1.1 - -{"peerURLs": ["http://10.0.0.10:2380"]} -``` - -### Example - -```sh -curl http://10.0.0.10:2379/v2/members/272e204152 -XPUT \ --H "Content-Type: application/json" -d '{"peerURLs":["http://10.0.0.10:2380"]}' -``` - diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/metrics.md b/vendor/github.com/coreos/etcd/Documentation/v2/metrics.md deleted file mode 100644 index 596c14b64..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/metrics.md +++ /dev/null @@ -1,148 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Metrics - -etcd uses [Prometheus][prometheus] for metrics reporting. The metrics can be used for real-time monitoring and debugging. etcd does not persist its metrics; if a member restarts, the metrics will be reset. - -The simplest way to see the available metrics is to cURL the metrics endpoint `/metrics`. The format is described [here](http://prometheus.io/docs/instrumenting/exposition_formats/). - -Follow the [Prometheus getting started doc][prometheus-getting-started] to spin up a Prometheus server to collect etcd metrics. - -The naming of metrics follows the suggested [Prometheus best practices][prometheus-naming]. A metric name has an `etcd` or `etcd_debugging` prefix as its namespace and a subsystem prefix (for example `wal` and `etcdserver`). - -## etcd namespace metrics - -The metrics under the `etcd` prefix are for monitoring and alerting. They are stable high level metrics. If there is any change of these metrics, it will be included in release notes. - -### http requests - -These metrics describe the serving of requests (non-watch events) served by etcd members in non-proxy mode: total -incoming requests, request failures and processing latency (inc. raft rounds for storage). They are useful for tracking - user-generated traffic hitting the etcd cluster . - -All these metrics are prefixed with `etcd_http_` - -| Name | Description | Type | -|--------------------------------|-----------------------------------------------------------------------------------------|--------------------| -| received_total | Total number of events after parsing and auth. | Counter(method) | -| failed_total | Total number of failed events.   | Counter(method,error) | -| successful_duration_seconds | Bucketed handling times of the requests, including raft rounds for writes. | Histogram(method) | - - -Example Prometheus queries that may be useful from these metrics (across all etcd members): - - * `sum(rate(etcd_http_failed_total{job="etcd"}[1m]) by (method) / sum(rate(etcd_http_events_received_total{job="etcd"})[1m]) by (method)` - - Shows the fraction of events that failed by HTTP method across all members, across a time window of `1m`. - - * `sum(rate(etcd_http_received_total{job="etcd",method="GET})[1m]) by (method)` - `sum(rate(etcd_http_received_total{job="etcd",method~="GET})[1m]) by (method)` - - Shows the rate of successful readonly/write queries across all servers, across a time window of `1m`. - - * `histogram_quantile(0.9, sum(rate(etcd_http_successful_duration_seconds{job="etcd",method="GET"}[5m]) ) by (le))` - `histogram_quantile(0.9, sum(rate(etcd_http_successful_duration_seconds{job="etcd",method!="GET"}[5m]) ) by (le))` - - Show the 0.90-tile latency (in seconds) of read/write (respectively) event handling across all members, with a window of `5m`. - -### proxy - -etcd members operating in proxy mode do not directly perform store operations. They forward all requests to cluster instances. - -Tracking the rate of requests coming from a proxy allows one to pin down which machine is performing most reads/writes. - -All these metrics are prefixed with `etcd_proxy_` - -| Name | Description | Type | -|---------------------------|-----------------------------------------------------------------------------------------|--------------------| -| requests_total | Total number of requests by this proxy instance. | Counter(method) | -| handled_total | Total number of fully handled requests, with responses from etcd members. | Counter(method) | -| dropped_total | Total number of dropped requests due to forwarding errors to etcd members.  | Counter(method,error) | -| handling_duration_seconds | Bucketed handling times by HTTP method, including round trip to member instances. | Histogram(method) | - -Example Prometheus queries that may be useful from these metrics (across all etcd servers): - - * `sum(rate(etcd_proxy_handled_total{job="etcd"}[1m])) by (method)` - - Rate of requests (by HTTP method) handled by all proxies, across a window of `1m`. - - * `histogram_quantile(0.9, sum(rate(handling_duration_seconds{job="etcd",method="GET"}[5m])) by (le))` - `histogram_quantile(0.9, sum(rate(handling_duration_seconds{job="etcd",method!="GET"}[5m])) by (le))` - - Show the 0.90-tile latency (in seconds) of handling of user requests across all proxy machines, with a window of `5m`. - - * `sum(rate(etcd_proxy_dropped_total{job="etcd"}[1m])) by (proxying_error)` - - Number of failed request on the proxy. This should be 0, spikes here indicate connectivity issues to the etcd cluster. - -## etcd_debugging namespace metrics - -The metrics under the `etcd_debugging` prefix are for debugging. They are very implementation dependent and volatile. They might be changed or removed without any warning in new etcd releases. Some of the metrics might be moved to the `etcd` prefix when they become more stable. - -### etcdserver - -| Name | Description | Type | -|-----------------------------------------|--------------------------------------------------|-----------| -| proposal_duration_seconds | The latency distributions of committing proposal | Histogram | -| proposals_pending | The current number of pending proposals | Gauge | -| proposals_failed_total | The total number of failed proposals | Counter | - -[Proposal][glossary-proposal] duration (`proposal_duration_seconds`) provides a proposal commit latency histogram. The reported latency reflects network and disk IO delays in etcd. - -Proposals pending (`proposals_pending`) indicates how many proposals are queued for commit. Rising pending proposals suggests there is a high client load or the cluster is unstable. - -Failed proposals (`proposals_failed_total`) are normally related to two issues: temporary failures related to a leader election or longer duration downtime caused by a loss of quorum in the cluster. - -### wal - -| Name | Description | Type | -|------------------------------------|--------------------------------------------------|-----------| -| fsync_duration_seconds | The latency distributions of fsync called by wal | Histogram | -| last_index_saved | The index of the last entry saved by wal | Gauge | - -Abnormally high fsync duration (`fsync_duration_seconds`) indicates disk issues and might cause the cluster to be unstable. - -### snapshot - -| Name | Description | Type | -|--------------------------------------------|------------------------------------------------------------|-----------| -| snapshot_save_total_duration_seconds | The total latency distributions of save called by snapshot | Histogram | - -Abnormally high snapshot duration (`snapshot_save_total_duration_seconds`) indicates disk issues and might cause the cluster to be unstable. - -### rafthttp - -| Name | Description | Type | Labels | -|-----------------------------------|--------------------------------------------|--------------|--------------------------------| -| message_sent_latency_seconds | The latency distributions of messages sent | HistogramVec | sendingType, msgType, remoteID | -| message_sent_failed_total | The total number of failed messages sent | Summary | sendingType, msgType, remoteID | - - -Abnormally high message duration (`message_sent_latency_seconds`) indicates network issues and might cause the cluster to be unstable. - -An increase in message failures (`message_sent_failed_total`) indicates more severe network issues and might cause the cluster to be unstable. - -Label `sendingType` is the connection type to send messages. `message`, `msgapp` and `msgappv2` use HTTP streaming, while `pipeline` does HTTP request for each message. - -Label `msgType` is the type of raft message. `MsgApp` is log replication messages; `MsgSnap` is snapshot install messages; `MsgProp` is proposal forward messages; the others maintain internal raft status. Given large snapshots, a lengthy msgSnap transmission latency should be expected. For other types of messages, given enough network bandwidth, latencies comparable to ping latency should be expected. - -Label `remoteID` is the member ID of the message destination. - -## Prometheus supplied metrics - -The Prometheus client library provides a number of metrics under the `go` and `process` namespaces. There are a few that are particlarly interesting. - -| Name | Description | Type | -|-----------------------------------|--------------------------------------------|--------------| -| process_open_fds | Number of open file descriptors. | Gauge | -| process_max_fds | Maximum number of open file descriptors. | Gauge | - -Heavy file descriptor (`process_open_fds`) usage (i.e., near the process's file descriptor limit, `process_max_fds`) indicates a potential file descriptor exhaustion issue. If the file descriptors are exhausted, etcd may panic because it cannot create new WAL files. - -[glossary-proposal]: glossary.md#proposal -[prometheus]: http://prometheus.io/ -[prometheus-getting-started]: http://prometheus.io/docs/introduction/getting_started/ -[prometheus-naming]: http://prometheus.io/docs/practices/naming/ diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/other_apis.md b/vendor/github.com/coreos/etcd/Documentation/v2/other_apis.md deleted file mode 100644 index ec21a886c..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/other_apis.md +++ /dev/null @@ -1,33 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Miscellaneous APIs - -* [Getting the etcd version](#getting-the-etcd-version) -* [Checking health of an etcd member node](#checking-health-of-an-etcd-member-node) - -## Getting the etcd version - -The etcd version of a specific instance can be obtained from the `/version` endpoint. - -```sh -curl -L http://127.0.0.1:2379/version -``` - -``` -etcd 2.0.12 -``` - -## Checking health of an etcd member node - -etcd provides a `/health` endpoint to verify the health of a particular member. - -```sh -curl http://10.0.0.10:2379/health -``` - -```json -{"health":"true"} -``` diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/platforms/freebsd.md b/vendor/github.com/coreos/etcd/Documentation/v2/platforms/freebsd.md deleted file mode 100644 index 891ea6f53..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/platforms/freebsd.md +++ /dev/null @@ -1,67 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../../docs.md#documentation - - -# FreeBSD - -Starting with version 0.1.2 both etcd and etcdctl have been ported to FreeBSD and can -be installed either via packages or ports system. Their versions have been recently -updated to 0.2.0 so now you can enjoy using etcd and etcdctl on FreeBSD 10.0 (RC4 as -of now) and 9.x where they have been tested. They might also work when installed from -ports on earlier versions of FreeBSD, but your mileage may vary. - -## Installation - -### Using pkgng package system - -1. If you do not have pkg­ng installed, install it with command `pkg` and answering 'Y' -when asked - -2. Update your repository data with `pkg update` - -3. Install etcd with `pkg install coreos-etcd coreos-etcdctl` - -4. Verify successful installation with `pkg info | grep etcd` and you should get: - -``` -r@fbsd­10:/ # pkg info | grep etcd -coreos­etcd­0.2.0              Highly­available key value store and service discovery -coreos­etcdctl­0.2.0           Simple commandline client for etcd -r@fbsd­10:/ # -``` - -5. You’re ready to use etcd and etcdctl! For more information about using pkgng, please -see: http://www.freebsd.org/doc/handbook/pkgng­intro.html -  -### Using ports system - -1. If you do not have ports installed, install with with `portsnap fetch extract` (it -may take some time depending on your hardware and network connection) - -2. Build etcd with `cd /usr/ports/devel/etcd && make install clean`, you -will get an option to build and install documentation and etcdctl with it. - -3. If you haven't installed it with etcdctl, and you would like to install it later, you can build it -with `cd /usr/ports/devel/etcdctl && make install clean` - -4. Verify successful installation with `pkg info | grep etcd` and you should get: -  - -``` -r@fbsd­10:/ # pkg info | grep etcd -coreos­etcd­0.2.0              Highly­available key value store and service discovery -coreos­etcdctl­0.2.0           Simple commandline client for etcd -r@fbsd­10:/ # -``` - -5. You’re ready to use etcd and etcdctl! For more information about using ports system, -please see: https://www.freebsd.org/doc/handbook/ports­using.html - -## Issues - -If you find any issues with the build/install procedure or you've found a problem that -you've verified is local to FreeBSD version only (for example, by not being able to -reproduce it on any other platform, like OSX or Linux), please sent a -problem report using this page for more -information: http://www.freebsd.org/send­pr.html diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/production-users.md b/vendor/github.com/coreos/etcd/Documentation/v2/production-users.md deleted file mode 100644 index addef2a92..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/production-users.md +++ /dev/null @@ -1,56 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Production Users - -This document tracks people and use cases for etcd in production. By creating a list of production use cases we hope to build a community of advisors that we can reach out to with experience using various etcd applications, operation environments, and cluster sizes. The etcd development team may reach out periodically to check-in on your experience and update this list. - -## discovery.etcd.io - -- *Application*: https://github.com/coreos/discovery.etcd.io -- *Launched*: Feb. 2014 -- *Cluster Size*: 5 members, 5 discovery proxies -- *Order of Data Size*: 100s of Megabytes -- *Operator*: CoreOS, brandon.philips@coreos.com -- *Environment*: AWS -- *Backups*: Periodic async to S3 - -discovery.etcd.io is the longest continuously running etcd backed service that we know about. It is the basis of automatic cluster bootstrap and was launched in Feb. 2014: https://coreos.com/blog/etcd-0.3.0-released/. - -## OpenTable - -- *Application*: OpenTable internal service discovery and cluster configuration management -- *Launched*: May 2014 -- *Cluster Size*: 3 members each in 6 independent clusters; approximately 50 nodes reading / writing -- *Order of Data Size*: 10s of MB -- *Operator*: OpenTable, Inc; sschlansker@opentable.com -- *Environment*: AWS, VMWare -- *Backups*: None, all data can be re-created if necessary. - -## cycoresys.com - -- *Application*: multiple -- *Launched*: Jul. 2014 -- *Cluster Size*: 3 members, _n_ proxies -- *Order of Data Size*: 100s of kilobytes -- *Operator*: CyCore Systems, Inc, sys@cycoresys.com -- *Environment*: Baremetal -- *Backups*: Periodic sync to Ceph RadosGW and DigitalOcean VM - -CyCore Systems provides architecture and engineering for computing systems. This cluster provides microservices, virtual machines, databases, storage clusters to a number of clients. It is built on CoreOS machines, with each machine in the cluster running etcd as a peer or proxy. - -## Radius Intelligence - -- *Application*: multiple internal tools, Kubernetes clusters, bootstrappable system configs -- *Launched*: June 2015 -- *Cluster Size*: 2 clusters of 5 and 3 members; approximately a dozen nodes read/write -- *Order of Data Size*: 100s of kilobytes -- *Operator*: Radius Intelligence; jcderr@radius.com -- *Environment*: AWS, CoreOS, Kubernetes -- *Backups*: None, all data can be recreated if necessary. - -Radius Intelligence uses Kubernetes running CoreOS to containerize and scale internal toolsets. Examples include running [JetBrains TeamCity][teamcity] and internal AWS security and cost reporting tools. etcd clusters back these clusters as well as provide some basic environment bootstrapping configuration keys. - -[teamcity]: https://www.jetbrains.com/teamcity/ diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/proxy.md b/vendor/github.com/coreos/etcd/Documentation/v2/proxy.md deleted file mode 100644 index e96147cbd..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/proxy.md +++ /dev/null @@ -1,158 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Proxy - -etcd can run as a transparent proxy. Doing so allows for easy discovery of etcd within your infrastructure, since it can run on each machine as a local service. In this mode, etcd acts as a reverse proxy and forwards client requests to an active etcd cluster. The etcd proxy does not participate in the consensus replication of the etcd cluster, thus it neither increases the resilience nor decreases the write performance of the etcd cluster. - -etcd currently supports two proxy modes: `readwrite` and `readonly`. The default mode is `readwrite`, which forwards both read and write requests to the etcd cluster. A `readonly` etcd proxy only forwards read requests to the etcd cluster, and returns `HTTP 501` to all write requests. - -The proxy will shuffle the list of cluster members periodically to avoid sending all connections to a single member. - -The member list used by an etcd proxy consists of all client URLs advertised in the cluster. These client URLs are specified in each etcd cluster member's `advertise-client-urls` option. - -An etcd proxy examines several command-line options to discover its peer URLs. In order of precedence, these options are `discovery`, `discovery-srv`, and `initial-cluster`. The `initial-cluster` option is set to a comma-separated list of one or more etcd peer URLs used temporarily in order to discover the permanent cluster. - -After establishing a list of peer URLs in this manner, the proxy retrieves the list of client URLs from the first reachable peer. These client URLs are specified by the `advertise-client-urls` option to etcd peers. The proxy then continues to connect to the first reachable etcd cluster member every thirty seconds to refresh the list of client URLs. - -While etcd proxies therefore do not need to be given the `advertise-client-urls` option, as they retrieve this configuration from the cluster, this implies that `initial-cluster` must be set correctly for every proxy, and the `advertise-client-urls` option must be set correctly for every non-proxy, first-order cluster peer. Otherwise, requests to any etcd proxy would be forwarded improperly. Take special care not to set the `advertise-client-urls` option to URLs that point to the proxy itself, as such a configuration will cause the proxy to enter a loop, forwarding requests to itself until resources are exhausted. To correct either case, stop etcd and restart it with the correct URLs. - -[This example Procfile][procfile] illustrates the difference in the etcd peer and proxy command lines used to configure and start a cluster with one proxy under the [goreman process management utility][goreman]. - -To summarize etcd proxy startup and peer discovery: - -1. etcd proxies execute the following steps in order until the cluster *peer-urls* are known: - 1. If `discovery` is set for the proxy, ask the given discovery service for - the *peer-urls*. The *peer-urls* will be the combined - `initial-advertise-peer-urls` of all first-order, non-proxy cluster - members. - 2. If `discovery-srv` is set for the proxy, the *peer-urls* are discovered - from DNS. - 3. If `initial-cluster` is set for the proxy, that will become the value of - *peer-urls*. - 4. Otherwise use the default value of - `http://localhost:2380,http://localhost:7001`. -2. These *peer-urls* are used to contact the (non-proxy) members of the cluster - to find their *client-urls*. The *client-urls* will thus be the combined - `advertise-client-urls` of all cluster members (i.e. non-proxies). -3. Request of clients of the proxy will be forwarded (proxied) to these - *client-urls*. - -Always start the first-order etcd cluster members first, then any proxies. A proxy must be able to reach the cluster members to retrieve its configuration, and will attempt connections somewhat aggressively in the absence of such a channel. Starting the members before any proxy ensures the proxy can discover the client URLs when it later starts. - -## Using an etcd proxy -To start etcd in proxy mode, you need to provide three flags: `proxy`, `listen-client-urls`, and `initial-cluster` (or `discovery`). - -To start a readwrite proxy, set `-proxy on`; To start a readonly proxy, set `-proxy readonly`. - -The proxy will be listening on `listen-client-urls` and forward requests to the etcd cluster discovered from in `initial-cluster` or `discovery` url. - -### Start an etcd proxy with a static configuration -To start a proxy that will connect to a statically defined etcd cluster, specify the `initial-cluster` flag: - -``` -etcd --proxy on \ ---listen-client-urls http://127.0.0.1:2379 \ ---initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 -``` - -### Start an etcd proxy with the discovery service -If you bootstrap an etcd cluster using the [discovery service][discovery-service], you can also start the proxy with the same `discovery`. - -To start a proxy using the discovery service, specify the `discovery` flag. The proxy will wait until the etcd cluster defined at the `discovery` url finishes bootstrapping, and then start to forward the requests. - -``` -etcd --proxy on \ ---listen-client-urls http://127.0.0.1:2379 \ ---discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de \ -``` - -## Fallback to proxy mode with discovery service - -If you bootstrap an etcd cluster using [discovery service][discovery-service] with more than the expected number of etcd members, the extra etcd processes will fall back to being `readwrite` proxies by default. They will forward the requests to the cluster as described above. For example, if you create a discovery url with `size=5`, and start ten etcd processes using that same discovery url, the result will be a cluster with five etcd members and five proxies. Note that this behaviour can be disabled with the `discovery-fallback='exit'` flag. - -## Promote a proxy to a member of etcd cluster - -A Proxy is in the part of etcd cluster that does not participate in consensus. A proxy will not promote itself to an etcd member that participates in consensus automatically in any case. - -If you want to promote a proxy to an etcd member, there are four steps you need to follow: - -- use etcdctl to add the proxy node as an etcd member into the existing cluster -- stop the etcd proxy process or service -- remove the existing proxy data directory -- restart the etcd process with new member configuration - -## Example - -We assume you have a one member etcd cluster with one proxy. The cluster information is listed below: - -|Name|Address| -|------|---------| -|infra0|10.0.1.10| -|proxy0|10.0.1.11| - -This example walks you through a case that you promote one proxy to an etcd member. The cluster will become a two member cluster after finishing the four steps. - -### Add a new member into the existing cluster - -First, use etcdctl to add the member to the cluster, which will output the environment variables need to correctly configure the new member: - -``` bash -$ etcdctl -endpoint http://10.0.1.10:2379 member add infra1 http://10.0.1.11:2380 -added member 9bf1b35fc7761a23 to cluster - -ETCD_NAME="infra1" -ETCD_INITIAL_CLUSTER="infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380" -ETCD_INITIAL_CLUSTER_STATE=existing -``` - -### Stop the proxy process - -Stop the existing proxy so we can wipe its state on disk and reload it with the new configuration: - -``` bash -ps aux | grep etcd -kill %etcd_proxy_pid% -``` - -or (if you are running etcd proxy as etcd service under systemd) - -``` bash -sudo systemctl stop etcd -``` - -### Remove the existing proxy data dir - -``` bash -rm -rf %data_dir%/proxy -``` - -### Start etcd as a new member - -Finally, start the reconfigured member and make sure it joins the cluster correctly: - -``` bash -$ export ETCD_NAME="infra1" -$ export ETCD_INITIAL_CLUSTER="infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380" -$ export ETCD_INITIAL_CLUSTER_STATE=existing -$ etcd --listen-client-urls http://10.0.1.11:2379 \ ---advertise-client-urls http://10.0.1.11:2379 \ ---listen-peer-urls http://10.0.1.11:2380 \ ---initial-advertise-peer-urls http://10.0.1.11:2380 \ ---data-dir %data_dir% -``` - -If you are running etcd under systemd, you should modify the service file with correct configuration and restart the service: - -``` bash -sudo systemd restart etcd -``` - -If an error occurs, check the [add member troubleshooting doc][runtime-configuration]. - -[discovery-service]: clustering.md#discovery -[goreman]: https://github.com/mattn/goreman -[procfile]: https://github.com/coreos/etcd/blob/master/Procfile.v2 -[runtime-configuration]: runtime-configuration.md#error-cases-when-adding-members diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/reporting_bugs.md b/vendor/github.com/coreos/etcd/Documentation/v2/reporting_bugs.md deleted file mode 100644 index 1f5880faa..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/reporting_bugs.md +++ /dev/null @@ -1,50 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Reporting Bugs - -If you find bugs or documentation mistakes in the etcd project, please let us know by [opening an issue][etcd-issue]. We treat bugs and mistakes very seriously and believe no issue is too small. Before creating a bug report, please check that an issue reporting the same problem does not already exist. - -To make your bug report accurate and easy to understand, please try to create bug reports that are: - -- Specific. Include as much details as possible: which version, what environment, what configuration, etc. You can also attach etcd log (the starting log with etcd configuration is especially important). - -- Reproducible. Include the steps to reproduce the problem. We understand some issues might be hard to reproduce, please includes the steps that might lead to the problem. You can also attach the affected etcd data dir and stack strace to the bug report. - -- Isolated. Please try to isolate and reproduce the bug with minimum dependencies. It would significantly slow down the speed to fix a bug if too many dependencies are involved in a bug report. Debugging external systems that rely on etcd is out of scope, but we are happy to point you in the right direction or help you interact with etcd in the correct manner. - -- Unique. Do not duplicate existing bug report. - -- Scoped. One bug per report. Do not follow up with another bug inside one report. - -You might also want to read [Elika Etemad’s article on filing good bug reports][filing-good-bugs] before creating a bug report. - -We might ask you for further information to locate a bug. A duplicated bug report will be closed. - -## Frequently Asked Questions - -### How to get a stack trace - -``` bash -$ kill -QUIT $PID -``` - -### How to get etcd version - -``` bash -$ etcd --version -``` - -### How to get etcd configuration and log when it runs as systemd service ‘etcd2.service’ - -``` bash -$ sudo systemctl cat etcd2 -$ sudo journalctl -u etcd2 -``` - -Due to an upstream systemd bug, journald may miss the last few log lines when its process exit. If journalctl tells you that etcd stops without fatal or panic message, you could try `sudo journalctl -f -t etcd2` to get full log. - -[etcd-issue]: https://github.com/coreos/etcd/issues/new -[filing-good-bugs]: http://fantasai.inkedblade.net/style/talks/filing-good-bugs/ diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/runtime-configuration.md b/vendor/github.com/coreos/etcd/Documentation/v2/runtime-configuration.md deleted file mode 100644 index a6b57b916..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/runtime-configuration.md +++ /dev/null @@ -1,189 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Runtime Reconfiguration - -etcd comes with support for incremental runtime reconfiguration, which allows users to update the membership of the cluster at run time. - -Reconfiguration requests can only be processed when the majority of the cluster members are functioning. It is **highly recommended** to always have a cluster size greater than two in production. It is unsafe to remove a member from a two member cluster. The majority of a two member cluster is also two. If there is a failure during the removal process, the cluster might not able to make progress and need to [restart from majority failure][majority failure]. - -To better understand the design behind runtime reconfiguration, we suggest you read [the runtime reconfiguration document][runtime-reconf]. - -## Reconfiguration Use Cases - -Let's walk through some common reasons for reconfiguring a cluster. Most of these just involve combinations of adding or removing a member, which are explained below under [Cluster Reconfiguration Operations][cluster-reconf]. - -### Cycle or Upgrade Multiple Machines - -If you need to move multiple members of your cluster due to planned maintenance (hardware upgrades, network downtime, etc.), it is recommended to modify members one at a time. - -It is safe to remove the leader, however there is a brief period of downtime while the election process takes place. If your cluster holds more than 50MB, it is recommended to [migrate the member's data directory][member migration]. - -### Change the Cluster Size - -Increasing the cluster size can enhance [failure tolerance][fault tolerance table] and provide better read performance. Since clients can read from any member, increasing the number of members increases the overall read throughput. - -Decreasing the cluster size can improve the write performance of a cluster, with a trade-off of decreased resilience. Writes into the cluster are replicated to a majority of members of the cluster before considered committed. Decreasing the cluster size lowers the majority, and each write is committed more quickly. - -### Replace A Failed Machine - -If a machine fails due to hardware failure, data directory corruption, or some other fatal situation, it should be replaced as soon as possible. Machines that have failed but haven't been removed adversely affect your quorum and reduce the tolerance for an additional failure. - -To replace the machine, follow the instructions for [removing the member][remove member] from the cluster, and then [add a new member][add member] in its place. If your cluster holds more than 50MB, it is recommended to [migrate the failed member's data directory][member migration] if you can still access it. - -### Restart Cluster from Majority Failure - -If the majority of your cluster is lost or all of your nodes have changed IP addresses, then you need to take manual action in order to recover safely. -The basic steps in the recovery process include [creating a new cluster using the old data][disaster recovery], forcing a single member to act as the leader, and finally using runtime configuration to [add new members][add member] to this new cluster one at a time. - -## Cluster Reconfiguration Operations - -Now that we have the use cases in mind, let us lay out the operations involved in each. - -Before making any change, the simple majority (quorum) of etcd members must be available. -This is essentially the same requirement as for any other write to etcd. - -All changes to the cluster are done one at a time: - -* To update a single member peerURLs you will make an update operation -* To replace a single member you will make an add then a remove operation -* To increase from 3 to 5 members you will make two add operations -* To decrease from 5 to 3 you will make two remove operations - -All of these examples will use the `etcdctl` command line tool that ships with etcd. -If you want to use the members API directly you can find the documentation [here][member-api]. - -### Update a Member - -#### Update advertise client URLs - -If you would like to update the advertise client URLs of a member, you can simply restart -that member with updated client urls flag (`--advertise-client-urls`) or environment variable -(`ETCD_ADVERTISE_CLIENT_URLS`). The restarted member will self publish the updated URLs. -A wrongly updated client URL will not affect the health of the etcd cluster. - -#### Update advertise peer URLs - -If you would like to update the advertise peer URLs of a member, you have to first update -it explicitly via member command and then restart the member. The additional action is required -since updating peer URLs changes the cluster wide configuration and can affect the health of the etcd cluster. - -To update the peer URLs, first, we need to find the target member's ID. You can list all members with `etcdctl`: - -```sh -$ etcdctl member list -6e3bd23ae5f1eae0: name=node2 peerURLs=http://localhost:23802 clientURLs=http://127.0.0.1:23792 -924e2e83e93f2560: name=node3 peerURLs=http://localhost:23803 clientURLs=http://127.0.0.1:23793 -a8266ecf031671f3: name=node1 peerURLs=http://localhost:23801 clientURLs=http://127.0.0.1:23791 -``` - -In this example let's `update` a8266ecf031671f3 member ID and change its peerURLs value to http://10.0.1.10:2380 - -```sh -$ etcdctl member update a8266ecf031671f3 http://10.0.1.10:2380 -Updated member with ID a8266ecf031671f3 in cluster -``` - -### Remove a Member - -Let us say the member ID we want to remove is a8266ecf031671f3. -We then use the `remove` command to perform the removal: - -```sh -$ etcdctl member remove a8266ecf031671f3 -Removed member a8266ecf031671f3 from cluster -``` - -The target member will stop itself at this point and print out the removal in the log: - -``` -etcd: this member has been permanently removed from the cluster. Exiting. -``` - -It is safe to remove the leader, however the cluster will be inactive while a new leader is elected. This duration is normally the period of election timeout plus the voting process. - -### Add a New Member - -Adding a member is a two step process: - - * Add the new member to the cluster via the [members API][member-api] or the `etcdctl member add` command. - * Start the new member with the new cluster configuration, including a list of the updated members (existing members + the new member). - -Using `etcdctl` let's add the new member to the cluster by specifying its [name][conf-name] and [advertised peer URLs][conf-adv-peer]: - -```sh -$ etcdctl member add infra3 http://10.0.1.13:2380 -added member 9bf1b35fc7761a23 to cluster - -ETCD_NAME="infra3" -ETCD_INITIAL_CLUSTER="infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380,infra3=http://10.0.1.13:2380" -ETCD_INITIAL_CLUSTER_STATE=existing -``` - -`etcdctl` has informed the cluster about the new member and printed out the environment variables needed to successfully start it. -Now start the new etcd process with the relevant flags for the new member: - -```sh -$ export ETCD_NAME="infra3" -$ export ETCD_INITIAL_CLUSTER="infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380,infra3=http://10.0.1.13:2380" -$ export ETCD_INITIAL_CLUSTER_STATE=existing -$ etcd -listen-client-urls http://10.0.1.13:2379 -advertise-client-urls http://10.0.1.13:2379 -listen-peer-urls http://10.0.1.13:2380 -initial-advertise-peer-urls http://10.0.1.13:2380 -data-dir %data_dir% -``` - -The new member will run as a part of the cluster and immediately begin catching up with the rest of the cluster. - -If you are adding multiple members the best practice is to configure a single member at a time and verify it starts correctly before adding more new members. -If you add a new member to a 1-node cluster, the cluster cannot make progress before the new member starts because it needs two members as majority to agree on the consensus. You will only see this behavior between the time `etcdctl member add` informs the cluster about the new member and the new member successfully establishing a connection to the existing one. - -#### Error Cases When Adding Members - -In the following case we have not included our new host in the list of enumerated nodes. -If this is a new cluster, the node must be added to the list of initial cluster members. - -```sh -$ etcd -name infra3 \ - -initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 \ - -initial-cluster-state existing -etcdserver: assign ids error: the member count is unequal -exit 1 -``` - -In this case we give a different address (10.0.1.14:2380) to the one that we used to join the cluster (10.0.1.13:2380). - -```sh -$ etcd -name infra4 \ - -initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380,infra4=http://10.0.1.14:2380 \ - -initial-cluster-state existing -etcdserver: assign ids error: unmatched member while checking PeerURLs -exit 1 -``` - -When we start etcd using the data directory of a removed member, etcd will exit automatically if it connects to any active member in the cluster: - -```sh -$ etcd -etcd: this member has been permanently removed from the cluster. Exiting. -exit 1 -``` - -### Strict Reconfiguration Check Mode (`-strict-reconfig-check`) - -As described in the above, the best practice of adding new members is to configure a single member at a time and verify it starts correctly before adding more new members. This step by step approach is very important because if newly added members is not configured correctly (for example the peer URLs are incorrect), the cluster can lose quorum. The quorum loss happens since the newly added member are counted in the quorum even if that member is not reachable from other existing members. Also quorum loss might happen if there is a connectivity issue or there are operational issues. - -For avoiding this problem, etcd provides an option `-strict-reconfig-check`. If this option is passed to etcd, etcd rejects reconfiguration requests if the number of started members will be less than a quorum of the reconfigured cluster. - -It is recommended to enable this option. However, it is disabled by default because of keeping compatibility. - -[add member]: #add-a-new-member -[cluster-reconf]: #cluster-reconfiguration-operations -[conf-adv-peer]: configuration.md#-initial-advertise-peer-urls -[conf-name]: configuration.md#-name -[disaster recovery]: admin_guide.md#disaster-recovery -[fault tolerance table]: admin_guide.md#fault-tolerance-table -[majority failure]: #restart-cluster-from-majority-failure -[member-api]: members_api.md -[member migration]: admin_guide.md#member-migration -[remove member]: #remove-a-member -[runtime-reconf]: runtime-reconf-design.md diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/runtime-reconf-design.md b/vendor/github.com/coreos/etcd/Documentation/v2/runtime-reconf-design.md deleted file mode 100644 index 6ee9bd6b3..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/runtime-reconf-design.md +++ /dev/null @@ -1,55 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Design of Runtime Reconfiguration - -Runtime reconfiguration is one of the hardest and most error prone features in a distributed system, especially in a consensus based system like etcd. - -Read on to learn about the design of etcd's runtime reconfiguration commands and how we tackled these problems. - -## Two Phase Config Changes Keep you Safe - -In etcd, every runtime reconfiguration has to go through [two phases][add-member] for safety reasons. For example, to add a member you need to first inform cluster of new configuration and then start the new member. - -Phase 1 - Inform cluster of new configuration - -To add a member into etcd cluster, you need to make an API call to request a new member to be added to the cluster. And this is the only way that you can add a new member into an existing cluster. The API call returns when the cluster agrees on the configuration change. - -Phase 2 - Start new member - -To join the new etcd member into the existing cluster, you need to specify the correct `initial-cluster` and set `initial-cluster-state` to `existing`. When the member starts, it will contact the existing cluster first and verify the current cluster configuration matches the expected one specified in `initial-cluster`. When the new member successfully starts, you know your cluster reached the expected configuration. - -By splitting the process into two discrete phases users are forced to be explicit regarding cluster membership changes. This actually gives users more flexibility and makes things easier to reason about. For example, if there is an attempt to add a new member with the same ID as an existing member in an etcd cluster, the action will fail immediately during phase one without impacting the running cluster. Similar protection is provided to prevent adding new members by mistake. If a new etcd member attempts to join the cluster before the cluster has accepted the configuration change, it will not be accepted by the cluster. - -Without the explicit workflow around cluster membership etcd would be vulnerable to unexpected cluster membership changes. For example, if etcd is running under an init system such as systemd, etcd would be restarted after being removed via the membership API, and attempt to rejoin the cluster on startup. This cycle would continue every time a member is removed via the API and systemd is set to restart etcd after failing, which is unexpected. - -We think runtime reconfiguration should be a low frequent operation. We made the decision to keep it explicit and user-driven to ensure configuration safety and keep your cluster always running smoothly under your control. - -## Permanent Loss of Quorum Requires New Cluster - -If a cluster permanently loses a majority of its members, a new cluster will need to be started from an old data directory to recover the previous state. - -It is entirely possible to force removing the failed members from the existing cluster to recover. However, we decided not to support this method since it bypasses the normal consensus committing phase, which is unsafe. If the member to remove is not actually dead or you force to remove different members through different members in the same cluster, you will end up with diverged cluster with same clusterID. This is very dangerous and hard to debug/fix afterwards. - -If you have a correct deployment, the possibility of permanent majority lose is very low. But it is a severe enough problem that worth special care. We strongly suggest you to read the [disaster recovery documentation][disaster-recovery] and prepare for permanent majority lose before you put etcd into production. - -## Do Not Use Public Discovery Service For Runtime Reconfiguration - -The public discovery service should only be used for bootstrapping a cluster. To join member into an existing cluster, you should use runtime reconfiguration API. - -Discovery service is designed for bootstrapping an etcd cluster in the cloud environment, when you do not know the IP addresses of all the members beforehand. After you successfully bootstrap a cluster, the IP addresses of all the members are known. Technically, you should not need the discovery service any more. - -It seems that using public discovery service is a convenient way to do runtime reconfiguration, after all discovery service already has all the cluster configuration information. However relying on public discovery service brings troubles: - -1. it introduces external dependencies for the entire life-cycle of your cluster, not just bootstrap time. If there is a network issue between your cluster and public discovery service, your cluster will suffer from it. - -2. public discovery service must reflect correct runtime configuration of your cluster during it life-cycle. It has to provide security mechanism to avoid bad actions, and it is hard. - -3. public discovery service has to keep tens of thousands of cluster configurations. Our public discovery service backend is not ready for that workload. - -If you want to have a discovery service that supports runtime reconfiguration, the best choice is to build your private one. - -[add-member]: runtime-configuration.md#add-a-new-member -[disaster-recovery]: admin_guide.md#disaster-recovery diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/security.md b/vendor/github.com/coreos/etcd/Documentation/v2/security.md deleted file mode 100644 index 2fd196fd0..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/security.md +++ /dev/null @@ -1,199 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Security Model - -etcd supports SSL/TLS as well as authentication through client certificates, both for clients to server as well as peer (server to server / cluster) communication. - -To get up and running you first need to have a CA certificate and a signed key pair for one member. It is recommended to create and sign a new key pair for every member in a cluster. - -For convenience, the [cfssl] tool provides an easy interface to certificate generation, and we provide an example using the tool [here][tls-setup]. You can also examine this [alternative guide to generating self-signed key pairs][tls-guide]. - -## Basic setup - -etcd takes several certificate related configuration options, either through command-line flags or environment variables: - -**Client-to-server communication:** - -`--cert-file=`: Certificate used for SSL/TLS connections **to** etcd. When this option is set, you can set advertise-client-urls using HTTPS schema. - -`--key-file=`: Key for the certificate. Must be unencrypted. - -`--client-cert-auth`: When this is set etcd will check all incoming HTTPS requests for a client certificate signed by the trusted CA, requests that don't supply a valid client certificate will fail. If [authentication][auth] is enabled, the certificate provides credentials for the user name given by the Common Name field. - -`--trusted-ca-file=`: Trusted certificate authority. - -**Peer (server-to-server / cluster) communication:** - -The peer options work the same way as the client-to-server options: - -`--peer-cert-file=`: Certificate used for SSL/TLS connections between peers. This will be used both for listening on the peer address as well as sending requests to other peers. - -`--peer-key-file=`: Key for the certificate. Must be unencrypted. - -`--peer-client-cert-auth`: When set, etcd will check all incoming peer requests from the cluster for valid client certificates signed by the supplied CA. - -`--peer-trusted-ca-file=`: Trusted certificate authority. - -If either a client-to-server or peer certificate is supplied the key must also be set. All of these configuration options are also available through the environment variables, `ETCD_CA_FILE`, `ETCD_PEER_CA_FILE` and so on. - -## Example 1: Client-to-server transport security with HTTPS - -For this you need your CA certificate (`ca.crt`) and signed key pair (`server.crt`, `server.key`) ready. - -Let us configure etcd to provide simple HTTPS transport security step by step: - -```sh -$ etcd -name infra0 -data-dir infra0 \ - -cert-file=/path/to/server.crt -key-file=/path/to/server.key \ - -advertise-client-urls=https://127.0.0.1:2379 -listen-client-urls=https://127.0.0.1:2379 -``` - -This should start up fine and you can now test the configuration by speaking HTTPS to etcd: - -```sh -$ curl --cacert /path/to/ca.crt https://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -v -``` - -You should be able to see the handshake succeed. Because we use self-signed certificates with our own certificate authorities you need to provide the CA to curl using the `--cacert` option. Another possibility would be to add your CA certificate to the trusted certificates on your system (usually in `/etc/ssl/certs`). - -**OSX 10.9+ Users**: curl 7.30.0 on OSX 10.9+ doesn't understand certificates passed in on the command line. -Instead you must import the dummy ca.crt directly into the keychain or add the `-k` flag to curl to ignore errors. -If you want to test without the `-k` flag run `open ./fixtures/ca/ca.crt` and follow the prompts. -Please remove this certificate after you are done testing! -If you know of a workaround let us know. - -## Example 2: Client-to-server authentication with HTTPS client certificates - -For now we've given the etcd client the ability to verify the server identity and provide transport security. We can however also use client certificates to prevent unauthorized access to etcd. - -The clients will provide their certificates to the server and the server will check whether the cert is signed by the supplied CA and decide whether to serve the request. - -You need the same files mentioned in the first example for this, as well as a key pair for the client (`client.crt`, `client.key`) signed by the same certificate authority. - -```sh -$ etcd -name infra0 -data-dir infra0 \ - -client-cert-auth -trusted-ca-file=/path/to/ca.crt -cert-file=/path/to/server.crt -key-file=/path/to/server.key \ - -advertise-client-urls https://127.0.0.1:2379 -listen-client-urls https://127.0.0.1:2379 -``` - -Now try the same request as above to this server: - -```sh -$ curl --cacert /path/to/ca.crt https://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -v -``` - -The request should be rejected by the server: - -``` -... -routines:SSL3_READ_BYTES:sslv3 alert bad certificate -... -``` - -To make it succeed, we need to give the CA signed client certificate to the server: - -```sh -$ curl --cacert /path/to/ca.crt --cert /path/to/client.crt --key /path/to/client.key \ - -L https://127.0.0.1:2379/v2/keys/foo -XPUT -d value=bar -v -``` - -You should be able to see: - -``` -... -SSLv3, TLS handshake, CERT verify (15): -... -TLS handshake, Finished (20) -``` - -And also the response from the server: - -```json -{ - "action": "set", - "node": { - "createdIndex": 12, - "key": "/foo", - "modifiedIndex": 12, - "value": "bar" - } -} -``` - -## Example 3: Transport security & client certificates in a cluster - -etcd supports the same model as above for **peer communication**, that means the communication between etcd members in a cluster. - -Assuming we have our `ca.crt` and two members with their own keypairs (`member1.crt` & `member1.key`, `member2.crt` & `member2.key`) signed by this CA, we launch etcd as follows: - - -```sh -DISCOVERY_URL=... # from https://discovery.etcd.io/new - -# member1 -$ etcd -name infra1 -data-dir infra1 \ - -peer-client-cert-auth -peer-trusted-ca-file=/path/to/ca.crt -peer-cert-file=/path/to/member1.crt -peer-key-file=/path/to/member1.key \ - -initial-advertise-peer-urls=https://10.0.1.10:2380 -listen-peer-urls=https://10.0.1.10:2380 \ - -discovery ${DISCOVERY_URL} - -# member2 -$ etcd -name infra2 -data-dir infra2 \ - -peer-client-cert-auth -peer-trusted-ca-file=/path/to/ca.crt -peer-cert-file=/path/to/member2.crt -peer-key-file=/path/to/member2.key \ - -initial-advertise-peer-urls=https://10.0.1.11:2380 -listen-peer-urls=https://10.0.1.11:2380 \ - -discovery ${DISCOVERY_URL} -``` - -The etcd members will form a cluster and all communication between members in the cluster will be encrypted and authenticated using the client certificates. You will see in the output of etcd that the addresses it connects to use HTTPS. - -## Notes For etcd Proxy - -etcd proxy terminates the TLS from its client if the connection is secure, and uses proxy's own key/cert specified in `--peer-key-file` and `--peer-cert-file` to communicate with etcd members. - -The proxy communicates with etcd members through both the `--advertise-client-urls` and `--advertise-peer-urls` of a given member. It forwards client requests to etcd members’ advertised client urls, and it syncs the initial cluster configuration through etcd members’ advertised peer urls. - -When client authentication is enabled for an etcd member, the administrator must ensure that the peer certificate specified in the proxy's `--peer-cert-file` option is valid for that authentication. The proxy's peer certificate must also be valid for peer authentication if peer authentication is enabled. - -## Frequently Asked Questions - -### My cluster is not working with peer tls configuration? - -The internal protocol of etcd v2.0.x uses a lot of short-lived HTTP connections. -So, when enabling TLS you may need to increase the heartbeat interval and election timeouts to reduce internal cluster connection churn. -A reasonable place to start are these values: ` --heartbeat-interval 500 --election-timeout 2500`. -These issues are resolved in the etcd v2.1.x series of releases which uses fewer connections. - -### I'm seeing a SSLv3 alert handshake failure when using SSL client authentication? - -The `crypto/tls` package of `golang` checks the key usage of the certificate public key before using it. -To use the certificate public key to do client auth, we need to add `clientAuth` to `Extended Key Usage` when creating the certificate public key. - -Here is how to do it: - -Add the following section to your openssl.cnf: - -``` -[ ssl_client ] -... - extendedKeyUsage = clientAuth -... -``` - -When creating the cert be sure to reference it in the `-extensions` flag: - -``` -$ openssl ca -config openssl.cnf -policy policy_anything -extensions ssl_client -out certs/machine.crt -infiles machine.csr -``` - -### With peer certificate authentication I receive "certificate is valid for 127.0.0.1, not $MY_IP" -Make sure that you sign your certificates with a Subject Name your member's public IP address. The `etcd-ca` tool for example provides an `--ip=` option for its `new-cert` command. - -If you need your certificate to be signed for your member's FQDN in its Subject Name then you could use Subject Alternative Names (short IP SANs) to add your IP address. The `etcd-ca` tool provides `--domain=` option for its `new-cert` command, and openssl can make [it][alt-name] too. - -[cfssl]: https://github.com/cloudflare/cfssl -[tls-setup]: ../../hack/tls-setup -[tls-guide]: https://github.com/coreos/docs/blob/master/os/generate-self-signed-certificates.md -[alt-name]: http://wiki.cacert.org/FAQ/subjectAltName -[auth]: authentication.md diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/tuning.md b/vendor/github.com/coreos/etcd/Documentation/v2/tuning.md deleted file mode 100644 index 290e887cd..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/tuning.md +++ /dev/null @@ -1,80 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Tuning - -The default settings in etcd should work well for installations on a local network where the average network latency is low. -However, when using etcd across multiple data centers or over networks with high latency you may need to tweak the heartbeat interval and election timeout settings. - -The network isn't the only source of latency. Each request and response may be impacted by slow disks on both the leader and follower. Each of these timeouts represents the total time from request to successful response from the other machine. - -## Time Parameters - -The underlying distributed consensus protocol relies on two separate time parameters to ensure that nodes can handoff leadership if one stalls or goes offline. -The first parameter is called the *Heartbeat Interval*. -This is the frequency with which the leader will notify followers that it is still the leader. -For best practices, the parameter should be set around round-trip time between members. -By default, etcd uses a `100ms` heartbeat interval. - -The second parameter is the *Election Timeout*. -This timeout is how long a follower node will go without hearing a heartbeat before attempting to become leader itself. -By default, etcd uses a `1000ms` election timeout. - -Adjusting these values is a trade off. -The value of heartbeat interval is recommended to be around the maximum of average round-trip time (RTT) between members, normally around 0.5-1.5x the round-trip time. -If heartbeat interval is too low, etcd will send unnecessary messages that increase the usage of CPU and network resources. -On the other side, a too high heartbeat interval leads to high election timeout. Higher election timeout takes longer time to detect a leader failure. -The easiest way to measure round-trip time (RTT) is to use [PING utility][ping]. - -The election timeout should be set based on the heartbeat interval and average round-trip time between members. -Election timeouts must be at least 10 times the round-trip time so it can account for variance in your network. -For example, if the round-trip time between your members is 10ms then you should have at least a 100ms election timeout. - -You should also set your election timeout to at least 5 to 10 times your heartbeat interval to account for variance in leader replication. -For a heartbeat interval of 50ms you should set your election timeout to at least 250ms - 500ms. - -The upper limit of election timeout is 50000ms (50s), which should only be used when deploying a globally-distributed etcd cluster. -A reasonable round-trip time for the continental United States is 130ms, and the time between US and Japan is around 350-400ms. -If your network has uneven performance or regular packet delays/loss then it is possible that a couple of retries may be necessary to successfully send a packet. So 5s is a safe upper limit of global round-trip time. -As the election timeout should be an order of magnitude bigger than broadcast time, in the case of ~5s for a globally distributed cluster, then 50 seconds becomes a reasonable maximum. - -The heartbeat interval and election timeout value should be the same for all members in one cluster. Setting different values for etcd members may disrupt cluster stability. - -You can override the default values on the command line: - -```sh -# Command line arguments: -$ etcd -heartbeat-interval=100 -election-timeout=500 - -# Environment variables: -$ ETCD_HEARTBEAT_INTERVAL=100 ETCD_ELECTION_TIMEOUT=500 etcd -``` - -The values are specified in milliseconds. - -## Snapshots - -etcd appends all key changes to a log file. -This log grows forever and is a complete linear history of every change made to the keys. -A complete history works well for lightly used clusters but clusters that are heavily used would carry around a large log. - -To avoid having a huge log etcd makes periodic snapshots. -These snapshots provide a way for etcd to compact the log by saving the current state of the system and removing old logs. - -### Snapshot Tuning - -Creating snapshots can be expensive so they're only created after a given number of changes to etcd. -By default, snapshots will be made after every 10,000 changes. -If etcd's memory usage and disk usage are too high, you can lower the snapshot threshold by setting the following on the command line: - -```sh -# Command line arguments: -$ etcd -snapshot-count=5000 - -# Environment variables: -$ ETCD_SNAPSHOT_COUNT=5000 etcd -``` - -[ping]: https://en.wikipedia.org/wiki/Ping_(networking_utility) diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/upgrade_2_1.md b/vendor/github.com/coreos/etcd/Documentation/v2/upgrade_2_1.md deleted file mode 100644 index 07ce35776..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/upgrade_2_1.md +++ /dev/null @@ -1,121 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Upgrade etcd to 2.1 - -In the general case, upgrading from etcd 2.0 to 2.1 can be a zero-downtime, rolling upgrade: - - one by one, stop the etcd v2.0 processes and replace them with etcd v2.1 processes - - after you are running all v2.1 processes, new features in v2.1 are available to the cluster - -Before [starting an upgrade](#upgrade-procedure), read through the rest of this guide to prepare. - -## Upgrade Checklists - -### Upgrade Requirements - -To upgrade an existing etcd deployment to 2.1, you must be running 2.0. If you’re running a version of etcd before 2.0, you must upgrade to [2.0][v2.0] before upgrading to 2.1. - -Also, to ensure a smooth rolling upgrade, your running cluster must be healthy. You can check the health of the cluster by using `etcdctl cluster-health` command. - -### Preparedness - -Before upgrading etcd, always test the services relying on etcd in a staging environment before deploying the upgrade to the production environment. - -You might also want to [backup your data directory][backup-datastore] for a potential [downgrade](#downgrade). - -etcd 2.1 introduces a new [authentication][auth] feature, which is disabled by default. If your deployment depends on these, you may want to test the auth features before enabling them in production. - -### Mixed Versions - -While upgrading, an etcd cluster supports mixed versions of etcd members. The cluster is only considered upgraded once all its members are upgraded to 2.1. - -Internally, etcd members negotiate with each other to determine the overall etcd cluster version, which controls the reported cluster version and the supported features. For example, if you are mid-upgrade, any 2.1 features (such as the the authentication feature mentioned above) won’t be available. - -### Limitations - -If you encounter any issues during the upgrade, you can attempt to restart the etcd process in trouble using a newer v2.1 binary to solve the problem. One known issue is that etcd v2.0.0 and v2.0.2 may panic during rolling upgrades due to an existing bug, which has been fixed since etcd v2.0.3. - -It might take up to 2 minutes for the newly upgraded member to catch up with the existing cluster when the total data size is larger than 50MB (You can check the size of the existing snapshot to know about the rough data size). In other words, it is safest to wait for 2 minutes before upgrading the next member. - -If you have even more data, this might take more time. If you have a data size larger than 100MB you should contact us before upgrading, so we can make sure the upgrades work smoothly. - -### Downgrade - -If all members have been upgraded to v2.1, the cluster will be upgraded to v2.1, and downgrade is **not possible**. If any member is still v2.0, the cluster will remain in v2.0, and you can go back to use v2.0 binary. - -Please [backup your data directory][backup-datastore] of all etcd members if you want to downgrade the cluster, even if it is upgraded. - -### Upgrade Procedure - -#### 1. Check upgrade requirements. - -``` -$ etcdctl cluster-health -cluster is healthy -member 6e3bd23ae5f1eae0 is healthy -member 924e2e83e93f2560 is healthy -member a8266ecf031671f3 is healthy - -$ curl http://127.0.0.1:4001/version -etcd 2.0.x -``` - -#### 2. Stop the existing etcd process - -You will see similar error logging from other etcd processes in your cluster. This is normal, since you just shut down a member. - -``` -2015/06/23 15:45:09 sender: error posting to 6e3bd23ae5f1eae0: dial tcp 127.0.0.1:7002: connection refused -2015/06/23 15:45:09 sender: the connection with 6e3bd23ae5f1eae0 became inactive -2015/06/23 15:45:11 rafthttp: encountered error writing to server log stream: write tcp 127.0.0.1:53783: broken pipe -2015/06/23 15:45:11 rafthttp: server streaming to 6e3bd23ae5f1eae0 at term 2 has been stopped -2015/06/23 15:45:11 stream: error sending message: stopped -2015/06/23 15:45:11 stream: stopping the stream server... -``` - -You could [backup your data directory][backup-datastore] for data safety. - -``` -$ etcdctl backup \ - --data-dir /var/lib/etcd \ - --backup-dir /tmp/etcd_backup -``` - -#### 3. Drop-in etcd v2.1 binary and start the new etcd process - -You will see the etcd publish its information to the cluster. - -``` -2015/06/23 15:45:39 etcdserver: published {Name:infra2 ClientURLs:[http://localhost:4002]} to cluster e9c7614f68f35fb2 -``` - -You could verify the cluster becomes healthy. - -``` -$ etcdctl cluster-health -cluster is healthy -member 6e3bd23ae5f1eae0 is healthy -member 924e2e83e93f2560 is healthy -member a8266ecf031671f3 is healthy -``` - -#### 4. Repeat step 2 to step 3 for all other members - -#### 5. Finish - -When all members are upgraded, you will see the cluster is upgraded to 2.1 successfully: - -``` -2015/06/23 15:46:35 etcdserver: updated the cluster version from 2.0.0 to 2.1.0 -``` - -``` -$ curl http://127.0.0.1:4001/version -{"etcdserver":"2.1.x","etcdcluster":"2.1.0"} -``` - -[auth]: auth_api.md -[backup-datastore]: admin_guide.md#backing-up-the-datastore -[v2.0]: https://github.com/coreos/etcd/releases/tag/v2.0.13 diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/upgrade_2_2.md b/vendor/github.com/coreos/etcd/Documentation/v2/upgrade_2_2.md deleted file mode 100644 index 76fcf811e..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/upgrade_2_2.md +++ /dev/null @@ -1,137 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -# Upgrade etcd from 2.1 to 2.2 - -In the general case, upgrading from etcd 2.1 to 2.2 can be a zero-downtime, rolling upgrade: - - - one by one, stop the etcd v2.1 processes and replace them with etcd v2.2 processes - - after you are running all v2.2 processes, new features in v2.2 are available to the cluster - -Before [starting an upgrade](#upgrade-procedure), read through the rest of this guide to prepare. - -## Upgrade Checklists - -### Upgrade Requirement - -To upgrade an existing etcd deployment to 2.2, you must be running 2.1. If you’re running a version of etcd before 2.1, you must upgrade to [2.1][v2.1] before upgrading to 2.2. - -Also, to ensure a smooth rolling upgrade, your running cluster must be healthy. You can check the health of the cluster by using `etcdctl cluster-health` command. - -### Preparedness - -Before upgrading etcd, always test the services relying on etcd in a staging environment before deploying the upgrade to the production environment. - -You might also want to [backup the data directory][backup-datastore] for a potential [downgrade]. - -### Mixed Versions - -While upgrading, an etcd cluster supports mixed versions of etcd members. The cluster is only considered upgraded once all its members are upgraded to 2.2. - -Internally, etcd members negotiate with each other to determine the overall etcd cluster version, which controls the reported cluster version and the supported features. - -### Limitations - -If you have a data size larger than 100MB you should contact us before upgrading, so we can make sure the upgrades work smoothly. - -Every etcd 2.2 member will do health checking across the cluster periodically. etcd 2.1 member does not support health checking. During the upgrade, etcd 2.2 member will log warning about the unhealthy state of etcd 2.1 member. You can ignore the warning. - -### Downgrade - -If all members have been upgraded to v2.2, the cluster will be upgraded to v2.2, and downgrade is **not possible**. If any member is still v2.1, the cluster will remain in v2.1, and you can go back to use v2.1 binary. - -Please [backup the data directory][backup-datastore] of all etcd members if you want to downgrade the cluster, even if it is upgraded. - -### Upgrade Procedure - -In the example, we upgrade a three member v2.1 cluster running on local machine. - -#### 1. Check upgrade requirements. - -``` -$ etcdctl cluster-health -member 6e3bd23ae5f1eae0 is healthy: got healthy result from http://localhost:22379 -member 924e2e83e93f2560 is healthy: got healthy result from http://localhost:32379 -member a8266ecf031671f3 is healthy: got healthy result from http://localhost:12379 -cluster is healthy - -$ curl http://localhost:4001/version -{"etcdserver":"2.1.x","etcdcluster":"2.1.0"} -``` - -#### 2. Stop the existing etcd process - -You will see similar error logging from other etcd processes in your cluster. This is normal, since you just shut down a member and the connection is broken. - -``` -2015/09/2 09:48:35 etcdserver: failed to reach the peerURL(http://localhost:12380) of member a8266ecf031671f3 (Get http://localhost:12380/version: dial tcp [::1]:12380: getsockopt: connection refused) -2015/09/2 09:48:35 etcdserver: cannot get the version of member a8266ecf031671f3 (Get http://localhost:12380/version: dial tcp [::1]:12380: getsockopt: connection refused) -2015/09/2 09:48:35 rafthttp: failed to write a8266ecf031671f3 on stream Message (write tcp 127.0.0.1:32380->127.0.0.1:64394: write: broken pipe) -2015/09/2 09:48:35 rafthttp: failed to write a8266ecf031671f3 on pipeline (dial tcp [::1]:12380: getsockopt: connection refused) -2015/09/2 09:48:40 etcdserver: failed to reach the peerURL(http://localhost:7001) of member a8266ecf031671f3 (Get http://localhost:7001/version: dial tcp [::1]:12380: getsockopt: connection refused) -2015/09/2 09:48:40 etcdserver: cannot get the version of member a8266ecf031671f3 (Get http://localhost:12380/version: dial tcp [::1]:12380: getsockopt: connection refused) -2015/09/2 09:48:40 rafthttp: failed to heartbeat a8266ecf031671f3 on stream MsgApp v2 (write tcp 127.0.0.1:32380->127.0.0.1:64393: write: broken pipe) -``` - -You will see logging output like this from ungraded member due to a mixed version cluster. You can ignore this while upgrading. - -``` -2015/09/2 09:48:45 etcdserver: the etcd version 2.1.2+git is not up-to-date -2015/09/2 09:48:45 etcdserver: member a8266ecf031671f3 has a higher version &{2.2.0-rc.0+git 2.1.0} -``` - -You will also see logging output like this from the newly upgraded member, since etcd 2.1 member does not support health checking. You can ignore this while upgrading. - -``` -2015-09-02 09:55:42.691384 W | rafthttp: the connection to peer 6e3bd23ae5f1eae0 is unhealthy -2015-09-02 09:55:42.705626 W | rafthttp: the connection to peer 924e2e83e93f2560 is unhealthy - -``` - -[Backup your data directory][backup-datastore] for data safety. - -``` -$ etcdctl backup \ - --data-dir /var/lib/etcd \ - --backup-dir /tmp/etcd_backup -``` - -#### 3. Drop-in etcd v2.2 binary and start the new etcd process - -Now, you can start the etcd v2.2 binary with the previous configuration. -You will see the etcd start and publish its information to the cluster. - -``` -2015-09-02 09:56:46.117609 I | etcdserver: published {Name:infra2 ClientURLs:[http://localhost:22380]} to cluster e9c7614f68f35fb2 -``` - -You could verify the cluster becomes healthy. - -``` -$ etcdctl cluster-health -member 6e3bd23ae5f1eae0 is healthy: got healthy result from http://localhost:22379 -member 924e2e83e93f2560 is healthy: got healthy result from http://localhost:32379 -member a8266ecf031671f3 is healthy: got healthy result from http://localhost:12379 -cluster is healthy -``` - -#### 4. Repeat step 2 to step 3 for all other members - -#### 5. Finish - -When all members are upgraded, you will see the cluster is upgraded to 2.2 successfully: - -``` -2015-09-02 09:56:54.896848 N | etcdserver: updated the cluster version from 2.1 to 2.2 -``` - -``` -$ curl http://127.0.0.1:4001/version -{"etcdserver":"2.2.x","etcdcluster":"2.2.0"} -``` - -[backup-datastore]: admin_guide.md#backing-up-the-datastore -[downgrade]: #downgrade -[v2.1]: https://github.com/coreos/etcd/releases/tag/v2.1.2 diff --git a/vendor/github.com/coreos/etcd/Documentation/v2/upgrade_2_3.md b/vendor/github.com/coreos/etcd/Documentation/v2/upgrade_2_3.md deleted file mode 100644 index 95ddbbf41..000000000 --- a/vendor/github.com/coreos/etcd/Documentation/v2/upgrade_2_3.md +++ /dev/null @@ -1,126 +0,0 @@ -**This is the documentation for etcd2 releases. Read [etcd3 doc][v3-docs] for etcd3 releases.** - -[v3-docs]: ../docs.md#documentation - - -## Upgrade etcd from 2.2 to 2.3 - -In the general case, upgrading from etcd 2.2 to 2.3 can be a zero-downtime, rolling upgrade: - - one by one, stop the etcd v2.2 processes and replace them with etcd v2.3 processes - - after running all v2.3 processes, new features in v2.3 are available to the cluster - -Before [starting an upgrade](#upgrade-procedure), read through the rest of this guide to prepare. - -### Upgrade Checklists - -#### Upgrade Requirements - -To upgrade an existing etcd deployment to 2.3, the running cluster must be 2.2 or greater. If it's before 2.2, please upgrade to [2.2](https://github.com/coreos/etcd/releases/tag/v2.2.0) before upgrading to 2.3. - -Also, to ensure a smooth rolling upgrade, the running cluster must be healthy. You can check the health of the cluster by using the `etcdctl cluster-health` command. - -#### Preparation - -Before upgrading etcd, always test the services relying on etcd in a staging environment before deploying the upgrade to the production environment. - -Before beginning, [backup the etcd data directory](admin_guide.md#backing-up-the-datastore). Should something go wrong with the upgrade, it is possible to use this backup to[downgrade](#downgrade) back to existing etcd version. - -#### Mixed Versions - -While upgrading, an etcd cluster supports mixed versions of etcd members, and operates with the protocol of the lowest common version. The cluster is only considered upgraded once all of its members are upgraded to version 2.3. Internally, etcd members negotiate with each other to determine the overall cluster version, which controls the reported version and the supported features. - -#### Limitations - -It might take up to 2 minutes for the newly upgraded member to catch up with the existing cluster when the total data size is larger than 50MB. Check the size of a recent snapshot to estimate the total data size. In other words, it is safest to wait for 2 minutes between upgrading each member. - -For a much larger total data size, 100MB or more , this one-time process might take even more time. Administrators of very large etcd clusters of this magnitude can feel free to contact the [etcd team][etcd-contact] before upgrading, and we’ll be happy to provide advice on the procedure. - -#### Downgrade - -If all members have been upgraded to v2.3, the cluster will be upgraded to v2.3, and downgrade from this completed state is **not possible**. If any single member is still v2.2, however, the cluster and its operations remains “v2.2”, and it is possible from this mixed cluster state to return to using a v2.2 etcd binary on all members. - -Please [backup the data directory](admin_guide.md#backing-up-the-datastore) of all etcd members to make downgrading the cluster possible even after it has been completely upgraded. - -### Upgrade Procedure - - -This example details the upgrade of a three-member v2.2 ectd cluster running on a local machine. - -#### 1. Check upgrade requirements. - -Is the the cluster healthy and running v.2.2.x? - -``` -$ etcdctl cluster-health -member 6e3bd23ae5f1eae0 is healthy: got healthy result from http://localhost:22379 -member 924e2e83e93f2560 is healthy: got healthy result from http://localhost:32379 -member a8266ecf031671f3 is healthy: got healthy result from http://localhost:12379 -cluster is healthy - -$ curl http://localhost:4001/version -{"etcdserver":"2.2.x","etcdcluster":"2.2.0"} -``` - -#### 2. Stop the existing etcd process - -When each etcd process is stopped, expected errors will be logged by other cluster members. This is normal since a cluster member connection has been (temporarily) broken: - -``` -2016-03-11 09:50:49.860319 E | rafthttp: failed to read 8211f1d0f64f3269 on stream Message (unexpected EOF) -2016-03-11 09:50:49.860335 I | rafthttp: the connection with 8211f1d0f64f3269 became inactive -2016-03-11 09:50:51.023804 W | etcdserver: failed to reach the peerURL(http://127.0.0.1:12380) of member 8211f1d0f64f3269 (Get http://127.0.0.1:12380/version: dial tcp 127.0.0.1:12380: getsockopt: connection refused) -2016-03-11 09:50:51.023821 W | etcdserver: cannot get the version of member 8211f1d0f64f3269 (Get http://127.0.0.1:12380/version: dial tcp 127.0.0.1:12380: getsockopt: connection refused) -``` - -It’s a good idea at this point to [backup the etcd data directory](https://github.com/coreos/etcd/blob/7f7e2cc79d9c5c342a6eb1e48c386b0223cf934e/Documentation/admin_guide.md#backing-up-the-datastore) to provide a downgrade path should any problems occur: - -``` -$ etcdctl backup \ - --data-dir /var/lib/etcd \ - --backup-dir /tmp/etcd_backup -``` - -#### 3. Drop-in etcd v2.3 binary and start the new etcd process - -The new v2.3 etcd will publish its information to the cluster: - -``` -09:58:25.938673 I | etcdserver: published {Name:infra1 ClientURLs:[http://localhost:12379]} to cluster 524400597fb1d5f6 -``` - -Verify that each member, and then the entire cluster, becomes healthy with the new v2.3 etcd binary: - -``` -$ etcdctl cluster-health -member 6e3bd23ae5f1eae0 is healthy: got healthy result from http://localhost:22379 -member 924e2e83e93f2560 is healthy: got healthy result from http://localhost:32379 -member a8266ecf031671f3 is healthy: got healthy result from http://localhost:12379 -cluster is healthy -``` - - -Upgraded members will log warnings like the following until the entire cluster is upgraded. This is expected and will cease after all etcd cluster members are upgraded to v2.3: - -``` -2016-03-11 09:58:26.851837 W | etcdserver: the local etcd version 2.2.0 is not up-to-date -2016-03-11 09:58:26.851854 W | etcdserver: member c02c70ede158499f has a higher version 2.3.0 -``` - -#### 4. Repeat step 2 to step 3 for all other members - -#### 5. Finish - -When all members are upgraded, the cluster will report upgrading to 2.3 successfully: - -``` -2016-03-11 10:03:01.583392 N | etcdserver: updated the cluster version from 2.2 to 2.3 -``` - -``` -$ curl http://127.0.0.1:4001/version -{"etcdserver":"2.3.x","etcdcluster":"2.3.0"} -``` - - -[etcd-contact]: https://coreos.com/etcd/? - diff --git a/vendor/github.com/coreos/etcd/Makefile b/vendor/github.com/coreos/etcd/Makefile index a8eceefe0..ffa6fca9d 100644 --- a/vendor/github.com/coreos/etcd/Makefile +++ b/vendor/github.com/coreos/etcd/Makefile @@ -50,7 +50,7 @@ docker-remove: -GO_VERSION ?= 1.10.3 +GO_VERSION ?= 1.12.9 ETCD_VERSION ?= $(shell git rev-parse --short HEAD || echo "GitNotFound") TEST_SUFFIX = $(shell date +%s | base64 | head -c 15) @@ -64,11 +64,11 @@ endif # Example: -# GO_VERSION=1.8.7 make build-docker-test +# GO_VERSION=1.12.9 make build-docker-test # make build-docker-test # # gcloud docker -- login -u _json_key -p "$(cat /etc/gcp-key-etcd-development.json)" https://gcr.io -# GO_VERSION=1.8.7 make push-docker-test +# GO_VERSION=1.12.9 make push-docker-test # make push-docker-test # # gsutil -m acl ch -u allUsers:R -r gs://artifacts.etcd-development.appspot.com @@ -78,17 +78,17 @@ build-docker-test: $(info GO_VERSION: $(GO_VERSION)) @sed -i.bak 's|REPLACE_ME_GO_VERSION|$(GO_VERSION)|g' ./tests/Dockerfile docker build \ - --tag gcr.io/etcd-development/etcd-test:go$(GO_VERSION) \ + --tag gcr.io/etcd-development/etcd-test:go$(GO_VERSION)-release-3.3 \ --file ./tests/Dockerfile . @mv ./tests/Dockerfile.bak ./tests/Dockerfile push-docker-test: $(info GO_VERSION: $(GO_VERSION)) - gcloud docker -- push gcr.io/etcd-development/etcd-test:go$(GO_VERSION) + gcloud docker -- push gcr.io/etcd-development/etcd-test:go$(GO_VERSION)-release-3.3 pull-docker-test: $(info GO_VERSION: $(GO_VERSION)) - docker pull gcr.io/etcd-development/etcd-test:go$(GO_VERSION) + docker pull gcr.io/etcd-development/etcd-test:go$(GO_VERSION)-release-3.3 @@ -102,16 +102,16 @@ compile-with-docker-test: docker run \ --rm \ --mount type=bind,source=`pwd`,destination=/go/src/github.com/coreos/etcd \ - gcr.io/etcd-development/etcd-test:go$(GO_VERSION) \ - /bin/bash -c "GO_BUILD_FLAGS=-v ./build && ./bin/etcd --version" + gcr.io/etcd-development/etcd-test:go$(GO_VERSION)-release-3.3 \ + /bin/bash -c "GO_BUILD_FLAGS=-v GOOS=linux GOARCH=amd64 ./build && ./bin/etcd --version" compile-setup-gopath-with-docker-test: $(info GO_VERSION: $(GO_VERSION)) docker run \ --rm \ --mount type=bind,source=`pwd`,destination=/etcd \ - gcr.io/etcd-development/etcd-test:go$(GO_VERSION) \ - /bin/bash -c "cd /etcd && ETCD_SETUP_GOPATH=1 GO_BUILD_FLAGS=-v ./build && ./bin/etcd --version && rm -rf ./gopath" + gcr.io/etcd-development/etcd-test:go$(GO_VERSION)-release-3.3 \ + /bin/bash -c "cd /etcd && ETCD_SETUP_GOPATH=1 GO_BUILD_FLAGS=-v GOOS=linux GOARCH=amd64 ./build && ./bin/etcd --version && rm -rf ./gopath" @@ -145,7 +145,7 @@ test: $(info TEST_OPTS: $(TEST_OPTS)) $(info log-file: test-$(TEST_SUFFIX).log) $(TEST_OPTS) ./test 2>&1 | tee test-$(TEST_SUFFIX).log - ! egrep "(--- FAIL:|panic: test timed out|appears to have leaked)" -B50 -A10 test-$(TEST_SUFFIX).log + ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test-$(TEST_SUFFIX).log docker-test: $(info GO_VERSION: $(GO_VERSION)) @@ -158,9 +158,9 @@ docker-test: --rm \ $(TMP_DIR_MOUNT_FLAG) \ --mount type=bind,source=`pwd`,destination=/go/src/github.com/coreos/etcd \ - gcr.io/etcd-development/etcd-test:go$(GO_VERSION) \ + gcr.io/etcd-development/etcd-test:go$(GO_VERSION)-release-3.3 \ /bin/bash -c "$(TEST_OPTS) ./test 2>&1 | tee test-$(TEST_SUFFIX).log" - ! egrep "(--- FAIL:|panic: test timed out|appears to have leaked)" -B50 -A10 test-$(TEST_SUFFIX).log + ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test-$(TEST_SUFFIX).log docker-test-coverage: $(info GO_VERSION: $(GO_VERSION)) @@ -172,9 +172,9 @@ docker-test-coverage: --rm \ $(TMP_DIR_MOUNT_FLAG) \ --mount type=bind,source=`pwd`,destination=/go/src/github.com/coreos/etcd \ - gcr.io/etcd-development/etcd-test:go$(GO_VERSION) \ + gcr.io/etcd-development/etcd-test:go$(GO_VERSION)-release-3.3 \ /bin/bash -c "COVERDIR=covdir PASSES='build build_cov cov' ./test 2>&1 | tee docker-test-coverage-$(TEST_SUFFIX).log && /codecov -t 6040de41-c073-4d6f-bbf8-d89256ef31e1" - ! egrep "(--- FAIL:|panic: test timed out|appears to have leaked)" -B50 -A10 docker-test-coverage-$(TEST_SUFFIX).log + ! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 docker-test-coverage-$(TEST_SUFFIX).log diff --git a/vendor/github.com/coreos/etcd/auth/authpb/auth.pb.go b/vendor/github.com/coreos/etcd/auth/authpb/auth.pb.go index 1a940c39b..c5faf00c6 100644 --- a/vendor/github.com/coreos/etcd/auth/authpb/auth.pb.go +++ b/vendor/github.com/coreos/etcd/auth/authpb/auth.pb.go @@ -1,29 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: auth.proto -/* - Package authpb is a generated protocol buffer package. - - It is generated from these files: - auth.proto - - It has these top-level messages: - User - Permission - Role -*/ package authpb import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - + fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" - - io "io" + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -50,6 +37,7 @@ var Permission_Type_name = map[int32]string{ 1: "WRITE", 2: "READWRITE", } + var Permission_Type_value = map[string]int32{ "READ": 0, "WRITE": 1, @@ -59,53 +47,174 @@ var Permission_Type_value = map[string]int32{ func (x Permission_Type) String() string { return proto.EnumName(Permission_Type_name, int32(x)) } -func (Permission_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptorAuth, []int{1, 0} } + +func (Permission_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8bbd6f3875b0e874, []int{1, 0} +} // User is a single entry in the bucket authUsers type User struct { - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - Roles []string `protobuf:"bytes,3,rep,name=roles" json:"roles,omitempty"` + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + Roles []string `protobuf:"bytes,3,rep,name=roles,proto3" json:"roles,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *User) Reset() { *m = User{} } -func (m *User) String() string { return proto.CompactTextString(m) } -func (*User) ProtoMessage() {} -func (*User) Descriptor() ([]byte, []int) { return fileDescriptorAuth, []int{0} } +func (m *User) Reset() { *m = User{} } +func (m *User) String() string { return proto.CompactTextString(m) } +func (*User) ProtoMessage() {} +func (*User) Descriptor() ([]byte, []int) { + return fileDescriptor_8bbd6f3875b0e874, []int{0} +} +func (m *User) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_User.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *User) XXX_Merge(src proto.Message) { + xxx_messageInfo_User.Merge(m, src) +} +func (m *User) XXX_Size() int { + return m.Size() +} +func (m *User) XXX_DiscardUnknown() { + xxx_messageInfo_User.DiscardUnknown(m) +} + +var xxx_messageInfo_User proto.InternalMessageInfo // Permission is a single entity type Permission struct { - PermType Permission_Type `protobuf:"varint,1,opt,name=permType,proto3,enum=authpb.Permission_Type" json:"permType,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - RangeEnd []byte `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + PermType Permission_Type `protobuf:"varint,1,opt,name=permType,proto3,enum=authpb.Permission_Type" json:"permType,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + RangeEnd []byte `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Permission) Reset() { *m = Permission{} } -func (m *Permission) String() string { return proto.CompactTextString(m) } -func (*Permission) ProtoMessage() {} -func (*Permission) Descriptor() ([]byte, []int) { return fileDescriptorAuth, []int{1} } +func (m *Permission) Reset() { *m = Permission{} } +func (m *Permission) String() string { return proto.CompactTextString(m) } +func (*Permission) ProtoMessage() {} +func (*Permission) Descriptor() ([]byte, []int) { + return fileDescriptor_8bbd6f3875b0e874, []int{1} +} +func (m *Permission) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Permission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Permission.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Permission) XXX_Merge(src proto.Message) { + xxx_messageInfo_Permission.Merge(m, src) +} +func (m *Permission) XXX_Size() int { + return m.Size() +} +func (m *Permission) XXX_DiscardUnknown() { + xxx_messageInfo_Permission.DiscardUnknown(m) +} + +var xxx_messageInfo_Permission proto.InternalMessageInfo // Role is a single entry in the bucket authRoles type Role struct { - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - KeyPermission []*Permission `protobuf:"bytes,2,rep,name=keyPermission" json:"keyPermission,omitempty"` + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + KeyPermission []*Permission `protobuf:"bytes,2,rep,name=keyPermission,proto3" json:"keyPermission,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Role) Reset() { *m = Role{} } +func (m *Role) String() string { return proto.CompactTextString(m) } +func (*Role) ProtoMessage() {} +func (*Role) Descriptor() ([]byte, []int) { + return fileDescriptor_8bbd6f3875b0e874, []int{2} +} +func (m *Role) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Role) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Role.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Role) XXX_Merge(src proto.Message) { + xxx_messageInfo_Role.Merge(m, src) +} +func (m *Role) XXX_Size() int { + return m.Size() +} +func (m *Role) XXX_DiscardUnknown() { + xxx_messageInfo_Role.DiscardUnknown(m) } -func (m *Role) Reset() { *m = Role{} } -func (m *Role) String() string { return proto.CompactTextString(m) } -func (*Role) ProtoMessage() {} -func (*Role) Descriptor() ([]byte, []int) { return fileDescriptorAuth, []int{2} } +var xxx_messageInfo_Role proto.InternalMessageInfo func init() { + proto.RegisterEnum("authpb.Permission_Type", Permission_Type_name, Permission_Type_value) proto.RegisterType((*User)(nil), "authpb.User") proto.RegisterType((*Permission)(nil), "authpb.Permission") proto.RegisterType((*Role)(nil), "authpb.Role") - proto.RegisterEnum("authpb.Permission_Type", Permission_Type_name, Permission_Type_value) } + +func init() { proto.RegisterFile("auth.proto", fileDescriptor_8bbd6f3875b0e874) } + +var fileDescriptor_8bbd6f3875b0e874 = []byte{ + // 288 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4a, 0xc3, 0x30, + 0x1c, 0xc6, 0x9b, 0xb6, 0x1b, 0xed, 0x5f, 0x27, 0x25, 0x0c, 0x0c, 0x13, 0x42, 0xe9, 0xa9, 0x78, + 0xa8, 0xb0, 0x5d, 0xbc, 0x2a, 0xf6, 0x20, 0x78, 0x90, 0x50, 0xf1, 0x28, 0x1d, 0x0d, 0x75, 0x6c, + 0x6d, 0x4a, 0x32, 0x91, 0xbe, 0x89, 0x07, 0x1f, 0x68, 0xc7, 0x3d, 0x82, 0xab, 0x2f, 0x22, 0x4d, + 0x64, 0x43, 0xdc, 0xed, 0xfb, 0xbe, 0xff, 0x97, 0xe4, 0x97, 0x3f, 0x40, 0xfe, 0xb6, 0x7e, 0x4d, + 0x1a, 0x29, 0xd6, 0x02, 0x0f, 0x7b, 0xdd, 0xcc, 0x27, 0xe3, 0x52, 0x94, 0x42, 0x47, 0x57, 0xbd, + 0x32, 0xd3, 0xe8, 0x01, 0xdc, 0x27, 0xc5, 0x25, 0xc6, 0xe0, 0xd6, 0x79, 0xc5, 0x09, 0x0a, 0x51, + 0x7c, 0xca, 0xb4, 0xc6, 0x13, 0xf0, 0x9a, 0x5c, 0xa9, 0x77, 0x21, 0x0b, 0x62, 0xeb, 0x7c, 0xef, + 0xf1, 0x18, 0x06, 0x52, 0xac, 0xb8, 0x22, 0x4e, 0xe8, 0xc4, 0x3e, 0x33, 0x26, 0xfa, 0x44, 0x00, + 0x8f, 0x5c, 0x56, 0x0b, 0xa5, 0x16, 0xa2, 0xc6, 0x33, 0xf0, 0x1a, 0x2e, 0xab, 0xac, 0x6d, 0xcc, + 0xc5, 0x67, 0xd3, 0xf3, 0xc4, 0xd0, 0x24, 0x87, 0x56, 0xd2, 0x8f, 0xd9, 0xbe, 0x88, 0x03, 0x70, + 0x96, 0xbc, 0xfd, 0x7d, 0xb0, 0x97, 0xf8, 0x02, 0x7c, 0x99, 0xd7, 0x25, 0x7f, 0xe1, 0x75, 0x41, + 0x1c, 0x03, 0xa2, 0x83, 0xb4, 0x2e, 0xa2, 0x4b, 0x70, 0xf5, 0x31, 0x0f, 0x5c, 0x96, 0xde, 0xdc, + 0x05, 0x16, 0xf6, 0x61, 0xf0, 0xcc, 0xee, 0xb3, 0x34, 0x40, 0x78, 0x04, 0x7e, 0x1f, 0x1a, 0x6b, + 0x47, 0x19, 0xb8, 0x4c, 0xac, 0xf8, 0xd1, 0xcf, 0x5e, 0xc3, 0x68, 0xc9, 0xdb, 0x03, 0x16, 0xb1, + 0x43, 0x27, 0x3e, 0x99, 0xe2, 0xff, 0xc0, 0xec, 0x6f, 0xf1, 0x96, 0x6c, 0x76, 0xd4, 0xda, 0xee, + 0xa8, 0xb5, 0xe9, 0x28, 0xda, 0x76, 0x14, 0x7d, 0x75, 0x14, 0x7d, 0x7c, 0x53, 0x6b, 0x3e, 0xd4, + 0x3b, 0x9e, 0xfd, 0x04, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x76, 0x8d, 0x4f, 0x8f, 0x01, 0x00, 0x00, +} + func (m *User) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -113,44 +222,49 @@ func (m *User) Marshal() (dAtA []byte, err error) { } func (m *User) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *User) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintAuth(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if len(m.Password) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintAuth(dAtA, i, uint64(len(m.Password))) - i += copy(dAtA[i:], m.Password) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Roles) > 0 { - for _, s := range m.Roles { + for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Roles[iNdEx]) + copy(dAtA[i:], m.Roles[iNdEx]) + i = encodeVarintAuth(dAtA, i, uint64(len(m.Roles[iNdEx]))) + i-- dAtA[i] = 0x1a - 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 + if len(m.Password) > 0 { + i -= len(m.Password) + copy(dAtA[i:], m.Password) + i = encodeVarintAuth(dAtA, i, uint64(len(m.Password))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintAuth(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Permission) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -158,34 +272,45 @@ func (m *Permission) Marshal() (dAtA []byte, err error) { } func (m *Permission) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Permission) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.PermType != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintAuth(dAtA, i, uint64(m.PermType)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.RangeEnd) > 0 { + i -= len(m.RangeEnd) + copy(dAtA[i:], m.RangeEnd) + i = encodeVarintAuth(dAtA, i, uint64(len(m.RangeEnd))) + i-- + dAtA[i] = 0x1a } if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Key) + copy(dAtA[i:], m.Key) i = encodeVarintAuth(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + i-- + dAtA[i] = 0x12 } - if len(m.RangeEnd) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintAuth(dAtA, i, uint64(len(m.RangeEnd))) - i += copy(dAtA[i:], m.RangeEnd) + if m.PermType != 0 { + i = encodeVarintAuth(dAtA, i, uint64(m.PermType)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Role) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -193,41 +318,58 @@ func (m *Role) Marshal() (dAtA []byte, err error) { } func (m *Role) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Role) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintAuth(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.KeyPermission) > 0 { - for _, msg := range m.KeyPermission { - dAtA[i] = 0x12 - i++ - i = encodeVarintAuth(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.KeyPermission) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.KeyPermission[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAuth(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - return i, nil + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintAuth(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func encodeVarintAuth(dAtA []byte, offset int, v uint64) int { + offset -= sovAuth(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *User) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -244,10 +386,16 @@ func (m *User) Size() (n int) { n += 1 + l + sovAuth(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *Permission) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.PermType != 0 { @@ -261,10 +409,16 @@ func (m *Permission) Size() (n int) { if l > 0 { n += 1 + l + sovAuth(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *Role) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -277,18 +431,14 @@ func (m *Role) Size() (n int) { n += 1 + l + sovAuth(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func sovAuth(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozAuth(x uint64) (n int) { return sovAuth(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -308,7 +458,7 @@ func (m *User) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -336,7 +486,7 @@ func (m *User) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -345,6 +495,9 @@ func (m *User) Unmarshal(dAtA []byte) error { return ErrInvalidLengthAuth } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAuth + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -367,7 +520,7 @@ func (m *User) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -376,6 +529,9 @@ func (m *User) Unmarshal(dAtA []byte) error { return ErrInvalidLengthAuth } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAuth + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -398,7 +554,7 @@ func (m *User) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -408,6 +564,9 @@ func (m *User) Unmarshal(dAtA []byte) error { return ErrInvalidLengthAuth } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuth + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -422,9 +581,13 @@ func (m *User) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthAuth } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthAuth + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -449,7 +612,7 @@ func (m *Permission) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -477,7 +640,7 @@ func (m *Permission) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.PermType |= (Permission_Type(b) & 0x7F) << shift + m.PermType |= Permission_Type(b&0x7F) << shift if b < 0x80 { break } @@ -496,7 +659,7 @@ func (m *Permission) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -505,6 +668,9 @@ func (m *Permission) Unmarshal(dAtA []byte) error { return ErrInvalidLengthAuth } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAuth + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -527,7 +693,7 @@ func (m *Permission) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -536,6 +702,9 @@ func (m *Permission) Unmarshal(dAtA []byte) error { return ErrInvalidLengthAuth } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAuth + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -553,9 +722,13 @@ func (m *Permission) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthAuth } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthAuth + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -580,7 +753,7 @@ func (m *Role) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -608,7 +781,7 @@ func (m *Role) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -617,6 +790,9 @@ func (m *Role) Unmarshal(dAtA []byte) error { return ErrInvalidLengthAuth } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAuth + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -639,7 +815,7 @@ func (m *Role) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -648,6 +824,9 @@ func (m *Role) Unmarshal(dAtA []byte) error { return ErrInvalidLengthAuth } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAuth + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -665,9 +844,13 @@ func (m *Role) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthAuth } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthAuth + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -731,10 +914,13 @@ func skipAuth(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthAuth } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthAuth + } return iNdEx, nil case 3: for { @@ -763,6 +949,9 @@ func skipAuth(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthAuth + } } return iNdEx, nil case 4: @@ -781,27 +970,3 @@ var ( ErrInvalidLengthAuth = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowAuth = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("auth.proto", fileDescriptorAuth) } - -var fileDescriptorAuth = []byte{ - // 288 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4a, 0xc3, 0x30, - 0x1c, 0xc6, 0x9b, 0xb6, 0x1b, 0xed, 0x5f, 0x27, 0x25, 0x0c, 0x0c, 0x13, 0x42, 0xe9, 0xa9, 0x78, - 0xa8, 0xb0, 0x5d, 0xbc, 0x2a, 0xf6, 0x20, 0x78, 0x90, 0x50, 0xf1, 0x28, 0x1d, 0x0d, 0x75, 0x6c, - 0x6d, 0x4a, 0x32, 0x91, 0xbe, 0x89, 0x07, 0x1f, 0x68, 0xc7, 0x3d, 0x82, 0xab, 0x2f, 0x22, 0x4d, - 0x64, 0x43, 0xdc, 0xed, 0xfb, 0xbe, 0xff, 0x97, 0xe4, 0x97, 0x3f, 0x40, 0xfe, 0xb6, 0x7e, 0x4d, - 0x1a, 0x29, 0xd6, 0x02, 0x0f, 0x7b, 0xdd, 0xcc, 0x27, 0xe3, 0x52, 0x94, 0x42, 0x47, 0x57, 0xbd, - 0x32, 0xd3, 0xe8, 0x01, 0xdc, 0x27, 0xc5, 0x25, 0xc6, 0xe0, 0xd6, 0x79, 0xc5, 0x09, 0x0a, 0x51, - 0x7c, 0xca, 0xb4, 0xc6, 0x13, 0xf0, 0x9a, 0x5c, 0xa9, 0x77, 0x21, 0x0b, 0x62, 0xeb, 0x7c, 0xef, - 0xf1, 0x18, 0x06, 0x52, 0xac, 0xb8, 0x22, 0x4e, 0xe8, 0xc4, 0x3e, 0x33, 0x26, 0xfa, 0x44, 0x00, - 0x8f, 0x5c, 0x56, 0x0b, 0xa5, 0x16, 0xa2, 0xc6, 0x33, 0xf0, 0x1a, 0x2e, 0xab, 0xac, 0x6d, 0xcc, - 0xc5, 0x67, 0xd3, 0xf3, 0xc4, 0xd0, 0x24, 0x87, 0x56, 0xd2, 0x8f, 0xd9, 0xbe, 0x88, 0x03, 0x70, - 0x96, 0xbc, 0xfd, 0x7d, 0xb0, 0x97, 0xf8, 0x02, 0x7c, 0x99, 0xd7, 0x25, 0x7f, 0xe1, 0x75, 0x41, - 0x1c, 0x03, 0xa2, 0x83, 0xb4, 0x2e, 0xa2, 0x4b, 0x70, 0xf5, 0x31, 0x0f, 0x5c, 0x96, 0xde, 0xdc, - 0x05, 0x16, 0xf6, 0x61, 0xf0, 0xcc, 0xee, 0xb3, 0x34, 0x40, 0x78, 0x04, 0x7e, 0x1f, 0x1a, 0x6b, - 0x47, 0x19, 0xb8, 0x4c, 0xac, 0xf8, 0xd1, 0xcf, 0x5e, 0xc3, 0x68, 0xc9, 0xdb, 0x03, 0x16, 0xb1, - 0x43, 0x27, 0x3e, 0x99, 0xe2, 0xff, 0xc0, 0xec, 0x6f, 0xf1, 0x96, 0x6c, 0x76, 0xd4, 0xda, 0xee, - 0xa8, 0xb5, 0xe9, 0x28, 0xda, 0x76, 0x14, 0x7d, 0x75, 0x14, 0x7d, 0x7c, 0x53, 0x6b, 0x3e, 0xd4, - 0x3b, 0x9e, 0xfd, 0x04, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x76, 0x8d, 0x4f, 0x8f, 0x01, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/etcd/auth/range_perm_cache.go b/vendor/github.com/coreos/etcd/auth/range_perm_cache.go index 691b65ba3..7d47d2610 100644 --- a/vendor/github.com/coreos/etcd/auth/range_perm_cache.go +++ b/vendor/github.com/coreos/etcd/auth/range_perm_cache.go @@ -27,8 +27,8 @@ func getMergedPerms(tx backend.BatchTx, userName string) *unifiedRangePermission return nil } - readPerms := &adt.IntervalTree{} - writePerms := &adt.IntervalTree{} + readPerms := adt.NewIntervalTree() + writePerms := adt.NewIntervalTree() for _, roleName := range user.Roles { role := getRole(tx, roleName) @@ -128,6 +128,6 @@ func (as *authStore) invalidateCachedPerm(userName string) { } type unifiedRangePermissions struct { - readPerms *adt.IntervalTree - writePerms *adt.IntervalTree + readPerms adt.IntervalTree + writePerms adt.IntervalTree } diff --git a/vendor/github.com/coreos/etcd/auth/range_perm_cache_test.go b/vendor/github.com/coreos/etcd/auth/range_perm_cache_test.go index fd8df6a9e..fa6322248 100644 --- a/vendor/github.com/coreos/etcd/auth/range_perm_cache_test.go +++ b/vendor/github.com/coreos/etcd/auth/range_perm_cache_test.go @@ -46,7 +46,7 @@ func TestRangePermission(t *testing.T) { } for i, tt := range tests { - readPerms := &adt.IntervalTree{} + readPerms := adt.NewIntervalTree() for _, p := range tt.perms { readPerms.Insert(p, struct{}{}) } diff --git a/vendor/github.com/coreos/etcd/auth/store.go b/vendor/github.com/coreos/etcd/auth/store.go index c2455a903..d676cb555 100644 --- a/vendor/github.com/coreos/etcd/auth/store.go +++ b/vendor/github.com/coreos/etcd/auth/store.go @@ -982,10 +982,23 @@ func (as *authStore) AuthInfoFromTLS(ctx context.Context) *AuthInfo { cn := chain.Subject.CommonName plog.Debugf("found common name %s", cn) - return &AuthInfo{ + ai := &AuthInfo{ Username: cn, Revision: as.Revision(), } + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return nil + } + + // gRPC-gateway proxy request to etcd server includes Grpcgateway-Accept + // header. The proxy uses etcd client server certificate. If the certificate + // has a CommonName we should never use this for authentication. + if gw := md["grpcgateway-accept"]; len(gw) > 0 { + plog.Warningf("ignoring common name in gRPC-gateway proxy request %s", ai.Username) + return nil + } + return ai } } diff --git a/vendor/github.com/coreos/etcd/auth/store_test.go b/vendor/github.com/coreos/etcd/auth/store_test.go index 02c8539d3..155b2f07f 100644 --- a/vendor/github.com/coreos/etcd/auth/store_test.go +++ b/vendor/github.com/coreos/etcd/auth/store_test.go @@ -672,25 +672,25 @@ func TestRolesOrder(t *testing.T) { } username := "user" - _, err = as.UserAdd(&pb.AuthUserAddRequest{username, "pass"}) + _, err = as.UserAdd(&pb.AuthUserAddRequest{Name: username, Password: "pass"}) if err != nil { t.Fatal(err) } roles := []string{"role1", "role2", "abc", "xyz", "role3"} for _, role := range roles { - _, err = as.RoleAdd(&pb.AuthRoleAddRequest{role}) + _, err = as.RoleAdd(&pb.AuthRoleAddRequest{Name: role}) if err != nil { t.Fatal(err) } - _, err = as.UserGrantRole(&pb.AuthUserGrantRoleRequest{username, role}) + _, err = as.UserGrantRole(&pb.AuthUserGrantRoleRequest{User: username, Role: role}) if err != nil { t.Fatal(err) } } - user, err := as.UserGet(&pb.AuthUserGetRequest{username}) + user, err := as.UserGet(&pb.AuthUserGetRequest{Name: username}) if err != nil { t.Fatal(err) } diff --git a/vendor/github.com/coreos/etcd/bill-of-materials.json b/vendor/github.com/coreos/etcd/bill-of-materials.json index 98e282262..3673a5b4c 100644 --- a/vendor/github.com/coreos/etcd/bill-of-materials.json +++ b/vendor/github.com/coreos/etcd/bill-of-materials.json @@ -98,15 +98,6 @@ } ] }, - { - "project": "github.com/ghodss/yaml", - "licenses": [ - { - "type": "MIT License and BSD 3-clause \"New\" or \"Revised\" License", - "confidence": 1 - } - ] - }, { "project": "github.com/gogo/protobuf", "licenses": [ @@ -192,6 +183,15 @@ } ] }, + { + "project": "github.com/json-iterator/go", + "licenses": [ + { + "type": "MIT License", + "confidence": 1 + } + ] + }, { "project": "github.com/mattn/go-runewidth", "licenses": [ @@ -210,6 +210,24 @@ } ] }, + { + "project": "github.com/modern-go/concurrent", + "licenses": [ + { + "type": "Apache License 2.0", + "confidence": 1 + } + ] + }, + { + "project": "github.com/modern-go/reflect2", + "licenses": [ + { + "type": "Apache License 2.0", + "confidence": 1 + } + ] + }, { "project": "github.com/olekukonko/tablewriter", "licenses": [ @@ -309,15 +327,6 @@ } ] }, - { - "project": "github.com/ugorji/go/codec", - "licenses": [ - { - "type": "MIT License", - "confidence": 0.9946524064171123 - } - ] - }, { "project": "github.com/urfave/cli", "licenses": [ @@ -447,5 +456,14 @@ "confidence": 0.8975609756097561 } ] + }, + { + "project": "sigs.k8s.io/yaml", + "licenses": [ + { + "type": "BSD 3-clause \"New\" or \"Revised\" License", + "confidence": 1 + } + ] } ] diff --git a/vendor/github.com/coreos/etcd/bill-of-materials.override.json b/vendor/github.com/coreos/etcd/bill-of-materials.override.json index 34de90e71..5224974a5 100644 --- a/vendor/github.com/coreos/etcd/bill-of-materials.override.json +++ b/vendor/github.com/coreos/etcd/bill-of-materials.override.json @@ -8,10 +8,10 @@ ] }, { - "project": "github.com/ghodss/yaml", + "project": "sigs.k8s.io/yaml", "licenses": [ { - "type": "MIT License and BSD 3-clause \"New\" or \"Revised\" License" + "type": "BSD 3-clause \"New\" or \"Revised\" License" } ] }, diff --git a/vendor/github.com/coreos/etcd/build b/vendor/github.com/coreos/etcd/build index b233d3272..5cf4d7c64 100755 --- a/vendor/github.com/coreos/etcd/build +++ b/vendor/github.com/coreos/etcd/build @@ -1,66 +1,94 @@ -#!/bin/sh -e +#!/usr/bin/env bash # set some environment variables ORG_PATH="github.com/coreos" REPO_PATH="${ORG_PATH}/etcd" GIT_SHA=$(git rev-parse --short HEAD || echo "GitNotFound") -if [ ! -z "$FAILPOINTS" ]; then +if [[ -n "$FAILPOINTS" ]]; then GIT_SHA="$GIT_SHA"-FAILPOINTS fi # Set GO_LDFLAGS="-s" for building without symbols for debugging. -GO_LDFLAGS="$GO_LDFLAGS -X ${REPO_PATH}/cmd/vendor/${REPO_PATH}/version.GitSHA=${GIT_SHA}" +GO_LDFLAGS="$GO_LDFLAGS -X ${REPO_PATH}/version.GitSHA=${GIT_SHA}" # enable/disable failpoints toggle_failpoints() { mode="$1" - if which gofail >/dev/null 2>&1; then + if command -v gofail >/dev/null 2>&1; then gofail "$mode" etcdserver/ mvcc/backend/ - elif [ "$mode" != "disable" ]; then + elif [[ "$mode" != "disable" ]]; then echo "FAILPOINTS set but gofail not found" exit 1 fi } +etcd_setup_gopath() { + echo "Setting GOPATH from vendor directory at 'gopath'" + d=$(dirname "$0") + CDIR=$(cd "$d" || return && pwd) + cd "$CDIR" || return + etcdGOPATH="${CDIR}/gopath" + # preserve old gopath to support building with unvendored tooling deps (e.g., gofail) + if [[ -n "$GOPATH" ]]; then + GOPATH=":$GOPATH" + fi + rm -rf "${etcdGOPATH:?}/" + mkdir -p "${etcdGOPATH}/vendor" "${etcdGOPATH}/etcd_src/src/github.com/coreos" + export GOPATH=${etcdGOPATH}/vendor:${etcdGOPATH}/etcd_src${GOPATH} + ln -s "${CDIR}/vendor" "${etcdGOPATH}/vendor/src" + ln -s "${CDIR}" "${etcdGOPATH}/etcd_src/src/github.com/coreos/etcd" +} + toggle_failpoints_default() { mode="disable" - if [ ! -z "$FAILPOINTS" ]; then mode="enable"; fi + if [[ -n "$FAILPOINTS" ]]; then mode="enable"; fi toggle_failpoints "$mode" } etcd_build() { out="bin" - if [ -n "${BINDIR}" ]; then out="${BINDIR}"; fi + if [[ -n "${BINDIR}" ]]; then out="${BINDIR}"; fi toggle_failpoints_default - # Static compilation is useful when etcd is run in a container. $GO_BUILD_FLAGS is OK + # Static compilation is useful when etcd is run in a container. $GO_BUILD_FLAGS is OK # shellcheck disable=SC2086 - CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "$GO_LDFLAGS" -o "${out}/etcd" ${REPO_PATH}/cmd/etcd || return + CGO_ENABLED=0 go build $GO_BUILD_FLAGS \ + -installsuffix cgo \ + -ldflags "$GO_LDFLAGS" \ + -o "${out}/etcd" ${REPO_PATH} || return # shellcheck disable=SC2086 - CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "$GO_LDFLAGS" -o "${out}/etcdctl" ${REPO_PATH}/cmd/etcdctl || return + CGO_ENABLED=0 go build $GO_BUILD_FLAGS \ + -installsuffix cgo \ + -ldflags "$GO_LDFLAGS" \ + -o "${out}/etcdctl" ${REPO_PATH}/etcdctl || return } -etcd_setup_gopath() { - d=$(dirname "$0") - CDIR=$(cd "$d" && pwd) - cd "$CDIR" - etcdGOPATH="${CDIR}/gopath" - # preserve old gopath to support building with unvendored tooling deps (e.g., gofail) - if [ -n "$GOPATH" ]; then - GOPATH=":$GOPATH" - fi - export GOPATH=${etcdGOPATH}$GOPATH - rm -rf "${etcdGOPATH}/src" - mkdir -p "${etcdGOPATH}" - ln -s "${CDIR}/cmd/vendor" "${etcdGOPATH}/src" +tools_build() { + out="bin" + if [[ -n "${BINDIR}" ]]; then out="${BINDIR}"; fi + tools_path="functional/cmd/etcd-agent + functional/cmd/etcd-proxy + functional/cmd/etcd-runner + functional/cmd/etcd-tester" + for tool in ${tools_path} + do + echo "Building" "'${tool}'"... + # shellcheck disable=SC2086 + CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} \ + -installsuffix cgo \ + -ldflags "${GO_LDFLAGS}" \ + -o "${out}/${tool}" "${REPO_PATH}/${tool}" || return + done } toggle_failpoints_default +if [[ "${ETCD_SETUP_GOPATH}" == "1" ]]; then + etcd_setup_gopath +fi + # only build when called directly, not sourced if echo "$0" | grep "build$" >/dev/null; then - # force new gopath so builds outside of gopath work - etcd_setup_gopath etcd_build fi diff --git a/vendor/github.com/coreos/etcd/client/json.go b/vendor/github.com/coreos/etcd/client/json.go new file mode 100644 index 000000000..97cdbcd7c --- /dev/null +++ b/vendor/github.com/coreos/etcd/client/json.go @@ -0,0 +1,72 @@ +// Copyright 2019 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "github.com/json-iterator/go" + "github.com/modern-go/reflect2" + "strconv" + "unsafe" +) + +type customNumberExtension struct { + jsoniter.DummyExtension +} + +func (cne *customNumberExtension) CreateDecoder(typ reflect2.Type) jsoniter.ValDecoder { + if typ.String() == "interface {}" { + return customNumberDecoder{} + } + return nil +} + +type customNumberDecoder struct { +} + +func (customNumberDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator) { + switch iter.WhatIsNext() { + case jsoniter.NumberValue: + var number jsoniter.Number + iter.ReadVal(&number) + i64, err := strconv.ParseInt(string(number), 10, 64) + if err == nil { + *(*interface{})(ptr) = i64 + return + } + f64, err := strconv.ParseFloat(string(number), 64) + if err == nil { + *(*interface{})(ptr) = f64 + return + } + iter.ReportError("DecodeNumber", err.Error()) + default: + *(*interface{})(ptr) = iter.Read() + } +} + +// caseSensitiveJsonIterator returns a jsoniterator API that's configured to be +// case-sensitive when unmarshalling, and otherwise compatible with +// the encoding/json standard library. +func caseSensitiveJsonIterator() jsoniter.API { + config := jsoniter.Config{ + EscapeHTML: true, + SortMapKeys: true, + ValidateJsonRawMessage: true, + CaseSensitive: true, + }.Froze() + // Force jsoniter to decode number to interface{} via int64/float64, if possible. + config.RegisterExtension(&customNumberExtension{}) + return config +} diff --git a/vendor/github.com/coreos/etcd/client/keys.generated.go b/vendor/github.com/coreos/etcd/client/keys.generated.go deleted file mode 100644 index 237fdbe8f..000000000 --- a/vendor/github.com/coreos/etcd/client/keys.generated.go +++ /dev/null @@ -1,5218 +0,0 @@ -// ************************************************************ -// DO NOT EDIT. -// THIS FILE IS AUTO-GENERATED BY codecgen. -// ************************************************************ - -package client - -import ( - "errors" - "fmt" - "reflect" - "runtime" - time "time" - - codec1978 "github.com/ugorji/go/codec" -) - -const ( - // ----- content types ---- - codecSelferC_UTF87612 = 1 - codecSelferC_RAW7612 = 0 - // ----- value types used ---- - codecSelferValueTypeArray7612 = 10 - codecSelferValueTypeMap7612 = 9 - // ----- containerStateValues ---- - codecSelfer_containerMapKey7612 = 2 - codecSelfer_containerMapValue7612 = 3 - codecSelfer_containerMapEnd7612 = 4 - codecSelfer_containerArrayElem7612 = 6 - codecSelfer_containerArrayEnd7612 = 7 -) - -var ( - codecSelferBitsize7612 = uint8(reflect.TypeOf(uint(0)).Bits()) - codecSelferOnlyMapOrArrayEncodeToStructErr7612 = errors.New(`only encoded map or array can be decoded into a struct`) -) - -type codecSelfer7612 struct{} - -func init() { - if codec1978.GenVersion != 8 { - _, file, _, _ := runtime.Caller(0) - err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", - 8, codec1978.GenVersion, file) - panic(err) - } - if false { // reference the types, but skip this branch at build/run time - var v0 time.Duration - _ = v0 - } -} - -func (x *Error) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(4) - } else { - r.WriteMapStart(4) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeInt(int64(x.Code)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("errorCode")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeInt(int64(x.Code)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Message)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("message")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Message)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Cause)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("cause")) - r.WriteMapElemValue() - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Cause)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym13 := z.EncBinary() - _ = yym13 - if false { - } else { - r.EncodeUint(uint64(x.Index)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("index")) - r.WriteMapElemValue() - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeUint(uint64(x.Index)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *Error) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *Error) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "errorCode": - if r.TryDecodeAsNil() { - x.Code = 0 - } else { - yyv4 := &x.Code - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*int)(yyv4)) = int(r.DecodeInt(codecSelferBitsize7612)) - } - } - case "message": - if r.TryDecodeAsNil() { - x.Message = "" - } else { - yyv6 := &x.Message - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(yyv6)) = r.DecodeString() - } - } - case "cause": - if r.TryDecodeAsNil() { - x.Cause = "" - } else { - yyv8 := &x.Cause - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*string)(yyv8)) = r.DecodeString() - } - } - case "index": - if r.TryDecodeAsNil() { - x.Index = 0 - } else { - yyv10 := &x.Index - yym11 := z.DecBinary() - _ = yym11 - if false { - } else { - *((*uint64)(yyv10)) = uint64(r.DecodeUint(64)) - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *Error) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj12 int - var yyb12 bool - var yyhl12 bool = l >= 0 - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Code = 0 - } else { - yyv13 := &x.Code - yym14 := z.DecBinary() - _ = yym14 - if false { - } else { - *((*int)(yyv13)) = int(r.DecodeInt(codecSelferBitsize7612)) - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Message = "" - } else { - yyv15 := &x.Message - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - *((*string)(yyv15)) = r.DecodeString() - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Cause = "" - } else { - yyv17 := &x.Cause - yym18 := z.DecBinary() - _ = yym18 - if false { - } else { - *((*string)(yyv17)) = r.DecodeString() - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Index = 0 - } else { - yyv19 := &x.Index - yym20 := z.DecBinary() - _ = yym20 - if false { - } else { - *((*uint64)(yyv19)) = uint64(r.DecodeUint(64)) - } - } - for { - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj12-1, "") - } - r.ReadArrayEnd() -} - -func (x PrevExistType) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x)) - } -} - -func (x *PrevExistType) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - *((*string)(x)) = r.DecodeString() - } -} - -func (x *WatcherOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(2) - } else { - r.WriteMapStart(2) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeUint(uint64(x.AfterIndex)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("AfterIndex")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeUint(uint64(x.AfterIndex)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Recursive")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *WatcherOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *WatcherOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "AfterIndex": - if r.TryDecodeAsNil() { - x.AfterIndex = 0 - } else { - yyv4 := &x.AfterIndex - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*uint64)(yyv4)) = uint64(r.DecodeUint(64)) - } - } - case "Recursive": - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv6 := &x.Recursive - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*bool)(yyv6)) = r.DecodeBool() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *WatcherOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj8 int - var yyb8 bool - var yyhl8 bool = l >= 0 - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.AfterIndex = 0 - } else { - yyv9 := &x.AfterIndex - yym10 := z.DecBinary() - _ = yym10 - if false { - } else { - *((*uint64)(yyv9)) = uint64(r.DecodeUint(64)) - } - } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv11 := &x.Recursive - yym12 := z.DecBinary() - _ = yym12 - if false { - } else { - *((*bool)(yyv11)) = r.DecodeBool() - } - } - for { - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj8-1, "") - } - r.ReadArrayEnd() -} - -func (x *CreateInOrderOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(1) - } else { - r.WriteMapStart(1) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else if z.HasExtensions() && z.EncExt(x.TTL) { - } else { - r.EncodeInt(int64(x.TTL)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("TTL")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else if z.HasExtensions() && z.EncExt(x.TTL) { - } else { - r.EncodeInt(int64(x.TTL)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *CreateInOrderOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *CreateInOrderOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "TTL": - if r.TryDecodeAsNil() { - x.TTL = 0 - } else { - yyv4 := &x.TTL - yym5 := z.DecBinary() - _ = yym5 - if false { - } else if z.HasExtensions() && z.DecExt(yyv4) { - } else { - *((*int64)(yyv4)) = int64(r.DecodeInt(64)) - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *CreateInOrderOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj6 int - var yyb6 bool - var yyhl6 bool = l >= 0 - yyj6++ - if yyhl6 { - yyb6 = yyj6 > l - } else { - yyb6 = r.CheckBreak() - } - if yyb6 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.TTL = 0 - } else { - yyv7 := &x.TTL - yym8 := z.DecBinary() - _ = yym8 - if false { - } else if z.HasExtensions() && z.DecExt(yyv7) { - } else { - *((*int64)(yyv7)) = int64(r.DecodeInt(64)) - } - } - for { - yyj6++ - if yyhl6 { - yyb6 = yyj6 > l - } else { - yyb6 = r.CheckBreak() - } - if yyb6 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj6-1, "") - } - r.ReadArrayEnd() -} - -func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(7) - } else { - r.WriteMapStart(7) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("PrevValue")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeUint(uint64(x.PrevIndex)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("PrevIndex")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeUint(uint64(x.PrevIndex)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - x.PrevExist.CodecEncodeSelf(e) - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("PrevExist")) - r.WriteMapElemValue() - x.PrevExist.CodecEncodeSelf(e) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym13 := z.EncBinary() - _ = yym13 - if false { - } else if z.HasExtensions() && z.EncExt(x.TTL) { - } else { - r.EncodeInt(int64(x.TTL)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("TTL")) - r.WriteMapElemValue() - yym14 := z.EncBinary() - _ = yym14 - if false { - } else if z.HasExtensions() && z.EncExt(x.TTL) { - } else { - r.EncodeInt(int64(x.TTL)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym16 := z.EncBinary() - _ = yym16 - if false { - } else { - r.EncodeBool(bool(x.Refresh)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Refresh")) - r.WriteMapElemValue() - yym17 := z.EncBinary() - _ = yym17 - if false { - } else { - r.EncodeBool(bool(x.Refresh)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym19 := z.EncBinary() - _ = yym19 - if false { - } else { - r.EncodeBool(bool(x.Dir)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Dir")) - r.WriteMapElemValue() - yym20 := z.EncBinary() - _ = yym20 - if false { - } else { - r.EncodeBool(bool(x.Dir)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym22 := z.EncBinary() - _ = yym22 - if false { - } else { - r.EncodeBool(bool(x.NoValueOnSuccess)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("NoValueOnSuccess")) - r.WriteMapElemValue() - yym23 := z.EncBinary() - _ = yym23 - if false { - } else { - r.EncodeBool(bool(x.NoValueOnSuccess)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *SetOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *SetOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "PrevValue": - if r.TryDecodeAsNil() { - x.PrevValue = "" - } else { - yyv4 := &x.PrevValue - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyv4)) = r.DecodeString() - } - } - case "PrevIndex": - if r.TryDecodeAsNil() { - x.PrevIndex = 0 - } else { - yyv6 := &x.PrevIndex - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*uint64)(yyv6)) = uint64(r.DecodeUint(64)) - } - } - case "PrevExist": - if r.TryDecodeAsNil() { - x.PrevExist = "" - } else { - yyv8 := &x.PrevExist - yyv8.CodecDecodeSelf(d) - } - case "TTL": - if r.TryDecodeAsNil() { - x.TTL = 0 - } else { - yyv9 := &x.TTL - yym10 := z.DecBinary() - _ = yym10 - if false { - } else if z.HasExtensions() && z.DecExt(yyv9) { - } else { - *((*int64)(yyv9)) = int64(r.DecodeInt(64)) - } - } - case "Refresh": - if r.TryDecodeAsNil() { - x.Refresh = false - } else { - yyv11 := &x.Refresh - yym12 := z.DecBinary() - _ = yym12 - if false { - } else { - *((*bool)(yyv11)) = r.DecodeBool() - } - } - case "Dir": - if r.TryDecodeAsNil() { - x.Dir = false - } else { - yyv13 := &x.Dir - yym14 := z.DecBinary() - _ = yym14 - if false { - } else { - *((*bool)(yyv13)) = r.DecodeBool() - } - } - case "NoValueOnSuccess": - if r.TryDecodeAsNil() { - x.NoValueOnSuccess = false - } else { - yyv15 := &x.NoValueOnSuccess - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - *((*bool)(yyv15)) = r.DecodeBool() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *SetOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj17 int - var yyb17 bool - var yyhl17 bool = l >= 0 - yyj17++ - if yyhl17 { - yyb17 = yyj17 > l - } else { - yyb17 = r.CheckBreak() - } - if yyb17 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.PrevValue = "" - } else { - yyv18 := &x.PrevValue - yym19 := z.DecBinary() - _ = yym19 - if false { - } else { - *((*string)(yyv18)) = r.DecodeString() - } - } - yyj17++ - if yyhl17 { - yyb17 = yyj17 > l - } else { - yyb17 = r.CheckBreak() - } - if yyb17 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.PrevIndex = 0 - } else { - yyv20 := &x.PrevIndex - yym21 := z.DecBinary() - _ = yym21 - if false { - } else { - *((*uint64)(yyv20)) = uint64(r.DecodeUint(64)) - } - } - yyj17++ - if yyhl17 { - yyb17 = yyj17 > l - } else { - yyb17 = r.CheckBreak() - } - if yyb17 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.PrevExist = "" - } else { - yyv22 := &x.PrevExist - yyv22.CodecDecodeSelf(d) - } - yyj17++ - if yyhl17 { - yyb17 = yyj17 > l - } else { - yyb17 = r.CheckBreak() - } - if yyb17 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.TTL = 0 - } else { - yyv23 := &x.TTL - yym24 := z.DecBinary() - _ = yym24 - if false { - } else if z.HasExtensions() && z.DecExt(yyv23) { - } else { - *((*int64)(yyv23)) = int64(r.DecodeInt(64)) - } - } - yyj17++ - if yyhl17 { - yyb17 = yyj17 > l - } else { - yyb17 = r.CheckBreak() - } - if yyb17 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Refresh = false - } else { - yyv25 := &x.Refresh - yym26 := z.DecBinary() - _ = yym26 - if false { - } else { - *((*bool)(yyv25)) = r.DecodeBool() - } - } - yyj17++ - if yyhl17 { - yyb17 = yyj17 > l - } else { - yyb17 = r.CheckBreak() - } - if yyb17 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Dir = false - } else { - yyv27 := &x.Dir - yym28 := z.DecBinary() - _ = yym28 - if false { - } else { - *((*bool)(yyv27)) = r.DecodeBool() - } - } - yyj17++ - if yyhl17 { - yyb17 = yyj17 > l - } else { - yyb17 = r.CheckBreak() - } - if yyb17 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.NoValueOnSuccess = false - } else { - yyv29 := &x.NoValueOnSuccess - yym30 := z.DecBinary() - _ = yym30 - if false { - } else { - *((*bool)(yyv29)) = r.DecodeBool() - } - } - for { - yyj17++ - if yyhl17 { - yyb17 = yyj17 > l - } else { - yyb17 = r.CheckBreak() - } - if yyb17 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj17-1, "") - } - r.ReadArrayEnd() -} - -func (x *GetOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(3) - } else { - r.WriteMapStart(3) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Recursive")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeBool(bool(x.Sort)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Sort")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeBool(bool(x.Sort)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeBool(bool(x.Quorum)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Quorum")) - r.WriteMapElemValue() - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeBool(bool(x.Quorum)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *GetOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *GetOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "Recursive": - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv4 := &x.Recursive - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*bool)(yyv4)) = r.DecodeBool() - } - } - case "Sort": - if r.TryDecodeAsNil() { - x.Sort = false - } else { - yyv6 := &x.Sort - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*bool)(yyv6)) = r.DecodeBool() - } - } - case "Quorum": - if r.TryDecodeAsNil() { - x.Quorum = false - } else { - yyv8 := &x.Quorum - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*bool)(yyv8)) = r.DecodeBool() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *GetOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj10 int - var yyb10 bool - var yyhl10 bool = l >= 0 - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv11 := &x.Recursive - yym12 := z.DecBinary() - _ = yym12 - if false { - } else { - *((*bool)(yyv11)) = r.DecodeBool() - } - } - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Sort = false - } else { - yyv13 := &x.Sort - yym14 := z.DecBinary() - _ = yym14 - if false { - } else { - *((*bool)(yyv13)) = r.DecodeBool() - } - } - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Quorum = false - } else { - yyv15 := &x.Quorum - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - *((*bool)(yyv15)) = r.DecodeBool() - } - } - for { - yyj10++ - if yyhl10 { - yyb10 = yyj10 > l - } else { - yyb10 = r.CheckBreak() - } - if yyb10 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj10-1, "") - } - r.ReadArrayEnd() -} - -func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(4) - } else { - r.WriteMapStart(4) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("PrevValue")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeUint(uint64(x.PrevIndex)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("PrevIndex")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeUint(uint64(x.PrevIndex)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Recursive")) - r.WriteMapElemValue() - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym13 := z.EncBinary() - _ = yym13 - if false { - } else { - r.EncodeBool(bool(x.Dir)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Dir")) - r.WriteMapElemValue() - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeBool(bool(x.Dir)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *DeleteOptions) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "PrevValue": - if r.TryDecodeAsNil() { - x.PrevValue = "" - } else { - yyv4 := &x.PrevValue - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyv4)) = r.DecodeString() - } - } - case "PrevIndex": - if r.TryDecodeAsNil() { - x.PrevIndex = 0 - } else { - yyv6 := &x.PrevIndex - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*uint64)(yyv6)) = uint64(r.DecodeUint(64)) - } - } - case "Recursive": - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv8 := &x.Recursive - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*bool)(yyv8)) = r.DecodeBool() - } - } - case "Dir": - if r.TryDecodeAsNil() { - x.Dir = false - } else { - yyv10 := &x.Dir - yym11 := z.DecBinary() - _ = yym11 - if false { - } else { - *((*bool)(yyv10)) = r.DecodeBool() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj12 int - var yyb12 bool - var yyhl12 bool = l >= 0 - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.PrevValue = "" - } else { - yyv13 := &x.PrevValue - yym14 := z.DecBinary() - _ = yym14 - if false { - } else { - *((*string)(yyv13)) = r.DecodeString() - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.PrevIndex = 0 - } else { - yyv15 := &x.PrevIndex - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - *((*uint64)(yyv15)) = uint64(r.DecodeUint(64)) - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv17 := &x.Recursive - yym18 := z.DecBinary() - _ = yym18 - if false { - } else { - *((*bool)(yyv17)) = r.DecodeBool() - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Dir = false - } else { - yyv19 := &x.Dir - yym20 := z.DecBinary() - _ = yym20 - if false { - } else { - *((*bool)(yyv19)) = r.DecodeBool() - } - } - for { - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj12-1, "") - } - r.ReadArrayEnd() -} - -func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(3) - } else { - r.WriteMapStart(3) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Action)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("action")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Action)) - } - } - var yyn6 bool - if x.Node == nil { - yyn6 = true - goto LABEL6 - } - LABEL6: - if yyr2 || yy2arr2 { - if yyn6 { - r.WriteArrayElem() - r.EncodeNil() - } else { - r.WriteArrayElem() - if x.Node == nil { - r.EncodeNil() - } else { - x.Node.CodecEncodeSelf(e) - } - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("node")) - r.WriteMapElemValue() - if yyn6 { - r.EncodeNil() - } else { - if x.Node == nil { - r.EncodeNil() - } else { - x.Node.CodecEncodeSelf(e) - } - } - } - var yyn9 bool - if x.PrevNode == nil { - yyn9 = true - goto LABEL9 - } - LABEL9: - if yyr2 || yy2arr2 { - if yyn9 { - r.WriteArrayElem() - r.EncodeNil() - } else { - r.WriteArrayElem() - if x.PrevNode == nil { - r.EncodeNil() - } else { - x.PrevNode.CodecEncodeSelf(e) - } - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("prevNode")) - r.WriteMapElemValue() - if yyn9 { - r.EncodeNil() - } else { - if x.PrevNode == nil { - r.EncodeNil() - } else { - x.PrevNode.CodecEncodeSelf(e) - } - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "action": - if r.TryDecodeAsNil() { - x.Action = "" - } else { - yyv4 := &x.Action - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyv4)) = r.DecodeString() - } - } - case "node": - if x.Node == nil { - x.Node = new(Node) - } - if r.TryDecodeAsNil() { - if x.Node != nil { - x.Node = nil - } - } else { - if x.Node == nil { - x.Node = new(Node) - } - x.Node.CodecDecodeSelf(d) - } - case "prevNode": - if x.PrevNode == nil { - x.PrevNode = new(Node) - } - if r.TryDecodeAsNil() { - if x.PrevNode != nil { - x.PrevNode = nil - } - } else { - if x.PrevNode == nil { - x.PrevNode = new(Node) - } - x.PrevNode.CodecDecodeSelf(d) - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj8 int - var yyb8 bool - var yyhl8 bool = l >= 0 - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Action = "" - } else { - yyv9 := &x.Action - yym10 := z.DecBinary() - _ = yym10 - if false { - } else { - *((*string)(yyv9)) = r.DecodeString() - } - } - if x.Node == nil { - x.Node = new(Node) - } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - if x.Node != nil { - x.Node = nil - } - } else { - if x.Node == nil { - x.Node = new(Node) - } - x.Node.CodecDecodeSelf(d) - } - if x.PrevNode == nil { - x.PrevNode = new(Node) - } - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - if x.PrevNode != nil { - x.PrevNode = nil - } - } else { - if x.PrevNode == nil { - x.PrevNode = new(Node) - } - x.PrevNode.CodecDecodeSelf(d) - } - for { - yyj8++ - if yyhl8 { - yyb8 = yyj8 > l - } else { - yyb8 = r.CheckBreak() - } - if yyb8 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj8-1, "") - } - r.ReadArrayEnd() -} - -func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [8]bool - _ = yyq2 - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - yyq2[1] = x.Dir != false - yyq2[6] = x.Expiration != nil - yyq2[7] = x.TTL != 0 - if yyr2 || yy2arr2 { - r.WriteArrayStart(8) - } else { - var yynn2 = 5 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.WriteMapStart(yynn2) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Key)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("key")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Key)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - if yyq2[1] { - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeBool(bool(x.Dir)) - } - } else { - r.EncodeBool(false) - } - } else { - if yyq2[1] { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("dir")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeBool(bool(x.Dir)) - } - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Value)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("value")) - r.WriteMapElemValue() - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Value)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - if x.Nodes == nil { - r.EncodeNil() - } else { - x.Nodes.CodecEncodeSelf(e) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("nodes")) - r.WriteMapElemValue() - if x.Nodes == nil { - r.EncodeNil() - } else { - x.Nodes.CodecEncodeSelf(e) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym16 := z.EncBinary() - _ = yym16 - if false { - } else { - r.EncodeUint(uint64(x.CreatedIndex)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("createdIndex")) - r.WriteMapElemValue() - yym17 := z.EncBinary() - _ = yym17 - if false { - } else { - r.EncodeUint(uint64(x.CreatedIndex)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym19 := z.EncBinary() - _ = yym19 - if false { - } else { - r.EncodeUint(uint64(x.ModifiedIndex)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("modifiedIndex")) - r.WriteMapElemValue() - yym20 := z.EncBinary() - _ = yym20 - if false { - } else { - r.EncodeUint(uint64(x.ModifiedIndex)) - } - } - var yyn21 bool - if x.Expiration == nil { - yyn21 = true - goto LABEL21 - } - LABEL21: - if yyr2 || yy2arr2 { - if yyn21 { - r.WriteArrayElem() - r.EncodeNil() - } else { - r.WriteArrayElem() - if yyq2[6] { - if x.Expiration == nil { - r.EncodeNil() - } else { - yym22 := z.EncBinary() - _ = yym22 - if false { - } else if yym23 := z.TimeRtidIfBinc(); yym23 != 0 { - r.EncodeBuiltin(yym23, x.Expiration) - } else if z.HasExtensions() && z.EncExt(x.Expiration) { - } else if yym22 { - z.EncBinaryMarshal(x.Expiration) - } else if !yym22 && z.IsJSONHandle() { - z.EncJSONMarshal(x.Expiration) - } else { - z.EncFallback(x.Expiration) - } - } - } else { - r.EncodeNil() - } - } - } else { - if yyq2[6] { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("expiration")) - r.WriteMapElemValue() - if yyn21 { - r.EncodeNil() - } else { - if x.Expiration == nil { - r.EncodeNil() - } else { - yym24 := z.EncBinary() - _ = yym24 - if false { - } else if yym25 := z.TimeRtidIfBinc(); yym25 != 0 { - r.EncodeBuiltin(yym25, x.Expiration) - } else if z.HasExtensions() && z.EncExt(x.Expiration) { - } else if yym24 { - z.EncBinaryMarshal(x.Expiration) - } else if !yym24 && z.IsJSONHandle() { - z.EncJSONMarshal(x.Expiration) - } else { - z.EncFallback(x.Expiration) - } - } - } - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - if yyq2[7] { - yym27 := z.EncBinary() - _ = yym27 - if false { - } else { - r.EncodeInt(int64(x.TTL)) - } - } else { - r.EncodeInt(0) - } - } else { - if yyq2[7] { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("ttl")) - r.WriteMapElemValue() - yym28 := z.EncBinary() - _ = yym28 - if false { - } else { - r.EncodeInt(int64(x.TTL)) - } - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "key": - if r.TryDecodeAsNil() { - x.Key = "" - } else { - yyv4 := &x.Key - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyv4)) = r.DecodeString() - } - } - case "dir": - if r.TryDecodeAsNil() { - x.Dir = false - } else { - yyv6 := &x.Dir - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*bool)(yyv6)) = r.DecodeBool() - } - } - case "value": - if r.TryDecodeAsNil() { - x.Value = "" - } else { - yyv8 := &x.Value - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*string)(yyv8)) = r.DecodeString() - } - } - case "nodes": - if r.TryDecodeAsNil() { - x.Nodes = nil - } else { - yyv10 := &x.Nodes - yyv10.CodecDecodeSelf(d) - } - case "createdIndex": - if r.TryDecodeAsNil() { - x.CreatedIndex = 0 - } else { - yyv11 := &x.CreatedIndex - yym12 := z.DecBinary() - _ = yym12 - if false { - } else { - *((*uint64)(yyv11)) = uint64(r.DecodeUint(64)) - } - } - case "modifiedIndex": - if r.TryDecodeAsNil() { - x.ModifiedIndex = 0 - } else { - yyv13 := &x.ModifiedIndex - yym14 := z.DecBinary() - _ = yym14 - if false { - } else { - *((*uint64)(yyv13)) = uint64(r.DecodeUint(64)) - } - } - case "expiration": - if x.Expiration == nil { - x.Expiration = new(time.Time) - } - if r.TryDecodeAsNil() { - if x.Expiration != nil { - x.Expiration = nil - } - } else { - if x.Expiration == nil { - x.Expiration = new(time.Time) - } - yym16 := z.DecBinary() - _ = yym16 - if false { - } else if yym17 := z.TimeRtidIfBinc(); yym17 != 0 { - r.DecodeBuiltin(yym17, x.Expiration) - } else if z.HasExtensions() && z.DecExt(x.Expiration) { - } else if yym16 { - z.DecBinaryUnmarshal(x.Expiration) - } else if !yym16 && z.IsJSONHandle() { - z.DecJSONUnmarshal(x.Expiration) - } else { - z.DecFallback(x.Expiration, false) - } - } - case "ttl": - if r.TryDecodeAsNil() { - x.TTL = 0 - } else { - yyv18 := &x.TTL - yym19 := z.DecBinary() - _ = yym19 - if false { - } else { - *((*int64)(yyv18)) = int64(r.DecodeInt(64)) - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj20 int - var yyb20 bool - var yyhl20 bool = l >= 0 - yyj20++ - if yyhl20 { - yyb20 = yyj20 > l - } else { - yyb20 = r.CheckBreak() - } - if yyb20 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Key = "" - } else { - yyv21 := &x.Key - yym22 := z.DecBinary() - _ = yym22 - if false { - } else { - *((*string)(yyv21)) = r.DecodeString() - } - } - yyj20++ - if yyhl20 { - yyb20 = yyj20 > l - } else { - yyb20 = r.CheckBreak() - } - if yyb20 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Dir = false - } else { - yyv23 := &x.Dir - yym24 := z.DecBinary() - _ = yym24 - if false { - } else { - *((*bool)(yyv23)) = r.DecodeBool() - } - } - yyj20++ - if yyhl20 { - yyb20 = yyj20 > l - } else { - yyb20 = r.CheckBreak() - } - if yyb20 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Value = "" - } else { - yyv25 := &x.Value - yym26 := z.DecBinary() - _ = yym26 - if false { - } else { - *((*string)(yyv25)) = r.DecodeString() - } - } - yyj20++ - if yyhl20 { - yyb20 = yyj20 > l - } else { - yyb20 = r.CheckBreak() - } - if yyb20 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Nodes = nil - } else { - yyv27 := &x.Nodes - yyv27.CodecDecodeSelf(d) - } - yyj20++ - if yyhl20 { - yyb20 = yyj20 > l - } else { - yyb20 = r.CheckBreak() - } - if yyb20 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.CreatedIndex = 0 - } else { - yyv28 := &x.CreatedIndex - yym29 := z.DecBinary() - _ = yym29 - if false { - } else { - *((*uint64)(yyv28)) = uint64(r.DecodeUint(64)) - } - } - yyj20++ - if yyhl20 { - yyb20 = yyj20 > l - } else { - yyb20 = r.CheckBreak() - } - if yyb20 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.ModifiedIndex = 0 - } else { - yyv30 := &x.ModifiedIndex - yym31 := z.DecBinary() - _ = yym31 - if false { - } else { - *((*uint64)(yyv30)) = uint64(r.DecodeUint(64)) - } - } - if x.Expiration == nil { - x.Expiration = new(time.Time) - } - yyj20++ - if yyhl20 { - yyb20 = yyj20 > l - } else { - yyb20 = r.CheckBreak() - } - if yyb20 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - if x.Expiration != nil { - x.Expiration = nil - } - } else { - if x.Expiration == nil { - x.Expiration = new(time.Time) - } - yym33 := z.DecBinary() - _ = yym33 - if false { - } else if yym34 := z.TimeRtidIfBinc(); yym34 != 0 { - r.DecodeBuiltin(yym34, x.Expiration) - } else if z.HasExtensions() && z.DecExt(x.Expiration) { - } else if yym33 { - z.DecBinaryUnmarshal(x.Expiration) - } else if !yym33 && z.IsJSONHandle() { - z.DecJSONUnmarshal(x.Expiration) - } else { - z.DecFallback(x.Expiration, false) - } - } - yyj20++ - if yyhl20 { - yyb20 = yyj20 > l - } else { - yyb20 = r.CheckBreak() - } - if yyb20 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.TTL = 0 - } else { - yyv35 := &x.TTL - yym36 := z.DecBinary() - _ = yym36 - if false { - } else { - *((*int64)(yyv35)) = int64(r.DecodeInt(64)) - } - } - for { - yyj20++ - if yyhl20 { - yyb20 = yyj20 > l - } else { - yyb20 = r.CheckBreak() - } - if yyb20 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj20-1, "") - } - r.ReadArrayEnd() -} - -func (x Nodes) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - h.encNodes((Nodes)(x), e) - } - } -} - -func (x *Nodes) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - h.decNodes((*Nodes)(x), d) - } -} - -func (x *httpKeysAPI) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(0) - } else { - r.WriteMapStart(0) - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *httpKeysAPI) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *httpKeysAPI) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *httpKeysAPI) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj4 int - var yyb4 bool - var yyhl4 bool = l >= 0 - for { - yyj4++ - if yyhl4 { - yyb4 = yyj4 > l - } else { - yyb4 = r.CheckBreak() - } - if yyb4 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj4-1, "") - } - r.ReadArrayEnd() -} - -func (x *httpWatcher) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(0) - } else { - r.WriteMapStart(0) - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *httpWatcher) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *httpWatcher) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *httpWatcher) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj4 int - var yyb4 bool - var yyhl4 bool = l >= 0 - for { - yyj4++ - if yyhl4 { - yyb4 = yyj4 > l - } else { - yyb4 = r.CheckBreak() - } - if yyb4 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj4-1, "") - } - r.ReadArrayEnd() -} - -func (x *getAction) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(5) - } else { - r.WriteMapStart(5) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Prefix")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Key)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Key")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Key)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Recursive")) - r.WriteMapElemValue() - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym13 := z.EncBinary() - _ = yym13 - if false { - } else { - r.EncodeBool(bool(x.Sorted)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Sorted")) - r.WriteMapElemValue() - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeBool(bool(x.Sorted)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym16 := z.EncBinary() - _ = yym16 - if false { - } else { - r.EncodeBool(bool(x.Quorum)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Quorum")) - r.WriteMapElemValue() - yym17 := z.EncBinary() - _ = yym17 - if false { - } else { - r.EncodeBool(bool(x.Quorum)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *getAction) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *getAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "Prefix": - if r.TryDecodeAsNil() { - x.Prefix = "" - } else { - yyv4 := &x.Prefix - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyv4)) = r.DecodeString() - } - } - case "Key": - if r.TryDecodeAsNil() { - x.Key = "" - } else { - yyv6 := &x.Key - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(yyv6)) = r.DecodeString() - } - } - case "Recursive": - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv8 := &x.Recursive - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*bool)(yyv8)) = r.DecodeBool() - } - } - case "Sorted": - if r.TryDecodeAsNil() { - x.Sorted = false - } else { - yyv10 := &x.Sorted - yym11 := z.DecBinary() - _ = yym11 - if false { - } else { - *((*bool)(yyv10)) = r.DecodeBool() - } - } - case "Quorum": - if r.TryDecodeAsNil() { - x.Quorum = false - } else { - yyv12 := &x.Quorum - yym13 := z.DecBinary() - _ = yym13 - if false { - } else { - *((*bool)(yyv12)) = r.DecodeBool() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *getAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj14 int - var yyb14 bool - var yyhl14 bool = l >= 0 - yyj14++ - if yyhl14 { - yyb14 = yyj14 > l - } else { - yyb14 = r.CheckBreak() - } - if yyb14 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Prefix = "" - } else { - yyv15 := &x.Prefix - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - *((*string)(yyv15)) = r.DecodeString() - } - } - yyj14++ - if yyhl14 { - yyb14 = yyj14 > l - } else { - yyb14 = r.CheckBreak() - } - if yyb14 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Key = "" - } else { - yyv17 := &x.Key - yym18 := z.DecBinary() - _ = yym18 - if false { - } else { - *((*string)(yyv17)) = r.DecodeString() - } - } - yyj14++ - if yyhl14 { - yyb14 = yyj14 > l - } else { - yyb14 = r.CheckBreak() - } - if yyb14 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv19 := &x.Recursive - yym20 := z.DecBinary() - _ = yym20 - if false { - } else { - *((*bool)(yyv19)) = r.DecodeBool() - } - } - yyj14++ - if yyhl14 { - yyb14 = yyj14 > l - } else { - yyb14 = r.CheckBreak() - } - if yyb14 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Sorted = false - } else { - yyv21 := &x.Sorted - yym22 := z.DecBinary() - _ = yym22 - if false { - } else { - *((*bool)(yyv21)) = r.DecodeBool() - } - } - yyj14++ - if yyhl14 { - yyb14 = yyj14 > l - } else { - yyb14 = r.CheckBreak() - } - if yyb14 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Quorum = false - } else { - yyv23 := &x.Quorum - yym24 := z.DecBinary() - _ = yym24 - if false { - } else { - *((*bool)(yyv23)) = r.DecodeBool() - } - } - for { - yyj14++ - if yyhl14 { - yyb14 = yyj14 > l - } else { - yyb14 = r.CheckBreak() - } - if yyb14 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj14-1, "") - } - r.ReadArrayEnd() -} - -func (x *waitAction) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(4) - } else { - r.WriteMapStart(4) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Prefix")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Key)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Key")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Key)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeUint(uint64(x.WaitIndex)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("WaitIndex")) - r.WriteMapElemValue() - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeUint(uint64(x.WaitIndex)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym13 := z.EncBinary() - _ = yym13 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Recursive")) - r.WriteMapElemValue() - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *waitAction) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *waitAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "Prefix": - if r.TryDecodeAsNil() { - x.Prefix = "" - } else { - yyv4 := &x.Prefix - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyv4)) = r.DecodeString() - } - } - case "Key": - if r.TryDecodeAsNil() { - x.Key = "" - } else { - yyv6 := &x.Key - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(yyv6)) = r.DecodeString() - } - } - case "WaitIndex": - if r.TryDecodeAsNil() { - x.WaitIndex = 0 - } else { - yyv8 := &x.WaitIndex - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*uint64)(yyv8)) = uint64(r.DecodeUint(64)) - } - } - case "Recursive": - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv10 := &x.Recursive - yym11 := z.DecBinary() - _ = yym11 - if false { - } else { - *((*bool)(yyv10)) = r.DecodeBool() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *waitAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj12 int - var yyb12 bool - var yyhl12 bool = l >= 0 - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Prefix = "" - } else { - yyv13 := &x.Prefix - yym14 := z.DecBinary() - _ = yym14 - if false { - } else { - *((*string)(yyv13)) = r.DecodeString() - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Key = "" - } else { - yyv15 := &x.Key - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - *((*string)(yyv15)) = r.DecodeString() - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.WaitIndex = 0 - } else { - yyv17 := &x.WaitIndex - yym18 := z.DecBinary() - _ = yym18 - if false { - } else { - *((*uint64)(yyv17)) = uint64(r.DecodeUint(64)) - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv19 := &x.Recursive - yym20 := z.DecBinary() - _ = yym20 - if false { - } else { - *((*bool)(yyv19)) = r.DecodeBool() - } - } - for { - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj12-1, "") - } - r.ReadArrayEnd() -} - -func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(10) - } else { - r.WriteMapStart(10) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Prefix")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Key)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Key")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Key)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Value)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Value")) - r.WriteMapElemValue() - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Value)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym13 := z.EncBinary() - _ = yym13 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("PrevValue")) - r.WriteMapElemValue() - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym16 := z.EncBinary() - _ = yym16 - if false { - } else { - r.EncodeUint(uint64(x.PrevIndex)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("PrevIndex")) - r.WriteMapElemValue() - yym17 := z.EncBinary() - _ = yym17 - if false { - } else { - r.EncodeUint(uint64(x.PrevIndex)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - x.PrevExist.CodecEncodeSelf(e) - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("PrevExist")) - r.WriteMapElemValue() - x.PrevExist.CodecEncodeSelf(e) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym22 := z.EncBinary() - _ = yym22 - if false { - } else if z.HasExtensions() && z.EncExt(x.TTL) { - } else { - r.EncodeInt(int64(x.TTL)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("TTL")) - r.WriteMapElemValue() - yym23 := z.EncBinary() - _ = yym23 - if false { - } else if z.HasExtensions() && z.EncExt(x.TTL) { - } else { - r.EncodeInt(int64(x.TTL)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym25 := z.EncBinary() - _ = yym25 - if false { - } else { - r.EncodeBool(bool(x.Refresh)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Refresh")) - r.WriteMapElemValue() - yym26 := z.EncBinary() - _ = yym26 - if false { - } else { - r.EncodeBool(bool(x.Refresh)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym28 := z.EncBinary() - _ = yym28 - if false { - } else { - r.EncodeBool(bool(x.Dir)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Dir")) - r.WriteMapElemValue() - yym29 := z.EncBinary() - _ = yym29 - if false { - } else { - r.EncodeBool(bool(x.Dir)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym31 := z.EncBinary() - _ = yym31 - if false { - } else { - r.EncodeBool(bool(x.NoValueOnSuccess)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("NoValueOnSuccess")) - r.WriteMapElemValue() - yym32 := z.EncBinary() - _ = yym32 - if false { - } else { - r.EncodeBool(bool(x.NoValueOnSuccess)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *setAction) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *setAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "Prefix": - if r.TryDecodeAsNil() { - x.Prefix = "" - } else { - yyv4 := &x.Prefix - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyv4)) = r.DecodeString() - } - } - case "Key": - if r.TryDecodeAsNil() { - x.Key = "" - } else { - yyv6 := &x.Key - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(yyv6)) = r.DecodeString() - } - } - case "Value": - if r.TryDecodeAsNil() { - x.Value = "" - } else { - yyv8 := &x.Value - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*string)(yyv8)) = r.DecodeString() - } - } - case "PrevValue": - if r.TryDecodeAsNil() { - x.PrevValue = "" - } else { - yyv10 := &x.PrevValue - yym11 := z.DecBinary() - _ = yym11 - if false { - } else { - *((*string)(yyv10)) = r.DecodeString() - } - } - case "PrevIndex": - if r.TryDecodeAsNil() { - x.PrevIndex = 0 - } else { - yyv12 := &x.PrevIndex - yym13 := z.DecBinary() - _ = yym13 - if false { - } else { - *((*uint64)(yyv12)) = uint64(r.DecodeUint(64)) - } - } - case "PrevExist": - if r.TryDecodeAsNil() { - x.PrevExist = "" - } else { - yyv14 := &x.PrevExist - yyv14.CodecDecodeSelf(d) - } - case "TTL": - if r.TryDecodeAsNil() { - x.TTL = 0 - } else { - yyv15 := &x.TTL - yym16 := z.DecBinary() - _ = yym16 - if false { - } else if z.HasExtensions() && z.DecExt(yyv15) { - } else { - *((*int64)(yyv15)) = int64(r.DecodeInt(64)) - } - } - case "Refresh": - if r.TryDecodeAsNil() { - x.Refresh = false - } else { - yyv17 := &x.Refresh - yym18 := z.DecBinary() - _ = yym18 - if false { - } else { - *((*bool)(yyv17)) = r.DecodeBool() - } - } - case "Dir": - if r.TryDecodeAsNil() { - x.Dir = false - } else { - yyv19 := &x.Dir - yym20 := z.DecBinary() - _ = yym20 - if false { - } else { - *((*bool)(yyv19)) = r.DecodeBool() - } - } - case "NoValueOnSuccess": - if r.TryDecodeAsNil() { - x.NoValueOnSuccess = false - } else { - yyv21 := &x.NoValueOnSuccess - yym22 := z.DecBinary() - _ = yym22 - if false { - } else { - *((*bool)(yyv21)) = r.DecodeBool() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *setAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj23 int - var yyb23 bool - var yyhl23 bool = l >= 0 - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Prefix = "" - } else { - yyv24 := &x.Prefix - yym25 := z.DecBinary() - _ = yym25 - if false { - } else { - *((*string)(yyv24)) = r.DecodeString() - } - } - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Key = "" - } else { - yyv26 := &x.Key - yym27 := z.DecBinary() - _ = yym27 - if false { - } else { - *((*string)(yyv26)) = r.DecodeString() - } - } - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Value = "" - } else { - yyv28 := &x.Value - yym29 := z.DecBinary() - _ = yym29 - if false { - } else { - *((*string)(yyv28)) = r.DecodeString() - } - } - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.PrevValue = "" - } else { - yyv30 := &x.PrevValue - yym31 := z.DecBinary() - _ = yym31 - if false { - } else { - *((*string)(yyv30)) = r.DecodeString() - } - } - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.PrevIndex = 0 - } else { - yyv32 := &x.PrevIndex - yym33 := z.DecBinary() - _ = yym33 - if false { - } else { - *((*uint64)(yyv32)) = uint64(r.DecodeUint(64)) - } - } - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.PrevExist = "" - } else { - yyv34 := &x.PrevExist - yyv34.CodecDecodeSelf(d) - } - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.TTL = 0 - } else { - yyv35 := &x.TTL - yym36 := z.DecBinary() - _ = yym36 - if false { - } else if z.HasExtensions() && z.DecExt(yyv35) { - } else { - *((*int64)(yyv35)) = int64(r.DecodeInt(64)) - } - } - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Refresh = false - } else { - yyv37 := &x.Refresh - yym38 := z.DecBinary() - _ = yym38 - if false { - } else { - *((*bool)(yyv37)) = r.DecodeBool() - } - } - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Dir = false - } else { - yyv39 := &x.Dir - yym40 := z.DecBinary() - _ = yym40 - if false { - } else { - *((*bool)(yyv39)) = r.DecodeBool() - } - } - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.NoValueOnSuccess = false - } else { - yyv41 := &x.NoValueOnSuccess - yym42 := z.DecBinary() - _ = yym42 - if false { - } else { - *((*bool)(yyv41)) = r.DecodeBool() - } - } - for { - yyj23++ - if yyhl23 { - yyb23 = yyj23 > l - } else { - yyb23 = r.CheckBreak() - } - if yyb23 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj23-1, "") - } - r.ReadArrayEnd() -} - -func (x *deleteAction) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(6) - } else { - r.WriteMapStart(6) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Prefix")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Key)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Key")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Key)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("PrevValue")) - r.WriteMapElemValue() - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym13 := z.EncBinary() - _ = yym13 - if false { - } else { - r.EncodeUint(uint64(x.PrevIndex)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("PrevIndex")) - r.WriteMapElemValue() - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeUint(uint64(x.PrevIndex)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym16 := z.EncBinary() - _ = yym16 - if false { - } else { - r.EncodeBool(bool(x.Dir)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Dir")) - r.WriteMapElemValue() - yym17 := z.EncBinary() - _ = yym17 - if false { - } else { - r.EncodeBool(bool(x.Dir)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym19 := z.EncBinary() - _ = yym19 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Recursive")) - r.WriteMapElemValue() - yym20 := z.EncBinary() - _ = yym20 - if false { - } else { - r.EncodeBool(bool(x.Recursive)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *deleteAction) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *deleteAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "Prefix": - if r.TryDecodeAsNil() { - x.Prefix = "" - } else { - yyv4 := &x.Prefix - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyv4)) = r.DecodeString() - } - } - case "Key": - if r.TryDecodeAsNil() { - x.Key = "" - } else { - yyv6 := &x.Key - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(yyv6)) = r.DecodeString() - } - } - case "PrevValue": - if r.TryDecodeAsNil() { - x.PrevValue = "" - } else { - yyv8 := &x.PrevValue - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*string)(yyv8)) = r.DecodeString() - } - } - case "PrevIndex": - if r.TryDecodeAsNil() { - x.PrevIndex = 0 - } else { - yyv10 := &x.PrevIndex - yym11 := z.DecBinary() - _ = yym11 - if false { - } else { - *((*uint64)(yyv10)) = uint64(r.DecodeUint(64)) - } - } - case "Dir": - if r.TryDecodeAsNil() { - x.Dir = false - } else { - yyv12 := &x.Dir - yym13 := z.DecBinary() - _ = yym13 - if false { - } else { - *((*bool)(yyv12)) = r.DecodeBool() - } - } - case "Recursive": - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv14 := &x.Recursive - yym15 := z.DecBinary() - _ = yym15 - if false { - } else { - *((*bool)(yyv14)) = r.DecodeBool() - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *deleteAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj16 int - var yyb16 bool - var yyhl16 bool = l >= 0 - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l - } else { - yyb16 = r.CheckBreak() - } - if yyb16 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Prefix = "" - } else { - yyv17 := &x.Prefix - yym18 := z.DecBinary() - _ = yym18 - if false { - } else { - *((*string)(yyv17)) = r.DecodeString() - } - } - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l - } else { - yyb16 = r.CheckBreak() - } - if yyb16 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Key = "" - } else { - yyv19 := &x.Key - yym20 := z.DecBinary() - _ = yym20 - if false { - } else { - *((*string)(yyv19)) = r.DecodeString() - } - } - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l - } else { - yyb16 = r.CheckBreak() - } - if yyb16 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.PrevValue = "" - } else { - yyv21 := &x.PrevValue - yym22 := z.DecBinary() - _ = yym22 - if false { - } else { - *((*string)(yyv21)) = r.DecodeString() - } - } - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l - } else { - yyb16 = r.CheckBreak() - } - if yyb16 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.PrevIndex = 0 - } else { - yyv23 := &x.PrevIndex - yym24 := z.DecBinary() - _ = yym24 - if false { - } else { - *((*uint64)(yyv23)) = uint64(r.DecodeUint(64)) - } - } - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l - } else { - yyb16 = r.CheckBreak() - } - if yyb16 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Dir = false - } else { - yyv25 := &x.Dir - yym26 := z.DecBinary() - _ = yym26 - if false { - } else { - *((*bool)(yyv25)) = r.DecodeBool() - } - } - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l - } else { - yyb16 = r.CheckBreak() - } - if yyb16 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Recursive = false - } else { - yyv27 := &x.Recursive - yym28 := z.DecBinary() - _ = yym28 - if false { - } else { - *((*bool)(yyv27)) = r.DecodeBool() - } - } - for { - yyj16++ - if yyhl16 { - yyb16 = yyj16 > l - } else { - yyb16 = r.CheckBreak() - } - if yyb16 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj16-1, "") - } - r.ReadArrayEnd() -} - -func (x *createInOrderAction) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - if x == nil { - r.EncodeNil() - } else { - yym1 := z.EncBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.EncExt(x) { - } else { - yysep2 := !z.EncBinary() - yy2arr2 := z.EncBasicHandle().StructToArray - _, _ = yysep2, yy2arr2 - const yyr2 bool = false - if yyr2 || yy2arr2 { - r.WriteArrayStart(4) - } else { - r.WriteMapStart(4) - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym4 := z.EncBinary() - _ = yym4 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Prefix")) - r.WriteMapElemValue() - yym5 := z.EncBinary() - _ = yym5 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym7 := z.EncBinary() - _ = yym7 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Dir)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Dir")) - r.WriteMapElemValue() - yym8 := z.EncBinary() - _ = yym8 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Dir)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym10 := z.EncBinary() - _ = yym10 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Value)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("Value")) - r.WriteMapElemValue() - yym11 := z.EncBinary() - _ = yym11 - if false { - } else { - r.EncodeString(codecSelferC_UTF87612, string(x.Value)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayElem() - yym13 := z.EncBinary() - _ = yym13 - if false { - } else if z.HasExtensions() && z.EncExt(x.TTL) { - } else { - r.EncodeInt(int64(x.TTL)) - } - } else { - r.WriteMapElemKey() - r.EncodeString(codecSelferC_UTF87612, string("TTL")) - r.WriteMapElemValue() - yym14 := z.EncBinary() - _ = yym14 - if false { - } else if z.HasExtensions() && z.EncExt(x.TTL) { - } else { - r.EncodeInt(int64(x.TTL)) - } - } - if yyr2 || yy2arr2 { - r.WriteArrayEnd() - } else { - r.WriteMapEnd() - } - } - } -} - -func (x *createInOrderAction) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - yym1 := z.DecBinary() - _ = yym1 - if false { - } else if z.HasExtensions() && z.DecExt(x) { - } else { - yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap7612 { - yyl2 := r.ReadMapStart() - if yyl2 == 0 { - r.ReadMapEnd() - } else { - x.codecDecodeSelfFromMap(yyl2, d) - } - } else if yyct2 == codecSelferValueTypeArray7612 { - yyl2 := r.ReadArrayStart() - if yyl2 == 0 { - r.ReadArrayEnd() - } else { - x.codecDecodeSelfFromArray(yyl2, d) - } - } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) - } - } -} - -func (x *createInOrderAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yys3Slc = z.DecScratchBuffer() // default slice to decode into - _ = yys3Slc - var yyhl3 bool = l >= 0 - for yyj3 := 0; ; yyj3++ { - if yyhl3 { - if yyj3 >= l { - break - } - } else { - if r.CheckBreak() { - break - } - } - r.ReadMapElemKey() - yys3Slc = r.DecodeStringAsBytes() - yys3 := string(yys3Slc) - r.ReadMapElemValue() - switch yys3 { - case "Prefix": - if r.TryDecodeAsNil() { - x.Prefix = "" - } else { - yyv4 := &x.Prefix - yym5 := z.DecBinary() - _ = yym5 - if false { - } else { - *((*string)(yyv4)) = r.DecodeString() - } - } - case "Dir": - if r.TryDecodeAsNil() { - x.Dir = "" - } else { - yyv6 := &x.Dir - yym7 := z.DecBinary() - _ = yym7 - if false { - } else { - *((*string)(yyv6)) = r.DecodeString() - } - } - case "Value": - if r.TryDecodeAsNil() { - x.Value = "" - } else { - yyv8 := &x.Value - yym9 := z.DecBinary() - _ = yym9 - if false { - } else { - *((*string)(yyv8)) = r.DecodeString() - } - } - case "TTL": - if r.TryDecodeAsNil() { - x.TTL = 0 - } else { - yyv10 := &x.TTL - yym11 := z.DecBinary() - _ = yym11 - if false { - } else if z.HasExtensions() && z.DecExt(yyv10) { - } else { - *((*int64)(yyv10)) = int64(r.DecodeInt(64)) - } - } - default: - z.DecStructFieldNotFound(-1, yys3) - } // end switch yys3 - } // end for yyj3 - r.ReadMapEnd() -} - -func (x *createInOrderAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - var yyj12 int - var yyb12 bool - var yyhl12 bool = l >= 0 - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Prefix = "" - } else { - yyv13 := &x.Prefix - yym14 := z.DecBinary() - _ = yym14 - if false { - } else { - *((*string)(yyv13)) = r.DecodeString() - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Dir = "" - } else { - yyv15 := &x.Dir - yym16 := z.DecBinary() - _ = yym16 - if false { - } else { - *((*string)(yyv15)) = r.DecodeString() - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.Value = "" - } else { - yyv17 := &x.Value - yym18 := z.DecBinary() - _ = yym18 - if false { - } else { - *((*string)(yyv17)) = r.DecodeString() - } - } - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - r.ReadArrayEnd() - return - } - r.ReadArrayElem() - if r.TryDecodeAsNil() { - x.TTL = 0 - } else { - yyv19 := &x.TTL - yym20 := z.DecBinary() - _ = yym20 - if false { - } else if z.HasExtensions() && z.DecExt(yyv19) { - } else { - *((*int64)(yyv19)) = int64(r.DecodeInt(64)) - } - } - for { - yyj12++ - if yyhl12 { - yyb12 = yyj12 > l - } else { - yyb12 = r.CheckBreak() - } - if yyb12 { - break - } - r.ReadArrayElem() - z.DecStructFieldNotFound(yyj12-1, "") - } - r.ReadArrayEnd() -} - -func (x codecSelfer7612) encNodes(v Nodes, e *codec1978.Encoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperEncoder(e) - _, _, _ = h, z, r - r.WriteArrayStart(len(v)) - for _, yyv1 := range v { - r.WriteArrayElem() - if yyv1 == nil { - r.EncodeNil() - } else { - yyv1.CodecEncodeSelf(e) - } - } - r.WriteArrayEnd() -} - -func (x codecSelfer7612) decNodes(v *Nodes, d *codec1978.Decoder) { - var h codecSelfer7612 - z, r := codec1978.GenHelperDecoder(d) - _, _, _ = h, z, r - - yyv1 := *v - yyh1, yyl1 := z.DecSliceHelperStart() - var yyc1 bool - _ = yyc1 - if yyl1 == 0 { - if yyv1 == nil { - yyv1 = []*Node{} - yyc1 = true - } else if len(yyv1) != 0 { - yyv1 = yyv1[:0] - yyc1 = true - } - } else { - yyhl1 := yyl1 > 0 - var yyrl1 int - _ = yyrl1 - if yyhl1 { - if yyl1 > cap(yyv1) { - yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) - if yyrl1 <= cap(yyv1) { - yyv1 = yyv1[:yyrl1] - } else { - yyv1 = make([]*Node, yyrl1) - } - yyc1 = true - } else if yyl1 != len(yyv1) { - yyv1 = yyv1[:yyl1] - yyc1 = true - } - } - var yyj1 int - // var yydn1 bool - for ; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { - if yyj1 == 0 && len(yyv1) == 0 { - if yyhl1 { - yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) - } else { - yyrl1 = 8 - } - yyv1 = make([]*Node, yyrl1) - yyc1 = true - } - yyh1.ElemContainerState(yyj1) - // yydn1 = r.TryDecodeAsNil() - - // if indefinite, etc, then expand the slice if necessary - var yydb1 bool - if yyj1 >= len(yyv1) { - yyv1 = append(yyv1, nil) - yyc1 = true - - } - if yydb1 { - z.DecSwallow() - } else { - if r.TryDecodeAsNil() { - if yyv1[yyj1] != nil { - *yyv1[yyj1] = Node{} - } - } else { - if yyv1[yyj1] == nil { - yyv1[yyj1] = new(Node) - } - yyw2 := yyv1[yyj1] - yyw2.CodecDecodeSelf(d) - } - - } - - } - if yyj1 < len(yyv1) { - yyv1 = yyv1[:yyj1] - yyc1 = true - } else if yyj1 == 0 && yyv1 == nil { - yyv1 = make([]*Node, 0) - yyc1 = true - } - } - yyh1.End() - if yyc1 { - *v = yyv1 - } - -} diff --git a/vendor/github.com/coreos/etcd/client/keys.go b/vendor/github.com/coreos/etcd/client/keys.go index 8b9fd3f87..f8f2c7b18 100644 --- a/vendor/github.com/coreos/etcd/client/keys.go +++ b/vendor/github.com/coreos/etcd/client/keys.go @@ -14,8 +14,6 @@ package client -//go:generate codecgen -d 1819 -r "Node|Response|Nodes" -o keys.generated.go keys.go - import ( "context" "encoding/json" @@ -28,7 +26,6 @@ import ( "time" "github.com/coreos/etcd/pkg/pathutil" - "github.com/ugorji/go/codec" ) const ( @@ -656,9 +653,11 @@ func unmarshalHTTPResponse(code int, header http.Header, body []byte) (res *Resp return res, err } +var jsonIterator = caseSensitiveJsonIterator() + func unmarshalSuccessfulKeysResponse(header http.Header, body []byte) (*Response, error) { var res Response - err := codec.NewDecoderBytes(body, new(codec.JsonHandle)).Decode(&res) + err := jsonIterator.Unmarshal(body, &res) if err != nil { return nil, ErrInvalidJSON } diff --git a/vendor/github.com/coreos/etcd/clientv3/README.md b/vendor/github.com/coreos/etcd/clientv3/README.md deleted file mode 100644 index 376bfba76..000000000 --- a/vendor/github.com/coreos/etcd/clientv3/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# etcd/clientv3 - -[![Godoc](https://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://godoc.org/github.com/coreos/etcd/clientv3) - -`etcd/clientv3` is the official Go etcd client for v3. - -## Install - -```bash -go get github.com/coreos/etcd/clientv3 -``` - -## Get started - -Create client using `clientv3.New`: - -```go -cli, err := clientv3.New(clientv3.Config{ - Endpoints: []string{"localhost:2379", "localhost:22379", "localhost:32379"}, - DialTimeout: 5 * time.Second, -}) -if err != nil { - // handle error! -} -defer cli.Close() -``` - -etcd v3 uses [`gRPC`](http://www.grpc.io) for remote procedure calls. And `clientv3` uses -[`grpc-go`](https://github.com/grpc/grpc-go) to connect to etcd. Make sure to close the client after using it. -If the client is not closed, the connection will have leaky goroutines. To specify client request timeout, -pass `context.WithTimeout` to APIs: - -```go -ctx, cancel := context.WithTimeout(context.Background(), timeout) -resp, err := cli.Put(ctx, "sample_key", "sample_value") -cancel() -if err != nil { - // handle error! -} -// use the response -``` - -etcd uses `cmd/vendor` directory to store external dependencies, which are -to be compiled into etcd release binaries. `client` can be imported without -vendoring. For full compatibility, it is recommended to vendor builds using -etcd's vendored packages, using tools like godep, as in -[vendor directories](https://golang.org/cmd/go/#hdr-Vendor_Directories). -For more detail, please read [Go vendor design](https://golang.org/s/go15vendor). - -## Error Handling - -etcd client returns 2 types of errors: - -1. context error: canceled or deadline exceeded. -2. gRPC error: see [api/v3rpc/rpctypes](https://godoc.org/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes). - -Here is the example code to handle client errors: - -```go -resp, err := cli.Put(ctx, "", "") -if err != nil { - switch err { - case context.Canceled: - log.Fatalf("ctx is canceled by another routine: %v", err) - case context.DeadlineExceeded: - log.Fatalf("ctx is attached with a deadline is exceeded: %v", err) - case rpctypes.ErrEmptyKey: - log.Fatalf("client-side error: %v", err) - default: - log.Fatalf("bad cluster endpoints, which are not etcd servers: %v", err) - } -} -``` - -## Metrics - -The etcd client optionally exposes RPC metrics through [go-grpc-prometheus](https://github.com/grpc-ecosystem/go-grpc-prometheus). See the [examples](https://github.com/coreos/etcd/blob/master/clientv3/example_metrics_test.go). - -## Namespacing - -The [namespace](https://godoc.org/github.com/coreos/etcd/clientv3/namespace) package provides `clientv3` interface wrappers to transparently isolate client requests to a user-defined prefix. - -## Examples - -More code examples can be found at [GoDoc](https://godoc.org/github.com/coreos/etcd/clientv3). diff --git a/vendor/github.com/coreos/etcd/clientv3/auth.go b/vendor/github.com/coreos/etcd/clientv3/auth.go index 7545bb6ca..edccf1a8c 100644 --- a/vendor/github.com/coreos/etcd/clientv3/auth.go +++ b/vendor/github.com/coreos/etcd/clientv3/auth.go @@ -216,8 +216,8 @@ func (auth *authenticator) close() { auth.conn.Close() } -func newAuthenticator(endpoint string, opts []grpc.DialOption, c *Client) (*authenticator, error) { - conn, err := grpc.Dial(endpoint, opts...) +func newAuthenticator(ctx context.Context, target string, opts []grpc.DialOption, c *Client) (*authenticator, error) { + conn, err := grpc.DialContext(ctx, target, opts...) if err != nil { return nil, err } diff --git a/vendor/github.com/coreos/etcd/clientv3/balancer/balancer.go b/vendor/github.com/coreos/etcd/clientv3/balancer/balancer.go new file mode 100644 index 000000000..9306385e9 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/balancer/balancer.go @@ -0,0 +1,293 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package balancer implements client balancer. +package balancer + +import ( + "strconv" + "sync" + "time" + + "github.com/coreos/etcd/clientv3/balancer/connectivity" + "github.com/coreos/etcd/clientv3/balancer/picker" + + "go.uber.org/zap" + "google.golang.org/grpc/balancer" + grpcconnectivity "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/resolver" + _ "google.golang.org/grpc/resolver/dns" // register DNS resolver + _ "google.golang.org/grpc/resolver/passthrough" // register passthrough resolver +) + +// Config defines balancer configurations. +type Config struct { + // Policy configures balancer policy. + Policy picker.Policy + + // Picker implements gRPC picker. + // Leave empty if "Policy" field is not custom. + // TODO: currently custom policy is not supported. + // Picker picker.Picker + + // Name defines an additional name for balancer. + // Useful for balancer testing to avoid register conflicts. + // If empty, defaults to policy name. + Name string + + // Logger configures balancer logging. + // If nil, logs are discarded. + Logger *zap.Logger +} + +// RegisterBuilder creates and registers a builder. Since this function calls balancer.Register, it +// must be invoked at initialization time. +func RegisterBuilder(cfg Config) { + bb := &builder{cfg} + balancer.Register(bb) + + bb.cfg.Logger.Debug( + "registered balancer", + zap.String("policy", bb.cfg.Policy.String()), + zap.String("name", bb.cfg.Name), + ) +} + +type builder struct { + cfg Config +} + +// Build is called initially when creating "ccBalancerWrapper". +// "grpc.Dial" is called to this client connection. +// Then, resolved addresses will be handled via "HandleResolvedAddrs". +func (b *builder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { + bb := &baseBalancer{ + id: strconv.FormatInt(time.Now().UnixNano(), 36), + policy: b.cfg.Policy, + name: b.cfg.Name, + lg: b.cfg.Logger, + + addrToSc: make(map[resolver.Address]balancer.SubConn), + scToAddr: make(map[balancer.SubConn]resolver.Address), + scToSt: make(map[balancer.SubConn]grpcconnectivity.State), + + currentConn: nil, + connectivityRecorder: connectivity.New(b.cfg.Logger), + + // initialize picker always returns "ErrNoSubConnAvailable" + picker: picker.NewErr(balancer.ErrNoSubConnAvailable), + } + + // TODO: support multiple connections + bb.mu.Lock() + bb.currentConn = cc + bb.mu.Unlock() + + bb.lg.Info( + "built balancer", + zap.String("balancer-id", bb.id), + zap.String("policy", bb.policy.String()), + zap.String("resolver-target", cc.Target()), + ) + return bb +} + +// Name implements "grpc/balancer.Builder" interface. +func (b *builder) Name() string { return b.cfg.Name } + +// Balancer defines client balancer interface. +type Balancer interface { + // Balancer is called on specified client connection. Client initiates gRPC + // connection with "grpc.Dial(addr, grpc.WithBalancerName)", and then those resolved + // addresses are passed to "grpc/balancer.Balancer.HandleResolvedAddrs". + // For each resolved address, balancer calls "balancer.ClientConn.NewSubConn". + // "grpc/balancer.Balancer.HandleSubConnStateChange" is called when connectivity state + // changes, thus requires failover logic in this method. + balancer.Balancer + + // Picker calls "Pick" for every client request. + picker.Picker +} + +type baseBalancer struct { + id string + policy picker.Policy + name string + lg *zap.Logger + + mu sync.RWMutex + + addrToSc map[resolver.Address]balancer.SubConn + scToAddr map[balancer.SubConn]resolver.Address + scToSt map[balancer.SubConn]grpcconnectivity.State + + currentConn balancer.ClientConn + connectivityRecorder connectivity.Recorder + + picker picker.Picker +} + +// HandleResolvedAddrs implements "grpc/balancer.Balancer" interface. +// gRPC sends initial or updated resolved addresses from "Build". +func (bb *baseBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { + if err != nil { + bb.lg.Warn("HandleResolvedAddrs called with error", zap.String("balancer-id", bb.id), zap.Error(err)) + return + } + bb.lg.Info("resolved", + zap.String("picker", bb.picker.String()), + zap.String("balancer-id", bb.id), + zap.Strings("addresses", addrsToStrings(addrs)), + ) + + bb.mu.Lock() + defer bb.mu.Unlock() + + resolved := make(map[resolver.Address]struct{}) + for _, addr := range addrs { + resolved[addr] = struct{}{} + if _, ok := bb.addrToSc[addr]; !ok { + sc, err := bb.currentConn.NewSubConn([]resolver.Address{addr}, balancer.NewSubConnOptions{}) + if err != nil { + bb.lg.Warn("NewSubConn failed", zap.String("picker", bb.picker.String()), zap.String("balancer-id", bb.id), zap.Error(err), zap.String("address", addr.Addr)) + continue + } + bb.lg.Info("created subconn", zap.String("address", addr.Addr)) + bb.addrToSc[addr] = sc + bb.scToAddr[sc] = addr + bb.scToSt[sc] = grpcconnectivity.Idle + sc.Connect() + } + } + + for addr, sc := range bb.addrToSc { + if _, ok := resolved[addr]; !ok { + // was removed by resolver or failed to create subconn + bb.currentConn.RemoveSubConn(sc) + delete(bb.addrToSc, addr) + + bb.lg.Info( + "removed subconn", + zap.String("picker", bb.picker.String()), + zap.String("balancer-id", bb.id), + zap.String("address", addr.Addr), + zap.String("subconn", scToString(sc)), + ) + + // Keep the state of this sc in bb.scToSt until sc's state becomes Shutdown. + // The entry will be deleted in HandleSubConnStateChange. + // (DO NOT) delete(bb.scToAddr, sc) + // (DO NOT) delete(bb.scToSt, sc) + } + } +} + +// HandleSubConnStateChange implements "grpc/balancer.Balancer" interface. +func (bb *baseBalancer) HandleSubConnStateChange(sc balancer.SubConn, s grpcconnectivity.State) { + bb.mu.Lock() + defer bb.mu.Unlock() + + old, ok := bb.scToSt[sc] + if !ok { + bb.lg.Warn( + "state change for an unknown subconn", + zap.String("picker", bb.picker.String()), + zap.String("balancer-id", bb.id), + zap.String("subconn", scToString(sc)), + zap.Int("subconn-size", len(bb.scToAddr)), + zap.String("state", s.String()), + ) + return + } + + bb.lg.Info( + "state changed", + zap.String("picker", bb.picker.String()), + zap.String("balancer-id", bb.id), + zap.Bool("connected", s == grpcconnectivity.Ready), + zap.String("subconn", scToString(sc)), + zap.Int("subconn-size", len(bb.scToAddr)), + zap.String("address", bb.scToAddr[sc].Addr), + zap.String("old-state", old.String()), + zap.String("new-state", s.String()), + ) + + bb.scToSt[sc] = s + switch s { + case grpcconnectivity.Idle: + sc.Connect() + case grpcconnectivity.Shutdown: + // When an address was removed by resolver, b called RemoveSubConn but + // kept the sc's state in scToSt. Remove state for this sc here. + delete(bb.scToAddr, sc) + delete(bb.scToSt, sc) + } + + oldAggrState := bb.connectivityRecorder.GetCurrentState() + bb.connectivityRecorder.RecordTransition(old, s) + + // Update balancer picker when one of the following happens: + // - this sc became ready from not-ready + // - this sc became not-ready from ready + // - the aggregated state of balancer became TransientFailure from non-TransientFailure + // - the aggregated state of balancer became non-TransientFailure from TransientFailure + if (s == grpcconnectivity.Ready) != (old == grpcconnectivity.Ready) || + (bb.connectivityRecorder.GetCurrentState() == grpcconnectivity.TransientFailure) != (oldAggrState == grpcconnectivity.TransientFailure) { + bb.updatePicker() + } + + bb.currentConn.UpdateBalancerState(bb.connectivityRecorder.GetCurrentState(), bb.picker) +} + +func (bb *baseBalancer) updatePicker() { + if bb.connectivityRecorder.GetCurrentState() == grpcconnectivity.TransientFailure { + bb.picker = picker.NewErr(balancer.ErrTransientFailure) + bb.lg.Info( + "updated picker to transient error picker", + zap.String("picker", bb.picker.String()), + zap.String("balancer-id", bb.id), + zap.String("policy", bb.policy.String()), + ) + return + } + + // only pass ready subconns to picker + scToAddr := make(map[balancer.SubConn]resolver.Address) + for addr, sc := range bb.addrToSc { + if st, ok := bb.scToSt[sc]; ok && st == grpcconnectivity.Ready { + scToAddr[sc] = addr + } + } + + bb.picker = picker.New(picker.Config{ + Policy: bb.policy, + Logger: bb.lg, + SubConnToResolverAddress: scToAddr, + }) + bb.lg.Info( + "updated picker", + zap.String("picker", bb.picker.String()), + zap.String("balancer-id", bb.id), + zap.String("policy", bb.policy.String()), + zap.Strings("subconn-ready", scsToStrings(scToAddr)), + zap.Int("subconn-size", len(scToAddr)), + ) +} + +// Close implements "grpc/balancer.Balancer" interface. +// Close is a nop because base balancer doesn't have internal state to clean up, +// and it doesn't need to call RemoveSubConn for the SubConns. +func (bb *baseBalancer) Close() { + // TODO +} diff --git a/vendor/github.com/coreos/etcd/clientv3/balancer/balancer_test.go b/vendor/github.com/coreos/etcd/clientv3/balancer/balancer_test.go new file mode 100644 index 000000000..592eda102 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/balancer/balancer_test.go @@ -0,0 +1,310 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package balancer + +import ( + "context" + "fmt" + "strings" + "testing" + "time" + + "github.com/coreos/etcd/clientv3/balancer/picker" + "github.com/coreos/etcd/clientv3/balancer/resolver/endpoint" + pb "github.com/coreos/etcd/etcdserver/etcdserverpb" + "github.com/coreos/etcd/pkg/mock/mockserver" + + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/peer" + "google.golang.org/grpc/status" +) + +// TestRoundRobinBalancedResolvableNoFailover ensures that +// requests to a resolvable endpoint can be balanced between +// multiple, if any, nodes. And there needs be no failover. +func TestRoundRobinBalancedResolvableNoFailover(t *testing.T) { + testCases := []struct { + name string + serverCount int + reqN int + network string + }{ + {name: "rrBalanced_1", serverCount: 1, reqN: 5, network: "tcp"}, + {name: "rrBalanced_1_unix_sockets", serverCount: 1, reqN: 5, network: "unix"}, + {name: "rrBalanced_3", serverCount: 3, reqN: 7, network: "tcp"}, + {name: "rrBalanced_5", serverCount: 5, reqN: 10, network: "tcp"}, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + ms, err := mockserver.StartMockServersOnNetwork(tc.serverCount, tc.network) + if err != nil { + t.Fatalf("failed to start mock servers: %v", err) + } + defer ms.Stop() + + var eps []string + for _, svr := range ms.Servers { + eps = append(eps, svr.ResolverAddress().Addr) + } + + rsv, err := endpoint.NewResolverGroup("nofailover") + if err != nil { + t.Fatal(err) + } + defer rsv.Close() + rsv.SetEndpoints(eps) + + name := genName() + cfg := Config{ + Policy: picker.RoundrobinBalanced, + Name: name, + Logger: zap.NewExample(), + } + RegisterBuilder(cfg) + conn, err := grpc.Dial(fmt.Sprintf("endpoint://nofailover/*"), grpc.WithInsecure(), grpc.WithBalancerName(name)) + if err != nil { + t.Fatalf("failed to dial mock server: %v", err) + } + defer conn.Close() + cli := pb.NewKVClient(conn) + + reqFunc := func(ctx context.Context) (picked string, err error) { + var p peer.Peer + _, err = cli.Range(ctx, &pb.RangeRequest{Key: []byte("/x")}, grpc.Peer(&p)) + if p.Addr != nil { + picked = p.Addr.String() + } + return picked, err + } + + prev, switches := "", 0 + for i := 0; i < tc.reqN; i++ { + picked, err := reqFunc(context.Background()) + if err != nil { + t.Fatalf("#%d: unexpected failure %v", i, err) + } + if prev == "" { + prev = picked + continue + } + if prev != picked { + switches++ + } + prev = picked + } + if tc.serverCount > 1 && switches < tc.reqN-3 { // -3 for initial resolutions + // TODO: FIX ME + t.Skipf("expected balanced loads for %d requests, got switches %d", tc.reqN, switches) + } + }) + } +} + +// TestRoundRobinBalancedResolvableFailoverFromServerFail ensures that +// loads be rebalanced while one server goes down and comes back. +func TestRoundRobinBalancedResolvableFailoverFromServerFail(t *testing.T) { + serverCount := 5 + ms, err := mockserver.StartMockServers(serverCount) + if err != nil { + t.Fatalf("failed to start mock servers: %s", err) + } + defer ms.Stop() + var eps []string + for _, svr := range ms.Servers { + eps = append(eps, svr.ResolverAddress().Addr) + } + + rsv, err := endpoint.NewResolverGroup("serverfail") + if err != nil { + t.Fatal(err) + } + defer rsv.Close() + rsv.SetEndpoints(eps) + + name := genName() + cfg := Config{ + Policy: picker.RoundrobinBalanced, + Name: name, + Logger: zap.NewExample(), + } + RegisterBuilder(cfg) + conn, err := grpc.Dial(fmt.Sprintf("endpoint://serverfail/mock.server"), grpc.WithInsecure(), grpc.WithBalancerName(name)) + if err != nil { + t.Fatalf("failed to dial mock server: %s", err) + } + defer conn.Close() + cli := pb.NewKVClient(conn) + + reqFunc := func(ctx context.Context) (picked string, err error) { + var p peer.Peer + _, err = cli.Range(ctx, &pb.RangeRequest{Key: []byte("/x")}, grpc.Peer(&p)) + if p.Addr != nil { + picked = p.Addr.String() + } + return picked, err + } + + // stop first server, loads should be redistributed + // stopped server should never be picked + ms.StopAt(0) + available := make(map[string]struct{}) + for i := 1; i < serverCount; i++ { + available[eps[i]] = struct{}{} + } + + reqN := 10 + prev, switches := "", 0 + for i := 0; i < reqN; i++ { + picked, err := reqFunc(context.Background()) + if err != nil && strings.Contains(err.Error(), "transport is closing") { + continue + } + if prev == "" { // first failover + if eps[0] == picked { + t.Fatalf("expected failover from %q, picked %q", eps[0], picked) + } + prev = picked + continue + } + if _, ok := available[picked]; !ok { + t.Fatalf("picked unavailable address %q (available %v)", picked, available) + } + if prev != picked { + switches++ + } + prev = picked + } + if switches < reqN-3 { // -3 for initial resolutions + failover + // TODO: FIX ME! + t.Skipf("expected balanced loads for %d requests, got switches %d", reqN, switches) + } + + // now failed server comes back + ms.StartAt(0) + + // enough time for reconnecting to recovered server + time.Sleep(time.Second) + + prev, switches = "", 0 + recoveredAddr, recovered := eps[0], 0 + available[recoveredAddr] = struct{}{} + + for i := 0; i < 2*reqN; i++ { + picked, err := reqFunc(context.Background()) + if err != nil { + t.Fatalf("#%d: unexpected failure %v", i, err) + } + if prev == "" { + prev = picked + continue + } + if _, ok := available[picked]; !ok { + t.Fatalf("#%d: picked unavailable address %q (available %v)", i, picked, available) + } + if prev != picked { + switches++ + } + if picked == recoveredAddr { + recovered++ + } + prev = picked + } + if switches < reqN-3 { // -3 for initial resolutions + t.Fatalf("expected balanced loads for %d requests, got switches %d", reqN, switches) + } + if recovered < reqN/serverCount { + t.Fatalf("recovered server %q got only %d requests", recoveredAddr, recovered) + } +} + +// TestRoundRobinBalancedResolvableFailoverFromRequestFail ensures that +// loads be rebalanced while some requests are failed. +func TestRoundRobinBalancedResolvableFailoverFromRequestFail(t *testing.T) { + serverCount := 5 + ms, err := mockserver.StartMockServers(serverCount) + if err != nil { + t.Fatalf("failed to start mock servers: %s", err) + } + defer ms.Stop() + var eps []string + available := make(map[string]struct{}) + for _, svr := range ms.Servers { + eps = append(eps, svr.ResolverAddress().Addr) + available[svr.Address] = struct{}{} + } + rsv, err := endpoint.NewResolverGroup("requestfail") + if err != nil { + t.Fatal(err) + } + defer rsv.Close() + rsv.SetEndpoints(eps) + + name := genName() + cfg := Config{ + Policy: picker.RoundrobinBalanced, + Name: name, + Logger: zap.NewExample(), + } + RegisterBuilder(cfg) + conn, err := grpc.Dial(fmt.Sprintf("endpoint://requestfail/mock.server"), grpc.WithInsecure(), grpc.WithBalancerName(name)) + if err != nil { + t.Fatalf("failed to dial mock server: %s", err) + } + defer conn.Close() + cli := pb.NewKVClient(conn) + + reqFunc := func(ctx context.Context) (picked string, err error) { + var p peer.Peer + _, err = cli.Range(ctx, &pb.RangeRequest{Key: []byte("/x")}, grpc.Peer(&p)) + if p.Addr != nil { + picked = p.Addr.String() + } + return picked, err + } + + reqN := 20 + prev, switches := "", 0 + for i := 0; i < reqN; i++ { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + if i%2 == 0 { + cancel() + } + picked, err := reqFunc(ctx) + if i%2 == 0 { + if s, ok := status.FromError(err); ok && s.Code() != codes.Canceled || picked != "" { + t.Fatalf("#%d: expected %v, got %v", i, context.Canceled, err) + } + continue + } + if prev == "" && picked != "" { + prev = picked + continue + } + if _, ok := available[picked]; !ok { + t.Fatalf("#%d: picked unavailable address %q (available %v)", i, picked, available) + } + if prev != picked { + switches++ + } + prev = picked + } + if switches < reqN/2-3 { // -3 for initial resolutions + failover + t.Fatalf("expected balanced loads for %d requests, got switches %d", reqN, switches) + } +} diff --git a/vendor/github.com/coreos/etcd/clientv3/balancer/connectivity/connectivity.go b/vendor/github.com/coreos/etcd/clientv3/balancer/connectivity/connectivity.go new file mode 100644 index 000000000..4c4ad363a --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/balancer/connectivity/connectivity.go @@ -0,0 +1,93 @@ +// Copyright 2019 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package connectivity implements client connectivity operations. +package connectivity + +import ( + "sync" + + "go.uber.org/zap" + "google.golang.org/grpc/connectivity" +) + +// Recorder records gRPC connectivity. +type Recorder interface { + GetCurrentState() connectivity.State + RecordTransition(oldState, newState connectivity.State) +} + +// New returns a new Recorder. +func New(lg *zap.Logger) Recorder { + return &recorder{lg: lg} +} + +// recorder takes the connectivity states of multiple SubConns +// and returns one aggregated connectivity state. +// ref. https://github.com/grpc/grpc-go/blob/master/balancer/balancer.go +type recorder struct { + lg *zap.Logger + + mu sync.RWMutex + + cur connectivity.State + + numReady uint64 // Number of addrConns in ready state. + numConnecting uint64 // Number of addrConns in connecting state. + numTransientFailure uint64 // Number of addrConns in transientFailure. +} + +func (rc *recorder) GetCurrentState() (state connectivity.State) { + rc.mu.RLock() + defer rc.mu.RUnlock() + return rc.cur +} + +// RecordTransition records state change happening in subConn and based on that +// it evaluates what aggregated state should be. +// +// - If at least one SubConn in Ready, the aggregated state is Ready; +// - Else if at least one SubConn in Connecting, the aggregated state is Connecting; +// - Else the aggregated state is TransientFailure. +// +// Idle and Shutdown are not considered. +// +// ref. https://github.com/grpc/grpc-go/blob/master/balancer/balancer.go +func (rc *recorder) RecordTransition(oldState, newState connectivity.State) { + rc.mu.Lock() + defer rc.mu.Unlock() + + for idx, state := range []connectivity.State{oldState, newState} { + updateVal := 2*uint64(idx) - 1 // -1 for oldState and +1 for new. + switch state { + case connectivity.Ready: + rc.numReady += updateVal + case connectivity.Connecting: + rc.numConnecting += updateVal + case connectivity.TransientFailure: + rc.numTransientFailure += updateVal + default: + rc.lg.Warn("connectivity recorder received unknown state", zap.String("connectivity-state", state.String())) + } + } + + switch { // must be exclusive, no overlap + case rc.numReady > 0: + rc.cur = connectivity.Ready + case rc.numConnecting > 0: + rc.cur = connectivity.Connecting + default: + rc.cur = connectivity.TransientFailure + } +} diff --git a/vendor/github.com/coreos/etcd/clientv3/balancer/picker/doc.go b/vendor/github.com/coreos/etcd/clientv3/balancer/picker/doc.go new file mode 100644 index 000000000..35dabf553 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/balancer/picker/doc.go @@ -0,0 +1,16 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package picker defines/implements client balancer picker policy. +package picker diff --git a/vendor/github.com/coreos/etcd/clientv3/balancer/picker/err.go b/vendor/github.com/coreos/etcd/clientv3/balancer/picker/err.go new file mode 100644 index 000000000..9e043789c --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/balancer/picker/err.go @@ -0,0 +1,39 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package picker + +import ( + "context" + + "google.golang.org/grpc/balancer" +) + +// NewErr returns a picker that always returns err on "Pick". +func NewErr(err error) Picker { + return &errPicker{p: Error, err: err} +} + +type errPicker struct { + p Policy + err error +} + +func (ep *errPicker) String() string { + return ep.p.String() +} + +func (ep *errPicker) Pick(context.Context, balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { + return nil, nil, ep.err +} diff --git a/vendor/github.com/coreos/etcd/clientv3/balancer/picker/picker.go b/vendor/github.com/coreos/etcd/clientv3/balancer/picker/picker.go new file mode 100644 index 000000000..bd1a5d25e --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/balancer/picker/picker.go @@ -0,0 +1,91 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package picker + +import ( + "fmt" + + "go.uber.org/zap" + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/resolver" +) + +// Picker defines balancer Picker methods. +type Picker interface { + balancer.Picker + String() string +} + +// Config defines picker configuration. +type Config struct { + // Policy specifies etcd clientv3's built in balancer policy. + Policy Policy + + // Logger defines picker logging object. + Logger *zap.Logger + + // SubConnToResolverAddress maps each gRPC sub-connection to an address. + // Basically, it is a list of addresses that the Picker can pick from. + SubConnToResolverAddress map[balancer.SubConn]resolver.Address +} + +// Policy defines balancer picker policy. +type Policy uint8 + +const ( + // Error is error picker policy. + Error Policy = iota + + // RoundrobinBalanced balances loads over multiple endpoints + // and implements failover in roundrobin fashion. + RoundrobinBalanced + + // Custom defines custom balancer picker. + // TODO: custom picker is not supported yet. + Custom +) + +func (p Policy) String() string { + switch p { + case Error: + return "picker-error" + + case RoundrobinBalanced: + return "picker-roundrobin-balanced" + + case Custom: + panic("'custom' picker policy is not supported yet") + + default: + panic(fmt.Errorf("invalid balancer picker policy (%d)", p)) + } +} + +// New creates a new Picker. +func New(cfg Config) Picker { + switch cfg.Policy { + case Error: + panic("'error' picker policy is not supported here; use 'picker.NewErr'") + + case RoundrobinBalanced: + return newRoundrobinBalanced(cfg) + + case Custom: + panic("'custom' picker policy is not supported yet") + + default: + panic(fmt.Errorf("invalid balancer picker policy (%d)", cfg.Policy)) + } +} diff --git a/vendor/github.com/coreos/etcd/clientv3/balancer/picker/roundrobin_balanced.go b/vendor/github.com/coreos/etcd/clientv3/balancer/picker/roundrobin_balanced.go new file mode 100644 index 000000000..1b8b28573 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/balancer/picker/roundrobin_balanced.go @@ -0,0 +1,95 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package picker + +import ( + "context" + "sync" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/resolver" +) + +// newRoundrobinBalanced returns a new roundrobin balanced picker. +func newRoundrobinBalanced(cfg Config) Picker { + scs := make([]balancer.SubConn, 0, len(cfg.SubConnToResolverAddress)) + for sc := range cfg.SubConnToResolverAddress { + scs = append(scs, sc) + } + return &rrBalanced{ + p: RoundrobinBalanced, + lg: cfg.Logger, + scs: scs, + scToAddr: cfg.SubConnToResolverAddress, + } +} + +type rrBalanced struct { + p Policy + + lg *zap.Logger + + mu sync.RWMutex + next int + scs []balancer.SubConn + scToAddr map[balancer.SubConn]resolver.Address +} + +func (rb *rrBalanced) String() string { return rb.p.String() } + +// Pick is called for every client request. +func (rb *rrBalanced) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { + rb.mu.RLock() + n := len(rb.scs) + rb.mu.RUnlock() + if n == 0 { + return nil, nil, balancer.ErrNoSubConnAvailable + } + + rb.mu.Lock() + cur := rb.next + sc := rb.scs[cur] + picked := rb.scToAddr[sc].Addr + rb.next = (rb.next + 1) % len(rb.scs) + rb.mu.Unlock() + + rb.lg.Debug( + "picked", + zap.String("picker", rb.p.String()), + zap.String("address", picked), + zap.Int("subconn-index", cur), + zap.Int("subconn-size", n), + ) + + doneFunc := func(info balancer.DoneInfo) { + // TODO: error handling? + fss := []zapcore.Field{ + zap.Error(info.Err), + zap.String("picker", rb.p.String()), + zap.String("address", picked), + zap.Bool("success", info.Err == nil), + zap.Bool("bytes-sent", info.BytesSent), + zap.Bool("bytes-received", info.BytesReceived), + } + if info.Err == nil { + rb.lg.Debug("balancer done", fss...) + } else { + rb.lg.Warn("balancer failed", fss...) + } + } + return sc, doneFunc, nil +} diff --git a/vendor/github.com/coreos/etcd/clientv3/balancer/resolver/endpoint/endpoint.go b/vendor/github.com/coreos/etcd/clientv3/balancer/resolver/endpoint/endpoint.go new file mode 100644 index 000000000..1f32039e3 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/balancer/resolver/endpoint/endpoint.go @@ -0,0 +1,240 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package endpoint resolves etcd entpoints using grpc targets of the form 'endpoint:///'. +package endpoint + +import ( + "fmt" + "net/url" + "strings" + "sync" + + "google.golang.org/grpc/resolver" +) + +const scheme = "endpoint" + +var ( + targetPrefix = fmt.Sprintf("%s://", scheme) + + bldr *builder +) + +func init() { + bldr = &builder{ + resolverGroups: make(map[string]*ResolverGroup), + } + resolver.Register(bldr) +} + +type builder struct { + mu sync.RWMutex + resolverGroups map[string]*ResolverGroup +} + +// NewResolverGroup creates a new ResolverGroup with the given id. +func NewResolverGroup(id string) (*ResolverGroup, error) { + return bldr.newResolverGroup(id) +} + +// ResolverGroup keeps all endpoints of resolvers using a common endpoint:/// target +// up-to-date. +type ResolverGroup struct { + mu sync.RWMutex + id string + endpoints []string + resolvers []*Resolver +} + +func (e *ResolverGroup) addResolver(r *Resolver) { + e.mu.Lock() + addrs := epsToAddrs(e.endpoints...) + e.resolvers = append(e.resolvers, r) + e.mu.Unlock() + r.cc.NewAddress(addrs) +} + +func (e *ResolverGroup) removeResolver(r *Resolver) { + e.mu.Lock() + for i, er := range e.resolvers { + if er == r { + e.resolvers = append(e.resolvers[:i], e.resolvers[i+1:]...) + break + } + } + e.mu.Unlock() +} + +// SetEndpoints updates the endpoints for ResolverGroup. All registered resolver are updated +// immediately with the new endpoints. +func (e *ResolverGroup) SetEndpoints(endpoints []string) { + addrs := epsToAddrs(endpoints...) + e.mu.Lock() + e.endpoints = endpoints + for _, r := range e.resolvers { + r.cc.NewAddress(addrs) + } + e.mu.Unlock() +} + +// Target constructs a endpoint target using the endpoint id of the ResolverGroup. +func (e *ResolverGroup) Target(endpoint string) string { + return Target(e.id, endpoint) +} + +// Target constructs a endpoint resolver target. +func Target(id, endpoint string) string { + return fmt.Sprintf("%s://%s/%s", scheme, id, endpoint) +} + +// IsTarget checks if a given target string in an endpoint resolver target. +func IsTarget(target string) bool { + return strings.HasPrefix(target, "endpoint://") +} + +func (e *ResolverGroup) Close() { + bldr.close(e.id) +} + +// Build creates or reuses an etcd resolver for the etcd cluster name identified by the authority part of the target. +func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { + if len(target.Authority) < 1 { + return nil, fmt.Errorf("'etcd' target scheme requires non-empty authority identifying etcd cluster being routed to") + } + id := target.Authority + es, err := b.getResolverGroup(id) + if err != nil { + return nil, fmt.Errorf("failed to build resolver: %v", err) + } + r := &Resolver{ + endpointID: id, + cc: cc, + } + es.addResolver(r) + return r, nil +} + +func (b *builder) newResolverGroup(id string) (*ResolverGroup, error) { + b.mu.RLock() + _, ok := b.resolverGroups[id] + b.mu.RUnlock() + if ok { + return nil, fmt.Errorf("Endpoint already exists for id: %s", id) + } + + es := &ResolverGroup{id: id} + b.mu.Lock() + b.resolverGroups[id] = es + b.mu.Unlock() + return es, nil +} + +func (b *builder) getResolverGroup(id string) (*ResolverGroup, error) { + b.mu.RLock() + es, ok := b.resolverGroups[id] + b.mu.RUnlock() + if !ok { + return nil, fmt.Errorf("ResolverGroup not found for id: %s", id) + } + return es, nil +} + +func (b *builder) close(id string) { + b.mu.Lock() + delete(b.resolverGroups, id) + b.mu.Unlock() +} + +func (b *builder) Scheme() string { + return scheme +} + +// Resolver provides a resolver for a single etcd cluster, identified by name. +type Resolver struct { + endpointID string + cc resolver.ClientConn + sync.RWMutex +} + +// TODO: use balancer.epsToAddrs +func epsToAddrs(eps ...string) (addrs []resolver.Address) { + addrs = make([]resolver.Address, 0, len(eps)) + for _, ep := range eps { + addrs = append(addrs, resolver.Address{Addr: ep}) + } + return addrs +} + +func (*Resolver) ResolveNow(o resolver.ResolveNowOption) {} + +func (r *Resolver) Close() { + es, err := bldr.getResolverGroup(r.endpointID) + if err != nil { + return + } + es.removeResolver(r) +} + +// ParseEndpoint endpoint parses an endpoint of the form +// (http|https)://*|(unix|unixs)://) +// and returns a protocol ('tcp' or 'unix'), +// host (or filepath if a unix socket), +// scheme (http, https, unix, unixs). +func ParseEndpoint(endpoint string) (proto string, host string, scheme string) { + proto = "tcp" + host = endpoint + url, uerr := url.Parse(endpoint) + if uerr != nil || !strings.Contains(endpoint, "://") { + return proto, host, scheme + } + scheme = url.Scheme + + // strip scheme:// prefix since grpc dials by host + host = url.Host + switch url.Scheme { + case "http", "https": + case "unix", "unixs": + proto = "unix" + host = url.Host + url.Path + default: + proto, host = "", "" + } + return proto, host, scheme +} + +// ParseTarget parses a endpoint:/// string and returns the parsed id and endpoint. +// If the target is malformed, an error is returned. +func ParseTarget(target string) (string, string, error) { + noPrefix := strings.TrimPrefix(target, targetPrefix) + if noPrefix == target { + return "", "", fmt.Errorf("malformed target, %s prefix is required: %s", targetPrefix, target) + } + parts := strings.SplitN(noPrefix, "/", 2) + if len(parts) != 2 { + return "", "", fmt.Errorf("malformed target, expected %s:///, but got %s", scheme, target) + } + return parts[0], parts[1], nil +} + +// ParseHostPort splits a ":" string into the host and port parts. +// The port part is optional. +func ParseHostPort(hostPort string) (host string, port string) { + parts := strings.SplitN(hostPort, ":", 2) + host = parts[0] + if len(parts) > 1 { + port = parts[1] + } + return host, port +} diff --git a/vendor/github.com/coreos/etcd/clientv3/balancer/utils.go b/vendor/github.com/coreos/etcd/clientv3/balancer/utils.go new file mode 100644 index 000000000..48eb87507 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/balancer/utils.go @@ -0,0 +1,68 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package balancer + +import ( + "fmt" + "net/url" + "sort" + "sync/atomic" + "time" + + "google.golang.org/grpc/balancer" + "google.golang.org/grpc/resolver" +) + +func scToString(sc balancer.SubConn) string { + return fmt.Sprintf("%p", sc) +} + +func scsToStrings(scs map[balancer.SubConn]resolver.Address) (ss []string) { + ss = make([]string, 0, len(scs)) + for sc, a := range scs { + ss = append(ss, fmt.Sprintf("%s (%s)", a.Addr, scToString(sc))) + } + sort.Strings(ss) + return ss +} + +func addrsToStrings(addrs []resolver.Address) (ss []string) { + ss = make([]string, len(addrs)) + for i := range addrs { + ss[i] = addrs[i].Addr + } + sort.Strings(ss) + return ss +} + +func epsToAddrs(eps ...string) (addrs []resolver.Address) { + addrs = make([]resolver.Address, 0, len(eps)) + for _, ep := range eps { + u, err := url.Parse(ep) + if err != nil { + addrs = append(addrs, resolver.Address{Addr: ep, Type: resolver.Backend}) + continue + } + addrs = append(addrs, resolver.Address{Addr: u.Host, Type: resolver.Backend}) + } + return addrs +} + +var genN = new(uint32) + +func genName() string { + now := time.Now().UnixNano() + return fmt.Sprintf("%X%X", now, atomic.AddUint32(genN, 1)) +} diff --git a/vendor/github.com/coreos/etcd/clientv3/balancer/utils_test.go b/vendor/github.com/coreos/etcd/clientv3/balancer/utils_test.go new file mode 100644 index 000000000..e58cd3495 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/balancer/utils_test.go @@ -0,0 +1,34 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package balancer + +import ( + "reflect" + "testing" + + "google.golang.org/grpc/resolver" +) + +func Test_epsToAddrs(t *testing.T) { + eps := []string{"https://example.com:2379", "127.0.0.1:2379"} + exp := []resolver.Address{ + {Addr: "example.com:2379", Type: resolver.Backend}, + {Addr: "127.0.0.1:2379", Type: resolver.Backend}, + } + rs := epsToAddrs(eps...) + if !reflect.DeepEqual(rs, exp) { + t.Fatalf("expected %v, got %v", exp, rs) + } +} diff --git a/vendor/github.com/coreos/etcd/clientv3/client.go b/vendor/github.com/coreos/etcd/clientv3/client.go index 713280776..64ac2da15 100644 --- a/vendor/github.com/coreos/etcd/clientv3/client.go +++ b/vendor/github.com/coreos/etcd/clientv3/client.go @@ -16,21 +16,26 @@ package clientv3 import ( "context" - "crypto/tls" "errors" "fmt" "net" - "net/url" + "os" "strconv" "strings" "sync" "time" + "github.com/google/uuid" + "github.com/coreos/etcd/clientv3/balancer" + "github.com/coreos/etcd/clientv3/balancer/picker" + "github.com/coreos/etcd/clientv3/balancer/resolver/endpoint" + "github.com/coreos/etcd/clientv3/credentials" "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" - + "github.com/coreos/etcd/pkg/logutil" + "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" + grpccredentials "google.golang.org/grpc/credentials" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" @@ -39,8 +44,31 @@ import ( var ( ErrNoAvailableEndpoints = errors.New("etcdclient: no available endpoints") ErrOldCluster = errors.New("etcdclient: old cluster version") + + roundRobinBalancerName = fmt.Sprintf("etcd-%s", picker.RoundrobinBalanced.String()) ) +func init() { + lg := zap.NewNop() + if os.Getenv("ETCD_CLIENT_DEBUG") != "" { + lcfg := logutil.DefaultZapLoggerConfig + lcfg.Level = zap.NewAtomicLevelAt(zap.DebugLevel) + + var err error + lg, err = lcfg.Build() // info level logging + if err != nil { + panic(err) + } + } + + // TODO: support custom balancer + balancer.RegisterBuilder(balancer.Config{ + Policy: picker.RoundrobinBalanced, + Name: roundRobinBalancerName, + Logger: lg, + }) +} + // Client provides and manages an etcd v3 client session. type Client struct { Cluster @@ -50,13 +78,12 @@ type Client struct { Auth Maintenance - conn *grpc.ClientConn - dialerrc chan error + conn *grpc.ClientConn - cfg Config - creds *credentials.TransportCredentials - balancer *healthBalancer - mu *sync.Mutex + cfg Config + creds grpccredentials.TransportCredentials + resolverGroup *endpoint.ResolverGroup + mu *sync.RWMutex ctx context.Context cancel context.CancelFunc @@ -64,11 +91,12 @@ type Client struct { // Username is a user name for authentication. Username string // Password is a password for authentication. - Password string - // tokenCred is an instance of WithPerRPCCredentials()'s argument - tokenCred *authTokenCredential + Password string + authTokenBundle credentials.Bundle callOpts []grpc.CallOption + + lg *zap.Logger } // New creates a new etcdv3 client from a given configuration. @@ -93,11 +121,19 @@ func NewFromURL(url string) (*Client, error) { return New(Config{Endpoints: []string{url}}) } +// NewFromURLs creates a new etcdv3 client from URLs. +func NewFromURLs(urls []string) (*Client, error) { + return New(Config{Endpoints: urls}) +} + // Close shuts down the client's etcd connections. func (c *Client) Close() error { c.cancel() c.Watcher.Close() c.Lease.Close() + if c.resolverGroup != nil { + c.resolverGroup.Close() + } if c.conn != nil { return toErr(c.ctx, c.conn.Close()) } @@ -110,32 +146,21 @@ func (c *Client) Close() error { func (c *Client) Ctx() context.Context { return c.ctx } // Endpoints lists the registered endpoints for the client. -func (c *Client) Endpoints() (eps []string) { +func (c *Client) Endpoints() []string { // copy the slice; protect original endpoints from being changed - eps = make([]string, len(c.cfg.Endpoints)) + c.mu.RLock() + defer c.mu.RUnlock() + eps := make([]string, len(c.cfg.Endpoints)) copy(eps, c.cfg.Endpoints) - return + return eps } // SetEndpoints updates client's endpoints. func (c *Client) SetEndpoints(eps ...string) { c.mu.Lock() + defer c.mu.Unlock() c.cfg.Endpoints = eps - c.mu.Unlock() - c.balancer.updateAddrs(eps...) - - // updating notifyCh can trigger new connections, - // need update addrs if all connections are down - // or addrs does not include pinAddr. - c.balancer.mu.RLock() - update := !hasAddr(c.balancer.addrs, c.balancer.pinAddr) - c.balancer.mu.RUnlock() - if update { - select { - case c.balancer.updateAddrsC <- notifyNext: - case <-c.balancer.stopc: - } - } + c.resolverGroup.SetEndpoints(eps) } // Sync synchronizes client's endpoints with the known endpoints from the etcd membership. @@ -166,52 +191,13 @@ func (c *Client) autoSync() { err := c.Sync(ctx) cancel() if err != nil && err != c.ctx.Err() { - logger.Println("Auto sync endpoints failed:", err) + lg.Lvl(4).Infof("Auto sync endpoints failed: %v", err) } } } } -type authTokenCredential struct { - token string - tokenMu *sync.RWMutex -} - -func (cred authTokenCredential) RequireTransportSecurity() bool { - return false -} - -func (cred authTokenCredential) GetRequestMetadata(ctx context.Context, s ...string) (map[string]string, error) { - cred.tokenMu.RLock() - defer cred.tokenMu.RUnlock() - return map[string]string{ - "token": cred.token, - }, nil -} - -func parseEndpoint(endpoint string) (proto string, host string, scheme string) { - proto = "tcp" - host = endpoint - url, uerr := url.Parse(endpoint) - if uerr != nil || !strings.Contains(endpoint, "://") { - return proto, host, scheme - } - scheme = url.Scheme - - // strip scheme:// prefix since grpc dials by host - host = url.Host - switch url.Scheme { - case "http", "https": - case "unix", "unixs": - proto = "unix" - host = url.Host + url.Path - default: - proto, host = "", "" - } - return proto, host, scheme -} - -func (c *Client) processCreds(scheme string) (creds *credentials.TransportCredentials) { +func (c *Client) processCreds(scheme string) (creds grpccredentials.TransportCredentials) { creds = c.creds switch scheme { case "unix": @@ -221,83 +207,87 @@ func (c *Client) processCreds(scheme string) (creds *credentials.TransportCreden if creds != nil { break } - tlsconfig := &tls.Config{} - emptyCreds := credentials.NewTLS(tlsconfig) - creds = &emptyCreds + creds = credentials.NewBundle(credentials.Config{}).TransportCredentials() default: creds = nil } return creds } -// dialSetupOpts gives the dial opts prior to any authentication -func (c *Client) dialSetupOpts(endpoint string, dopts ...grpc.DialOption) (opts []grpc.DialOption) { - if c.cfg.DialTimeout > 0 { - opts = []grpc.DialOption{grpc.WithTimeout(c.cfg.DialTimeout)} - } +// dialSetupOpts gives the dial opts prior to any authentication. +func (c *Client) dialSetupOpts(creds grpccredentials.TransportCredentials, dopts ...grpc.DialOption) (opts []grpc.DialOption, err error) { if c.cfg.DialKeepAliveTime > 0 { params := keepalive.ClientParameters{ - Time: c.cfg.DialKeepAliveTime, - Timeout: c.cfg.DialKeepAliveTimeout, + Time: c.cfg.DialKeepAliveTime, + Timeout: c.cfg.DialKeepAliveTimeout, + PermitWithoutStream: c.cfg.PermitWithoutStream, } opts = append(opts, grpc.WithKeepaliveParams(params)) } opts = append(opts, dopts...) - f := func(host string, t time.Duration) (net.Conn, error) { - proto, host, _ := parseEndpoint(c.balancer.endpoint(host)) - if host == "" && endpoint != "" { - // dialing an endpoint not in the balancer; use - // endpoint passed into dial - proto, host, _ = parseEndpoint(endpoint) - } - if proto == "" { - return nil, fmt.Errorf("unknown scheme for %q", host) - } + // Provide a net dialer that supports cancelation and timeout. + f := func(dialEp string, t time.Duration) (net.Conn, error) { + proto, host, _ := endpoint.ParseEndpoint(dialEp) select { case <-c.ctx.Done(): return nil, c.ctx.Err() default: } dialer := &net.Dialer{Timeout: t} - conn, err := dialer.DialContext(c.ctx, proto, host) - if err != nil { - select { - case c.dialerrc <- err: - default: - } - } - return conn, err + return dialer.DialContext(c.ctx, proto, host) } opts = append(opts, grpc.WithDialer(f)) - creds := c.creds - if _, _, scheme := parseEndpoint(endpoint); len(scheme) != 0 { - creds = c.processCreds(scheme) - } if creds != nil { - opts = append(opts, grpc.WithTransportCredentials(*creds)) + opts = append(opts, grpc.WithTransportCredentials(creds)) } else { opts = append(opts, grpc.WithInsecure()) } - return opts + // Interceptor retry and backoff. + // TODO: Replace all of clientv3/retry.go with interceptor based retry, or with + // https://github.com/grpc/proposal/blob/master/A6-client-retries.md#retry-policy + // once it is available. + rrBackoff := withBackoff(c.roundRobinQuorumBackoff(defaultBackoffWaitBetween, defaultBackoffJitterFraction)) + opts = append(opts, + // Disable stream retry by default since go-grpc-middleware/retry does not support client streams. + // Streams that are safe to retry are enabled individually. + grpc.WithStreamInterceptor(c.streamClientInterceptor(c.lg, withMax(0), rrBackoff)), + grpc.WithUnaryInterceptor(c.unaryClientInterceptor(c.lg, withMax(defaultUnaryMaxRetries), rrBackoff)), + ) + + return opts, nil } // Dial connects to a single endpoint using the client's config. -func (c *Client) Dial(endpoint string) (*grpc.ClientConn, error) { - return c.dial(endpoint) +func (c *Client) Dial(ep string) (*grpc.ClientConn, error) { + creds := c.directDialCreds(ep) + // Use the grpc passthrough resolver to directly dial a single endpoint. + // This resolver passes through the 'unix' and 'unixs' endpoints schemes used + // by etcd without modification, allowing us to directly dial endpoints and + // using the same dial functions that we use for load balancer dialing. + return c.dial(fmt.Sprintf("passthrough:///%s", ep), creds) } func (c *Client) getToken(ctx context.Context) error { var err error // return last error in a case of fail var auth *authenticator - for i := 0; i < len(c.cfg.Endpoints); i++ { - endpoint := c.cfg.Endpoints[i] - host := getHost(endpoint) + eps := c.Endpoints() + for _, ep := range eps { // use dial options without dopts to avoid reusing the client balancer - auth, err = newAuthenticator(host, c.dialSetupOpts(endpoint), c) + var dOpts []grpc.DialOption + _, host, _ := endpoint.ParseEndpoint(ep) + target := c.resolverGroup.Target(host) + creds := c.dialWithBalancerCreds(ep) + dOpts, err = c.dialSetupOpts(creds, c.cfg.DialOptions...) + if err != nil { + err = fmt.Errorf("failed to configure auth dialer: %v", err) + continue + } + dOpts = append(dOpts, grpc.WithBalancerName(roundRobinBalancerName)) + auth, err = newAuthenticator(ctx, target, dOpts, c) if err != nil { continue } @@ -306,56 +296,102 @@ func (c *Client) getToken(ctx context.Context) error { var resp *AuthenticateResponse resp, err = auth.authenticate(ctx, c.Username, c.Password) if err != nil { + // return err without retrying other endpoints + if err == rpctypes.ErrAuthNotEnabled { + return err + } continue } - c.tokenCred.tokenMu.Lock() - c.tokenCred.token = resp.Token - c.tokenCred.tokenMu.Unlock() - + c.authTokenBundle.UpdateAuthToken(resp.Token) return nil } return err } -func (c *Client) dial(endpoint string, dopts ...grpc.DialOption) (*grpc.ClientConn, error) { - opts := c.dialSetupOpts(endpoint, dopts...) - host := getHost(endpoint) +// dialWithBalancer dials the client's current load balanced resolver group. The scheme of the host +// of the provided endpoint determines the scheme used for all endpoints of the client connection. +func (c *Client) dialWithBalancer(ep string, dopts ...grpc.DialOption) (*grpc.ClientConn, error) { + _, host, _ := endpoint.ParseEndpoint(ep) + target := c.resolverGroup.Target(host) + creds := c.dialWithBalancerCreds(ep) + return c.dial(target, creds, dopts...) +} + +// dial configures and dials any grpc balancer target. +func (c *Client) dial(target string, creds grpccredentials.TransportCredentials, dopts ...grpc.DialOption) (*grpc.ClientConn, error) { + opts, err := c.dialSetupOpts(creds, dopts...) + if err != nil { + return nil, fmt.Errorf("failed to configure dialer: %v", err) + } + if c.Username != "" && c.Password != "" { - c.tokenCred = &authTokenCredential{ - tokenMu: &sync.RWMutex{}, - } + c.authTokenBundle = credentials.NewBundle(credentials.Config{}) - ctx := c.ctx + ctx, cancel := c.ctx, func() {} if c.cfg.DialTimeout > 0 { - cctx, cancel := context.WithTimeout(ctx, c.cfg.DialTimeout) - defer cancel() - ctx = cctx + ctx, cancel = context.WithTimeout(ctx, c.cfg.DialTimeout) } - err := c.getToken(ctx) + err = c.getToken(ctx) if err != nil { if toErr(ctx, err) != rpctypes.ErrAuthNotEnabled { if err == ctx.Err() && ctx.Err() != c.ctx.Err() { err = context.DeadlineExceeded } + cancel() return nil, err } } else { - opts = append(opts, grpc.WithPerRPCCredentials(c.tokenCred)) + opts = append(opts, grpc.WithPerRPCCredentials(c.authTokenBundle.PerRPCCredentials())) } + cancel() } opts = append(opts, c.cfg.DialOptions...) - conn, err := grpc.DialContext(c.ctx, host, opts...) + dctx := c.ctx + if c.cfg.DialTimeout > 0 { + var cancel context.CancelFunc + dctx, cancel = context.WithTimeout(c.ctx, c.cfg.DialTimeout) + defer cancel() // TODO: Is this right for cases where grpc.WithBlock() is not set on the dial options? + } + + conn, err := grpc.DialContext(dctx, target, opts...) if err != nil { return nil, err } return conn, nil } +func (c *Client) directDialCreds(ep string) grpccredentials.TransportCredentials { + _, hostPort, scheme := endpoint.ParseEndpoint(ep) + creds := c.creds + if len(scheme) != 0 { + creds = c.processCreds(scheme) + if creds != nil { + clone := creds.Clone() + // Set the server name must to the endpoint hostname without port since grpc + // otherwise attempts to check if x509 cert is valid for the full endpoint + // including the scheme and port, which fails. + host, _ := endpoint.ParseHostPort(hostPort) + clone.OverrideServerName(host) + creds = clone + } + } + return creds +} + +func (c *Client) dialWithBalancerCreds(ep string) grpccredentials.TransportCredentials { + _, _, scheme := endpoint.ParseEndpoint(ep) + creds := c.creds + if len(scheme) != 0 { + creds = c.processCreds(scheme) + } + return creds +} + // WithRequireLeader requires client requests to only succeed // when the cluster has a leader. func WithRequireLeader(ctx context.Context) context.Context { @@ -367,10 +403,9 @@ func newClient(cfg *Config) (*Client, error) { if cfg == nil { cfg = &Config{} } - var creds *credentials.TransportCredentials + var creds grpccredentials.TransportCredentials if cfg.TLS != nil { - c := credentials.NewTLS(cfg.TLS) - creds = &c + creds = credentials.NewBundle(credentials.Config{TLSConfig: cfg.TLS}).TransportCredentials() } // use a temporary skeleton client to bootstrap first connection @@ -382,14 +417,24 @@ func newClient(cfg *Config) (*Client, error) { ctx, cancel := context.WithCancel(baseCtx) client := &Client{ conn: nil, - dialerrc: make(chan error, 1), cfg: *cfg, creds: creds, ctx: ctx, cancel: cancel, - mu: new(sync.Mutex), + mu: new(sync.RWMutex), callOpts: defaultCallOpts, } + + lcfg := logutil.DefaultZapLoggerConfig + if cfg.LogConfig != nil { + lcfg = *cfg.LogConfig + } + var err error + client.lg, err = lcfg.Build() + if err != nil { + return nil, err + } + if cfg.Username != "" && cfg.Password != "" { client.Username = cfg.Username client.Password = cfg.Password @@ -412,43 +457,32 @@ func newClient(cfg *Config) (*Client, error) { client.callOpts = callOpts } - client.balancer = newHealthBalancer(cfg.Endpoints, cfg.DialTimeout, func(ep string) (bool, error) { - return grpcHealthCheck(client, ep) - }) + // Prepare a 'endpoint:///' resolver for the client and create a endpoint target to pass + // to dial so the client knows to use this resolver. + client.resolverGroup, err = endpoint.NewResolverGroup(fmt.Sprintf("client-%s", uuid.New().String())) + if err != nil { + client.cancel() + return nil, err + } + client.resolverGroup.SetEndpoints(cfg.Endpoints) - // use Endpoints[0] so that for https:// without any tls config given, then + if len(cfg.Endpoints) < 1 { + return nil, fmt.Errorf("at least one Endpoint must is required in client config") + } + dialEndpoint := cfg.Endpoints[0] + + // Use a provided endpoint target so that for https:// without any tls config given, then // grpc will assume the certificate server name is the endpoint host. - conn, err := client.dial(cfg.Endpoints[0], grpc.WithBalancer(client.balancer)) + conn, err := client.dialWithBalancer(dialEndpoint, grpc.WithBalancerName(roundRobinBalancerName)) if err != nil { client.cancel() - client.balancer.Close() + client.resolverGroup.Close() return nil, err } + // TODO: With the old grpc balancer interface, we waited until the dial timeout + // for the balancer to be ready. Is there an equivalent wait we should do with the new grpc balancer interface? client.conn = conn - // wait for a connection - if cfg.DialTimeout > 0 { - hasConn := false - waitc := time.After(cfg.DialTimeout) - select { - case <-client.balancer.ready(): - hasConn = true - case <-ctx.Done(): - case <-waitc: - } - if !hasConn { - err := context.DeadlineExceeded - select { - case err = <-client.dialerrc: - default: - } - client.cancel() - client.balancer.Close() - conn.Close() - return nil, err - } - } - client.Cluster = NewCluster(client) client.KV = NewKV(client) client.Lease = NewLease(client) @@ -467,15 +501,35 @@ func newClient(cfg *Config) (*Client, error) { return client, nil } +// roundRobinQuorumBackoff retries against quorum between each backoff. +// This is intended for use with a round robin load balancer. +func (c *Client) roundRobinQuorumBackoff(waitBetween time.Duration, jitterFraction float64) backoffFunc { + return func(attempt uint) time.Duration { + // after each round robin across quorum, backoff for our wait between duration + n := uint(len(c.Endpoints())) + quorum := (n/2 + 1) + if attempt%quorum == 0 { + c.lg.Debug("backoff", zap.Uint("attempt", attempt), zap.Uint("quorum", quorum), zap.Duration("waitBetween", waitBetween), zap.Float64("jitterFraction", jitterFraction)) + return jitterUp(waitBetween, jitterFraction) + } + c.lg.Debug("backoff skipped", zap.Uint("attempt", attempt), zap.Uint("quorum", quorum)) + return 0 + } +} + func (c *Client) checkVersion() (err error) { var wg sync.WaitGroup - errc := make(chan error, len(c.cfg.Endpoints)) + + eps := c.Endpoints() + errc := make(chan error, len(eps)) ctx, cancel := context.WithCancel(c.ctx) if c.cfg.DialTimeout > 0 { - ctx, cancel = context.WithTimeout(ctx, c.cfg.DialTimeout) + cancel() + ctx, cancel = context.WithTimeout(c.ctx, c.cfg.DialTimeout) } - wg.Add(len(c.cfg.Endpoints)) - for _, ep := range c.cfg.Endpoints { + + wg.Add(len(eps)) + for _, ep := range eps { // if cluster is current, any endpoint gives a recent version go func(e string) { defer wg.Done() @@ -487,8 +541,15 @@ func (c *Client) checkVersion() (err error) { vs := strings.Split(resp.Version, ".") maj, min := 0, 0 if len(vs) >= 2 { - maj, _ = strconv.Atoi(vs[0]) - min, rerr = strconv.Atoi(vs[1]) + var serr error + if maj, serr = strconv.Atoi(vs[0]); serr != nil { + errc <- serr + return + } + if min, serr = strconv.Atoi(vs[1]); serr != nil { + errc <- serr + return + } } if maj < 3 || (maj == 3 && min < 2) { rerr = ErrOldCluster @@ -497,7 +558,7 @@ func (c *Client) checkVersion() (err error) { }(ep) } // wait for success - for i := 0; i < len(c.cfg.Endpoints); i++ { + for range eps { if err = <-errc; err == nil { break } @@ -537,10 +598,13 @@ func isUnavailableErr(ctx context.Context, err error) bool { if err == nil { return false } - ev, _ := status.FromError(err) - // Unavailable codes mean the system will be right back. - // (e.g., can't connect, lost leader) - return ev.Code() == codes.Unavailable + ev, ok := status.FromError(err) + if ok { + // Unavailable codes mean the system will be right back. + // (e.g., can't connect, lost leader) + return ev.Code() == codes.Unavailable + } + return false } func toErr(ctx context.Context, err error) error { @@ -551,18 +615,16 @@ func toErr(ctx context.Context, err error) error { if _, ok := err.(rpctypes.EtcdError); ok { return err } - ev, _ := status.FromError(err) - code := ev.Code() - switch code { - case codes.DeadlineExceeded: - fallthrough - case codes.Canceled: - if ctx.Err() != nil { - err = ctx.Err() + if ev, ok := status.FromError(err); ok { + code := ev.Code() + switch code { + case codes.DeadlineExceeded: + fallthrough + case codes.Canceled: + if ctx.Err() != nil { + err = ctx.Err() + } } - case codes.Unavailable: - case codes.FailedPrecondition: - err = grpc.ErrClientConnClosing } return err } @@ -574,3 +636,26 @@ func canceledByCaller(stopCtx context.Context, err error) bool { return err == context.Canceled || err == context.DeadlineExceeded } + +// IsConnCanceled returns true, if error is from a closed gRPC connection. +// ref. https://github.com/grpc/grpc-go/pull/1854 +func IsConnCanceled(err error) bool { + if err == nil { + return false + } + + // >= gRPC v1.23.x + s, ok := status.FromError(err) + if ok { + // connection is canceled or server has already closed the connection + return s.Code() == codes.Canceled || s.Message() == "transport is closing" + } + + // >= gRPC v1.10.x + if err == context.Canceled { + return true + } + + // <= gRPC v1.7.x returns 'errors.New("grpc: the client connection is closing")' + return strings.Contains(err.Error(), "grpc: the client connection is closing") +} diff --git a/vendor/github.com/coreos/etcd/clientv3/client_test.go b/vendor/github.com/coreos/etcd/clientv3/client_test.go index d09e64330..31ffbbac0 100644 --- a/vendor/github.com/coreos/etcd/clientv3/client_test.go +++ b/vendor/github.com/coreos/etcd/clientv3/client_test.go @@ -23,6 +23,7 @@ import ( "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" "github.com/coreos/etcd/pkg/testutil" + "google.golang.org/grpc" ) func TestDialCancel(t *testing.T) { @@ -83,11 +84,13 @@ func TestDialTimeout(t *testing.T) { testCfgs := []Config{ { Endpoints: []string{"http://254.0.0.1:12345"}, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, DialTimeout: 2 * time.Second, }, { Endpoints: []string{"http://254.0.0.1:12345"}, DialTimeout: time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, Username: "abc", Password: "def", }, diff --git a/vendor/github.com/coreos/etcd/clientv3/concurrency/election.go b/vendor/github.com/coreos/etcd/clientv3/concurrency/election.go index e18a0ed4a..20160472a 100644 --- a/vendor/github.com/coreos/etcd/clientv3/concurrency/election.go +++ b/vendor/github.com/coreos/etcd/clientv3/concurrency/election.go @@ -49,6 +49,7 @@ func NewElection(s *Session, pfx string) *Election { func ResumeElection(s *Session, pfx string, leaderKey string, leaderRev int64) *Election { return &Election{ session: s, + keyPrefix: pfx, leaderKey: leaderKey, leaderRev: leaderRev, leaderSession: s, diff --git a/vendor/github.com/coreos/etcd/clientv3/concurrency/election_test.go b/vendor/github.com/coreos/etcd/clientv3/concurrency/election_test.go new file mode 100644 index 000000000..e320525d6 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/concurrency/election_test.go @@ -0,0 +1,114 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package concurrency_test + +import ( + "context" + "log" + "testing" + "time" + "strings" + + "github.com/coreos/etcd/clientv3" + "github.com/coreos/etcd/clientv3/concurrency" +) + +func TestResumeElection(t *testing.T) { + const prefix = "/resume-election/" + + cli, err := clientv3.New(clientv3.Config{Endpoints: endpoints}) + if err != nil { + log.Fatal(err) + } + defer cli.Close() + + s, err := concurrency.NewSession(cli) + if err != nil { + log.Fatal(err) + } + defer s.Close() + + e := concurrency.NewElection(s, prefix) + + // Entire test should never take more than 10 seconds + ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) + defer cancel() + + // Become leader + if err := e.Campaign(ctx, "candidate1"); err != nil { + t.Fatalf("Campaign() returned non nil err: %s", err) + } + + // Get the leadership details of the current election + leader, err := e.Leader(ctx) + if err != nil { + t.Fatalf("Leader() returned non nil err: %s", err) + } + + // Recreate the election + e = concurrency.ResumeElection(s, prefix, + string(leader.Kvs[0].Key), leader.Kvs[0].CreateRevision) + + respChan := make(chan *clientv3.GetResponse) + go func() { + o := e.Observe(ctx) + respChan <- nil + for { + select { + case resp, ok := <-o: + if !ok { + t.Fatal("Observe() channel closed prematurely") + } + // Ignore any observations that candidate1 was elected + if string(resp.Kvs[0].Value) == "candidate1" { + continue + } + respChan <- &resp + return + } + } + }() + + // Wait until observe goroutine is running + <-respChan + + // Put some random data to generate a change event, this put should be + // ignored by Observe() because it is not under the election prefix. + _, err = cli.Put(ctx, "foo", "bar") + if err != nil { + t.Fatalf("Put('foo') returned non nil err: %s", err) + } + + // Resign as leader + if err := e.Resign(ctx); err != nil { + t.Fatalf("Resign() returned non nil err: %s", err) + } + + // Elect a different candidate + if err := e.Campaign(ctx, "candidate2"); err != nil { + t.Fatalf("Campaign() returned non nil err: %s", err) + } + + // Wait for observed leader change + resp := <-respChan + + kv := resp.Kvs[0] + if !strings.HasPrefix(string(kv.Key), prefix) { + t.Errorf("expected observed election to have prefix '%s' got '%s'", prefix, string(kv.Key)) + } + if string(kv.Value) != "candidate2" { + t.Errorf("expected new leader to be 'candidate1' got '%s'", string(kv.Value)) + } +} diff --git a/vendor/github.com/coreos/etcd/clientv3/config.go b/vendor/github.com/coreos/etcd/clientv3/config.go index 79d6e2a98..9c17fc252 100644 --- a/vendor/github.com/coreos/etcd/clientv3/config.go +++ b/vendor/github.com/coreos/etcd/clientv3/config.go @@ -19,6 +19,7 @@ import ( "crypto/tls" "time" + "go.uber.org/zap" "google.golang.org/grpc" ) @@ -67,9 +68,19 @@ type Config struct { RejectOldCluster bool `json:"reject-old-cluster"` // DialOptions is a list of dial options for the grpc client (e.g., for interceptors). + // For example, pass "grpc.WithBlock()" to block until the underlying connection is up. + // Without this, Dial returns immediately and connecting the server happens in background. DialOptions []grpc.DialOption + // LogConfig configures client-side logger. + // If nil, use the default logger. + // TODO: configure gRPC logger + LogConfig *zap.Config + // Context is the default client context; it can be used to cancel grpc dial out and // other operations that do not have an explicit context. Context context.Context + + // PermitWithoutStream when set will allow client to send keepalive pings to server without any active streams(RPCs). + PermitWithoutStream bool `json:"permit-without-stream"` } diff --git a/vendor/github.com/coreos/etcd/clientv3/credentials/credentials.go b/vendor/github.com/coreos/etcd/clientv3/credentials/credentials.go new file mode 100644 index 000000000..e5a55667f --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/credentials/credentials.go @@ -0,0 +1,155 @@ +// Copyright 2019 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package credentials implements gRPC credential interface with etcd specific logic. +// e.g., client handshake with custom authority parameter +package credentials + +import ( + "context" + "crypto/tls" + "net" + "sync" + + "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" + grpccredentials "google.golang.org/grpc/credentials" +) + +// Config defines gRPC credential configuration. +type Config struct { + TLSConfig *tls.Config +} + +// Bundle defines gRPC credential interface. +type Bundle interface { + grpccredentials.Bundle + UpdateAuthToken(token string) +} + +// NewBundle constructs a new gRPC credential bundle. +func NewBundle(cfg Config) Bundle { + return &bundle{ + tc: newTransportCredential(cfg.TLSConfig), + rc: newPerRPCCredential(), + } +} + +// bundle implements "grpccredentials.Bundle" interface. +type bundle struct { + tc *transportCredential + rc *perRPCCredential +} + +func (b *bundle) TransportCredentials() grpccredentials.TransportCredentials { + return b.tc +} + +func (b *bundle) PerRPCCredentials() grpccredentials.PerRPCCredentials { + return b.rc +} + +func (b *bundle) NewWithMode(mode string) (grpccredentials.Bundle, error) { + // no-op + return nil, nil +} + +// transportCredential implements "grpccredentials.TransportCredentials" interface. +type transportCredential struct { + gtc grpccredentials.TransportCredentials +} + +func newTransportCredential(cfg *tls.Config) *transportCredential { + return &transportCredential{ + gtc: grpccredentials.NewTLS(cfg), + } +} + +func (tc *transportCredential) ClientHandshake(ctx context.Context, authority string, rawConn net.Conn) (net.Conn, grpccredentials.AuthInfo, error) { + // Only overwrite when authority is an IP address! + // Let's say, a server runs SRV records on "etcd.local" that resolves + // to "m1.etcd.local", and its SAN field also includes "m1.etcd.local". + // But what if SAN does not include its resolved IP address (e.g. 127.0.0.1)? + // Then, the server should only authenticate using its DNS hostname "m1.etcd.local", + // instead of overwriting it with its IP address. + // And we do not overwrite "localhost" either. Only overwrite IP addresses! + if isIP(authority) { + target := rawConn.RemoteAddr().String() + if authority != target { + // When user dials with "grpc.WithDialer", "grpc.DialContext" "cc.parsedTarget" + // update only happens once. This is problematic, because when TLS is enabled, + // retries happen through "grpc.WithDialer" with static "cc.parsedTarget" from + // the initial dial call. + // If the server authenticates by IP addresses, we want to set a new endpoint as + // a new authority. Otherwise + // "transport: authentication handshake failed: x509: certificate is valid for 127.0.0.1, 192.168.121.180, not 192.168.223.156" + // when the new dial target is "192.168.121.180" whose certificate host name is also "192.168.121.180" + // but client tries to authenticate with previously set "cc.parsedTarget" field "192.168.223.156" + authority = target + } + } + return tc.gtc.ClientHandshake(ctx, authority, rawConn) +} + +// return true if given string is an IP. +func isIP(ep string) bool { + return net.ParseIP(ep) != nil +} + +func (tc *transportCredential) ServerHandshake(rawConn net.Conn) (net.Conn, grpccredentials.AuthInfo, error) { + return tc.gtc.ServerHandshake(rawConn) +} + +func (tc *transportCredential) Info() grpccredentials.ProtocolInfo { + return tc.gtc.Info() +} + +func (tc *transportCredential) Clone() grpccredentials.TransportCredentials { + return &transportCredential{ + gtc: tc.gtc.Clone(), + } +} + +func (tc *transportCredential) OverrideServerName(serverNameOverride string) error { + return tc.gtc.OverrideServerName(serverNameOverride) +} + +// perRPCCredential implements "grpccredentials.PerRPCCredentials" interface. +type perRPCCredential struct { + authToken string + authTokenMu sync.RWMutex +} + +func newPerRPCCredential() *perRPCCredential { return &perRPCCredential{} } + +func (rc *perRPCCredential) RequireTransportSecurity() bool { return false } + +func (rc *perRPCCredential) GetRequestMetadata(ctx context.Context, s ...string) (map[string]string, error) { + rc.authTokenMu.RLock() + authToken := rc.authToken + rc.authTokenMu.RUnlock() + return map[string]string{rpctypes.TokenFieldNameGRPC: authToken}, nil +} + +func (b *bundle) UpdateAuthToken(token string) { + if b.rc == nil { + return + } + b.rc.UpdateAuthToken(token) +} + +func (rc *perRPCCredential) UpdateAuthToken(token string) { + rc.authTokenMu.Lock() + rc.authToken = token + rc.authTokenMu.Unlock() +} diff --git a/vendor/github.com/coreos/etcd/clientv3/health_balancer.go b/vendor/github.com/coreos/etcd/clientv3/health_balancer.go deleted file mode 100644 index 5918cba84..000000000 --- a/vendor/github.com/coreos/etcd/clientv3/health_balancer.go +++ /dev/null @@ -1,609 +0,0 @@ -// Copyright 2017 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package clientv3 - -import ( - "context" - "errors" - "net/url" - "strings" - "sync" - "time" - - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - healthpb "google.golang.org/grpc/health/grpc_health_v1" - "google.golang.org/grpc/status" -) - -const ( - minHealthRetryDuration = 3 * time.Second - unknownService = "unknown service grpc.health.v1.Health" -) - -// ErrNoAddrAvilable is returned by Get() when the balancer does not have -// any active connection to endpoints at the time. -// This error is returned only when opts.BlockingWait is true. -var ErrNoAddrAvilable = status.Error(codes.Unavailable, "there is no address available") - -type healthCheckFunc func(ep string) (bool, error) - -type notifyMsg int - -const ( - notifyReset notifyMsg = iota - notifyNext -) - -// healthBalancer does the bare minimum to expose multiple eps -// to the grpc reconnection code path -type healthBalancer struct { - // addrs are the client's endpoint addresses for grpc - addrs []grpc.Address - - // eps holds the raw endpoints from the client - eps []string - - // notifyCh notifies grpc of the set of addresses for connecting - notifyCh chan []grpc.Address - - // readyc closes once the first connection is up - readyc chan struct{} - readyOnce sync.Once - - // healthCheck checks an endpoint's health. - healthCheck healthCheckFunc - healthCheckTimeout time.Duration - - unhealthyMu sync.RWMutex - unhealthyHostPorts map[string]time.Time - - // mu protects all fields below. - mu sync.RWMutex - - // upc closes when pinAddr transitions from empty to non-empty or the balancer closes. - upc chan struct{} - - // downc closes when grpc calls down() on pinAddr - downc chan struct{} - - // stopc is closed to signal updateNotifyLoop should stop. - stopc chan struct{} - stopOnce sync.Once - wg sync.WaitGroup - - // donec closes when all goroutines are exited - donec chan struct{} - - // updateAddrsC notifies updateNotifyLoop to update addrs. - updateAddrsC chan notifyMsg - - // grpc issues TLS cert checks using the string passed into dial so - // that string must be the host. To recover the full scheme://host URL, - // have a map from hosts to the original endpoint. - hostPort2ep map[string]string - - // pinAddr is the currently pinned address; set to the empty string on - // initialization and shutdown. - pinAddr string - - closed bool -} - -func newHealthBalancer(eps []string, timeout time.Duration, hc healthCheckFunc) *healthBalancer { - notifyCh := make(chan []grpc.Address) - addrs := eps2addrs(eps) - hb := &healthBalancer{ - addrs: addrs, - eps: eps, - notifyCh: notifyCh, - readyc: make(chan struct{}), - healthCheck: hc, - unhealthyHostPorts: make(map[string]time.Time), - upc: make(chan struct{}), - stopc: make(chan struct{}), - downc: make(chan struct{}), - donec: make(chan struct{}), - updateAddrsC: make(chan notifyMsg), - hostPort2ep: getHostPort2ep(eps), - } - if timeout < minHealthRetryDuration { - timeout = minHealthRetryDuration - } - hb.healthCheckTimeout = timeout - - close(hb.downc) - go hb.updateNotifyLoop() - hb.wg.Add(1) - go func() { - defer hb.wg.Done() - hb.updateUnhealthy() - }() - return hb -} - -func (b *healthBalancer) Start(target string, config grpc.BalancerConfig) error { return nil } - -func (b *healthBalancer) ConnectNotify() <-chan struct{} { - b.mu.Lock() - defer b.mu.Unlock() - return b.upc -} - -func (b *healthBalancer) ready() <-chan struct{} { return b.readyc } - -func (b *healthBalancer) endpoint(hostPort string) string { - b.mu.RLock() - defer b.mu.RUnlock() - return b.hostPort2ep[hostPort] -} - -func (b *healthBalancer) pinned() string { - b.mu.RLock() - defer b.mu.RUnlock() - return b.pinAddr -} - -func (b *healthBalancer) hostPortError(hostPort string, err error) { - if b.endpoint(hostPort) == "" { - logger.Lvl(4).Infof("clientv3/balancer: %q is stale (skip marking as unhealthy on %q)", hostPort, err.Error()) - return - } - - b.unhealthyMu.Lock() - b.unhealthyHostPorts[hostPort] = time.Now() - b.unhealthyMu.Unlock() - logger.Lvl(4).Infof("clientv3/balancer: %q is marked unhealthy (%q)", hostPort, err.Error()) -} - -func (b *healthBalancer) removeUnhealthy(hostPort, msg string) { - if b.endpoint(hostPort) == "" { - logger.Lvl(4).Infof("clientv3/balancer: %q was not in unhealthy (%q)", hostPort, msg) - return - } - - b.unhealthyMu.Lock() - delete(b.unhealthyHostPorts, hostPort) - b.unhealthyMu.Unlock() - logger.Lvl(4).Infof("clientv3/balancer: %q is removed from unhealthy (%q)", hostPort, msg) -} - -func (b *healthBalancer) countUnhealthy() (count int) { - b.unhealthyMu.RLock() - count = len(b.unhealthyHostPorts) - b.unhealthyMu.RUnlock() - return count -} - -func (b *healthBalancer) isUnhealthy(hostPort string) (unhealthy bool) { - b.unhealthyMu.RLock() - _, unhealthy = b.unhealthyHostPorts[hostPort] - b.unhealthyMu.RUnlock() - return unhealthy -} - -func (b *healthBalancer) cleanupUnhealthy() { - b.unhealthyMu.Lock() - for k, v := range b.unhealthyHostPorts { - if time.Since(v) > b.healthCheckTimeout { - delete(b.unhealthyHostPorts, k) - logger.Lvl(4).Infof("clientv3/balancer: removed %q from unhealthy after %v", k, b.healthCheckTimeout) - } - } - b.unhealthyMu.Unlock() -} - -func (b *healthBalancer) liveAddrs() ([]grpc.Address, map[string]struct{}) { - unhealthyCnt := b.countUnhealthy() - - b.mu.RLock() - defer b.mu.RUnlock() - - hbAddrs := b.addrs - if len(b.addrs) == 1 || unhealthyCnt == 0 || unhealthyCnt == len(b.addrs) { - liveHostPorts := make(map[string]struct{}, len(b.hostPort2ep)) - for k := range b.hostPort2ep { - liveHostPorts[k] = struct{}{} - } - return hbAddrs, liveHostPorts - } - - addrs := make([]grpc.Address, 0, len(b.addrs)-unhealthyCnt) - liveHostPorts := make(map[string]struct{}, len(addrs)) - for _, addr := range b.addrs { - if !b.isUnhealthy(addr.Addr) { - addrs = append(addrs, addr) - liveHostPorts[addr.Addr] = struct{}{} - } - } - return addrs, liveHostPorts -} - -func (b *healthBalancer) updateUnhealthy() { - for { - select { - case <-time.After(b.healthCheckTimeout): - b.cleanupUnhealthy() - pinned := b.pinned() - if pinned == "" || b.isUnhealthy(pinned) { - select { - case b.updateAddrsC <- notifyNext: - case <-b.stopc: - return - } - } - case <-b.stopc: - return - } - } -} - -func (b *healthBalancer) updateAddrs(eps ...string) { - np := getHostPort2ep(eps) - - b.mu.Lock() - defer b.mu.Unlock() - - match := len(np) == len(b.hostPort2ep) - if match { - for k, v := range np { - if b.hostPort2ep[k] != v { - match = false - break - } - } - } - if match { - // same endpoints, so no need to update address - return - } - - b.hostPort2ep = np - b.addrs, b.eps = eps2addrs(eps), eps - - b.unhealthyMu.Lock() - b.unhealthyHostPorts = make(map[string]time.Time) - b.unhealthyMu.Unlock() -} - -func (b *healthBalancer) next() { - b.mu.RLock() - downc := b.downc - b.mu.RUnlock() - select { - case b.updateAddrsC <- notifyNext: - case <-b.stopc: - } - // wait until disconnect so new RPCs are not issued on old connection - select { - case <-downc: - case <-b.stopc: - } -} - -func (b *healthBalancer) updateNotifyLoop() { - defer close(b.donec) - - for { - b.mu.RLock() - upc, downc, addr := b.upc, b.downc, b.pinAddr - b.mu.RUnlock() - // downc or upc should be closed - select { - case <-downc: - downc = nil - default: - } - select { - case <-upc: - upc = nil - default: - } - switch { - case downc == nil && upc == nil: - // stale - select { - case <-b.stopc: - return - default: - } - case downc == nil: - b.notifyAddrs(notifyReset) - select { - case <-upc: - case msg := <-b.updateAddrsC: - b.notifyAddrs(msg) - case <-b.stopc: - return - } - case upc == nil: - select { - // close connections that are not the pinned address - case b.notifyCh <- []grpc.Address{{Addr: addr}}: - case <-downc: - case <-b.stopc: - return - } - select { - case <-downc: - b.notifyAddrs(notifyReset) - case msg := <-b.updateAddrsC: - b.notifyAddrs(msg) - case <-b.stopc: - return - } - } - } -} - -func (b *healthBalancer) notifyAddrs(msg notifyMsg) { - if msg == notifyNext { - select { - case b.notifyCh <- []grpc.Address{}: - case <-b.stopc: - return - } - } - b.mu.RLock() - pinAddr := b.pinAddr - downc := b.downc - b.mu.RUnlock() - addrs, hostPorts := b.liveAddrs() - - var waitDown bool - if pinAddr != "" { - _, ok := hostPorts[pinAddr] - waitDown = !ok - } - - select { - case b.notifyCh <- addrs: - if waitDown { - select { - case <-downc: - case <-b.stopc: - } - } - case <-b.stopc: - } -} - -func (b *healthBalancer) Up(addr grpc.Address) func(error) { - if !b.mayPin(addr) { - return func(err error) {} - } - - b.mu.Lock() - defer b.mu.Unlock() - - // gRPC might call Up after it called Close. We add this check - // to "fix" it up at application layer. Otherwise, will panic - // if b.upc is already closed. - if b.closed { - return func(err error) {} - } - - // gRPC might call Up on a stale address. - // Prevent updating pinAddr with a stale address. - if !hasAddr(b.addrs, addr.Addr) { - return func(err error) {} - } - - if b.pinAddr != "" { - logger.Lvl(4).Infof("clientv3/balancer: %q is up but not pinned (already pinned %q)", addr.Addr, b.pinAddr) - return func(err error) {} - } - - // notify waiting Get()s and pin first connected address - close(b.upc) - b.downc = make(chan struct{}) - b.pinAddr = addr.Addr - logger.Lvl(4).Infof("clientv3/balancer: pin %q", addr.Addr) - - // notify client that a connection is up - b.readyOnce.Do(func() { close(b.readyc) }) - - return func(err error) { - // If connected to a black hole endpoint or a killed server, the gRPC ping - // timeout will induce a network I/O error, and retrying until success; - // finding healthy endpoint on retry could take several timeouts and redials. - // To avoid wasting retries, gray-list unhealthy endpoints. - b.hostPortError(addr.Addr, err) - - b.mu.Lock() - b.upc = make(chan struct{}) - close(b.downc) - b.pinAddr = "" - b.mu.Unlock() - logger.Lvl(4).Infof("clientv3/balancer: unpin %q (%q)", addr.Addr, err.Error()) - } -} - -func (b *healthBalancer) mayPin(addr grpc.Address) bool { - if b.endpoint(addr.Addr) == "" { // stale host:port - return false - } - - b.unhealthyMu.RLock() - unhealthyCnt := len(b.unhealthyHostPorts) - failedTime, bad := b.unhealthyHostPorts[addr.Addr] - b.unhealthyMu.RUnlock() - - b.mu.RLock() - skip := len(b.addrs) == 1 || unhealthyCnt == 0 || len(b.addrs) == unhealthyCnt - b.mu.RUnlock() - if skip || !bad { - return true - } - - // prevent isolated member's endpoint from being infinitely retried, as follows: - // 1. keepalive pings detects GoAway with http2.ErrCodeEnhanceYourCalm - // 2. balancer 'Up' unpins with grpc: failed with network I/O error - // 3. grpc-healthcheck still SERVING, thus retry to pin - // instead, return before grpc-healthcheck if failed within healthcheck timeout - if elapsed := time.Since(failedTime); elapsed < b.healthCheckTimeout { - logger.Lvl(4).Infof("clientv3/balancer: %q is up but not pinned (failed %v ago, require minimum %v after failure)", addr.Addr, elapsed, b.healthCheckTimeout) - return false - } - - if ok, _ := b.healthCheck(addr.Addr); ok { - b.removeUnhealthy(addr.Addr, "health check success") - return true - } - - b.hostPortError(addr.Addr, errors.New("health check failed")) - return false -} - -func (b *healthBalancer) Get(ctx context.Context, opts grpc.BalancerGetOptions) (grpc.Address, func(), error) { - var ( - addr string - closed bool - ) - - // If opts.BlockingWait is false (for fail-fast RPCs), it should return - // an address it has notified via Notify immediately instead of blocking. - if !opts.BlockingWait { - b.mu.RLock() - closed = b.closed - addr = b.pinAddr - b.mu.RUnlock() - if closed { - return grpc.Address{Addr: ""}, nil, grpc.ErrClientConnClosing - } - if addr == "" { - return grpc.Address{Addr: ""}, nil, ErrNoAddrAvilable - } - return grpc.Address{Addr: addr}, func() {}, nil - } - - for { - b.mu.RLock() - ch := b.upc - b.mu.RUnlock() - select { - case <-ch: - case <-b.donec: - return grpc.Address{Addr: ""}, nil, grpc.ErrClientConnClosing - case <-ctx.Done(): - return grpc.Address{Addr: ""}, nil, ctx.Err() - } - b.mu.RLock() - closed = b.closed - addr = b.pinAddr - b.mu.RUnlock() - // Close() which sets b.closed = true can be called before Get(), Get() must exit if balancer is closed. - if closed { - return grpc.Address{Addr: ""}, nil, grpc.ErrClientConnClosing - } - if addr != "" { - break - } - } - return grpc.Address{Addr: addr}, func() {}, nil -} - -func (b *healthBalancer) Notify() <-chan []grpc.Address { return b.notifyCh } - -func (b *healthBalancer) Close() error { - b.mu.Lock() - // In case gRPC calls close twice. TODO: remove the checking - // when we are sure that gRPC wont call close twice. - if b.closed { - b.mu.Unlock() - <-b.donec - return nil - } - b.closed = true - b.stopOnce.Do(func() { close(b.stopc) }) - b.pinAddr = "" - - // In the case of following scenario: - // 1. upc is not closed; no pinned address - // 2. client issues an RPC, calling invoke(), which calls Get(), enters for loop, blocks - // 3. client.conn.Close() calls balancer.Close(); closed = true - // 4. for loop in Get() never exits since ctx is the context passed in by the client and may not be canceled - // we must close upc so Get() exits from blocking on upc - select { - case <-b.upc: - default: - // terminate all waiting Get()s - close(b.upc) - } - - b.mu.Unlock() - b.wg.Wait() - - // wait for updateNotifyLoop to finish - <-b.donec - close(b.notifyCh) - - return nil -} - -func grpcHealthCheck(client *Client, ep string) (bool, error) { - conn, err := client.dial(ep) - if err != nil { - return false, err - } - defer conn.Close() - cli := healthpb.NewHealthClient(conn) - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - resp, err := cli.Check(ctx, &healthpb.HealthCheckRequest{}) - cancel() - if err != nil { - if s, ok := status.FromError(err); ok && s.Code() == codes.Unavailable { - if s.Message() == unknownService { // etcd < v3.3.0 - return true, nil - } - } - return false, err - } - return resp.Status == healthpb.HealthCheckResponse_SERVING, nil -} - -func hasAddr(addrs []grpc.Address, targetAddr string) bool { - for _, addr := range addrs { - if targetAddr == addr.Addr { - return true - } - } - return false -} - -func getHost(ep string) string { - url, uerr := url.Parse(ep) - if uerr != nil || !strings.Contains(ep, "://") { - return ep - } - return url.Host -} - -func eps2addrs(eps []string) []grpc.Address { - addrs := make([]grpc.Address, len(eps)) - for i := range eps { - addrs[i].Addr = getHost(eps[i]) - } - return addrs -} - -func getHostPort2ep(eps []string) map[string]string { - hm := make(map[string]string, len(eps)) - for i := range eps { - _, host, _ := parseEndpoint(eps[i]) - hm[host] = eps[i] - } - return hm -} diff --git a/vendor/github.com/coreos/etcd/clientv3/health_balancer_test.go b/vendor/github.com/coreos/etcd/clientv3/health_balancer_test.go deleted file mode 100644 index dc9d28d0e..000000000 --- a/vendor/github.com/coreos/etcd/clientv3/health_balancer_test.go +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright 2017 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package clientv3 - -import ( - "context" - "errors" - "net" - "sync" - "testing" - "time" - - pb "github.com/coreos/etcd/etcdserver/etcdserverpb" - "github.com/coreos/etcd/pkg/testutil" - - "google.golang.org/grpc" -) - -var endpoints = []string{"localhost:2379", "localhost:22379", "localhost:32379"} - -func TestBalancerGetUnblocking(t *testing.T) { - hb := newHealthBalancer(endpoints, minHealthRetryDuration, func(string) (bool, error) { return true, nil }) - defer hb.Close() - if addrs := <-hb.Notify(); len(addrs) != len(endpoints) { - t.Errorf("Initialize newHealthBalancer should have triggered Notify() chan, but it didn't") - } - unblockingOpts := grpc.BalancerGetOptions{BlockingWait: false} - - _, _, err := hb.Get(context.Background(), unblockingOpts) - if err != ErrNoAddrAvilable { - t.Errorf("Get() with no up endpoints should return ErrNoAddrAvailable, got: %v", err) - } - - down1 := hb.Up(grpc.Address{Addr: endpoints[1]}) - if addrs := <-hb.Notify(); len(addrs) != 1 { - t.Errorf("first Up() should have triggered balancer to send the first connected address via Notify chan so that other connections can be closed") - } - down2 := hb.Up(grpc.Address{Addr: endpoints[2]}) - addrFirst, putFun, err := hb.Get(context.Background(), unblockingOpts) - if err != nil { - t.Errorf("Get() with up endpoints should success, got %v", err) - } - if addrFirst.Addr != endpoints[1] { - t.Errorf("Get() didn't return expected address, got %v", addrFirst) - } - if putFun == nil { - t.Errorf("Get() returned unexpected nil put function") - } - addrSecond, _, _ := hb.Get(context.Background(), unblockingOpts) - if addrFirst.Addr != addrSecond.Addr { - t.Errorf("Get() didn't return the same address as previous call, got %v and %v", addrFirst, addrSecond) - } - - down1(errors.New("error")) - if addrs := <-hb.Notify(); len(addrs) != len(endpoints)-1 { // we call down on one endpoint - t.Errorf("closing the only connection should triggered balancer to send the %d endpoints via Notify chan so that we can establish a connection", len(endpoints)-1) - } - down2(errors.New("error")) - _, _, err = hb.Get(context.Background(), unblockingOpts) - if err != ErrNoAddrAvilable { - t.Errorf("Get() with no up endpoints should return ErrNoAddrAvailable, got: %v", err) - } -} - -func TestBalancerGetBlocking(t *testing.T) { - hb := newHealthBalancer(endpoints, minHealthRetryDuration, func(string) (bool, error) { return true, nil }) - defer hb.Close() - if addrs := <-hb.Notify(); len(addrs) != len(endpoints) { - t.Errorf("Initialize newHealthBalancer should have triggered Notify() chan, but it didn't") - } - blockingOpts := grpc.BalancerGetOptions{BlockingWait: true} - - ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*100) - _, _, err := hb.Get(ctx, blockingOpts) - cancel() - if err != context.DeadlineExceeded { - t.Errorf("Get() with no up endpoints should timeout, got %v", err) - } - - downC := make(chan func(error), 1) - - go func() { - // ensure hb.Up() will be called after hb.Get() to see if Up() releases blocking Get() - time.Sleep(time.Millisecond * 100) - f := hb.Up(grpc.Address{Addr: endpoints[1]}) - if addrs := <-hb.Notify(); len(addrs) != 1 { - t.Errorf("first Up() should have triggered balancer to send the first connected address via Notify chan so that other connections can be closed") - } - downC <- f - }() - addrFirst, putFun, err := hb.Get(context.Background(), blockingOpts) - if err != nil { - t.Errorf("Get() with up endpoints should success, got %v", err) - } - if addrFirst.Addr != endpoints[1] { - t.Errorf("Get() didn't return expected address, got %v", addrFirst) - } - if putFun == nil { - t.Errorf("Get() returned unexpected nil put function") - } - down1 := <-downC - - down2 := hb.Up(grpc.Address{Addr: endpoints[2]}) - addrSecond, _, _ := hb.Get(context.Background(), blockingOpts) - if addrFirst.Addr != addrSecond.Addr { - t.Errorf("Get() didn't return the same address as previous call, got %v and %v", addrFirst, addrSecond) - } - - down1(errors.New("error")) - if addrs := <-hb.Notify(); len(addrs) != len(endpoints)-1 { // we call down on one endpoint - t.Errorf("closing the only connection should triggered balancer to send the %d endpoints via Notify chan so that we can establish a connection", len(endpoints)-1) - } - down2(errors.New("error")) - ctx, cancel = context.WithTimeout(context.Background(), time.Millisecond*100) - _, _, err = hb.Get(ctx, blockingOpts) - cancel() - if err != context.DeadlineExceeded { - t.Errorf("Get() with no up endpoints should timeout, got %v", err) - } -} - -// TestHealthBalancerGraylist checks one endpoint is tried after the other -// due to gray listing. -func TestHealthBalancerGraylist(t *testing.T) { - var wg sync.WaitGroup - // Use 3 endpoints so gray list doesn't fallback to all connections - // after failing on 2 endpoints. - lns, eps := make([]net.Listener, 3), make([]string, 3) - wg.Add(3) - connc := make(chan string, 2) - for i := range eps { - ln, err := net.Listen("tcp", ":0") - testutil.AssertNil(t, err) - lns[i], eps[i] = ln, ln.Addr().String() - go func() { - defer wg.Done() - for { - conn, err := ln.Accept() - if err != nil { - return - } - _, err = conn.Read(make([]byte, 512)) - conn.Close() - if err == nil { - select { - case connc <- ln.Addr().String(): - // sleep some so balancer catches up - // before attempted next reconnect. - time.Sleep(50 * time.Millisecond) - default: - } - } - } - }() - } - - tf := func(s string) (bool, error) { return false, nil } - hb := newHealthBalancer(eps, 5*time.Second, tf) - - conn, err := grpc.Dial("", grpc.WithInsecure(), grpc.WithBalancer(hb)) - testutil.AssertNil(t, err) - defer conn.Close() - - kvc := pb.NewKVClient(conn) - <-hb.ready() - - kvc.Range(context.TODO(), &pb.RangeRequest{}) - ep1 := <-connc - kvc.Range(context.TODO(), &pb.RangeRequest{}) - ep2 := <-connc - for _, ln := range lns { - ln.Close() - } - wg.Wait() - - if ep1 == ep2 { - t.Fatalf("expected %q != %q", ep1, ep2) - } -} - -// TestBalancerDoNotBlockOnClose ensures that balancer and grpc don't deadlock each other -// due to rapid open/close conn. The deadlock causes balancer.Close() to block forever. -// See issue: https://github.com/coreos/etcd/issues/7283 for more detail. -func TestBalancerDoNotBlockOnClose(t *testing.T) { - defer testutil.AfterTest(t) - - kcl := newKillConnListener(t, 3) - defer kcl.close() - - for i := 0; i < 5; i++ { - hb := newHealthBalancer(kcl.endpoints(), minHealthRetryDuration, func(string) (bool, error) { return true, nil }) - conn, err := grpc.Dial("", grpc.WithInsecure(), grpc.WithBalancer(hb)) - if err != nil { - t.Fatal(err) - } - kvc := pb.NewKVClient(conn) - <-hb.readyc - - var wg sync.WaitGroup - wg.Add(100) - cctx, cancel := context.WithCancel(context.TODO()) - for j := 0; j < 100; j++ { - go func() { - defer wg.Done() - kvc.Range(cctx, &pb.RangeRequest{}, grpc.FailFast(false)) - }() - } - // balancer.Close() might block - // if balancer and grpc deadlock each other. - bclosec, cclosec := make(chan struct{}), make(chan struct{}) - go func() { - defer close(bclosec) - hb.Close() - }() - go func() { - defer close(cclosec) - conn.Close() - }() - select { - case <-bclosec: - case <-time.After(3 * time.Second): - testutil.FatalStack(t, "balancer close timeout") - } - select { - case <-cclosec: - case <-time.After(3 * time.Second): - t.Fatal("grpc conn close timeout") - } - - cancel() - wg.Wait() - } -} - -// killConnListener listens incoming conn and kills it immediately. -type killConnListener struct { - wg sync.WaitGroup - eps []string - stopc chan struct{} - t *testing.T -} - -func newKillConnListener(t *testing.T, size int) *killConnListener { - kcl := &killConnListener{stopc: make(chan struct{}), t: t} - - for i := 0; i < size; i++ { - ln, err := net.Listen("tcp", ":0") - if err != nil { - t.Fatal(err) - } - kcl.eps = append(kcl.eps, ln.Addr().String()) - kcl.wg.Add(1) - go kcl.listen(ln) - } - return kcl -} - -func (kcl *killConnListener) endpoints() []string { - return kcl.eps -} - -func (kcl *killConnListener) listen(l net.Listener) { - go func() { - defer kcl.wg.Done() - for { - conn, err := l.Accept() - select { - case <-kcl.stopc: - return - default: - } - if err != nil { - kcl.t.Fatal(err) - } - time.Sleep(1 * time.Millisecond) - conn.Close() - } - }() - <-kcl.stopc - l.Close() -} - -func (kcl *killConnListener) close() { - close(kcl.stopc) - kcl.wg.Wait() -} diff --git a/vendor/github.com/coreos/etcd/clientv3/integration/black_hole_test.go b/vendor/github.com/coreos/etcd/clientv3/integration/black_hole_test.go index c59541e38..7f73c9273 100644 --- a/vendor/github.com/coreos/etcd/clientv3/integration/black_hole_test.go +++ b/vendor/github.com/coreos/etcd/clientv3/integration/black_hole_test.go @@ -25,6 +25,7 @@ import ( "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" "github.com/coreos/etcd/integration" "github.com/coreos/etcd/pkg/testutil" + "google.golang.org/grpc" ) // TestBalancerUnderBlackholeKeepAliveWatch tests when watch discovers it cannot talk to @@ -35,7 +36,7 @@ func TestBalancerUnderBlackholeKeepAliveWatch(t *testing.T) { clus := integration.NewClusterV3(t, &integration.ClusterConfig{ Size: 2, - GRPCKeepAliveMinTime: 1 * time.Millisecond, // avoid too_many_pings + GRPCKeepAliveMinTime: time.Millisecond, // avoid too_many_pings }) defer clus.Terminate(t) @@ -43,8 +44,9 @@ func TestBalancerUnderBlackholeKeepAliveWatch(t *testing.T) { ccfg := clientv3.Config{ Endpoints: []string{eps[0]}, - DialTimeout: 1 * time.Second, - DialKeepAliveTime: 1 * time.Second, + DialTimeout: time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, + DialKeepAliveTime: time.Second, DialKeepAliveTimeout: 500 * time.Millisecond, } @@ -70,6 +72,9 @@ func TestBalancerUnderBlackholeKeepAliveWatch(t *testing.T) { // endpoint can switch to eps[1] when it detects the failure of eps[0] cli.SetEndpoints(eps...) + // give enough time for balancer resolution + time.Sleep(5 * time.Second) + clus.Members[0].Blackhole() if _, err = clus.Client(1).Put(context.TODO(), "foo", "bar"); err != nil { @@ -106,7 +111,7 @@ func TestBalancerUnderBlackholeKeepAliveWatch(t *testing.T) { func TestBalancerUnderBlackholeNoKeepAlivePut(t *testing.T) { testBalancerUnderBlackholeNoKeepAlive(t, func(cli *clientv3.Client, ctx context.Context) error { _, err := cli.Put(ctx, "foo", "bar") - if err == context.DeadlineExceeded || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { + if isClientTimeout(err) || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { return errExpected } return err @@ -116,7 +121,7 @@ func TestBalancerUnderBlackholeNoKeepAlivePut(t *testing.T) { func TestBalancerUnderBlackholeNoKeepAliveDelete(t *testing.T) { testBalancerUnderBlackholeNoKeepAlive(t, func(cli *clientv3.Client, ctx context.Context) error { _, err := cli.Delete(ctx, "foo") - if err == context.DeadlineExceeded || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { + if isClientTimeout(err) || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { return errExpected } return err @@ -129,7 +134,7 @@ func TestBalancerUnderBlackholeNoKeepAliveTxn(t *testing.T) { If(clientv3.Compare(clientv3.Version("foo"), "=", 0)). Then(clientv3.OpPut("foo", "bar")). Else(clientv3.OpPut("foo", "baz")).Commit() - if err == context.DeadlineExceeded || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { + if isClientTimeout(err) || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { return errExpected } return err @@ -139,7 +144,7 @@ func TestBalancerUnderBlackholeNoKeepAliveTxn(t *testing.T) { func TestBalancerUnderBlackholeNoKeepAliveLinearizableGet(t *testing.T) { testBalancerUnderBlackholeNoKeepAlive(t, func(cli *clientv3.Client, ctx context.Context) error { _, err := cli.Get(ctx, "a") - if err == context.DeadlineExceeded || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { + if isClientTimeout(err) || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { return errExpected } return err @@ -149,7 +154,7 @@ func TestBalancerUnderBlackholeNoKeepAliveLinearizableGet(t *testing.T) { func TestBalancerUnderBlackholeNoKeepAliveSerializableGet(t *testing.T) { testBalancerUnderBlackholeNoKeepAlive(t, func(cli *clientv3.Client, ctx context.Context) error { _, err := cli.Get(ctx, "a", clientv3.WithSerializable()) - if err == context.DeadlineExceeded || isServerCtxTimeout(err) { + if isClientTimeout(err) || isServerCtxTimeout(err) { return errExpected } return err @@ -172,6 +177,7 @@ func testBalancerUnderBlackholeNoKeepAlive(t *testing.T, op func(*clientv3.Clien ccfg := clientv3.Config{ Endpoints: []string{eps[0]}, DialTimeout: 1 * time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, } cli, err := clientv3.New(ccfg) if err != nil { @@ -189,22 +195,23 @@ func testBalancerUnderBlackholeNoKeepAlive(t *testing.T, op func(*clientv3.Clien // blackhole eps[0] clus.Members[0].Blackhole() - // fail first due to blackhole, retry should succeed + // With round robin balancer, client will make a request to a healthy endpoint + // within a few requests. // TODO: first operation can succeed // when gRPC supports better retry on non-delivered request - for i := 0; i < 2; i++ { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) + for i := 0; i < 5; i++ { + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) err = op(cli, ctx) cancel() if err == nil { break - } - if i == 0 { - if err != errExpected { - t.Errorf("#%d: expected %v, got %v", i, errExpected, err) - } - } else if err != nil { + } else if err == errExpected { + t.Logf("#%d: current error %v", i, err) + } else { t.Errorf("#%d: failed with error %v", i, err) } } + if err != nil { + t.Fatal(err) + } } diff --git a/vendor/github.com/coreos/etcd/clientv3/integration/dial_test.go b/vendor/github.com/coreos/etcd/clientv3/integration/dial_test.go index 6da7e2940..9abe1b102 100644 --- a/vendor/github.com/coreos/etcd/clientv3/integration/dial_test.go +++ b/vendor/github.com/coreos/etcd/clientv3/integration/dial_test.go @@ -26,6 +26,7 @@ import ( "github.com/coreos/etcd/integration" "github.com/coreos/etcd/pkg/testutil" "github.com/coreos/etcd/pkg/transport" + "google.golang.org/grpc" ) var ( @@ -58,10 +59,11 @@ func TestDialTLSExpired(t *testing.T) { _, err = clientv3.New(clientv3.Config{ Endpoints: []string{clus.Members[0].GRPCAddr()}, DialTimeout: 3 * time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, TLS: tls, }) - if err != context.DeadlineExceeded { - t.Fatalf("expected %v, got %v", context.DeadlineExceeded, err) + if !isClientTimeout(err) { + t.Fatalf("expected dial timeout error, got %v", err) } } @@ -72,12 +74,18 @@ func TestDialTLSNoConfig(t *testing.T) { clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1, ClientTLS: &testTLSInfo, SkipCreatingClient: true}) defer clus.Terminate(t) // expect "signed by unknown authority" - _, err := clientv3.New(clientv3.Config{ + c, err := clientv3.New(clientv3.Config{ Endpoints: []string{clus.Members[0].GRPCAddr()}, DialTimeout: time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, }) - if err != context.DeadlineExceeded { - t.Fatalf("expected %v, got %v", context.DeadlineExceeded, err) + defer func() { + if c != nil { + c.Close() + } + }() + if !isClientTimeout(err) { + t.Fatalf("expected dial timeout error, got %v", err) } } @@ -104,7 +112,11 @@ func testDialSetEndpoints(t *testing.T, setBefore bool) { } toKill := rand.Intn(len(eps)) - cfg := clientv3.Config{Endpoints: []string{eps[toKill]}, DialTimeout: 1 * time.Second} + cfg := clientv3.Config{ + Endpoints: []string{eps[toKill]}, + DialTimeout: 1 * time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, + } cli, err := clientv3.New(cfg) if err != nil { t.Fatal(err) @@ -121,6 +133,7 @@ func testDialSetEndpoints(t *testing.T, setBefore bool) { if !setBefore { cli.SetEndpoints(eps[toKill%3], eps[(toKill+1)%3]) } + time.Sleep(time.Second * 2) ctx, cancel := context.WithTimeout(context.Background(), integration.RequestWaitTimeout) if _, err = cli.Get(ctx, "foo", clientv3.WithSerializable()); err != nil { t.Fatal(err) @@ -158,6 +171,7 @@ func TestRejectOldCluster(t *testing.T) { cfg := clientv3.Config{ Endpoints: []string{clus.Members[0].GRPCAddr(), clus.Members[1].GRPCAddr()}, DialTimeout: 5 * time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, RejectOldCluster: true, } cli, err := clientv3.New(cfg) diff --git a/vendor/github.com/coreos/etcd/clientv3/integration/kv_test.go b/vendor/github.com/coreos/etcd/clientv3/integration/kv_test.go index 66de753cd..a6161bb68 100644 --- a/vendor/github.com/coreos/etcd/clientv3/integration/kv_test.go +++ b/vendor/github.com/coreos/etcd/clientv3/integration/kv_test.go @@ -884,7 +884,7 @@ func TestKVLargeRequests(t *testing.T) { }, // without proper client-side receive size limit - // "code = ResourceExhausted desc = grpc: received message larger than max (5242929 vs. 4194304)" + // "code = ResourceExhausted desc = received message larger than max (5242929 vs. 4194304)" { maxRequestBytesServer: 7*1024*1024 + 512*1024, @@ -906,7 +906,7 @@ func TestKVLargeRequests(t *testing.T) { maxCallSendBytesClient: 10 * 1024 * 1024, maxCallRecvBytesClient: 0, valueSize: 10 * 1024 * 1024, - expectError: grpc.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max "), + expectError: grpc.Errorf(codes.ResourceExhausted, "trying to send message larger than max "), }, { maxRequestBytesServer: 10 * 1024 * 1024, @@ -920,7 +920,7 @@ func TestKVLargeRequests(t *testing.T) { maxCallSendBytesClient: 10 * 1024 * 1024, maxCallRecvBytesClient: 0, valueSize: 10*1024*1024 + 5, - expectError: grpc.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max "), + expectError: grpc.Errorf(codes.ResourceExhausted, "trying to send message larger than max "), }, } for i, test := range tests { @@ -940,7 +940,7 @@ func TestKVLargeRequests(t *testing.T) { t.Errorf("#%d: expected %v, got %v", i, test.expectError, err) } } else if err != nil && !strings.HasPrefix(err.Error(), test.expectError.Error()) { - t.Errorf("#%d: expected %v, got %v", i, test.expectError, err) + t.Errorf("#%d: expected error starting with '%s', got '%s'", i, test.expectError.Error(), err.Error()) } // put request went through, now expects large response back diff --git a/vendor/github.com/coreos/etcd/clientv3/integration/logger_test.go b/vendor/github.com/coreos/etcd/clientv3/integration/logger_test.go index bc0220db4..48da6e8bd 100644 --- a/vendor/github.com/coreos/etcd/clientv3/integration/logger_test.go +++ b/vendor/github.com/coreos/etcd/clientv3/integration/logger_test.go @@ -19,11 +19,9 @@ import ( "github.com/coreos/etcd/clientv3" - "github.com/coreos/pkg/capnslog" "google.golang.org/grpc/grpclog" ) func init() { - capnslog.SetGlobalLogLevel(capnslog.CRITICAL) clientv3.SetLogger(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard)) } diff --git a/vendor/github.com/coreos/etcd/clientv3/integration/network_partition_test.go b/vendor/github.com/coreos/etcd/clientv3/integration/network_partition_test.go index e175aa4f2..acba7472b 100644 --- a/vendor/github.com/coreos/etcd/clientv3/integration/network_partition_test.go +++ b/vendor/github.com/coreos/etcd/clientv3/integration/network_partition_test.go @@ -24,8 +24,10 @@ import ( "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" + pb "github.com/coreos/etcd/etcdserver/etcdserverpb" "github.com/coreos/etcd/integration" "github.com/coreos/etcd/pkg/testutil" + "google.golang.org/grpc" ) var errExpected = errors.New("expected error") @@ -36,7 +38,7 @@ var errExpected = errors.New("expected error") func TestBalancerUnderNetworkPartitionPut(t *testing.T) { testBalancerUnderNetworkPartition(t, func(cli *clientv3.Client, ctx context.Context) error { _, err := cli.Put(ctx, "a", "b") - if err == context.DeadlineExceeded || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { + if isClientTimeout(err) || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { return errExpected } return err @@ -46,7 +48,7 @@ func TestBalancerUnderNetworkPartitionPut(t *testing.T) { func TestBalancerUnderNetworkPartitionDelete(t *testing.T) { testBalancerUnderNetworkPartition(t, func(cli *clientv3.Client, ctx context.Context) error { _, err := cli.Delete(ctx, "a") - if err == context.DeadlineExceeded || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { + if isClientTimeout(err) || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { return errExpected } return err @@ -59,7 +61,7 @@ func TestBalancerUnderNetworkPartitionTxn(t *testing.T) { If(clientv3.Compare(clientv3.Version("foo"), "=", 0)). Then(clientv3.OpPut("foo", "bar")). Else(clientv3.OpPut("foo", "baz")).Commit() - if err == context.DeadlineExceeded || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { + if isClientTimeout(err) || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout { return errExpected } return err @@ -72,6 +74,9 @@ func TestBalancerUnderNetworkPartitionTxn(t *testing.T) { func TestBalancerUnderNetworkPartitionLinearizableGetWithLongTimeout(t *testing.T) { testBalancerUnderNetworkPartition(t, func(cli *clientv3.Client, ctx context.Context) error { _, err := cli.Get(ctx, "a") + if err == rpctypes.ErrTimeout { + return errExpected + } return err }, 7*time.Second) } @@ -82,7 +87,7 @@ func TestBalancerUnderNetworkPartitionLinearizableGetWithLongTimeout(t *testing. func TestBalancerUnderNetworkPartitionLinearizableGetWithShortTimeout(t *testing.T) { testBalancerUnderNetworkPartition(t, func(cli *clientv3.Client, ctx context.Context) error { _, err := cli.Get(ctx, "a") - if err == context.DeadlineExceeded || isServerCtxTimeout(err) { + if isClientTimeout(err) || isServerCtxTimeout(err) { return errExpected } return err @@ -111,6 +116,7 @@ func testBalancerUnderNetworkPartition(t *testing.T, op func(*clientv3.Client, c ccfg := clientv3.Config{ Endpoints: []string{eps[0]}, DialTimeout: 3 * time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, } cli, err := clientv3.New(ccfg) if err != nil { @@ -123,9 +129,10 @@ func testBalancerUnderNetworkPartition(t *testing.T, op func(*clientv3.Client, c // add other endpoints for later endpoint switch cli.SetEndpoints(eps...) + time.Sleep(time.Second * 2) clus.Members[0].InjectPartition(t, clus.Members[1:]...) - for i := 0; i < 2; i++ { + for i := 0; i < 5; i++ { ctx, cancel := context.WithTimeout(context.Background(), timeout) err = op(cli, ctx) cancel() @@ -133,7 +140,7 @@ func testBalancerUnderNetworkPartition(t *testing.T, op func(*clientv3.Client, c break } if err != errExpected { - t.Errorf("#%d: expected %v, got %v", i, errExpected, err) + t.Errorf("#%d: expected '%v', got '%v'", i, errExpected, err) } // give enough time for endpoint switch // TODO: remove random sleep by syncing directly with balancer @@ -165,16 +172,14 @@ func TestBalancerUnderNetworkPartitionLinearizableGetLeaderElection(t *testing.T cli, err := clientv3.New(clientv3.Config{ Endpoints: []string{eps[(lead+1)%2]}, - DialTimeout: 1 * time.Second, + DialTimeout: 2 * time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, }) if err != nil { t.Fatal(err) } defer cli.Close() - // wait for non-leader to be pinned - mustWaitPinReady(t, cli) - // add all eps to list, so that when the original pined one fails // the client can switch to other available eps cli.SetEndpoints(eps[lead], eps[(lead+1)%2]) @@ -182,10 +187,15 @@ func TestBalancerUnderNetworkPartitionLinearizableGetLeaderElection(t *testing.T // isolate leader clus.Members[lead].InjectPartition(t, clus.Members[(lead+1)%3], clus.Members[(lead+2)%3]) - // expects balancer endpoint switch while ongoing leader election - ctx, cancel := context.WithTimeout(context.TODO(), timeout) - _, err = cli.Get(ctx, "a") - cancel() + // expects balancer to round robin to leader within two attempts + for i := 0; i < 2; i++ { + ctx, cancel := context.WithTimeout(context.TODO(), timeout) + _, err = cli.Get(ctx, "a") + cancel() + if err == nil { + break + } + } if err != nil { t.Fatal(err) } @@ -218,7 +228,10 @@ func testBalancerUnderNetworkPartitionWatch(t *testing.T, isolateLeader bool) { } // pin eps[target] - watchCli, err := clientv3.New(clientv3.Config{Endpoints: []string{eps[target]}}) + watchCli, err := clientv3.New(clientv3.Config{ + Endpoints: []string{eps[target]}, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, + }) if err != nil { t.Fatal(err) } @@ -256,3 +269,63 @@ func testBalancerUnderNetworkPartitionWatch(t *testing.T, isolateLeader bool) { t.Fatal("took too long to detect leader lost") } } + +func TestDropReadUnderNetworkPartition(t *testing.T) { + defer testutil.AfterTest(t) + + clus := integration.NewClusterV3(t, &integration.ClusterConfig{ + Size: 3, + SkipCreatingClient: true, + }) + defer clus.Terminate(t) + leaderIndex := clus.WaitLeader(t) + // get a follower endpoint + eps := []string{clus.Members[(leaderIndex+1)%3].GRPCAddr()} + ccfg := clientv3.Config{ + Endpoints: eps, + DialTimeout: 10 * time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, + } + cli, err := clientv3.New(ccfg) + if err != nil { + t.Fatal(err) + } + defer cli.Close() + + // wait for eps[0] to be pinned + mustWaitPinReady(t, cli) + + // add other endpoints for later endpoint switch + cli.SetEndpoints(eps...) + time.Sleep(time.Second * 2) + conn, err := cli.Dial(clus.Members[(leaderIndex+1)%3].GRPCAddr()) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + + clus.Members[leaderIndex].InjectPartition(t, clus.Members[(leaderIndex+1)%3], clus.Members[(leaderIndex+2)%3]) + kvc := clientv3.NewKVFromKVClient(pb.NewKVClient(conn), nil) + ctx, cancel := context.WithTimeout(context.TODO(), 10*time.Second) + _, err = kvc.Get(ctx, "a") + cancel() + if err.Error() != rpctypes.ErrLeaderChanged.Error() { + t.Fatalf("expected %v, got %v", rpctypes.ErrLeaderChanged, err) + } + + for i := 0; i < 5; i++ { + ctx, cancel = context.WithTimeout(context.TODO(), 10*time.Second) + _, err = kvc.Get(ctx, "a") + cancel() + if err != nil { + if err == rpctypes.ErrTimeout { + <-time.After(time.Second) + i++ + continue + } + t.Fatalf("expected nil or timeout, got %v", err) + } + // No error returned and no retry required + break + } +} diff --git a/vendor/github.com/coreos/etcd/clientv3/integration/server_shutdown_test.go b/vendor/github.com/coreos/etcd/clientv3/integration/server_shutdown_test.go index 8a89acc58..2058a3ebb 100644 --- a/vendor/github.com/coreos/etcd/clientv3/integration/server_shutdown_test.go +++ b/vendor/github.com/coreos/etcd/clientv3/integration/server_shutdown_test.go @@ -26,6 +26,7 @@ import ( "github.com/coreos/etcd/integration" "github.com/coreos/etcd/pkg/testutil" + "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -75,16 +76,16 @@ func TestBalancerUnderServerShutdownWatch(t *testing.T) { select { case ev := <-wch: if werr := ev.Err(); werr != nil { - t.Fatal(werr) + t.Error(werr) } if len(ev.Events) != 1 { - t.Fatalf("expected one event, got %+v", ev) + t.Errorf("expected one event, got %+v", ev) } if !bytes.Equal(ev.Events[0].Kv.Value, []byte(val)) { - t.Fatalf("expected %q, got %+v", val, ev.Events[0].Kv) + t.Errorf("expected %q, got %+v", val, ev.Events[0].Kv) } case <-time.After(7 * time.Second): - t.Fatal("took too long to receive events") + t.Error("took too long to receive events") } }() @@ -92,7 +93,10 @@ func TestBalancerUnderServerShutdownWatch(t *testing.T) { clus.Members[lead].Terminate(t) // writes to eps[lead+1] - putCli, err := clientv3.New(clientv3.Config{Endpoints: []string{eps[(lead+1)%3]}}) + putCli, err := clientv3.New(clientv3.Config{ + Endpoints: []string{eps[(lead+1)%3]}, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, + }) if err != nil { t.Fatal(err) } @@ -104,7 +108,7 @@ func TestBalancerUnderServerShutdownWatch(t *testing.T) { if err == nil { break } - if err == context.DeadlineExceeded || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout || err == rpctypes.ErrTimeoutDueToLeaderFail { + if isClientTimeout(err) || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout || err == rpctypes.ErrTimeoutDueToLeaderFail { continue } t.Fatal(err) @@ -156,7 +160,10 @@ func testBalancerUnderServerShutdownMutable(t *testing.T, op func(*clientv3.Clie eps := []string{clus.Members[0].GRPCAddr(), clus.Members[1].GRPCAddr(), clus.Members[2].GRPCAddr()} // pin eps[0] - cli, err := clientv3.New(clientv3.Config{Endpoints: []string{eps[0]}}) + cli, err := clientv3.New(clientv3.Config{ + Endpoints: []string{eps[0]}, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, + }) if err != nil { t.Fatal(err) } @@ -337,10 +344,20 @@ func testBalancerUnderServerStopInflightRangeOnRestart(t *testing.T, linearizabl defer close(donec) ctx, cancel := context.WithTimeout(context.TODO(), clientTimeout) readyc <- struct{}{} - _, err := cli.Get(ctx, "abc", gops...) + + // TODO: The new grpc load balancer will not pin to an endpoint + // as intended by this test. But it will round robin member within + // two attempts. + // Remove retry loop once the new grpc load balancer provides retry. + for i := 0; i < 2; i++ { + _, err = cli.Get(ctx, "abc", gops...) + if err == nil { + break + } + } cancel() if err != nil { - t.Fatal(err) + t.Errorf("unexpected error: %v", err) } }() @@ -361,7 +378,57 @@ func isServerCtxTimeout(err error) bool { if err == nil { return false } - ev, _ := status.FromError(err) + ev, ok := status.FromError(err) + if !ok { + return false + } code := ev.Code() return code == codes.DeadlineExceeded && strings.Contains(err.Error(), "context deadline exceeded") } + +// In grpc v1.11.3+ dial timeouts can error out with transport.ErrConnClosing. Previously dial timeouts +// would always error out with context.DeadlineExceeded. +func isClientTimeout(err error) bool { + if err == nil { + return false + } + if err == context.DeadlineExceeded { + return true + } + ev, ok := status.FromError(err) + if !ok { + return false + } + code := ev.Code() + return code == codes.DeadlineExceeded +} + +func isCanceled(err error) bool { + if err == nil { + return false + } + if err == context.Canceled { + return true + } + ev, ok := status.FromError(err) + if !ok { + return false + } + code := ev.Code() + return code == codes.Canceled +} + +func isUnavailable(err error) bool { + if err == nil { + return false + } + if err == context.Canceled { + return true + } + ev, ok := status.FromError(err) + if !ok { + return false + } + code := ev.Code() + return code == codes.Unavailable +} diff --git a/vendor/github.com/coreos/etcd/clientv3/integration/util.go b/vendor/github.com/coreos/etcd/clientv3/integration/util.go index 647c06e1f..89796e17f 100644 --- a/vendor/github.com/coreos/etcd/clientv3/integration/util.go +++ b/vendor/github.com/coreos/etcd/clientv3/integration/util.go @@ -25,7 +25,7 @@ import ( // mustWaitPinReady waits up to 3-second until connection is up (pin endpoint). // Fatal on time-out. func mustWaitPinReady(t *testing.T, cli *clientv3.Client) { - ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) _, err := cli.Get(ctx, "foo") cancel() if err != nil { diff --git a/vendor/github.com/coreos/etcd/clientv3/integration/watch_fragment_test.go b/vendor/github.com/coreos/etcd/clientv3/integration/watch_fragment_test.go new file mode 100644 index 000000000..dd6a8448f --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/integration/watch_fragment_test.go @@ -0,0 +1,125 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !cluster_proxy + +package integration + +import ( + "context" + "fmt" + "strings" + "testing" + "time" + + "github.com/coreos/etcd/clientv3" + "github.com/coreos/etcd/integration" + "github.com/coreos/etcd/pkg/testutil" +) + +// TestWatchFragmentDisable ensures that large watch +// response exceeding server-side request limit can +// arrive even without watch response fragmentation. +func TestWatchFragmentDisable(t *testing.T) { + testWatchFragment(t, false, false) +} + +// TestWatchFragmentDisableWithGRPCLimit verifies +// large watch response exceeding server-side request +// limit and client-side gRPC response receive limit +// cannot arrive without watch events fragmentation, +// because multiple events exceed client-side gRPC +// response receive limit. +func TestWatchFragmentDisableWithGRPCLimit(t *testing.T) { + testWatchFragment(t, false, true) +} + +// TestWatchFragmentEnable ensures that large watch +// response exceeding server-side request limit arrive +// with watch response fragmentation. +func TestWatchFragmentEnable(t *testing.T) { + testWatchFragment(t, true, false) +} + +// TestWatchFragmentEnableWithGRPCLimit verifies +// large watch response exceeding server-side request +// limit and client-side gRPC response receive limit +// can arrive only when watch events are fragmented. +func TestWatchFragmentEnableWithGRPCLimit(t *testing.T) { + testWatchFragment(t, true, true) +} + +// testWatchFragment triggers watch response that spans over multiple +// revisions exceeding server request limits when combined. +func testWatchFragment(t *testing.T, fragment, exceedRecvLimit bool) { + cfg := &integration.ClusterConfig{ + Size: 1, + MaxRequestBytes: 1.5 * 1024 * 1024, + } + if exceedRecvLimit { + cfg.ClientMaxCallRecvMsgSize = 1.5 * 1024 * 1024 + } + clus := integration.NewClusterV3(t, cfg) + defer clus.Terminate(t) + + cli := clus.Client(0) + errc := make(chan error) + for i := 0; i < 10; i++ { + go func(i int) { + _, err := cli.Put(context.TODO(), + fmt.Sprint("foo", i), + strings.Repeat("a", 1024*1024), + ) + errc <- err + }(i) + } + for i := 0; i < 10; i++ { + if err := <-errc; err != nil { + t.Fatalf("failed to put: %v", err) + } + } + + opts := []clientv3.OpOption{clientv3.WithPrefix(), clientv3.WithRev(1)} + if fragment { + opts = append(opts, clientv3.WithFragment()) + } + wch := cli.Watch(context.TODO(), "foo", opts...) + + // expect 10 MiB watch response + select { + case ws := <-wch: + // without fragment, should exceed gRPC client receive limit + if !fragment && exceedRecvLimit { + if len(ws.Events) != 0 { + t.Fatalf("expected 0 events with watch fragmentation, got %d", len(ws.Events)) + } + exp := "code = ResourceExhausted desc = grpc: received message larger than max (" + if !strings.Contains(ws.Err().Error(), exp) { + t.Fatalf("expected 'ResourceExhausted' error, got %v", ws.Err()) + } + return + } + + // still expect merged watch events + if len(ws.Events) != 10 { + t.Fatalf("expected 10 events with watch fragmentation, got %d", len(ws.Events)) + } + if ws.Err() != nil { + t.Fatalf("unexpected error %v", ws.Err()) + } + + case <-time.After(testutil.RequestTimeout): + t.Fatalf("took too long to receive events") + } +} diff --git a/vendor/github.com/coreos/etcd/clientv3/integration/watch_test.go b/vendor/github.com/coreos/etcd/clientv3/integration/watch_test.go index f9ac47b4a..3c2e3c0dc 100644 --- a/vendor/github.com/coreos/etcd/clientv3/integration/watch_test.go +++ b/vendor/github.com/coreos/etcd/clientv3/integration/watch_test.go @@ -30,7 +30,6 @@ import ( mvccpb "github.com/coreos/etcd/mvcc/mvccpb" "github.com/coreos/etcd/pkg/testutil" - "google.golang.org/grpc" "google.golang.org/grpc/metadata" ) @@ -583,6 +582,78 @@ func testWatchWithProgressNotify(t *testing.T, watchOnPut bool) { } } +func TestWatchRequestProgress(t *testing.T) { + testCases := []struct { + name string + watchers []string + }{ + {"0-watcher", []string{}}, + {"1-watcher", []string{"/"}}, + {"2-watcher", []string{"/", "/"}}, + } + + for _, c := range testCases { + t.Run(c.name, func(t *testing.T) { + defer testutil.AfterTest(t) + + watchTimeout := 3 * time.Second + + clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 3}) + defer clus.Terminate(t) + + wc := clus.RandClient() + + var watchChans []clientv3.WatchChan + + for _, prefix := range c.watchers { + watchChans = append(watchChans, wc.Watch(context.Background(), prefix, clientv3.WithPrefix())) + } + + _, err := wc.Put(context.Background(), "/a", "1") + if err != nil { + t.Fatal(err) + } + + for _, rch := range watchChans { + select { + case resp := <-rch: // wait for notification + if len(resp.Events) != 1 { + t.Fatalf("resp.Events expected 1, got %d", len(resp.Events)) + } + case <-time.After(watchTimeout): + t.Fatalf("watch response expected in %v, but timed out", watchTimeout) + } + } + + // put a value not being watched to increment revision + _, err = wc.Put(context.Background(), "x", "1") + if err != nil { + t.Fatal(err) + } + + err = wc.RequestProgress(context.Background()) + if err != nil { + t.Fatal(err) + } + + // verify all watch channels receive a progress notify + for _, rch := range watchChans { + select { + case resp := <-rch: + if !resp.IsProgressNotify() { + t.Fatalf("expected resp.IsProgressNotify() == true") + } + if resp.Header.Revision != 3 { + t.Fatalf("resp.Header.Revision expected 3, got %d", resp.Header.Revision) + } + case <-time.After(watchTimeout): + t.Fatalf("progress response expected in %v, but timed out", watchTimeout) + } + } + }) + } +} + func TestWatchEventType(t *testing.T) { cluster := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) defer cluster.Terminate(t) @@ -667,8 +738,9 @@ func TestWatchErrConnClosed(t *testing.T) { go func() { defer close(donec) ch := cli.Watch(context.TODO(), "foo") - if wr := <-ch; grpc.ErrorDesc(wr.Err()) != grpc.ErrClientConnClosing.Error() { - t.Fatalf("expected %v, got %v", grpc.ErrClientConnClosing, grpc.ErrorDesc(wr.Err())) + + if wr := <-ch; !isCanceled(wr.Err()) { + t.Errorf("expected context canceled, got %v", wr.Err()) } }() @@ -699,8 +771,8 @@ func TestWatchAfterClose(t *testing.T) { donec := make(chan struct{}) go func() { cli.Watch(context.TODO(), "foo") - if err := cli.Close(); err != nil && err != grpc.ErrClientConnClosing { - t.Fatalf("expected %v, got %v", grpc.ErrClientConnClosing, err) + if err := cli.Close(); err != nil && err != context.Canceled { + t.Errorf("expected %v, got %v", context.Canceled, err) } close(donec) }() @@ -1061,3 +1133,24 @@ func TestWatchCancelDisconnected(t *testing.T) { t.Fatal("took too long to cancel disconnected watcher") } } + +// TestWatchClose ensures that close does not return error +func TestWatchClose(t *testing.T) { + runWatchTest(t, testWatchClose) +} + +func testWatchClose(t *testing.T, wctx *watchctx) { + ctx, cancel := context.WithCancel(context.Background()) + wch := wctx.w.Watch(ctx, "a") + cancel() + if wch == nil { + t.Fatalf("expected watcher channel, got nil") + } + if wctx.w.Close() != nil { + t.Fatalf("watch did not close successfully") + } + wresp, ok := <-wch + if ok { + t.Fatalf("read wch got %v; expected closed channel", wresp) + } +} diff --git a/vendor/github.com/coreos/etcd/clientv3/leasing/txn.go b/vendor/github.com/coreos/etcd/clientv3/leasing/txn.go index da5b83a8a..76e4f3693 100644 --- a/vendor/github.com/coreos/etcd/clientv3/leasing/txn.go +++ b/vendor/github.com/coreos/etcd/clientv3/leasing/txn.go @@ -85,7 +85,7 @@ func (txn *txnLeasing) eval() (*v3.TxnResponse, error) { if !ok { return nil, nil } - return &v3.TxnResponse{copyHeader(txn.lkv.leases.header), succeeded, resps}, nil + return &v3.TxnResponse{Header: copyHeader(txn.lkv.leases.header), Succeeded: succeeded, Responses: resps}, nil } // fallback computes the ops to fetch all possible conflicting diff --git a/vendor/github.com/coreos/etcd/clientv3/logger.go b/vendor/github.com/coreos/etcd/clientv3/logger.go index 782e31313..3276372ad 100644 --- a/vendor/github.com/coreos/etcd/clientv3/logger.go +++ b/vendor/github.com/coreos/etcd/clientv3/logger.go @@ -18,28 +18,14 @@ import ( "io/ioutil" "sync" + "github.com/coreos/etcd/pkg/logutil" + "google.golang.org/grpc/grpclog" ) -// Logger is the logger used by client library. -// It implements grpclog.LoggerV2 interface. -type Logger interface { - grpclog.LoggerV2 - - // Lvl returns logger if logger's verbosity level >= "lvl". - // Otherwise, logger that discards all logs. - Lvl(lvl int) Logger - - // to satisfy capnslog - - Print(args ...interface{}) - Printf(format string, args ...interface{}) - Println(args ...interface{}) -} - var ( - loggerMu sync.RWMutex - logger Logger + lgMu sync.RWMutex + lg logutil.Logger ) type settableLogger struct { @@ -49,29 +35,29 @@ type settableLogger struct { func init() { // disable client side logs by default - logger = &settableLogger{} + lg = &settableLogger{} SetLogger(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard)) } // SetLogger sets client-side Logger. func SetLogger(l grpclog.LoggerV2) { - loggerMu.Lock() - logger = NewLogger(l) + lgMu.Lock() + lg = logutil.NewLogger(l) // override grpclog so that any changes happen with locking - grpclog.SetLoggerV2(logger) - loggerMu.Unlock() + grpclog.SetLoggerV2(lg) + lgMu.Unlock() } -// GetLogger returns the current logger. -func GetLogger() Logger { - loggerMu.RLock() - l := logger - loggerMu.RUnlock() +// GetLogger returns the current logutil.Logger. +func GetLogger() logutil.Logger { + lgMu.RLock() + l := lg + lgMu.RUnlock() return l } -// NewLogger returns a new Logger with grpclog.LoggerV2. -func NewLogger(gl grpclog.LoggerV2) Logger { +// NewLogger returns a new Logger with logutil.Logger. +func NewLogger(gl grpclog.LoggerV2) logutil.Logger { return &settableLogger{l: gl} } @@ -104,32 +90,12 @@ func (s *settableLogger) Print(args ...interface{}) { s.get().In func (s *settableLogger) Printf(format string, args ...interface{}) { s.get().Infof(format, args...) } func (s *settableLogger) Println(args ...interface{}) { s.get().Infoln(args...) } func (s *settableLogger) V(l int) bool { return s.get().V(l) } -func (s *settableLogger) Lvl(lvl int) Logger { +func (s *settableLogger) Lvl(lvl int) grpclog.LoggerV2 { s.mu.RLock() l := s.l s.mu.RUnlock() if l.V(lvl) { return s } - return &noLogger{} + return logutil.NewDiscardLogger() } - -type noLogger struct{} - -func (*noLogger) Info(args ...interface{}) {} -func (*noLogger) Infof(format string, args ...interface{}) {} -func (*noLogger) Infoln(args ...interface{}) {} -func (*noLogger) Warning(args ...interface{}) {} -func (*noLogger) Warningf(format string, args ...interface{}) {} -func (*noLogger) Warningln(args ...interface{}) {} -func (*noLogger) Error(args ...interface{}) {} -func (*noLogger) Errorf(format string, args ...interface{}) {} -func (*noLogger) Errorln(args ...interface{}) {} -func (*noLogger) Fatal(args ...interface{}) {} -func (*noLogger) Fatalf(format string, args ...interface{}) {} -func (*noLogger) Fatalln(args ...interface{}) {} -func (*noLogger) Print(args ...interface{}) {} -func (*noLogger) Printf(format string, args ...interface{}) {} -func (*noLogger) Println(args ...interface{}) {} -func (*noLogger) V(l int) bool { return false } -func (ng *noLogger) Lvl(lvl int) Logger { return ng } diff --git a/vendor/github.com/coreos/etcd/clientv3/maintenance.go b/vendor/github.com/coreos/etcd/clientv3/maintenance.go index f60cfbe47..6db6c0e96 100644 --- a/vendor/github.com/coreos/etcd/clientv3/maintenance.go +++ b/vendor/github.com/coreos/etcd/clientv3/maintenance.go @@ -16,6 +16,7 @@ package clientv3 import ( "context" + "fmt" "io" pb "github.com/coreos/etcd/etcdserver/etcdserverpb" @@ -57,6 +58,8 @@ type Maintenance interface { HashKV(ctx context.Context, endpoint string, rev int64) (*HashKVResponse, error) // Snapshot provides a reader for a point-in-time snapshot of etcd. + // If the context "ctx" is canceled or timed out, reading from returned + // "io.ReadCloser" would error out (e.g. context.Canceled, context.DeadlineExceeded). Snapshot(ctx context.Context) (io.ReadCloser, error) // MoveLeader requests current leader to transfer its leadership to the transferee. @@ -73,9 +76,9 @@ type maintenance struct { func NewMaintenance(c *Client) Maintenance { api := &maintenance{ dial: func(endpoint string) (pb.MaintenanceClient, func(), error) { - conn, err := c.dial(endpoint) + conn, err := c.Dial(endpoint) if err != nil { - return nil, nil, err + return nil, nil, fmt.Errorf("failed to dial endpoint %s with maintenance client: %v", endpoint, err) } cancel := func() { conn.Close() } return RetryMaintenanceClient(c, conn), cancel, nil @@ -173,6 +176,7 @@ func (m *maintenance) Status(ctx context.Context, endpoint string) (*StatusRespo func (m *maintenance) HashKV(ctx context.Context, endpoint string, rev int64) (*HashKVResponse, error) { remote, cancel, err := m.dial(endpoint) if err != nil { + return nil, toErr(ctx, err) } defer cancel() @@ -184,7 +188,7 @@ func (m *maintenance) HashKV(ctx context.Context, endpoint string, rev int64) (* } func (m *maintenance) Snapshot(ctx context.Context) (io.ReadCloser, error) { - ss, err := m.remote.Snapshot(ctx, &pb.SnapshotRequest{}, m.callOpts...) + ss, err := m.remote.Snapshot(ctx, &pb.SnapshotRequest{}, append(m.callOpts, withMax(defaultStreamMaxRetries))...) if err != nil { return nil, toErr(ctx, err) } diff --git a/vendor/github.com/coreos/etcd/clientv3/op.go b/vendor/github.com/coreos/etcd/clientv3/op.go index c6ec5bf52..3dca41b5f 100644 --- a/vendor/github.com/coreos/etcd/clientv3/op.go +++ b/vendor/github.com/coreos/etcd/clientv3/op.go @@ -53,6 +53,12 @@ type Op struct { // for watch, put, delete prevKV bool + // for watch + // fragmentation should be disabled by default + // if true, split watch events when total exceeds + // "--max-request-bytes" flag value + 512-byte + fragment bool + // for put ignoreValue bool ignoreLease bool @@ -511,3 +517,14 @@ func toLeaseTimeToLiveRequest(id LeaseID, opts ...LeaseOption) *pb.LeaseTimeToLi ret.applyOpts(opts) return &pb.LeaseTimeToLiveRequest{ID: int64(id), Keys: ret.attachedKeys} } + +// WithFragment to receive raw watch response with fragmentation. +// Fragmentation is disabled by default. If fragmentation is enabled, +// etcd watch server will split watch response before sending to clients +// when the total size of watch events exceed server-side request limit. +// The default server-side request limit is 1.5 MiB, which can be configured +// as "--max-request-bytes" flag value + gRPC-overhead 512 bytes. +// See "etcdserver/api/v3rpc/watch.go" for more details. +func WithFragment() OpOption { + return func(op *Op) { op.fragment = true } +} diff --git a/vendor/github.com/coreos/etcd/clientv3/options.go b/vendor/github.com/coreos/etcd/clientv3/options.go index fa25811f3..700714c08 100644 --- a/vendor/github.com/coreos/etcd/clientv3/options.go +++ b/vendor/github.com/coreos/etcd/clientv3/options.go @@ -16,17 +16,17 @@ package clientv3 import ( "math" + "time" "google.golang.org/grpc" ) var ( - // Disable gRPC internal retrial logic - // TODO: enable when gRPC retry is stable (FailFast=false) - // Reference: - // - https://github.com/grpc/grpc-go/issues/1532 - // - https://github.com/grpc/proposal/blob/master/A6-client-retries.md - defaultFailFast = grpc.FailFast(true) + // client-side handling retrying of request failures where data was not written to the wire or + // where server indicates it did not process the data. gRPC default is default is "FailFast(true)" + // but for etcd we default to "FailFast(false)" to minimize client request error responses due to + // transient failures. + defaultFailFast = grpc.FailFast(false) // client-side request send limit, gRPC default is math.MaxInt32 // Make sure that "client-side send limit < server-side default send/recv limit" @@ -38,6 +38,22 @@ var ( // because range response can easily exceed request send limits // Default to math.MaxInt32; writes exceeding server-side send limit fails anyway defaultMaxCallRecvMsgSize = grpc.MaxCallRecvMsgSize(math.MaxInt32) + + // client-side non-streaming retry limit, only applied to requests where server responds with + // a error code clearly indicating it was unable to process the request such as codes.Unavailable. + // If set to 0, retry is disabled. + defaultUnaryMaxRetries uint = 100 + + // client-side streaming retry limit, only applied to requests where server responds with + // a error code clearly indicating it was unable to process the request such as codes.Unavailable. + // If set to 0, retry is disabled. + defaultStreamMaxRetries = ^uint(0) // max uint + + // client-side retry backoff wait between requests. + defaultBackoffWaitBetween = 25 * time.Millisecond + + // client-side retry backoff default jitter fraction. + defaultBackoffJitterFraction = 0.10 ) // defaultCallOpts defines a list of default "gRPC.CallOption". diff --git a/vendor/github.com/coreos/etcd/clientv3/retry.go b/vendor/github.com/coreos/etcd/clientv3/retry.go index 7f89ba641..6baa52e14 100644 --- a/vendor/github.com/coreos/etcd/clientv3/retry.go +++ b/vendor/github.com/coreos/etcd/clientv3/retry.go @@ -32,465 +32,263 @@ const ( nonRepeatable ) -type rpcFunc func(ctx context.Context) error -type retryRPCFunc func(context.Context, rpcFunc, retryPolicy) error -type retryStopErrFunc func(error) bool +func (rp retryPolicy) String() string { + switch rp { + case repeatable: + return "repeatable" + case nonRepeatable: + return "nonRepeatable" + default: + return "UNKNOWN" + } +} +// isSafeRetryImmutableRPC returns "true" when an immutable request is safe for retry. +// // immutable requests (e.g. Get) should be retried unless it's // an obvious server-side error (e.g. rpctypes.ErrRequestTooLarge). // -// "isRepeatableStopError" returns "true" when an immutable request -// is interrupted by server-side or gRPC-side error and its status -// code is not transient (!= codes.Unavailable). -// -// Returning "true" means retry should stop, since client cannot +// Returning "false" means retry should stop, since client cannot // handle itself even with retries. -func isRepeatableStopError(err error) bool { +func isSafeRetryImmutableRPC(err error) bool { eErr := rpctypes.Error(err) - // always stop retry on etcd errors if serverErr, ok := eErr.(rpctypes.EtcdError); ok && serverErr.Code() != codes.Unavailable { - return true + // interrupted by non-transient server-side or gRPC-side error + // client cannot handle itself (e.g. rpctypes.ErrCompacted) + return false } // only retry if unavailable - ev, _ := status.FromError(err) - return ev.Code() != codes.Unavailable + ev, ok := status.FromError(err) + if !ok { + // all errors from RPC is typed "grpc/status.(*statusError)" + // (ref. https://github.com/grpc/grpc-go/pull/1782) + // + // if the error type is not "grpc/status.(*statusError)", + // it could be from "Dial" + // TODO: do not retry for now + // ref. https://github.com/grpc/grpc-go/issues/1581 + return false + } + return ev.Code() == codes.Unavailable } +// isSafeRetryMutableRPC returns "true" when a mutable request is safe for retry. +// // mutable requests (e.g. Put, Delete, Txn) should only be retried // when the status code is codes.Unavailable when initial connection -// has not been established (no pinned endpoint). +// has not been established (no endpoint is up). // -// "isNonRepeatableStopError" returns "true" when a mutable request -// is interrupted by non-transient error that client cannot handle itself, -// or transient error while the connection has already been established -// (pinned endpoint exists). -// -// Returning "true" means retry should stop, otherwise it violates +// Returning "false" means retry should stop, otherwise it violates // write-at-most-once semantics. -func isNonRepeatableStopError(err error) bool { - ev, _ := status.FromError(err) - if ev.Code() != codes.Unavailable { - return true +func isSafeRetryMutableRPC(err error) bool { + if ev, ok := status.FromError(err); ok && ev.Code() != codes.Unavailable { + // not safe for mutable RPCs + // e.g. interrupted by non-transient error that client cannot handle itself, + // or transient error while the connection has already been established + return false } desc := rpctypes.ErrorDesc(err) - return desc != "there is no address available" && desc != "there is no connection available" -} - -func (c *Client) newRetryWrapper() retryRPCFunc { - return func(rpcCtx context.Context, f rpcFunc, rp retryPolicy) error { - var isStop retryStopErrFunc - switch rp { - case repeatable: - isStop = isRepeatableStopError - case nonRepeatable: - isStop = isNonRepeatableStopError - } - for { - if err := readyWait(rpcCtx, c.ctx, c.balancer.ConnectNotify()); err != nil { - return err - } - pinned := c.balancer.pinned() - err := f(rpcCtx) - if err == nil { - return nil - } - logger.Lvl(4).Infof("clientv3/retry: error %q on pinned endpoint %q", err.Error(), pinned) - - if s, ok := status.FromError(err); ok && (s.Code() == codes.Unavailable || s.Code() == codes.DeadlineExceeded || s.Code() == codes.Internal) { - // mark this before endpoint switch is triggered - c.balancer.hostPortError(pinned, err) - c.balancer.next() - logger.Lvl(4).Infof("clientv3/retry: switching from %q due to error %q", pinned, err.Error()) - } - - if isStop(err) { - return err - } - } - } -} - -func (c *Client) newAuthRetryWrapper(retryf retryRPCFunc) retryRPCFunc { - return func(rpcCtx context.Context, f rpcFunc, rp retryPolicy) error { - for { - pinned := c.balancer.pinned() - err := retryf(rpcCtx, f, rp) - if err == nil { - return nil - } - logger.Lvl(4).Infof("clientv3/auth-retry: error %q on pinned endpoint %q", err.Error(), pinned) - // always stop retry on etcd errors other than invalid auth token - if rpctypes.Error(err) == rpctypes.ErrInvalidAuthToken { - gterr := c.getToken(rpcCtx) - if gterr != nil { - logger.Lvl(4).Infof("clientv3/auth-retry: cannot retry due to error %q(%q) on pinned endpoint %q", err.Error(), gterr.Error(), pinned) - return err // return the original error for simplicity - } - continue - } - return err - } - } + return desc == "there is no address available" || desc == "there is no connection available" } type retryKVClient struct { - kc pb.KVClient - retryf retryRPCFunc + kc pb.KVClient } // RetryKVClient implements a KVClient. func RetryKVClient(c *Client) pb.KVClient { return &retryKVClient{ - kc: pb.NewKVClient(c.conn), - retryf: c.newAuthRetryWrapper(c.newRetryWrapper()), + kc: pb.NewKVClient(c.conn), } } func (rkv *retryKVClient) Range(ctx context.Context, in *pb.RangeRequest, opts ...grpc.CallOption) (resp *pb.RangeResponse, err error) { - err = rkv.retryf(ctx, func(rctx context.Context) error { - resp, err = rkv.kc.Range(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rkv.kc.Range(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rkv *retryKVClient) Put(ctx context.Context, in *pb.PutRequest, opts ...grpc.CallOption) (resp *pb.PutResponse, err error) { - err = rkv.retryf(ctx, func(rctx context.Context) error { - resp, err = rkv.kc.Put(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rkv.kc.Put(ctx, in, opts...) } func (rkv *retryKVClient) DeleteRange(ctx context.Context, in *pb.DeleteRangeRequest, opts ...grpc.CallOption) (resp *pb.DeleteRangeResponse, err error) { - err = rkv.retryf(ctx, func(rctx context.Context) error { - resp, err = rkv.kc.DeleteRange(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rkv.kc.DeleteRange(ctx, in, opts...) } func (rkv *retryKVClient) Txn(ctx context.Context, in *pb.TxnRequest, opts ...grpc.CallOption) (resp *pb.TxnResponse, err error) { - // TODO: "repeatable" for read-only txn - err = rkv.retryf(ctx, func(rctx context.Context) error { - resp, err = rkv.kc.Txn(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rkv.kc.Txn(ctx, in, opts...) } func (rkv *retryKVClient) Compact(ctx context.Context, in *pb.CompactionRequest, opts ...grpc.CallOption) (resp *pb.CompactionResponse, err error) { - err = rkv.retryf(ctx, func(rctx context.Context) error { - resp, err = rkv.kc.Compact(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rkv.kc.Compact(ctx, in, opts...) } type retryLeaseClient struct { - lc pb.LeaseClient - retryf retryRPCFunc + lc pb.LeaseClient } // RetryLeaseClient implements a LeaseClient. func RetryLeaseClient(c *Client) pb.LeaseClient { return &retryLeaseClient{ - lc: pb.NewLeaseClient(c.conn), - retryf: c.newAuthRetryWrapper(c.newRetryWrapper()), + lc: pb.NewLeaseClient(c.conn), } } func (rlc *retryLeaseClient) LeaseTimeToLive(ctx context.Context, in *pb.LeaseTimeToLiveRequest, opts ...grpc.CallOption) (resp *pb.LeaseTimeToLiveResponse, err error) { - err = rlc.retryf(ctx, func(rctx context.Context) error { - resp, err = rlc.lc.LeaseTimeToLive(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rlc.lc.LeaseTimeToLive(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rlc *retryLeaseClient) LeaseLeases(ctx context.Context, in *pb.LeaseLeasesRequest, opts ...grpc.CallOption) (resp *pb.LeaseLeasesResponse, err error) { - err = rlc.retryf(ctx, func(rctx context.Context) error { - resp, err = rlc.lc.LeaseLeases(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rlc.lc.LeaseLeases(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rlc *retryLeaseClient) LeaseGrant(ctx context.Context, in *pb.LeaseGrantRequest, opts ...grpc.CallOption) (resp *pb.LeaseGrantResponse, err error) { - err = rlc.retryf(ctx, func(rctx context.Context) error { - resp, err = rlc.lc.LeaseGrant(rctx, in, opts...) - return err - }, repeatable) - return resp, err - + return rlc.lc.LeaseGrant(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rlc *retryLeaseClient) LeaseRevoke(ctx context.Context, in *pb.LeaseRevokeRequest, opts ...grpc.CallOption) (resp *pb.LeaseRevokeResponse, err error) { - err = rlc.retryf(ctx, func(rctx context.Context) error { - resp, err = rlc.lc.LeaseRevoke(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rlc.lc.LeaseRevoke(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rlc *retryLeaseClient) LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (stream pb.Lease_LeaseKeepAliveClient, err error) { - err = rlc.retryf(ctx, func(rctx context.Context) error { - stream, err = rlc.lc.LeaseKeepAlive(rctx, opts...) - return err - }, repeatable) - return stream, err + return rlc.lc.LeaseKeepAlive(ctx, append(opts, withRetryPolicy(repeatable))...) } type retryClusterClient struct { - cc pb.ClusterClient - retryf retryRPCFunc + cc pb.ClusterClient } // RetryClusterClient implements a ClusterClient. func RetryClusterClient(c *Client) pb.ClusterClient { return &retryClusterClient{ - cc: pb.NewClusterClient(c.conn), - retryf: c.newRetryWrapper(), + cc: pb.NewClusterClient(c.conn), } } func (rcc *retryClusterClient) MemberList(ctx context.Context, in *pb.MemberListRequest, opts ...grpc.CallOption) (resp *pb.MemberListResponse, err error) { - err = rcc.retryf(ctx, func(rctx context.Context) error { - resp, err = rcc.cc.MemberList(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rcc.cc.MemberList(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rcc *retryClusterClient) MemberAdd(ctx context.Context, in *pb.MemberAddRequest, opts ...grpc.CallOption) (resp *pb.MemberAddResponse, err error) { - err = rcc.retryf(ctx, func(rctx context.Context) error { - resp, err = rcc.cc.MemberAdd(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rcc.cc.MemberAdd(ctx, in, opts...) } func (rcc *retryClusterClient) MemberRemove(ctx context.Context, in *pb.MemberRemoveRequest, opts ...grpc.CallOption) (resp *pb.MemberRemoveResponse, err error) { - err = rcc.retryf(ctx, func(rctx context.Context) error { - resp, err = rcc.cc.MemberRemove(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rcc.cc.MemberRemove(ctx, in, opts...) } func (rcc *retryClusterClient) MemberUpdate(ctx context.Context, in *pb.MemberUpdateRequest, opts ...grpc.CallOption) (resp *pb.MemberUpdateResponse, err error) { - err = rcc.retryf(ctx, func(rctx context.Context) error { - resp, err = rcc.cc.MemberUpdate(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rcc.cc.MemberUpdate(ctx, in, opts...) } type retryMaintenanceClient struct { - mc pb.MaintenanceClient - retryf retryRPCFunc + mc pb.MaintenanceClient } // RetryMaintenanceClient implements a Maintenance. func RetryMaintenanceClient(c *Client, conn *grpc.ClientConn) pb.MaintenanceClient { return &retryMaintenanceClient{ - mc: pb.NewMaintenanceClient(conn), - retryf: c.newRetryWrapper(), + mc: pb.NewMaintenanceClient(conn), } } func (rmc *retryMaintenanceClient) Alarm(ctx context.Context, in *pb.AlarmRequest, opts ...grpc.CallOption) (resp *pb.AlarmResponse, err error) { - err = rmc.retryf(ctx, func(rctx context.Context) error { - resp, err = rmc.mc.Alarm(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rmc.mc.Alarm(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rmc *retryMaintenanceClient) Status(ctx context.Context, in *pb.StatusRequest, opts ...grpc.CallOption) (resp *pb.StatusResponse, err error) { - err = rmc.retryf(ctx, func(rctx context.Context) error { - resp, err = rmc.mc.Status(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rmc.mc.Status(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rmc *retryMaintenanceClient) Hash(ctx context.Context, in *pb.HashRequest, opts ...grpc.CallOption) (resp *pb.HashResponse, err error) { - err = rmc.retryf(ctx, func(rctx context.Context) error { - resp, err = rmc.mc.Hash(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rmc.mc.Hash(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rmc *retryMaintenanceClient) HashKV(ctx context.Context, in *pb.HashKVRequest, opts ...grpc.CallOption) (resp *pb.HashKVResponse, err error) { - err = rmc.retryf(ctx, func(rctx context.Context) error { - resp, err = rmc.mc.HashKV(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rmc.mc.HashKV(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rmc *retryMaintenanceClient) Snapshot(ctx context.Context, in *pb.SnapshotRequest, opts ...grpc.CallOption) (stream pb.Maintenance_SnapshotClient, err error) { - err = rmc.retryf(ctx, func(rctx context.Context) error { - stream, err = rmc.mc.Snapshot(rctx, in, opts...) - return err - }, repeatable) - return stream, err + return rmc.mc.Snapshot(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rmc *retryMaintenanceClient) MoveLeader(ctx context.Context, in *pb.MoveLeaderRequest, opts ...grpc.CallOption) (resp *pb.MoveLeaderResponse, err error) { - err = rmc.retryf(ctx, func(rctx context.Context) error { - resp, err = rmc.mc.MoveLeader(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rmc.mc.MoveLeader(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rmc *retryMaintenanceClient) Defragment(ctx context.Context, in *pb.DefragmentRequest, opts ...grpc.CallOption) (resp *pb.DefragmentResponse, err error) { - err = rmc.retryf(ctx, func(rctx context.Context) error { - resp, err = rmc.mc.Defragment(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rmc.mc.Defragment(ctx, in, opts...) } type retryAuthClient struct { - ac pb.AuthClient - retryf retryRPCFunc + ac pb.AuthClient } // RetryAuthClient implements a AuthClient. func RetryAuthClient(c *Client) pb.AuthClient { return &retryAuthClient{ - ac: pb.NewAuthClient(c.conn), - retryf: c.newRetryWrapper(), + ac: pb.NewAuthClient(c.conn), } } func (rac *retryAuthClient) UserList(ctx context.Context, in *pb.AuthUserListRequest, opts ...grpc.CallOption) (resp *pb.AuthUserListResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.UserList(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rac.ac.UserList(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rac *retryAuthClient) UserGet(ctx context.Context, in *pb.AuthUserGetRequest, opts ...grpc.CallOption) (resp *pb.AuthUserGetResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.UserGet(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rac.ac.UserGet(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rac *retryAuthClient) RoleGet(ctx context.Context, in *pb.AuthRoleGetRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleGetResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.RoleGet(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rac.ac.RoleGet(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rac *retryAuthClient) RoleList(ctx context.Context, in *pb.AuthRoleListRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleListResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.RoleList(rctx, in, opts...) - return err - }, repeatable) - return resp, err + return rac.ac.RoleList(ctx, in, append(opts, withRetryPolicy(repeatable))...) } func (rac *retryAuthClient) AuthEnable(ctx context.Context, in *pb.AuthEnableRequest, opts ...grpc.CallOption) (resp *pb.AuthEnableResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.AuthEnable(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.AuthEnable(ctx, in, opts...) } func (rac *retryAuthClient) AuthDisable(ctx context.Context, in *pb.AuthDisableRequest, opts ...grpc.CallOption) (resp *pb.AuthDisableResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.AuthDisable(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.AuthDisable(ctx, in, opts...) } func (rac *retryAuthClient) UserAdd(ctx context.Context, in *pb.AuthUserAddRequest, opts ...grpc.CallOption) (resp *pb.AuthUserAddResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.UserAdd(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.UserAdd(ctx, in, opts...) } func (rac *retryAuthClient) UserDelete(ctx context.Context, in *pb.AuthUserDeleteRequest, opts ...grpc.CallOption) (resp *pb.AuthUserDeleteResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.UserDelete(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.UserDelete(ctx, in, opts...) } func (rac *retryAuthClient) UserChangePassword(ctx context.Context, in *pb.AuthUserChangePasswordRequest, opts ...grpc.CallOption) (resp *pb.AuthUserChangePasswordResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.UserChangePassword(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.UserChangePassword(ctx, in, opts...) } func (rac *retryAuthClient) UserGrantRole(ctx context.Context, in *pb.AuthUserGrantRoleRequest, opts ...grpc.CallOption) (resp *pb.AuthUserGrantRoleResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.UserGrantRole(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.UserGrantRole(ctx, in, opts...) } func (rac *retryAuthClient) UserRevokeRole(ctx context.Context, in *pb.AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (resp *pb.AuthUserRevokeRoleResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.UserRevokeRole(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.UserRevokeRole(ctx, in, opts...) } func (rac *retryAuthClient) RoleAdd(ctx context.Context, in *pb.AuthRoleAddRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleAddResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.RoleAdd(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.RoleAdd(ctx, in, opts...) } func (rac *retryAuthClient) RoleDelete(ctx context.Context, in *pb.AuthRoleDeleteRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleDeleteResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.RoleDelete(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.RoleDelete(ctx, in, opts...) } func (rac *retryAuthClient) RoleGrantPermission(ctx context.Context, in *pb.AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleGrantPermissionResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.RoleGrantPermission(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.RoleGrantPermission(ctx, in, opts...) } func (rac *retryAuthClient) RoleRevokePermission(ctx context.Context, in *pb.AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleRevokePermissionResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.RoleRevokePermission(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.RoleRevokePermission(ctx, in, opts...) } func (rac *retryAuthClient) Authenticate(ctx context.Context, in *pb.AuthenticateRequest, opts ...grpc.CallOption) (resp *pb.AuthenticateResponse, err error) { - err = rac.retryf(ctx, func(rctx context.Context) error { - resp, err = rac.ac.Authenticate(rctx, in, opts...) - return err - }, nonRepeatable) - return resp, err + return rac.ac.Authenticate(ctx, in, opts...) } diff --git a/vendor/github.com/coreos/etcd/clientv3/retry_interceptor.go b/vendor/github.com/coreos/etcd/clientv3/retry_interceptor.go new file mode 100644 index 000000000..c65ec81a4 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/retry_interceptor.go @@ -0,0 +1,389 @@ +// Copyright 2016 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Based on github.com/grpc-ecosystem/go-grpc-middleware/retry, but modified to support the more +// fine grained error checking required by write-at-most-once retry semantics of etcd. + +package clientv3 + +import ( + "context" + "io" + "sync" + "time" + + "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// unaryClientInterceptor returns a new retrying unary client interceptor. +// +// The default configuration of the interceptor is to not retry *at all*. This behaviour can be +// changed through options (e.g. WithMax) on creation of the interceptor or on call (through grpc.CallOptions). +func (c *Client) unaryClientInterceptor(logger *zap.Logger, optFuncs ...retryOption) grpc.UnaryClientInterceptor { + intOpts := reuseOrNewWithCallOptions(defaultOptions, optFuncs) + return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + grpcOpts, retryOpts := filterCallOptions(opts) + callOpts := reuseOrNewWithCallOptions(intOpts, retryOpts) + // short circuit for simplicity, and avoiding allocations. + if callOpts.max == 0 { + return invoker(ctx, method, req, reply, cc, grpcOpts...) + } + var lastErr error + for attempt := uint(0); attempt < callOpts.max; attempt++ { + if err := waitRetryBackoff(ctx, attempt, callOpts); err != nil { + return err + } + logger.Debug( + "retrying of unary invoker", + zap.String("target", cc.Target()), + zap.Uint("attempt", attempt), + ) + lastErr = invoker(ctx, method, req, reply, cc, grpcOpts...) + if lastErr == nil { + return nil + } + logger.Warn( + "retrying of unary invoker failed", + zap.String("target", cc.Target()), + zap.Uint("attempt", attempt), + zap.Error(lastErr), + ) + if isContextError(lastErr) { + if ctx.Err() != nil { + // its the context deadline or cancellation. + return lastErr + } + // its the callCtx deadline or cancellation, in which case try again. + continue + } + if callOpts.retryAuth && rpctypes.Error(lastErr) == rpctypes.ErrInvalidAuthToken { + gterr := c.getToken(ctx) + if gterr != nil { + logger.Warn( + "retrying of unary invoker failed to fetch new auth token", + zap.String("target", cc.Target()), + zap.Error(gterr), + ) + return gterr // lastErr must be invalid auth token + } + continue + } + if !isSafeRetry(c.lg, lastErr, callOpts) { + return lastErr + } + } + return lastErr + } +} + +// streamClientInterceptor returns a new retrying stream client interceptor for server side streaming calls. +// +// The default configuration of the interceptor is to not retry *at all*. This behaviour can be +// changed through options (e.g. WithMax) on creation of the interceptor or on call (through grpc.CallOptions). +// +// Retry logic is available *only for ServerStreams*, i.e. 1:n streams, as the internal logic needs +// to buffer the messages sent by the client. If retry is enabled on any other streams (ClientStreams, +// BidiStreams), the retry interceptor will fail the call. +func (c *Client) streamClientInterceptor(logger *zap.Logger, optFuncs ...retryOption) grpc.StreamClientInterceptor { + intOpts := reuseOrNewWithCallOptions(defaultOptions, optFuncs) + return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { + grpcOpts, retryOpts := filterCallOptions(opts) + callOpts := reuseOrNewWithCallOptions(intOpts, retryOpts) + // short circuit for simplicity, and avoiding allocations. + if callOpts.max == 0 { + return streamer(ctx, desc, cc, method, grpcOpts...) + } + if desc.ClientStreams { + return nil, status.Errorf(codes.Unimplemented, "clientv3/retry_interceptor: cannot retry on ClientStreams, set Disable()") + } + newStreamer, err := streamer(ctx, desc, cc, method, grpcOpts...) + logger.Warn("retry stream intercept", zap.Error(err)) + if err != nil { + // TODO(mwitkow): Maybe dial and transport errors should be retriable? + return nil, err + } + retryingStreamer := &serverStreamingRetryingStream{ + client: c, + ClientStream: newStreamer, + callOpts: callOpts, + ctx: ctx, + streamerCall: func(ctx context.Context) (grpc.ClientStream, error) { + return streamer(ctx, desc, cc, method, grpcOpts...) + }, + } + return retryingStreamer, nil + } +} + +// type serverStreamingRetryingStream is the implementation of grpc.ClientStream that acts as a +// proxy to the underlying call. If any of the RecvMsg() calls fail, it will try to reestablish +// a new ClientStream according to the retry policy. +type serverStreamingRetryingStream struct { + grpc.ClientStream + client *Client + bufferedSends []interface{} // single message that the client can sen + receivedGood bool // indicates whether any prior receives were successful + wasClosedSend bool // indicates that CloseSend was closed + ctx context.Context + callOpts *options + streamerCall func(ctx context.Context) (grpc.ClientStream, error) + mu sync.RWMutex +} + +func (s *serverStreamingRetryingStream) setStream(clientStream grpc.ClientStream) { + s.mu.Lock() + s.ClientStream = clientStream + s.mu.Unlock() +} + +func (s *serverStreamingRetryingStream) getStream() grpc.ClientStream { + s.mu.RLock() + defer s.mu.RUnlock() + return s.ClientStream +} + +func (s *serverStreamingRetryingStream) SendMsg(m interface{}) error { + s.mu.Lock() + s.bufferedSends = append(s.bufferedSends, m) + s.mu.Unlock() + return s.getStream().SendMsg(m) +} + +func (s *serverStreamingRetryingStream) CloseSend() error { + s.mu.Lock() + s.wasClosedSend = true + s.mu.Unlock() + return s.getStream().CloseSend() +} + +func (s *serverStreamingRetryingStream) Header() (metadata.MD, error) { + return s.getStream().Header() +} + +func (s *serverStreamingRetryingStream) Trailer() metadata.MD { + return s.getStream().Trailer() +} + +func (s *serverStreamingRetryingStream) RecvMsg(m interface{}) error { + attemptRetry, lastErr := s.receiveMsgAndIndicateRetry(m) + if !attemptRetry { + return lastErr // success or hard failure + } + // We start off from attempt 1, because zeroth was already made on normal SendMsg(). + for attempt := uint(1); attempt < s.callOpts.max; attempt++ { + if err := waitRetryBackoff(s.ctx, attempt, s.callOpts); err != nil { + return err + } + newStream, err := s.reestablishStreamAndResendBuffer(s.ctx) + if err != nil { + // TODO(mwitkow): Maybe dial and transport errors should be retriable? + return err + } + s.setStream(newStream) + attemptRetry, lastErr = s.receiveMsgAndIndicateRetry(m) + //fmt.Printf("Received message and indicate: %v %v\n", attemptRetry, lastErr) + if !attemptRetry { + return lastErr + } + } + return lastErr +} + +func (s *serverStreamingRetryingStream) receiveMsgAndIndicateRetry(m interface{}) (bool, error) { + s.mu.RLock() + wasGood := s.receivedGood + s.mu.RUnlock() + err := s.getStream().RecvMsg(m) + if err == nil || err == io.EOF { + s.mu.Lock() + s.receivedGood = true + s.mu.Unlock() + return false, err + } else if wasGood { + // previous RecvMsg in the stream succeeded, no retry logic should interfere + return false, err + } + if isContextError(err) { + if s.ctx.Err() != nil { + return false, err + } + // its the callCtx deadline or cancellation, in which case try again. + return true, err + } + if s.callOpts.retryAuth && rpctypes.Error(err) == rpctypes.ErrInvalidAuthToken { + gterr := s.client.getToken(s.ctx) + if gterr != nil { + s.client.lg.Warn("retry failed to fetch new auth token", zap.Error(gterr)) + return false, err // return the original error for simplicity + } + return true, err + + } + return isSafeRetry(s.client.lg, err, s.callOpts), err +} + +func (s *serverStreamingRetryingStream) reestablishStreamAndResendBuffer(callCtx context.Context) (grpc.ClientStream, error) { + s.mu.RLock() + bufferedSends := s.bufferedSends + s.mu.RUnlock() + newStream, err := s.streamerCall(callCtx) + if err != nil { + return nil, err + } + for _, msg := range bufferedSends { + if err := newStream.SendMsg(msg); err != nil { + return nil, err + } + } + if err := newStream.CloseSend(); err != nil { + return nil, err + } + return newStream, nil +} + +func waitRetryBackoff(ctx context.Context, attempt uint, callOpts *options) error { + waitTime := time.Duration(0) + if attempt > 0 { + waitTime = callOpts.backoffFunc(attempt) + } + if waitTime > 0 { + timer := time.NewTimer(waitTime) + select { + case <-ctx.Done(): + timer.Stop() + return contextErrToGrpcErr(ctx.Err()) + case <-timer.C: + } + } + return nil +} + +// isSafeRetry returns "true", if request is safe for retry with the given error. +func isSafeRetry(lg *zap.Logger, err error, callOpts *options) bool { + if isContextError(err) { + return false + } + switch callOpts.retryPolicy { + case repeatable: + return isSafeRetryImmutableRPC(err) + case nonRepeatable: + return isSafeRetryMutableRPC(err) + default: + lg.Warn("unrecognized retry policy", zap.String("retryPolicy", callOpts.retryPolicy.String())) + return false + } +} + +func isContextError(err error) bool { + return grpc.Code(err) == codes.DeadlineExceeded || grpc.Code(err) == codes.Canceled +} + +func contextErrToGrpcErr(err error) error { + switch err { + case context.DeadlineExceeded: + return status.Errorf(codes.DeadlineExceeded, err.Error()) + case context.Canceled: + return status.Errorf(codes.Canceled, err.Error()) + default: + return status.Errorf(codes.Unknown, err.Error()) + } +} + +var ( + defaultOptions = &options{ + retryPolicy: nonRepeatable, + max: 0, // disable + backoffFunc: backoffLinearWithJitter(50*time.Millisecond /*jitter*/, 0.10), + retryAuth: true, + } +) + +// backoffFunc denotes a family of functions that control the backoff duration between call retries. +// +// They are called with an identifier of the attempt, and should return a time the system client should +// hold off for. If the time returned is longer than the `context.Context.Deadline` of the request +// the deadline of the request takes precedence and the wait will be interrupted before proceeding +// with the next iteration. +type backoffFunc func(attempt uint) time.Duration + +// withRetryPolicy sets the retry policy of this call. +func withRetryPolicy(rp retryPolicy) retryOption { + return retryOption{applyFunc: func(o *options) { + o.retryPolicy = rp + }} +} + +// withMax sets the maximum number of retries on this call, or this interceptor. +func withMax(maxRetries uint) retryOption { + return retryOption{applyFunc: func(o *options) { + o.max = maxRetries + }} +} + +// WithBackoff sets the `BackoffFunc `used to control time between retries. +func withBackoff(bf backoffFunc) retryOption { + return retryOption{applyFunc: func(o *options) { + o.backoffFunc = bf + }} +} + +type options struct { + retryPolicy retryPolicy + max uint + backoffFunc backoffFunc + retryAuth bool +} + +// retryOption is a grpc.CallOption that is local to clientv3's retry interceptor. +type retryOption struct { + grpc.EmptyCallOption // make sure we implement private after() and before() fields so we don't panic. + applyFunc func(opt *options) +} + +func reuseOrNewWithCallOptions(opt *options, retryOptions []retryOption) *options { + if len(retryOptions) == 0 { + return opt + } + optCopy := &options{} + *optCopy = *opt + for _, f := range retryOptions { + f.applyFunc(optCopy) + } + return optCopy +} + +func filterCallOptions(callOptions []grpc.CallOption) (grpcOptions []grpc.CallOption, retryOptions []retryOption) { + for _, opt := range callOptions { + if co, ok := opt.(retryOption); ok { + retryOptions = append(retryOptions, co) + } else { + grpcOptions = append(grpcOptions, opt) + } + } + return grpcOptions, retryOptions +} + +// BackoffLinearWithJitter waits a set period of time, allowing for jitter (fractional adjustment). +// +// For example waitBetween=1s and jitter=0.10 can generate waits between 900ms and 1100ms. +func backoffLinearWithJitter(waitBetween time.Duration, jitterFraction float64) backoffFunc { + return func(attempt uint) time.Duration { + return jitterUp(waitBetween, jitterFraction) + } +} diff --git a/vendor/github.com/coreos/etcd/clientv3/snapshot/doc.go b/vendor/github.com/coreos/etcd/clientv3/snapshot/doc.go new file mode 100644 index 000000000..1c761be70 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/snapshot/doc.go @@ -0,0 +1,16 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package snapshot implements utilities around etcd snapshot. +package snapshot diff --git a/vendor/github.com/coreos/etcd/clientv3/snapshot/testdata/corrupted_backup.db b/vendor/github.com/coreos/etcd/clientv3/snapshot/testdata/corrupted_backup.db new file mode 100644 index 000000000..d4ab10ef7 Binary files /dev/null and b/vendor/github.com/coreos/etcd/clientv3/snapshot/testdata/corrupted_backup.db differ diff --git a/vendor/github.com/coreos/etcd/clientv3/snapshot/util.go b/vendor/github.com/coreos/etcd/clientv3/snapshot/util.go new file mode 100644 index 000000000..93ba70b6c --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/snapshot/util.go @@ -0,0 +1,35 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package snapshot + +import "encoding/binary" + +type revision struct { + main int64 + sub int64 +} + +func bytesToRev(bytes []byte) revision { + return revision{ + main: int64(binary.BigEndian.Uint64(bytes[0:8])), + sub: int64(binary.BigEndian.Uint64(bytes[9:])), + } +} + +// initIndex implements ConsistentIndexGetter so the snapshot won't block +// the new raft instance by waiting for a future raft index. +type initIndex int + +func (i *initIndex) ConsistentIndex() uint64 { return uint64(*i) } diff --git a/vendor/github.com/coreos/etcd/clientv3/snapshot/v3_snapshot.go b/vendor/github.com/coreos/etcd/clientv3/snapshot/v3_snapshot.go new file mode 100644 index 000000000..6bf9244aa --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/snapshot/v3_snapshot.go @@ -0,0 +1,492 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package snapshot + +import ( + "context" + "crypto/sha256" + "encoding/json" + "fmt" + "hash/crc32" + "io" + "math" + "os" + "path/filepath" + "reflect" + "strings" + "time" + + bolt "github.com/coreos/bbolt" + "github.com/coreos/etcd/clientv3" + "github.com/coreos/etcd/etcdserver" + "github.com/coreos/etcd/etcdserver/etcdserverpb" + "github.com/coreos/etcd/etcdserver/membership" + "github.com/coreos/etcd/lease" + "github.com/coreos/etcd/mvcc" + "github.com/coreos/etcd/mvcc/backend" + "github.com/coreos/etcd/pkg/fileutil" + "github.com/coreos/etcd/pkg/types" + "github.com/coreos/etcd/raft" + "github.com/coreos/etcd/raft/raftpb" + "github.com/coreos/etcd/snap" + "github.com/coreos/etcd/store" + "github.com/coreos/etcd/wal" + "github.com/coreos/etcd/wal/walpb" + "go.uber.org/zap" +) + +// Manager defines snapshot methods. +type Manager interface { + // Save fetches snapshot from remote etcd server and saves data + // to target path. If the context "ctx" is canceled or timed out, + // snapshot save stream will error out (e.g. context.Canceled, + // context.DeadlineExceeded). Make sure to specify only one endpoint + // in client configuration. Snapshot API must be requested to a + // selected node, and saved snapshot is the point-in-time state of + // the selected node. + Save(ctx context.Context, cfg clientv3.Config, dbPath string) error + + // Status returns the snapshot file information. + Status(dbPath string) (Status, error) + + // Restore restores a new etcd data directory from given snapshot + // file. It returns an error if specified data directory already + // exists, to prevent unintended data directory overwrites. + Restore(cfg RestoreConfig) error +} + +// NewV3 returns a new snapshot Manager for v3.x snapshot. +func NewV3(lg *zap.Logger) Manager { + if lg == nil { + lg = zap.NewExample() + } + return &v3Manager{lg: lg} +} + +type v3Manager struct { + lg *zap.Logger + + name string + dbPath string + walDir string + snapDir string + cl *membership.RaftCluster + + skipHashCheck bool +} + +// Save fetches snapshot from remote etcd server and saves data to target path. +func (s *v3Manager) Save(ctx context.Context, cfg clientv3.Config, dbPath string) error { + if len(cfg.Endpoints) != 1 { + return fmt.Errorf("snapshot must be requested to one selected node, not multiple %v", cfg.Endpoints) + } + cli, err := clientv3.New(cfg) + if err != nil { + return err + } + defer cli.Close() + + partpath := dbPath + ".part" + defer os.RemoveAll(partpath) + + var f *os.File + f, err = os.OpenFile(partpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fileutil.PrivateFileMode) + if err != nil { + return fmt.Errorf("could not open %s (%v)", partpath, err) + } + s.lg.Info( + "created temporary db file", + zap.String("path", partpath), + ) + + now := time.Now() + var rd io.ReadCloser + rd, err = cli.Snapshot(ctx) + if err != nil { + return err + } + s.lg.Info( + "fetching snapshot", + zap.String("endpoint", cfg.Endpoints[0]), + ) + if _, err = io.Copy(f, rd); err != nil { + return err + } + if err = fileutil.Fsync(f); err != nil { + return err + } + if err = f.Close(); err != nil { + return err + } + s.lg.Info( + "fetched snapshot", + zap.String("endpoint", cfg.Endpoints[0]), + zap.Duration("took", time.Since(now)), + ) + + if err = os.Rename(partpath, dbPath); err != nil { + return fmt.Errorf("could not rename %s to %s (%v)", partpath, dbPath, err) + } + s.lg.Info("saved", zap.String("path", dbPath)) + return nil +} + +// Status is the snapshot file status. +type Status struct { + Hash uint32 `json:"hash"` + Revision int64 `json:"revision"` + TotalKey int `json:"totalKey"` + TotalSize int64 `json:"totalSize"` +} + +// Status returns the snapshot file information. +func (s *v3Manager) Status(dbPath string) (ds Status, err error) { + if _, err = os.Stat(dbPath); err != nil { + return ds, err + } + + db, err := bolt.Open(dbPath, 0400, &bolt.Options{ReadOnly: true}) + if err != nil { + return ds, err + } + defer db.Close() + + h := crc32.New(crc32.MakeTable(crc32.Castagnoli)) + + if err = db.View(func(tx *bolt.Tx) error { + // check snapshot file integrity first + var dbErrStrings []string + for dbErr := range tx.Check() { + dbErrStrings = append(dbErrStrings, dbErr.Error()) + } + if len(dbErrStrings) > 0 { + return fmt.Errorf("snapshot file integrity check failed. %d errors found.\n"+strings.Join(dbErrStrings, "\n"), len(dbErrStrings)) + } + ds.TotalSize = tx.Size() + c := tx.Cursor() + for next, _ := c.First(); next != nil; next, _ = c.Next() { + b := tx.Bucket(next) + if b == nil { + return fmt.Errorf("cannot get hash of bucket %s", string(next)) + } + h.Write(next) + iskeyb := (string(next) == "key") + b.ForEach(func(k, v []byte) error { + h.Write(k) + h.Write(v) + if iskeyb { + rev := bytesToRev(k) + ds.Revision = rev.main + } + ds.TotalKey++ + return nil + }) + } + return nil + }); err != nil { + return ds, err + } + + ds.Hash = h.Sum32() + return ds, nil +} + +// RestoreConfig configures snapshot restore operation. +type RestoreConfig struct { + // SnapshotPath is the path of snapshot file to restore from. + SnapshotPath string + + // Name is the human-readable name of this member. + Name string + + // OutputDataDir is the target data directory to save restored data. + // OutputDataDir should not conflict with existing etcd data directory. + // If OutputDataDir already exists, it will return an error to prevent + // unintended data directory overwrites. + // If empty, defaults to "[Name].etcd" if not given. + OutputDataDir string + // OutputWALDir is the target WAL data directory. + // If empty, defaults to "[OutputDataDir]/member/wal" if not given. + OutputWALDir string + + // PeerURLs is a list of member's peer URLs to advertise to the rest of the cluster. + PeerURLs []string + + // InitialCluster is the initial cluster configuration for restore bootstrap. + InitialCluster string + // InitialClusterToken is the initial cluster token for etcd cluster during restore bootstrap. + InitialClusterToken string + + // SkipHashCheck is "true" to ignore snapshot integrity hash value + // (required if copied from data directory). + SkipHashCheck bool +} + +// Restore restores a new etcd data directory from given snapshot file. +func (s *v3Manager) Restore(cfg RestoreConfig) error { + pURLs, err := types.NewURLs(cfg.PeerURLs) + if err != nil { + return err + } + var ics types.URLsMap + ics, err = types.NewURLsMap(cfg.InitialCluster) + if err != nil { + return err + } + + srv := etcdserver.ServerConfig{ + Name: cfg.Name, + PeerURLs: pURLs, + InitialPeerURLsMap: ics, + InitialClusterToken: cfg.InitialClusterToken, + } + if err = srv.VerifyBootstrap(); err != nil { + return err + } + + s.cl, err = membership.NewClusterFromURLsMap(cfg.InitialClusterToken, ics) + if err != nil { + return err + } + + dataDir := cfg.OutputDataDir + if dataDir == "" { + dataDir = cfg.Name + ".etcd" + } + if fileutil.Exist(dataDir) { + return fmt.Errorf("data-dir %q exists", dataDir) + } + + walDir := cfg.OutputWALDir + if walDir == "" { + walDir = filepath.Join(dataDir, "member", "wal") + } else if fileutil.Exist(walDir) { + return fmt.Errorf("wal-dir %q exists", walDir) + } + + s.name = cfg.Name + s.dbPath = cfg.SnapshotPath + s.walDir = walDir + s.snapDir = filepath.Join(dataDir, "member", "snap") + s.skipHashCheck = cfg.SkipHashCheck + + s.lg.Info( + "restoring snapshot", + zap.String("path", s.dbPath), + zap.String("wal-dir", s.walDir), + zap.String("data-dir", dataDir), + zap.String("snap-dir", s.snapDir), + ) + if err = s.saveDB(); err != nil { + return err + } + if err = s.saveWALAndSnap(); err != nil { + return err + } + s.lg.Info( + "restored snapshot", + zap.String("path", s.dbPath), + zap.String("wal-dir", s.walDir), + zap.String("data-dir", dataDir), + zap.String("snap-dir", s.snapDir), + ) + + return nil +} + +// saveDB copies the database snapshot to the snapshot directory +func (s *v3Manager) saveDB() error { + f, ferr := os.OpenFile(s.dbPath, os.O_RDONLY, 0600) + if ferr != nil { + return ferr + } + defer f.Close() + + // get snapshot integrity hash + if _, err := f.Seek(-sha256.Size, io.SeekEnd); err != nil { + return err + } + sha := make([]byte, sha256.Size) + if _, err := f.Read(sha); err != nil { + return err + } + if _, err := f.Seek(0, io.SeekStart); err != nil { + return err + } + + if err := fileutil.CreateDirAll(s.snapDir); err != nil { + return err + } + + dbpath := filepath.Join(s.snapDir, "db") + db, dberr := os.OpenFile(dbpath, os.O_RDWR|os.O_CREATE, 0600) + if dberr != nil { + return dberr + } + if _, err := io.Copy(db, f); err != nil { + return err + } + + // truncate away integrity hash, if any. + off, serr := db.Seek(0, io.SeekEnd) + if serr != nil { + return serr + } + hasHash := (off % 512) == sha256.Size + if hasHash { + if err := db.Truncate(off - sha256.Size); err != nil { + return err + } + } + + if !hasHash && !s.skipHashCheck { + return fmt.Errorf("snapshot missing hash but --skip-hash-check=false") + } + + if hasHash && !s.skipHashCheck { + // check for match + if _, err := db.Seek(0, io.SeekStart); err != nil { + return err + } + h := sha256.New() + if _, err := io.Copy(h, db); err != nil { + return err + } + dbsha := h.Sum(nil) + if !reflect.DeepEqual(sha, dbsha) { + return fmt.Errorf("expected sha256 %v, got %v", sha, dbsha) + } + } + + // db hash is OK, can now modify DB so it can be part of a new cluster + db.Close() + + commit := len(s.cl.Members()) + + // update consistentIndex so applies go through on etcdserver despite + // having a new raft instance + be := backend.NewDefaultBackend(dbpath) + + // a lessor never timeouts leases + lessor := lease.NewLessor(be, math.MaxInt64) + + mvs := mvcc.NewStore(be, lessor, (*initIndex)(&commit)) + txn := mvs.Write() + btx := be.BatchTx() + del := func(k, v []byte) error { + txn.DeleteRange(k, nil) + return nil + } + + // delete stored members from old cluster since using new members + btx.UnsafeForEach([]byte("members"), del) + + // todo: add back new members when we start to deprecate old snap file. + btx.UnsafeForEach([]byte("members_removed"), del) + + // trigger write-out of new consistent index + txn.End() + + mvs.Commit() + mvs.Close() + be.Close() + + return nil +} + +// saveWALAndSnap creates a WAL for the initial cluster +func (s *v3Manager) saveWALAndSnap() error { + if err := fileutil.CreateDirAll(s.walDir); err != nil { + return err + } + + // add members again to persist them to the store we create. + st := store.New(etcdserver.StoreClusterPrefix, etcdserver.StoreKeysPrefix) + s.cl.SetStore(st) + for _, m := range s.cl.Members() { + s.cl.AddMember(m) + } + + m := s.cl.MemberByName(s.name) + md := &etcdserverpb.Metadata{NodeID: uint64(m.ID), ClusterID: uint64(s.cl.ID())} + metadata, merr := md.Marshal() + if merr != nil { + return merr + } + w, walerr := wal.Create(s.walDir, metadata) + if walerr != nil { + return walerr + } + defer w.Close() + + peers := make([]raft.Peer, len(s.cl.MemberIDs())) + for i, id := range s.cl.MemberIDs() { + ctx, err := json.Marshal((*s.cl).Member(id)) + if err != nil { + return err + } + peers[i] = raft.Peer{ID: uint64(id), Context: ctx} + } + + ents := make([]raftpb.Entry, len(peers)) + nodeIDs := make([]uint64, len(peers)) + for i, p := range peers { + nodeIDs[i] = p.ID + cc := raftpb.ConfChange{ + Type: raftpb.ConfChangeAddNode, + NodeID: p.ID, + Context: p.Context, + } + d, err := cc.Marshal() + if err != nil { + return err + } + ents[i] = raftpb.Entry{ + Type: raftpb.EntryConfChange, + Term: 1, + Index: uint64(i + 1), + Data: d, + } + } + + commit, term := uint64(len(ents)), uint64(1) + if err := w.Save(raftpb.HardState{ + Term: term, + Vote: peers[0].ID, + Commit: commit, + }, ents); err != nil { + return err + } + + b, berr := st.Save() + if berr != nil { + return berr + } + raftSnap := raftpb.Snapshot{ + Data: b, + Metadata: raftpb.SnapshotMetadata{ + Index: commit, + Term: term, + ConfState: raftpb.ConfState{ + Nodes: nodeIDs, + }, + }, + } + sn := snap.New(s.snapDir) + if err := sn.SaveSnap(raftSnap); err != nil { + return err + } + return w.SaveSnapshot(walpb.Snapshot{Index: commit, Term: term}) +} diff --git a/vendor/github.com/coreos/etcd/clientv3/utils.go b/vendor/github.com/coreos/etcd/clientv3/utils.go new file mode 100644 index 000000000..b998c41b9 --- /dev/null +++ b/vendor/github.com/coreos/etcd/clientv3/utils.go @@ -0,0 +1,49 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package clientv3 + +import ( + "math/rand" + "reflect" + "runtime" + "strings" + "time" +) + +// jitterUp adds random jitter to the duration. +// +// This adds or subtracts time from the duration within a given jitter fraction. +// For example for 10s and jitter 0.1, it will return a time within [9s, 11s]) +// +// Reference: https://godoc.org/github.com/grpc-ecosystem/go-grpc-middleware/util/backoffutils +func jitterUp(duration time.Duration, jitter float64) time.Duration { + multiplier := jitter * (rand.Float64()*2 - 1) + return time.Duration(float64(duration) * (1 + multiplier)) +} + +// Check if the provided function is being called in the op options. +func isOpFuncCalled(op string, opts []OpOption) bool { + for _, opt := range opts { + v := reflect.ValueOf(opt) + if v.Kind() == reflect.Func { + if opFunc := runtime.FuncForPC(v.Pointer()); opFunc != nil { + if strings.Contains(opFunc.Name(), op) { + return true + } + } + } + } + return false +} diff --git a/vendor/github.com/coreos/etcd/clientv3/watch.go b/vendor/github.com/coreos/etcd/clientv3/watch.go index d7633850e..4a3b8cccd 100644 --- a/vendor/github.com/coreos/etcd/clientv3/watch.go +++ b/vendor/github.com/coreos/etcd/clientv3/watch.go @@ -16,6 +16,7 @@ package clientv3 import ( "context" + "errors" "fmt" "sync" "time" @@ -46,8 +47,33 @@ type Watcher interface { // through the returned channel. If revisions waiting to be sent over the // watch are compacted, then the watch will be canceled by the server, the // client will post a compacted error watch response, and the channel will close. + // If the context "ctx" is canceled or timed out, returned "WatchChan" is closed, + // and "WatchResponse" from this closed channel has zero events and nil "Err()". + // The context "ctx" MUST be canceled, as soon as watcher is no longer being used, + // to release the associated resources. + // + // If the context is "context.Background/TODO", returned "WatchChan" will + // not be closed and block until event is triggered, except when server + // returns a non-recoverable error (e.g. ErrCompacted). + // For example, when context passed with "WithRequireLeader" and the + // connected server has no leader (e.g. due to network partition), + // error "etcdserver: no leader" (ErrNoLeader) will be returned, + // and then "WatchChan" is closed with non-nil "Err()". + // In order to prevent a watch stream being stuck in a partitioned node, + // make sure to wrap context with "WithRequireLeader". + // + // Otherwise, as long as the context has not been canceled or timed out, + // watch will retry on other recoverable errors forever until reconnected. + // + // TODO: explicitly set context error in the last "WatchResponse" message and close channel? + // Currently, client contexts are overwritten with "valCtx" that never closes. + // TODO(v3.4): configure watch retry policy, limit maximum retry number + // (see https://github.com/etcd-io/etcd/issues/8980) Watch(ctx context.Context, key string, opts ...OpOption) WatchChan + // RequestProgress requests a progress notify response be sent in all watch channels. + RequestProgress(ctx context.Context) error + // Close closes the watcher and cancels all watch requests. Close() error } @@ -134,7 +160,7 @@ type watchGrpcStream struct { resuming []*watcherStream // reqc sends a watch request from Watch() to the main goroutine - reqc chan *watchRequest + reqc chan watchStreamRequest // respc receives data from the watch client respc chan *pb.WatchResponse // donec closes to broadcast shutdown @@ -152,16 +178,27 @@ type watchGrpcStream struct { closeErr error } +// watchStreamRequest is a union of the supported watch request operation types +type watchStreamRequest interface { + toPB() *pb.WatchRequest +} + // watchRequest is issued by the subscriber to start a new watcher type watchRequest struct { ctx context.Context key string end string rev int64 + // send created notification event if this field is true createdNotify bool // progressNotify is for progress updates progressNotify bool + // fragmentation should be disabled by default + // if true, split watch events when total exceeds + // "--max-request-bytes" flag value + 512-byte + fragment bool + // filters is the list of events to filter out filters []pb.WatchCreateRequest_FilterType // get the previous key-value pair before the event happens @@ -170,6 +207,10 @@ type watchRequest struct { retc chan chan WatchResponse } +// progressRequest is issued by the subscriber to request watch progress +type progressRequest struct { +} + // watcherStream represents a registered watcher type watcherStream struct { // initReq is the request that initiated this request @@ -227,7 +268,7 @@ func (w *watcher) newWatcherGrpcStream(inctx context.Context) *watchGrpcStream { cancel: cancel, substreams: make(map[int64]*watcherStream), respc: make(chan *pb.WatchResponse), - reqc: make(chan *watchRequest), + reqc: make(chan watchStreamRequest), donec: make(chan struct{}), errc: make(chan error, 1), closingc: make(chan *watcherStream), @@ -256,6 +297,7 @@ func (w *watcher) Watch(ctx context.Context, key string, opts ...OpOption) Watch end: string(ow.end), rev: ow.rev, progressNotify: ow.progressNotify, + fragment: ow.fragment, filters: filters, prevKV: ow.prevKV, retc: make(chan chan WatchResponse, 1), @@ -292,7 +334,7 @@ func (w *watcher) Watch(ctx context.Context, key string, opts ...OpOption) Watch case <-wr.ctx.Done(): case <-donec: if wgs.closeErr != nil { - closeCh <- WatchResponse{closeErr: wgs.closeErr} + closeCh <- WatchResponse{Canceled: true, closeErr: wgs.closeErr} break } // retry; may have dropped stream from no ctxs @@ -307,7 +349,7 @@ func (w *watcher) Watch(ctx context.Context, key string, opts ...OpOption) Watch case <-ctx.Done(): case <-donec: if wgs.closeErr != nil { - closeCh <- WatchResponse{closeErr: wgs.closeErr} + closeCh <- WatchResponse{Canceled: true, closeErr: wgs.closeErr} break } // retry; may have dropped stream from no ctxs @@ -329,9 +371,50 @@ func (w *watcher) Close() (err error) { err = werr } } + // Consider context.Canceled as a successful close + if err == context.Canceled { + err = nil + } return err } +// RequestProgress requests a progress notify response be sent in all watch channels. +func (w *watcher) RequestProgress(ctx context.Context) (err error) { + ctxKey := streamKeyFromCtx(ctx) + + w.mu.Lock() + if w.streams == nil { + w.mu.Unlock() + return fmt.Errorf("no stream found for context") + } + wgs := w.streams[ctxKey] + if wgs == nil { + wgs = w.newWatcherGrpcStream(ctx) + w.streams[ctxKey] = wgs + } + donec := wgs.donec + reqc := wgs.reqc + w.mu.Unlock() + + pr := &progressRequest{} + + select { + case reqc <- pr: + return nil + case <-ctx.Done(): + if err == nil { + return ctx.Err() + } + return err + case <-donec: + if wgs.closeErr != nil { + return wgs.closeErr + } + // retry; may have dropped stream from no ctxs + return w.RequestProgress(ctx) + } +} + func (w *watchGrpcStream) close() (err error) { w.cancel() <-w.donec @@ -353,7 +436,9 @@ func (w *watcher) closeStream(wgs *watchGrpcStream) { } func (w *watchGrpcStream) addSubstream(resp *pb.WatchResponse, ws *watcherStream) { - if resp.WatchId == -1 { + // check watch ID for backward compatibility (<= v3.3) + if resp.WatchId == -1 || (resp.Canceled && resp.CancelReason != "") { + w.closeErr = v3rpc.Error(errors.New(resp.CancelReason)) // failed; no channel close(ws.recvc) return @@ -379,7 +464,7 @@ func (w *watchGrpcStream) closeSubstream(ws *watcherStream) { } // close subscriber's channel if closeErr := w.closeErr; closeErr != nil && ws.initReq.ctx.Err() == nil { - go w.sendCloseSubstream(ws, &WatchResponse{closeErr: w.closeErr}) + go w.sendCloseSubstream(ws, &WatchResponse{Canceled: true, closeErr: w.closeErr}) } else if ws.outc != nil { close(ws.outc) } @@ -434,31 +519,48 @@ func (w *watchGrpcStream) run() { cancelSet := make(map[int64]struct{}) + var cur *pb.WatchResponse for { select { // Watch() requested - case wreq := <-w.reqc: - outc := make(chan WatchResponse, 1) - ws := &watcherStream{ - initReq: *wreq, - id: -1, - outc: outc, - // unbuffered so resumes won't cause repeat events - recvc: make(chan *WatchResponse), - } + case req := <-w.reqc: + switch wreq := req.(type) { + case *watchRequest: + outc := make(chan WatchResponse, 1) + // TODO: pass custom watch ID? + ws := &watcherStream{ + initReq: *wreq, + id: -1, + outc: outc, + // unbuffered so resumes won't cause repeat events + recvc: make(chan *WatchResponse), + } - ws.donec = make(chan struct{}) - w.wg.Add(1) - go w.serveSubstream(ws, w.resumec) + ws.donec = make(chan struct{}) + w.wg.Add(1) + go w.serveSubstream(ws, w.resumec) - // queue up for watcher creation/resume - w.resuming = append(w.resuming, ws) - if len(w.resuming) == 1 { - // head of resume queue, can register a new watcher - wc.Send(ws.initReq.toPB()) + // queue up for watcher creation/resume + w.resuming = append(w.resuming, ws) + if len(w.resuming) == 1 { + // head of resume queue, can register a new watcher + wc.Send(ws.initReq.toPB()) + } + case *progressRequest: + wc.Send(wreq.toPB()) } - // New events from the watch client + + // new events from the watch client case pbresp := <-w.respc: + if cur == nil || pbresp.Created || pbresp.Canceled { + cur = pbresp + } else if cur != nil && cur.WatchId == pbresp.WatchId { + // merge new events + cur.Events = append(cur.Events, pbresp.Events...) + // update "Fragment" field; last response with "Fragment" == false + cur.Fragment = pbresp.Fragment + } + switch { case pbresp.Created: // response to head of queue creation @@ -467,9 +569,14 @@ func (w *watchGrpcStream) run() { w.dispatchEvent(pbresp) w.resuming[0] = nil } + if ws := w.nextResume(); ws != nil { wc.Send(ws.initReq.toPB()) } + + // reset for next iteration + cur = nil + case pbresp.Canceled && pbresp.CompactRevision == 0: delete(cancelSet, pbresp.WatchId) if ws, ok := w.substreams[pbresp.WatchId]; ok { @@ -477,15 +584,31 @@ func (w *watchGrpcStream) run() { close(ws.recvc) closing[ws] = struct{}{} } + + // reset for next iteration + cur = nil + + case cur.Fragment: + // watch response events are still fragmented + // continue to fetch next fragmented event arrival + continue + default: // dispatch to appropriate watch stream - if ok := w.dispatchEvent(pbresp); ok { + ok := w.dispatchEvent(cur) + + // reset for next iteration + cur = nil + + if ok { break } + // watch response on unexpected watch id; cancel id if _, ok := cancelSet[pbresp.WatchId]; ok { break } + cancelSet[pbresp.WatchId] = struct{}{} cr := &pb.WatchRequest_CancelRequest{ CancelRequest: &pb.WatchCancelRequest{ @@ -495,6 +618,7 @@ func (w *watchGrpcStream) run() { req := &pb.WatchRequest{RequestUnion: cr} wc.Send(req) } + // watch client failed on Recv; spawn another if possible case err := <-w.errc: if isHaltErr(w.ctx, err) || toErr(w.ctx, err) == v3rpc.ErrNoLeader { @@ -508,13 +632,15 @@ func (w *watchGrpcStream) run() { wc.Send(ws.initReq.toPB()) } cancelSet = make(map[int64]struct{}) + case <-w.ctx.Done(): return + case ws := <-w.closingc: w.closeSubstream(ws) delete(closing, ws) + // no more watchers on this stream, shutdown if len(w.substreams)+len(w.resuming) == 0 { - // no more watchers on this stream, shutdown return } } @@ -539,6 +665,7 @@ func (w *watchGrpcStream) dispatchEvent(pbresp *pb.WatchResponse) bool { for i, ev := range pbresp.Events { events[i] = (*Event)(ev) } + // TODO: return watch ID? wr := &WatchResponse{ Header: *pbresp.Header, Events: events, @@ -547,7 +674,31 @@ func (w *watchGrpcStream) dispatchEvent(pbresp *pb.WatchResponse) bool { Canceled: pbresp.Canceled, cancelReason: pbresp.CancelReason, } - ws, ok := w.substreams[pbresp.WatchId] + + // watch IDs are zero indexed, so request notify watch responses are assigned a watch ID of -1 to + // indicate they should be broadcast. + if wr.IsProgressNotify() && pbresp.WatchId == -1 { + return w.broadcastResponse(wr) + } + + return w.unicastResponse(wr, pbresp.WatchId) + +} + +// broadcastResponse send a watch response to all watch substreams. +func (w *watchGrpcStream) broadcastResponse(wr *WatchResponse) bool { + for _, ws := range w.substreams { + select { + case ws.recvc <- wr: + case <-ws.donec: + } + } + return true +} + +// unicastResponse sends a watch response to a specific watch substream. +func (w *watchGrpcStream) unicastResponse(wr *WatchResponse, watchId int64) bool { + ws, ok := w.substreams[watchId] if !ok { return false } @@ -815,11 +966,19 @@ func (wr *watchRequest) toPB() *pb.WatchRequest { ProgressNotify: wr.progressNotify, Filters: wr.filters, PrevKv: wr.prevKV, + Fragment: wr.fragment, } cr := &pb.WatchRequest_CreateRequest{CreateRequest: req} return &pb.WatchRequest{RequestUnion: cr} } +// toPB converts an internal progress request structure to its protobuf WatchRequest structure. +func (pr *progressRequest) toPB() *pb.WatchRequest { + req := &pb.WatchProgressRequest{} + cr := &pb.WatchRequest_ProgressRequest{ProgressRequest: req} + return &pb.WatchRequest{RequestUnion: cr} +} + func streamKeyFromCtx(ctx context.Context) string { if md, ok := metadata.FromOutgoingContext(ctx); ok { return fmt.Sprintf("%+v", md) diff --git a/vendor/github.com/coreos/etcd/clientv3/yaml/config.go b/vendor/github.com/coreos/etcd/clientv3/yaml/config.go index 7539da294..ced503895 100644 --- a/vendor/github.com/coreos/etcd/clientv3/yaml/config.go +++ b/vendor/github.com/coreos/etcd/clientv3/yaml/config.go @@ -20,7 +20,7 @@ import ( "crypto/x509" "io/ioutil" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/pkg/tlsutil" diff --git a/vendor/github.com/coreos/etcd/clientv3/yaml/config_test.go b/vendor/github.com/coreos/etcd/clientv3/yaml/config_test.go index bcf28b434..7a8f71280 100644 --- a/vendor/github.com/coreos/etcd/clientv3/yaml/config_test.go +++ b/vendor/github.com/coreos/etcd/clientv3/yaml/config_test.go @@ -21,7 +21,7 @@ import ( "reflect" "testing" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" ) var ( diff --git a/vendor/github.com/coreos/etcd/cmd/README.md b/vendor/github.com/coreos/etcd/cmd/README.md deleted file mode 100644 index c45dabc1d..000000000 --- a/vendor/github.com/coreos/etcd/cmd/README.md +++ /dev/null @@ -1,4 +0,0 @@ -## cmd - -This directory is meant to enforce vendoring for etcd binaries without polluting -the etcd client libraries with vendored dependencies. diff --git a/vendor/github.com/coreos/etcd/cmd/etcd b/vendor/github.com/coreos/etcd/cmd/etcd deleted file mode 120000 index b870225aa..000000000 --- a/vendor/github.com/coreos/etcd/cmd/etcd +++ /dev/null @@ -1 +0,0 @@ -../ \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/cmd/etcdctl b/vendor/github.com/coreos/etcd/cmd/etcdctl deleted file mode 120000 index 05bb269d6..000000000 --- a/vendor/github.com/coreos/etcd/cmd/etcdctl +++ /dev/null @@ -1 +0,0 @@ -../etcdctl \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/cmd/functional b/vendor/github.com/coreos/etcd/cmd/functional deleted file mode 120000 index 44faa31ae..000000000 --- a/vendor/github.com/coreos/etcd/cmd/functional +++ /dev/null @@ -1 +0,0 @@ -../functional \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/cmd/tools b/vendor/github.com/coreos/etcd/cmd/tools deleted file mode 120000 index 4887d6e0c..000000000 --- a/vendor/github.com/coreos/etcd/cmd/tools +++ /dev/null @@ -1 +0,0 @@ -../tools \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/e2e/cluster_proxy_test.go b/vendor/github.com/coreos/etcd/e2e/cluster_proxy_test.go deleted file mode 100644 index 608d7ea96..000000000 --- a/vendor/github.com/coreos/etcd/e2e/cluster_proxy_test.go +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright 2017 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build cluster_proxy - -package e2e - -import ( - "fmt" - "net" - "net/url" - "os" - "strconv" - "strings" - - "github.com/coreos/etcd/pkg/expect" -) - -type proxyEtcdProcess struct { - etcdProc etcdProcess - proxyV2 *proxyV2Proc - proxyV3 *proxyV3Proc -} - -func newEtcdProcess(cfg *etcdServerProcessConfig) (etcdProcess, error) { - return newProxyEtcdProcess(cfg) -} - -func newProxyEtcdProcess(cfg *etcdServerProcessConfig) (*proxyEtcdProcess, error) { - ep, err := newEtcdServerProcess(cfg) - if err != nil { - return nil, err - } - pep := &proxyEtcdProcess{ - etcdProc: ep, - proxyV2: newProxyV2Proc(cfg), - proxyV3: newProxyV3Proc(cfg), - } - return pep, nil -} - -func (p *proxyEtcdProcess) Config() *etcdServerProcessConfig { return p.etcdProc.Config() } - -func (p *proxyEtcdProcess) EndpointsV2() []string { return p.proxyV2.endpoints() } -func (p *proxyEtcdProcess) EndpointsV3() []string { return p.proxyV3.endpoints() } -func (p *proxyEtcdProcess) EndpointsMetrics() []string { - panic("not implemented; proxy doesn't provide health information") -} - -func (p *proxyEtcdProcess) Start() error { - if err := p.etcdProc.Start(); err != nil { - return err - } - if err := p.proxyV2.Start(); err != nil { - return err - } - return p.proxyV3.Start() -} - -func (p *proxyEtcdProcess) Restart() error { - if err := p.etcdProc.Restart(); err != nil { - return err - } - if err := p.proxyV2.Restart(); err != nil { - return err - } - return p.proxyV3.Restart() -} - -func (p *proxyEtcdProcess) Stop() error { - err := p.proxyV2.Stop() - if v3err := p.proxyV3.Stop(); err == nil { - err = v3err - } - if eerr := p.etcdProc.Stop(); eerr != nil && err == nil { - // fails on go-grpc issue #1384 - if !strings.Contains(eerr.Error(), "exit status 2") { - err = eerr - } - } - return err -} - -func (p *proxyEtcdProcess) Close() error { - err := p.proxyV2.Close() - if v3err := p.proxyV3.Close(); err == nil { - err = v3err - } - if eerr := p.etcdProc.Close(); eerr != nil && err == nil { - // fails on go-grpc issue #1384 - if !strings.Contains(eerr.Error(), "exit status 2") { - err = eerr - } - } - return err -} - -func (p *proxyEtcdProcess) WithStopSignal(sig os.Signal) os.Signal { - p.proxyV3.WithStopSignal(sig) - p.proxyV3.WithStopSignal(sig) - return p.etcdProc.WithStopSignal(sig) -} - -type proxyProc struct { - execPath string - args []string - ep string - murl string - donec chan struct{} - - proc *expect.ExpectProcess -} - -func (pp *proxyProc) endpoints() []string { return []string{pp.ep} } - -func (pp *proxyProc) start() error { - if pp.proc != nil { - panic("already started") - } - proc, err := spawnCmd(append([]string{pp.execPath}, pp.args...)) - if err != nil { - return err - } - pp.proc = proc - return nil -} - -func (pp *proxyProc) waitReady(readyStr string) error { - defer close(pp.donec) - return waitReadyExpectProc(pp.proc, []string{readyStr}) -} - -func (pp *proxyProc) Stop() error { - if pp.proc == nil { - return nil - } - if err := pp.proc.Stop(); err != nil && !strings.Contains(err.Error(), "exit status 1") { - // v2proxy exits with status 1 on auto tls; not sure why - return err - } - pp.proc = nil - <-pp.donec - pp.donec = make(chan struct{}) - return nil -} - -func (pp *proxyProc) WithStopSignal(sig os.Signal) os.Signal { - ret := pp.proc.StopSignal - pp.proc.StopSignal = sig - return ret -} - -func (pp *proxyProc) Close() error { return pp.Stop() } - -type proxyV2Proc struct { - proxyProc - dataDir string -} - -func proxyListenURL(cfg *etcdServerProcessConfig, portOffset int) string { - u, err := url.Parse(cfg.acurl) - if err != nil { - panic(err) - } - host, port, _ := net.SplitHostPort(u.Host) - p, _ := strconv.ParseInt(port, 10, 16) - u.Host = fmt.Sprintf("%s:%d", host, int(p)+portOffset) - return u.String() -} - -func newProxyV2Proc(cfg *etcdServerProcessConfig) *proxyV2Proc { - listenAddr := proxyListenURL(cfg, 2) - name := fmt.Sprintf("testname-proxy-%p", cfg) - args := []string{ - "--name", name, - "--proxy", "on", - "--listen-client-urls", listenAddr, - "--initial-cluster", cfg.name + "=" + cfg.purl.String(), - } - return &proxyV2Proc{ - proxyProc{ - execPath: cfg.execPath, - args: append(args, cfg.tlsArgs...), - ep: listenAddr, - donec: make(chan struct{}), - }, - name + ".etcd", - } -} - -func (v2p *proxyV2Proc) Start() error { - os.RemoveAll(v2p.dataDir) - if err := v2p.start(); err != nil { - return err - } - return v2p.waitReady("httpproxy: endpoints found") -} - -func (v2p *proxyV2Proc) Restart() error { - if err := v2p.Stop(); err != nil { - return err - } - return v2p.Start() -} - -func (v2p *proxyV2Proc) Stop() error { - if err := v2p.proxyProc.Stop(); err != nil { - return err - } - // v2 proxy caches members; avoid reuse of directory - return os.RemoveAll(v2p.dataDir) -} - -type proxyV3Proc struct { - proxyProc -} - -func newProxyV3Proc(cfg *etcdServerProcessConfig) *proxyV3Proc { - listenAddr := proxyListenURL(cfg, 3) - args := []string{ - "grpc-proxy", - "start", - "--listen-addr", strings.Split(listenAddr, "/")[2], - "--endpoints", cfg.acurl, - // pass-through member RPCs - "--advertise-client-url", "", - } - murl := "" - if cfg.murl != "" { - murl = proxyListenURL(cfg, 4) - args = append(args, "--metrics-addr", murl) - } - tlsArgs := []string{} - for i := 0; i < len(cfg.tlsArgs); i++ { - switch cfg.tlsArgs[i] { - case "--cert-file": - tlsArgs = append(tlsArgs, "--cert", cfg.tlsArgs[i+1], "--cert-file", cfg.tlsArgs[i+1]) - i++ - case "--key-file": - tlsArgs = append(tlsArgs, "--key", cfg.tlsArgs[i+1], "--key-file", cfg.tlsArgs[i+1]) - i++ - case "--ca-file": - tlsArgs = append(tlsArgs, "--cacert", cfg.tlsArgs[i+1], "--trusted-ca-file", cfg.tlsArgs[i+1]) - i++ - case "--auto-tls": - tlsArgs = append(tlsArgs, "--auto-tls", "--insecure-skip-tls-verify") - case "--peer-ca-file", "--peer-cert-file", "--peer-key-file": - i++ // skip arg - case "--client-cert-auth", "--peer-auto-tls": - default: - tlsArgs = append(tlsArgs, cfg.tlsArgs[i]) - } - } - return &proxyV3Proc{ - proxyProc{ - execPath: cfg.execPath, - args: append(args, tlsArgs...), - ep: listenAddr, - murl: murl, - donec: make(chan struct{}), - }, - } -} - -func (v3p *proxyV3Proc) Restart() error { - if err := v3p.Stop(); err != nil { - return err - } - return v3p.Start() -} - -func (v3p *proxyV3Proc) Start() error { - if err := v3p.start(); err != nil { - return err - } - return v3p.waitReady("listening for grpc-proxy client requests") -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v2_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v2_test.go deleted file mode 100644 index 60d9ce74c..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v2_test.go +++ /dev/null @@ -1,513 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "io/ioutil" - "os" - "strings" - "testing" - "time" - - "github.com/coreos/etcd/pkg/fileutil" - "github.com/coreos/etcd/pkg/testutil" -) - -func TestCtlV2Set(t *testing.T) { testCtlV2Set(t, &configNoTLS, false) } -func TestCtlV2SetQuorum(t *testing.T) { testCtlV2Set(t, &configNoTLS, true) } -func TestCtlV2SetClientTLS(t *testing.T) { testCtlV2Set(t, &configClientTLS, false) } -func TestCtlV2SetPeerTLS(t *testing.T) { testCtlV2Set(t, &configPeerTLS, false) } -func TestCtlV2SetTLS(t *testing.T) { testCtlV2Set(t, &configTLS, false) } -func testCtlV2Set(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, cfg, quorum) - defer func() { - if errC := epc.Close(); errC != nil { - t.Fatalf("error closing etcd processes (%v)", errC) - } - }() - - key, value := "foo", "bar" - - if err := etcdctlSet(epc, key, value); err != nil { - t.Fatalf("failed set (%v)", err) - } - - if err := etcdctlGet(epc, key, value, quorum); err != nil { - t.Fatalf("failed get (%v)", err) - } -} - -func TestCtlV2Mk(t *testing.T) { testCtlV2Mk(t, &configNoTLS, false) } -func TestCtlV2MkQuorum(t *testing.T) { testCtlV2Mk(t, &configNoTLS, true) } -func TestCtlV2MkTLS(t *testing.T) { testCtlV2Mk(t, &configTLS, false) } -func testCtlV2Mk(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, cfg, quorum) - defer func() { - if errC := epc.Close(); errC != nil { - t.Fatalf("error closing etcd processes (%v)", errC) - } - }() - - key, value := "foo", "bar" - - if err := etcdctlMk(epc, key, value, true); err != nil { - t.Fatalf("failed mk (%v)", err) - } - if err := etcdctlMk(epc, key, value, false); err != nil { - t.Fatalf("failed mk (%v)", err) - } - - if err := etcdctlGet(epc, key, value, quorum); err != nil { - t.Fatalf("failed get (%v)", err) - } -} - -func TestCtlV2Rm(t *testing.T) { testCtlV2Rm(t, &configNoTLS) } -func TestCtlV2RmTLS(t *testing.T) { testCtlV2Rm(t, &configTLS) } -func testCtlV2Rm(t *testing.T, cfg *etcdProcessClusterConfig) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, cfg, true) - defer func() { - if errC := epc.Close(); errC != nil { - t.Fatalf("error closing etcd processes (%v)", errC) - } - }() - - key, value := "foo", "bar" - - if err := etcdctlSet(epc, key, value); err != nil { - t.Fatalf("failed set (%v)", err) - } - - if err := etcdctlRm(epc, key, value, true); err != nil { - t.Fatalf("failed rm (%v)", err) - } - if err := etcdctlRm(epc, key, value, false); err != nil { - t.Fatalf("failed rm (%v)", err) - } -} - -func TestCtlV2Ls(t *testing.T) { testCtlV2Ls(t, &configNoTLS, false) } -func TestCtlV2LsQuorum(t *testing.T) { testCtlV2Ls(t, &configNoTLS, true) } -func TestCtlV2LsTLS(t *testing.T) { testCtlV2Ls(t, &configTLS, false) } -func testCtlV2Ls(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, cfg, quorum) - defer func() { - if errC := epc.Close(); errC != nil { - t.Fatalf("error closing etcd processes (%v)", errC) - } - }() - - key, value := "foo", "bar" - - if err := etcdctlSet(epc, key, value); err != nil { - t.Fatalf("failed set (%v)", err) - } - - if err := etcdctlLs(epc, key, quorum); err != nil { - t.Fatalf("failed ls (%v)", err) - } -} - -func TestCtlV2Watch(t *testing.T) { testCtlV2Watch(t, &configNoTLS, false) } -func TestCtlV2WatchTLS(t *testing.T) { testCtlV2Watch(t, &configTLS, false) } - -func testCtlV2Watch(t *testing.T, cfg *etcdProcessClusterConfig, noSync bool) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, cfg, true) - defer func() { - if errC := epc.Close(); errC != nil { - t.Fatalf("error closing etcd processes (%v)", errC) - } - }() - - key, value := "foo", "bar" - errc := etcdctlWatch(epc, key, value, noSync) - if err := etcdctlSet(epc, key, value); err != nil { - t.Fatalf("failed set (%v)", err) - } - - select { - case err := <-errc: - if err != nil { - t.Fatalf("failed watch (%v)", err) - } - case <-time.After(5 * time.Second): - t.Fatalf("watch timed out") - } -} - -func TestCtlV2GetRoleUser(t *testing.T) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, &configNoTLS, false) - defer func() { - if err := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", err) - } - }() - - if err := etcdctlRoleAdd(epc, "foo"); err != nil { - t.Fatalf("failed to add role (%v)", err) - } - if err := etcdctlUserAdd(epc, "username", "password"); err != nil { - t.Fatalf("failed to add user (%v)", err) - } - if err := etcdctlUserGrant(epc, "username", "foo"); err != nil { - t.Fatalf("failed to grant role (%v)", err) - } - if err := etcdctlUserGet(epc, "username"); err != nil { - t.Fatalf("failed to get user (%v)", err) - } - - // ensure double grant gives an error; was crashing in 2.3.1 - regrantArgs := etcdctlPrefixArgs(epc) - regrantArgs = append(regrantArgs, "user", "grant", "--roles", "foo", "username") - if err := spawnWithExpect(regrantArgs, "duplicate"); err != nil { - t.Fatalf("missing duplicate error on double grant role (%v)", err) - } -} - -func TestCtlV2UserListUsername(t *testing.T) { testCtlV2UserList(t, "username") } -func TestCtlV2UserListRoot(t *testing.T) { testCtlV2UserList(t, "root") } -func testCtlV2UserList(t *testing.T, username string) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, &configNoTLS, false) - defer func() { - if err := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", err) - } - }() - - if err := etcdctlUserAdd(epc, username, "password"); err != nil { - t.Fatalf("failed to add user (%v)", err) - } - if err := etcdctlUserList(epc, username); err != nil { - t.Fatalf("failed to list users (%v)", err) - } -} - -func TestCtlV2RoleList(t *testing.T) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, &configNoTLS, false) - defer func() { - if err := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", err) - } - }() - - if err := etcdctlRoleAdd(epc, "foo"); err != nil { - t.Fatalf("failed to add role (%v)", err) - } - if err := etcdctlRoleList(epc, "foo"); err != nil { - t.Fatalf("failed to list roles (%v)", err) - } -} - -func TestCtlV2Backup(t *testing.T) { testCtlV2Backup(t, 0, false) } -func TestCtlV2BackupSnapshot(t *testing.T) { testCtlV2Backup(t, 1, false) } - -func TestCtlV2BackupV3(t *testing.T) { testCtlV2Backup(t, 0, true) } -func TestCtlV2BackupV3Snapshot(t *testing.T) { testCtlV2Backup(t, 1, true) } - -func testCtlV2Backup(t *testing.T, snapCount int, v3 bool) { - defer testutil.AfterTest(t) - - backupDir, err := ioutil.TempDir("", "testbackup0.etcd") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(backupDir) - - etcdCfg := configNoTLS - etcdCfg.snapCount = snapCount - epc1 := setupEtcdctlTest(t, &etcdCfg, false) - - // v3 put before v2 set so snapshot happens after v3 operations to confirm - // v3 data is preserved after snapshot. - if err := ctlV3Put(ctlCtx{t: t, epc: epc1}, "v3key", "123", ""); err != nil { - t.Fatal(err) - } - - if err := etcdctlSet(epc1, "foo1", "bar"); err != nil { - t.Fatal(err) - } - - if v3 { - // v3 must lock the db to backup, so stop process - if err := epc1.Stop(); err != nil { - t.Fatal(err) - } - } - if err := etcdctlBackup(epc1, epc1.procs[0].Config().dataDirPath, backupDir, v3); err != nil { - t.Fatal(err) - } - if err := epc1.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", err) - } - - // restart from the backup directory - cfg2 := configNoTLS - cfg2.dataDirPath = backupDir - cfg2.keepDataDir = true - cfg2.forceNewCluster = true - epc2 := setupEtcdctlTest(t, &cfg2, false) - - // check if backup went through correctly - if err := etcdctlGet(epc2, "foo1", "bar", false); err != nil { - t.Fatal(err) - } - - ctx2 := ctlCtx{t: t, epc: epc2} - if v3 { - if err := ctlV3Get(ctx2, []string{"v3key"}, kv{"v3key", "123"}); err != nil { - t.Fatal(err) - } - } else { - if err := ctlV3Get(ctx2, []string{"v3key"}); err != nil { - t.Fatal(err) - } - } - - // check if it can serve client requests - if err := etcdctlSet(epc2, "foo2", "bar"); err != nil { - t.Fatal(err) - } - if err := etcdctlGet(epc2, "foo2", "bar", false); err != nil { - t.Fatal(err) - } - - if err := epc2.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", err) - } -} - -func TestCtlV2AuthWithCommonName(t *testing.T) { - defer testutil.AfterTest(t) - - copiedCfg := configClientTLS - copiedCfg.clientCertAuthEnabled = true - - epc := setupEtcdctlTest(t, &copiedCfg, false) - defer func() { - if err := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", err) - } - }() - - if err := etcdctlRoleAdd(epc, "testrole"); err != nil { - t.Fatalf("failed to add role (%v)", err) - } - if err := etcdctlRoleGrant(epc, "testrole", "--rw", "--path=/foo"); err != nil { - t.Fatalf("failed to grant role (%v)", err) - } - if err := etcdctlUserAdd(epc, "root", "123"); err != nil { - t.Fatalf("failed to add user (%v)", err) - } - if err := etcdctlUserAdd(epc, "Autogenerated CA", "123"); err != nil { - t.Fatalf("failed to add user (%v)", err) - } - if err := etcdctlUserGrant(epc, "Autogenerated CA", "testrole"); err != nil { - t.Fatalf("failed to grant role (%v)", err) - } - if err := etcdctlAuthEnable(epc); err != nil { - t.Fatalf("failed to enable auth (%v)", err) - } - if err := etcdctlSet(epc, "foo", "bar"); err != nil { - t.Fatalf("failed to write (%v)", err) - } -} - -func TestCtlV2ClusterHealth(t *testing.T) { - defer testutil.AfterTest(t) - epc := setupEtcdctlTest(t, &configNoTLS, true) - defer func() { - if err := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", err) - } - }() - - // all members available - if err := etcdctlClusterHealth(epc, "cluster is healthy"); err != nil { - t.Fatalf("cluster-health expected to be healthy (%v)", err) - } - - // missing members, has quorum - epc.procs[0].Stop() - - for i := 0; i < 3; i++ { - err := etcdctlClusterHealth(epc, "cluster is degraded") - if err == nil { - break - } else if i == 2 { - t.Fatalf("cluster-health expected to be degraded (%v)", err) - } - // possibly no leader yet; retry - time.Sleep(time.Second) - } - - // no quorum - epc.procs[1].Stop() - if err := etcdctlClusterHealth(epc, "cluster is unavailable"); err != nil { - t.Fatalf("cluster-health expected to be unavailable (%v)", err) - } - - epc.procs[0], epc.procs[1] = nil, nil -} - -func etcdctlPrefixArgs(clus *etcdProcessCluster) []string { - endpoints := strings.Join(clus.EndpointsV2(), ",") - cmdArgs := []string{ctlBinPath, "--endpoints", endpoints} - if clus.cfg.clientTLS == clientTLS { - cmdArgs = append(cmdArgs, "--ca-file", caPath, "--cert-file", certPath, "--key-file", privateKeyPath) - } - return cmdArgs -} - -func etcdctlClusterHealth(clus *etcdProcessCluster, val string) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "cluster-health") - return spawnWithExpect(cmdArgs, val) -} - -func etcdctlSet(clus *etcdProcessCluster, key, value string) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "set", key, value) - return spawnWithExpect(cmdArgs, value) -} - -func etcdctlMk(clus *etcdProcessCluster, key, value string, first bool) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "mk", key, value) - if first { - return spawnWithExpect(cmdArgs, value) - } - return spawnWithExpect(cmdArgs, "Error: 105: Key already exists") -} - -func etcdctlGet(clus *etcdProcessCluster, key, value string, quorum bool) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "get", key) - if quorum { - cmdArgs = append(cmdArgs, "--quorum") - } - return spawnWithExpect(cmdArgs, value) -} - -func etcdctlRm(clus *etcdProcessCluster, key, value string, first bool) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "rm", key) - if first { - return spawnWithExpect(cmdArgs, "PrevNode.Value: "+value) - } - return spawnWithExpect(cmdArgs, "Error: 100: Key not found") -} - -func etcdctlLs(clus *etcdProcessCluster, key string, quorum bool) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "ls") - if quorum { - cmdArgs = append(cmdArgs, "--quorum") - } - return spawnWithExpect(cmdArgs, key) -} - -func etcdctlWatch(clus *etcdProcessCluster, key, value string, noSync bool) <-chan error { - cmdArgs := append(etcdctlPrefixArgs(clus), "watch", "--after-index=1", key) - if noSync { - cmdArgs = append(cmdArgs, "--no-sync") - } - errc := make(chan error, 1) - go func() { - errc <- spawnWithExpect(cmdArgs, value) - }() - return errc -} - -func etcdctlRoleAdd(clus *etcdProcessCluster, role string) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "role", "add", role) - return spawnWithExpect(cmdArgs, role) -} - -func etcdctlRoleGrant(clus *etcdProcessCluster, role string, perms ...string) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "role", "grant") - cmdArgs = append(cmdArgs, perms...) - cmdArgs = append(cmdArgs, role) - return spawnWithExpect(cmdArgs, role) -} - -func etcdctlRoleList(clus *etcdProcessCluster, expectedRole string) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "role", "list") - return spawnWithExpect(cmdArgs, expectedRole) -} - -func etcdctlUserAdd(clus *etcdProcessCluster, user, pass string) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "user", "add", user+":"+pass) - return spawnWithExpect(cmdArgs, "User "+user+" created") -} - -func etcdctlUserGrant(clus *etcdProcessCluster, user, role string) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "user", "grant", "--roles", role, user) - return spawnWithExpect(cmdArgs, "User "+user+" updated") -} - -func etcdctlUserGet(clus *etcdProcessCluster, user string) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "user", "get", user) - return spawnWithExpect(cmdArgs, "User: "+user) -} - -func etcdctlUserList(clus *etcdProcessCluster, expectedUser string) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "user", "list") - return spawnWithExpect(cmdArgs, expectedUser) -} - -func etcdctlAuthEnable(clus *etcdProcessCluster) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "auth", "enable") - return spawnWithExpect(cmdArgs, "Authentication Enabled") -} - -func etcdctlBackup(clus *etcdProcessCluster, dataDir, backupDir string, v3 bool) error { - cmdArgs := append(etcdctlPrefixArgs(clus), "backup", "--data-dir", dataDir, "--backup-dir", backupDir) - if v3 { - cmdArgs = append(cmdArgs, "--with-v3") - } - proc, err := spawnCmd(cmdArgs) - if err != nil { - return err - } - return proc.Close() -} - -func mustEtcdctl(t *testing.T) { - if !fileutil.Exist(binDir + "/etcdctl") { - t.Fatalf("could not find etcdctl binary") - } -} - -func setupEtcdctlTest(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) *etcdProcessCluster { - mustEtcdctl(t) - if !quorum { - cfg = configStandalone(*cfg) - } - epc, err := newEtcdProcessCluster(cfg) - if err != nil { - t.Fatalf("could not start etcd process cluster (%v)", err) - } - return epc -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_alarm_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_alarm_test.go deleted file mode 100644 index e0a88dd47..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_alarm_test.go +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "context" - "os" - "strings" - "testing" - "time" - - "github.com/coreos/etcd/clientv3" -) - -func TestCtlV3Alarm(t *testing.T) { - // The boltdb minimum working set is six pages. - testCtl(t, alarmTest, withQuota(int64(13*os.Getpagesize()))) -} - -func alarmTest(cx ctlCtx) { - // test small put still works - smallbuf := strings.Repeat("a", 64) - if err := ctlV3Put(cx, "1st_test", smallbuf, ""); err != nil { - cx.t.Fatal(err) - } - - // write some chunks to fill up the database - buf := strings.Repeat("b", int(os.Getpagesize())) - for { - if err := ctlV3Put(cx, "2nd_test", buf, ""); err != nil { - if !strings.Contains(err.Error(), "etcdserver: mvcc: database space exceeded") { - cx.t.Fatal(err) - } - break - } - } - - // quota alarm should now be on - if err := ctlV3Alarm(cx, "list", "alarm:NOSPACE"); err != nil { - cx.t.Fatal(err) - } - - // '/health' handler should return 'false' - if err := cURLGet(cx.epc, cURLReq{endpoint: "/health", expected: `{"health":"false"}`}); err != nil { - cx.t.Fatalf("failed get with curl (%v)", err) - } - - // check that Put is rejected when alarm is on - if err := ctlV3Put(cx, "3rd_test", smallbuf, ""); err != nil { - if !strings.Contains(err.Error(), "etcdserver: mvcc: database space exceeded") { - cx.t.Fatal(err) - } - } - - eps := cx.epc.EndpointsV3() - - // get latest revision to compact - cli, err := clientv3.New(clientv3.Config{ - Endpoints: eps, - DialTimeout: 3 * time.Second, - }) - if err != nil { - cx.t.Fatal(err) - } - defer cli.Close() - sresp, err := cli.Status(context.TODO(), eps[0]) - if err != nil { - cx.t.Fatal(err) - } - - // make some space - if err := ctlV3Compact(cx, sresp.Header.Revision, true); err != nil { - cx.t.Fatal(err) - } - if err := ctlV3Defrag(cx); err != nil { - cx.t.Fatal(err) - } - - // turn off alarm - if err := ctlV3Alarm(cx, "disarm", "alarm:NOSPACE"); err != nil { - cx.t.Fatal(err) - } - - // put one more key below quota - if err := ctlV3Put(cx, "4th_test", smallbuf, ""); err != nil { - cx.t.Fatal(err) - } -} - -func ctlV3Alarm(cx ctlCtx, cmd string, as ...string) error { - cmdArgs := append(cx.PrefixArgs(), "alarm", cmd) - return spawnWithExpects(cmdArgs, as...) -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_auth_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_auth_test.go deleted file mode 100644 index 2565cdfdc..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_auth_test.go +++ /dev/null @@ -1,1055 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "fmt" - "os" - "testing" - - "github.com/coreos/etcd/clientv3" -) - -func TestCtlV3AuthEnable(t *testing.T) { testCtl(t, authEnableTest) } -func TestCtlV3AuthDisable(t *testing.T) { testCtl(t, authDisableTest) } -func TestCtlV3AuthWriteKey(t *testing.T) { testCtl(t, authCredWriteKeyTest) } -func TestCtlV3AuthRoleUpdate(t *testing.T) { testCtl(t, authRoleUpdateTest) } -func TestCtlV3AuthUserDeleteDuringOps(t *testing.T) { testCtl(t, authUserDeleteDuringOpsTest) } -func TestCtlV3AuthRoleRevokeDuringOps(t *testing.T) { testCtl(t, authRoleRevokeDuringOpsTest) } -func TestCtlV3AuthTxn(t *testing.T) { testCtl(t, authTestTxn) } -func TestCtlV3AuthPrefixPerm(t *testing.T) { testCtl(t, authTestPrefixPerm) } -func TestCtlV3AuthMemberAdd(t *testing.T) { testCtl(t, authTestMemberAdd) } -func TestCtlV3AuthMemberRemove(t *testing.T) { - testCtl(t, authTestMemberRemove, withQuorum(), withNoStrictReconfig()) -} -func TestCtlV3AuthMemberUpdate(t *testing.T) { testCtl(t, authTestMemberUpdate) } -func TestCtlV3AuthCertCN(t *testing.T) { testCtl(t, authTestCertCN, withCfg(configClientTLSCertAuth)) } -func TestCtlV3AuthRevokeWithDelete(t *testing.T) { testCtl(t, authTestRevokeWithDelete) } -func TestCtlV3AuthInvalidMgmt(t *testing.T) { testCtl(t, authTestInvalidMgmt) } -func TestCtlV3AuthFromKeyPerm(t *testing.T) { testCtl(t, authTestFromKeyPerm) } -func TestCtlV3AuthAndWatch(t *testing.T) { testCtl(t, authTestWatch) } - -func TestCtlV3AuthLeaseTestKeepAlive(t *testing.T) { testCtl(t, authLeaseTestKeepAlive) } -func TestCtlV3AuthLeaseTestTimeToLiveExpired(t *testing.T) { testCtl(t, authLeaseTestTimeToLiveExpired) } - -func TestCtlV3AuthRoleGet(t *testing.T) { testCtl(t, authTestRoleGet) } -func TestCtlV3AuthUserGet(t *testing.T) { testCtl(t, authTestUserGet) } -func TestCtlV3AuthRoleList(t *testing.T) { testCtl(t, authTestRoleList) } - -func TestCtlV3AuthDefrag(t *testing.T) { testCtl(t, authTestDefrag) } -func TestCtlV3AuthEndpointHealth(t *testing.T) { - testCtl(t, authTestEndpointHealth, withQuorum()) -} -func TestCtlV3AuthSnapshot(t *testing.T) { testCtl(t, authTestSnapshot) } -func TestCtlV3AuthCertCNAndUsername(t *testing.T) { - testCtl(t, authTestCertCNAndUsername, withCfg(configClientTLSCertAuth)) -} - -func authEnableTest(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } -} - -func authEnable(cx ctlCtx) error { - // create root user with root role - if err := ctlV3User(cx, []string{"add", "root", "--interactive=false"}, "User root created", []string{"root"}); err != nil { - return fmt.Errorf("failed to create root user %v", err) - } - if err := ctlV3User(cx, []string{"grant-role", "root", "root"}, "Role root is granted to user root", nil); err != nil { - return fmt.Errorf("failed to grant root user root role %v", err) - } - if err := ctlV3AuthEnable(cx); err != nil { - return fmt.Errorf("authEnableTest ctlV3AuthEnable error (%v)", err) - } - return nil -} - -func ctlV3AuthEnable(cx ctlCtx) error { - cmdArgs := append(cx.PrefixArgs(), "auth", "enable") - return spawnWithExpect(cmdArgs, "Authentication Enabled") -} - -func authDisableTest(cx ctlCtx) { - // a key that isn't granted to test-user - if err := ctlV3Put(cx, "hoo", "a", ""); err != nil { - cx.t.Fatal(err) - } - - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - // test-user doesn't have the permission, it must fail - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3PutFailPerm(cx, "hoo", "bar"); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - if err := ctlV3AuthDisable(cx); err != nil { - cx.t.Fatalf("authDisableTest ctlV3AuthDisable error (%v)", err) - } - - // now ErrAuthNotEnabled of Authenticate() is simply ignored - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Put(cx, "hoo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - - // now the key can be accessed - cx.user, cx.pass = "", "" - if err := ctlV3Put(cx, "hoo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - // confirm put succeeded - if err := ctlV3Get(cx, []string{"hoo"}, []kv{{"hoo", "bar"}}...); err != nil { - cx.t.Fatal(err) - } -} - -func ctlV3AuthDisable(cx ctlCtx) error { - cmdArgs := append(cx.PrefixArgs(), "auth", "disable") - return spawnWithExpect(cmdArgs, "Authentication Disabled") -} - -func authCredWriteKeyTest(cx ctlCtx) { - // baseline key to check for failed puts - if err := ctlV3Put(cx, "foo", "a", ""); err != nil { - cx.t.Fatal(err) - } - - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - // confirm root role can access to all keys - if err := ctlV3Put(cx, "foo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - if err := ctlV3Get(cx, []string{"foo"}, []kv{{"foo", "bar"}}...); err != nil { - cx.t.Fatal(err) - } - - // try invalid user - cx.user, cx.pass = "a", "b" - if err := ctlV3PutFailAuth(cx, "foo", "bar"); err != nil { - cx.t.Fatal(err) - } - // confirm put failed - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Get(cx, []string{"foo"}, []kv{{"foo", "bar"}}...); err != nil { - cx.t.Fatal(err) - } - - // try good user - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Put(cx, "foo", "bar2", ""); err != nil { - cx.t.Fatal(err) - } - // confirm put succeeded - if err := ctlV3Get(cx, []string{"foo"}, []kv{{"foo", "bar2"}}...); err != nil { - cx.t.Fatal(err) - } - - // try bad password - cx.user, cx.pass = "test-user", "badpass" - if err := ctlV3PutFailAuth(cx, "foo", "baz"); err != nil { - cx.t.Fatal(err) - } - // confirm put failed - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Get(cx, []string{"foo"}, []kv{{"foo", "bar2"}}...); err != nil { - cx.t.Fatal(err) - } -} - -func authRoleUpdateTest(cx ctlCtx) { - if err := ctlV3Put(cx, "foo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - // try put to not granted key - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3PutFailPerm(cx, "hoo", "bar"); err != nil { - cx.t.Fatal(err) - } - - // grant a new key - cx.user, cx.pass = "root", "root" - if err := ctlV3RoleGrantPermission(cx, "test-role", grantingPerm{true, true, "hoo", "", false}); err != nil { - cx.t.Fatal(err) - } - - // try a newly granted key - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Put(cx, "hoo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - // confirm put succeeded - if err := ctlV3Get(cx, []string{"hoo"}, []kv{{"hoo", "bar"}}...); err != nil { - cx.t.Fatal(err) - } - - // revoke the newly granted key - cx.user, cx.pass = "root", "root" - if err := ctlV3RoleRevokePermission(cx, "test-role", "hoo", "", false); err != nil { - cx.t.Fatal(err) - } - - // try put to the revoked key - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3PutFailPerm(cx, "hoo", "bar"); err != nil { - cx.t.Fatal(err) - } - - // confirm a key still granted can be accessed - if err := ctlV3Get(cx, []string{"foo"}, []kv{{"foo", "bar"}}...); err != nil { - cx.t.Fatal(err) - } -} - -func authUserDeleteDuringOpsTest(cx ctlCtx) { - if err := ctlV3Put(cx, "foo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - // create a key - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Put(cx, "foo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - // confirm put succeeded - if err := ctlV3Get(cx, []string{"foo"}, []kv{{"foo", "bar"}}...); err != nil { - cx.t.Fatal(err) - } - - // delete the user - cx.user, cx.pass = "root", "root" - err := ctlV3User(cx, []string{"delete", "test-user"}, "User test-user deleted", []string{}) - if err != nil { - cx.t.Fatal(err) - } - - // check the user is deleted - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3PutFailAuth(cx, "foo", "baz"); err != nil { - cx.t.Fatal(err) - } -} - -func authRoleRevokeDuringOpsTest(cx ctlCtx) { - if err := ctlV3Put(cx, "foo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - // create a key - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Put(cx, "foo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - // confirm put succeeded - if err := ctlV3Get(cx, []string{"foo"}, []kv{{"foo", "bar"}}...); err != nil { - cx.t.Fatal(err) - } - - // create a new role - cx.user, cx.pass = "root", "root" - if err := ctlV3Role(cx, []string{"add", "test-role2"}, "Role test-role2 created"); err != nil { - cx.t.Fatal(err) - } - // grant a new key to the new role - if err := ctlV3RoleGrantPermission(cx, "test-role2", grantingPerm{true, true, "hoo", "", false}); err != nil { - cx.t.Fatal(err) - } - // grant the new role to the user - if err := ctlV3User(cx, []string{"grant-role", "test-user", "test-role2"}, "Role test-role2 is granted to user test-user", nil); err != nil { - cx.t.Fatal(err) - } - - // try a newly granted key - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Put(cx, "hoo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - // confirm put succeeded - if err := ctlV3Get(cx, []string{"hoo"}, []kv{{"hoo", "bar"}}...); err != nil { - cx.t.Fatal(err) - } - - // revoke a role from the user - cx.user, cx.pass = "root", "root" - err := ctlV3User(cx, []string{"revoke-role", "test-user", "test-role"}, "Role test-role is revoked from user test-user", []string{}) - if err != nil { - cx.t.Fatal(err) - } - - // check the role is revoked and permission is lost from the user - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3PutFailPerm(cx, "foo", "baz"); err != nil { - cx.t.Fatal(err) - } - - // try a key that can be accessed from the remaining role - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Put(cx, "hoo", "bar2", ""); err != nil { - cx.t.Fatal(err) - } - // confirm put succeeded - if err := ctlV3Get(cx, []string{"hoo"}, []kv{{"hoo", "bar2"}}...); err != nil { - cx.t.Fatal(err) - } -} - -func ctlV3PutFailAuth(cx ctlCtx, key, val string) error { - return spawnWithExpect(append(cx.PrefixArgs(), "put", key, val), "authentication failed") -} - -func ctlV3PutFailPerm(cx ctlCtx, key, val string) error { - return spawnWithExpect(append(cx.PrefixArgs(), "put", key, val), "permission denied") -} - -func authSetupTestUser(cx ctlCtx) { - if err := ctlV3User(cx, []string{"add", "test-user", "--interactive=false"}, "User test-user created", []string{"pass"}); err != nil { - cx.t.Fatal(err) - } - if err := spawnWithExpect(append(cx.PrefixArgs(), "role", "add", "test-role"), "Role test-role created"); err != nil { - cx.t.Fatal(err) - } - if err := ctlV3User(cx, []string{"grant-role", "test-user", "test-role"}, "Role test-role is granted to user test-user", nil); err != nil { - cx.t.Fatal(err) - } - cmd := append(cx.PrefixArgs(), "role", "grant-permission", "test-role", "readwrite", "foo") - if err := spawnWithExpect(cmd, "Role test-role updated"); err != nil { - cx.t.Fatal(err) - } -} - -func authTestTxn(cx ctlCtx) { - // keys with 1 suffix aren't granted to test-user - // keys with 2 suffix are granted to test-user - - keys := []string{"c1", "s1", "f1"} - grantedKeys := []string{"c2", "s2", "f2"} - for _, key := range keys { - if err := ctlV3Put(cx, key, "v", ""); err != nil { - cx.t.Fatal(err) - } - } - - for _, key := range grantedKeys { - if err := ctlV3Put(cx, key, "v", ""); err != nil { - cx.t.Fatal(err) - } - } - - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - // grant keys to test-user - cx.user, cx.pass = "root", "root" - for _, key := range grantedKeys { - if err := ctlV3RoleGrantPermission(cx, "test-role", grantingPerm{true, true, key, "", false}); err != nil { - cx.t.Fatal(err) - } - } - - // now test txn - cx.interactive = true - cx.user, cx.pass = "test-user", "pass" - - rqs := txnRequests{ - compare: []string{`version("c2") = "1"`}, - ifSucess: []string{"get s2"}, - ifFail: []string{"get f2"}, - results: []string{"SUCCESS", "s2", "v"}, - } - if err := ctlV3Txn(cx, rqs); err != nil { - cx.t.Fatal(err) - } - - // a key of compare case isn't granted - rqs = txnRequests{ - compare: []string{`version("c1") = "1"`}, - ifSucess: []string{"get s2"}, - ifFail: []string{"get f2"}, - results: []string{"Error: etcdserver: permission denied"}, - } - if err := ctlV3Txn(cx, rqs); err != nil { - cx.t.Fatal(err) - } - - // a key of success case isn't granted - rqs = txnRequests{ - compare: []string{`version("c2") = "1"`}, - ifSucess: []string{"get s1"}, - ifFail: []string{"get f2"}, - results: []string{"Error: etcdserver: permission denied"}, - } - if err := ctlV3Txn(cx, rqs); err != nil { - cx.t.Fatal(err) - } - - // a key of failure case isn't granted - rqs = txnRequests{ - compare: []string{`version("c2") = "1"`}, - ifSucess: []string{"get s2"}, - ifFail: []string{"get f1"}, - results: []string{"Error: etcdserver: permission denied"}, - } - if err := ctlV3Txn(cx, rqs); err != nil { - cx.t.Fatal(err) - } -} - -func authTestPrefixPerm(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - prefix := "/prefix/" // directory like prefix - // grant keys to test-user - cx.user, cx.pass = "root", "root" - if err := ctlV3RoleGrantPermission(cx, "test-role", grantingPerm{true, true, prefix, "", true}); err != nil { - cx.t.Fatal(err) - } - - // try a prefix granted permission - cx.user, cx.pass = "test-user", "pass" - for i := 0; i < 10; i++ { - key := fmt.Sprintf("%s%d", prefix, i) - if err := ctlV3Put(cx, key, "val", ""); err != nil { - cx.t.Fatal(err) - } - } - - if err := ctlV3PutFailPerm(cx, clientv3.GetPrefixRangeEnd(prefix), "baz"); err != nil { - cx.t.Fatal(err) - } - - // grant the entire keys to test-user - cx.user, cx.pass = "root", "root" - if err := ctlV3RoleGrantPermission(cx, "test-role", grantingPerm{true, true, "", "", true}); err != nil { - cx.t.Fatal(err) - } - - prefix2 := "/prefix2/" - cx.user, cx.pass = "test-user", "pass" - for i := 0; i < 10; i++ { - key := fmt.Sprintf("%s%d", prefix2, i) - if err := ctlV3Put(cx, key, "val", ""); err != nil { - cx.t.Fatal(err) - } - } -} - -func authTestMemberAdd(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - peerURL := fmt.Sprintf("http://localhost:%d", etcdProcessBasePort+11) - // ordinary user cannot add a new member - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3MemberAdd(cx, peerURL); err == nil { - cx.t.Fatalf("ordinary user must not be allowed to add a member") - } - - // root can add a new member - cx.user, cx.pass = "root", "root" - if err := ctlV3MemberAdd(cx, peerURL); err != nil { - cx.t.Fatal(err) - } -} - -func authTestMemberRemove(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - ep, memIDToRemove, clusterID := cx.memberToRemove() - - // ordinary user cannot remove a member - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3MemberRemove(cx, ep, memIDToRemove, clusterID); err == nil { - cx.t.Fatalf("ordinary user must not be allowed to remove a member") - } - - // root can remove a member - cx.user, cx.pass = "root", "root" - if err := ctlV3MemberRemove(cx, ep, memIDToRemove, clusterID); err != nil { - cx.t.Fatal(err) - } -} - -func authTestMemberUpdate(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - mr, err := getMemberList(cx) - if err != nil { - cx.t.Fatal(err) - } - - // ordinary user cannot update a member - cx.user, cx.pass = "test-user", "pass" - peerURL := fmt.Sprintf("http://localhost:%d", etcdProcessBasePort+11) - memberID := fmt.Sprintf("%x", mr.Members[0].ID) - if err = ctlV3MemberUpdate(cx, memberID, peerURL); err == nil { - cx.t.Fatalf("ordinary user must not be allowed to update a member") - } - - // root can update a member - cx.user, cx.pass = "root", "root" - if err = ctlV3MemberUpdate(cx, memberID, peerURL); err != nil { - cx.t.Fatal(err) - } -} - -func authTestCertCN(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - if err := ctlV3User(cx, []string{"add", "example.com", "--interactive=false"}, "User example.com created", []string{""}); err != nil { - cx.t.Fatal(err) - } - if err := spawnWithExpect(append(cx.PrefixArgs(), "role", "add", "test-role"), "Role test-role created"); err != nil { - cx.t.Fatal(err) - } - if err := ctlV3User(cx, []string{"grant-role", "example.com", "test-role"}, "Role test-role is granted to user example.com", nil); err != nil { - cx.t.Fatal(err) - } - - // grant a new key - if err := ctlV3RoleGrantPermission(cx, "test-role", grantingPerm{true, true, "hoo", "", false}); err != nil { - cx.t.Fatal(err) - } - - // try a granted key - cx.user, cx.pass = "", "" - if err := ctlV3Put(cx, "hoo", "bar", ""); err != nil { - cx.t.Error(err) - } - - // try a non granted key - cx.user, cx.pass = "", "" - if err := ctlV3PutFailPerm(cx, "baz", "bar"); err != nil { - cx.t.Error(err) - } -} - -func authTestRevokeWithDelete(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - // create a new role - cx.user, cx.pass = "root", "root" - if err := ctlV3Role(cx, []string{"add", "test-role2"}, "Role test-role2 created"); err != nil { - cx.t.Fatal(err) - } - - // grant the new role to the user - if err := ctlV3User(cx, []string{"grant-role", "test-user", "test-role2"}, "Role test-role2 is granted to user test-user", nil); err != nil { - cx.t.Fatal(err) - } - - // check the result - if err := ctlV3User(cx, []string{"get", "test-user"}, "Roles: test-role test-role2", nil); err != nil { - cx.t.Fatal(err) - } - - // delete the role, test-role2 must be revoked from test-user - if err := ctlV3Role(cx, []string{"delete", "test-role2"}, "Role test-role2 deleted"); err != nil { - cx.t.Fatal(err) - } - - // check the result - if err := ctlV3User(cx, []string{"get", "test-user"}, "Roles: test-role", nil); err != nil { - cx.t.Fatal(err) - } -} - -func authTestInvalidMgmt(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - if err := ctlV3Role(cx, []string{"delete", "root"}, "Error: etcdserver: invalid auth management"); err == nil { - cx.t.Fatal("deleting the role root must not be allowed") - } - - if err := ctlV3User(cx, []string{"revoke-role", "root", "root"}, "Error: etcdserver: invalid auth management", []string{}); err == nil { - cx.t.Fatal("revoking the role root from the user root must not be allowed") - } -} - -func authTestFromKeyPerm(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - // grant keys after z to test-user - cx.user, cx.pass = "root", "root" - if err := ctlV3RoleGrantPermission(cx, "test-role", grantingPerm{true, true, "z", "\x00", false}); err != nil { - cx.t.Fatal(err) - } - - // try the granted open ended permission - cx.user, cx.pass = "test-user", "pass" - for i := 0; i < 10; i++ { - key := fmt.Sprintf("z%d", i) - if err := ctlV3Put(cx, key, "val", ""); err != nil { - cx.t.Fatal(err) - } - } - largeKey := "" - for i := 0; i < 10; i++ { - largeKey += "\xff" - if err := ctlV3Put(cx, largeKey, "val", ""); err != nil { - cx.t.Fatal(err) - } - } - - // try a non granted key - if err := ctlV3PutFailPerm(cx, "x", "baz"); err != nil { - cx.t.Fatal(err) - } - - // revoke the open ended permission - cx.user, cx.pass = "root", "root" - if err := ctlV3RoleRevokePermission(cx, "test-role", "z", "", true); err != nil { - cx.t.Fatal(err) - } - - // try the revoked open ended permission - cx.user, cx.pass = "test-user", "pass" - for i := 0; i < 10; i++ { - key := fmt.Sprintf("z%d", i) - if err := ctlV3PutFailPerm(cx, key, "val"); err != nil { - cx.t.Fatal(err) - } - } - - // grant the entire keys - cx.user, cx.pass = "root", "root" - if err := ctlV3RoleGrantPermission(cx, "test-role", grantingPerm{true, true, "", "\x00", false}); err != nil { - cx.t.Fatal(err) - } - - // try keys, of course it must be allowed because test-role has a permission of the entire keys - cx.user, cx.pass = "test-user", "pass" - for i := 0; i < 10; i++ { - key := fmt.Sprintf("z%d", i) - if err := ctlV3Put(cx, key, "val", ""); err != nil { - cx.t.Fatal(err) - } - } - - // revoke the entire keys - cx.user, cx.pass = "root", "root" - if err := ctlV3RoleRevokePermission(cx, "test-role", "", "", true); err != nil { - cx.t.Fatal(err) - } - - // try the revoked entire key permission - cx.user, cx.pass = "test-user", "pass" - for i := 0; i < 10; i++ { - key := fmt.Sprintf("z%d", i) - if err := ctlV3PutFailPerm(cx, key, "val"); err != nil { - cx.t.Fatal(err) - } - } -} - -func authLeaseTestKeepAlive(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - // put with TTL 10 seconds and keep-alive - leaseID, err := ctlV3LeaseGrant(cx, 10) - if err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3LeaseGrant error (%v)", err) - } - if err := ctlV3Put(cx, "key", "val", leaseID); err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3Put error (%v)", err) - } - if err := ctlV3LeaseKeepAlive(cx, leaseID); err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3LeaseKeepAlive error (%v)", err) - } - if err := ctlV3Get(cx, []string{"key"}, kv{"key", "val"}); err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3Get error (%v)", err) - } -} - -func authLeaseTestTimeToLiveExpired(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - ttl := 3 - if err := leaseTestTimeToLiveExpire(cx, ttl); err != nil { - cx.t.Fatal(err) - } -} - -func authTestWatch(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - // grant a key range - if err := ctlV3RoleGrantPermission(cx, "test-role", grantingPerm{true, true, "key", "key4", false}); err != nil { - cx.t.Fatal(err) - } - - tests := []struct { - puts []kv - args []string - - wkv []kvExec - want bool - }{ - { // watch 1 key, should be successful - []kv{{"key", "value"}}, - []string{"key", "--rev", "1"}, - []kvExec{{key: "key", val: "value"}}, - true, - }, - { // watch 3 keys by range, should be successful - []kv{{"key1", "val1"}, {"key3", "val3"}, {"key2", "val2"}}, - []string{"key", "key3", "--rev", "1"}, - []kvExec{{key: "key1", val: "val1"}, {key: "key2", val: "val2"}}, - true, - }, - - { // watch 1 key, should not be successful - []kv{}, - []string{"key5", "--rev", "1"}, - []kvExec{}, - false, - }, - { // watch 3 keys by range, should not be successful - []kv{}, - []string{"key", "key6", "--rev", "1"}, - []kvExec{}, - false, - }, - } - - cx.user, cx.pass = "test-user", "pass" - for i, tt := range tests { - donec := make(chan struct{}) - go func(i int, puts []kv) { - defer close(donec) - for j := range puts { - if err := ctlV3Put(cx, puts[j].key, puts[j].val, ""); err != nil { - cx.t.Fatalf("watchTest #%d-%d: ctlV3Put error (%v)", i, j, err) - } - } - }(i, tt.puts) - - var err error - if tt.want { - err = ctlV3Watch(cx, tt.args, tt.wkv...) - } else { - err = ctlV3WatchFailPerm(cx, tt.args) - } - - if err != nil { - if cx.dialTimeout > 0 && !isGRPCTimedout(err) { - cx.t.Errorf("watchTest #%d: ctlV3Watch error (%v)", i, err) - } - } - - <-donec - } - -} - -func authTestRoleGet(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - expected := []string{ - "Role test-role", - "KV Read:", "foo", - "KV Write:", "foo", - } - if err := spawnWithExpects(append(cx.PrefixArgs(), "role", "get", "test-role"), expected...); err != nil { - cx.t.Fatal(err) - } - - // test-user can get the information of test-role because it belongs to the role - cx.user, cx.pass = "test-user", "pass" - if err := spawnWithExpects(append(cx.PrefixArgs(), "role", "get", "test-role"), expected...); err != nil { - cx.t.Fatal(err) - } - - // test-user cannot get the information of root because it doesn't belong to the role - expected = []string{ - "Error: etcdserver: permission denied", - } - if err := spawnWithExpects(append(cx.PrefixArgs(), "role", "get", "root"), expected...); err != nil { - cx.t.Fatal(err) - } -} - -func authTestUserGet(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - expected := []string{ - "User: test-user", - "Roles: test-role", - } - - if err := spawnWithExpects(append(cx.PrefixArgs(), "user", "get", "test-user"), expected...); err != nil { - cx.t.Fatal(err) - } - - // test-user can get the information of test-user itself - cx.user, cx.pass = "test-user", "pass" - if err := spawnWithExpects(append(cx.PrefixArgs(), "user", "get", "test-user"), expected...); err != nil { - cx.t.Fatal(err) - } - - // test-user cannot get the information of root - expected = []string{ - "Error: etcdserver: permission denied", - } - if err := spawnWithExpects(append(cx.PrefixArgs(), "user", "get", "root"), expected...); err != nil { - cx.t.Fatal(err) - } -} - -func authTestRoleList(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - if err := spawnWithExpect(append(cx.PrefixArgs(), "role", "list"), "test-role"); err != nil { - cx.t.Fatal(err) - } -} - -func authTestDefrag(cx ctlCtx) { - maintenanceInitKeys(cx) - - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - // ordinary user cannot defrag - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Defrag(cx); err == nil { - cx.t.Fatal("ordinary user should not be able to issue a defrag request") - } - - // root can defrag - cx.user, cx.pass = "root", "root" - if err := ctlV3Defrag(cx); err != nil { - cx.t.Fatal(err) - } -} - -func authTestSnapshot(cx ctlCtx) { - maintenanceInitKeys(cx) - - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - fpath := "test.snapshot" - defer os.RemoveAll(fpath) - - // ordinary user cannot save a snapshot - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3SnapshotSave(cx, fpath); err == nil { - cx.t.Fatal("ordinary user should not be able to save a snapshot") - } - - // root can save a snapshot - cx.user, cx.pass = "root", "root" - if err := ctlV3SnapshotSave(cx, fpath); err != nil { - cx.t.Fatalf("snapshotTest ctlV3SnapshotSave error (%v)", err) - } - - st, err := getSnapshotStatus(cx, fpath) - if err != nil { - cx.t.Fatalf("snapshotTest getSnapshotStatus error (%v)", err) - } - if st.Revision != 4 { - cx.t.Fatalf("expected 4, got %d", st.Revision) - } - if st.TotalKey < 3 { - cx.t.Fatalf("expected at least 3, got %d", st.TotalKey) - } -} - -func authTestEndpointHealth(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - if err := ctlV3EndpointHealth(cx); err != nil { - cx.t.Fatalf("endpointStatusTest ctlV3EndpointHealth error (%v)", err) - } - - // health checking with an ordinary user "succeeds" since permission denial goes through consensus - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3EndpointHealth(cx); err != nil { - cx.t.Fatalf("endpointStatusTest ctlV3EndpointHealth error (%v)", err) - } - - // succeed if permissions granted for ordinary user - cx.user, cx.pass = "root", "root" - if err := ctlV3RoleGrantPermission(cx, "test-role", grantingPerm{true, true, "health", "", false}); err != nil { - cx.t.Fatal(err) - } - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3EndpointHealth(cx); err != nil { - cx.t.Fatalf("endpointStatusTest ctlV3EndpointHealth error (%v)", err) - } -} - -func authTestCertCNAndUsername(cx ctlCtx) { - if err := authEnable(cx); err != nil { - cx.t.Fatal(err) - } - - cx.user, cx.pass = "root", "root" - authSetupTestUser(cx) - - if err := ctlV3User(cx, []string{"add", "example.com", "--interactive=false"}, "User example.com created", []string{""}); err != nil { - cx.t.Fatal(err) - } - if err := spawnWithExpect(append(cx.PrefixArgs(), "role", "add", "test-role-cn"), "Role test-role-cn created"); err != nil { - cx.t.Fatal(err) - } - if err := ctlV3User(cx, []string{"grant-role", "example.com", "test-role-cn"}, "Role test-role-cn is granted to user example.com", nil); err != nil { - cx.t.Fatal(err) - } - - // grant a new key for CN based user - if err := ctlV3RoleGrantPermission(cx, "test-role-cn", grantingPerm{true, true, "hoo", "", false}); err != nil { - cx.t.Fatal(err) - } - - // grant a new key for username based user - if err := ctlV3RoleGrantPermission(cx, "test-role", grantingPerm{true, true, "bar", "", false}); err != nil { - cx.t.Fatal(err) - } - - // try a granted key for CN based user - cx.user, cx.pass = "", "" - if err := ctlV3Put(cx, "hoo", "bar", ""); err != nil { - cx.t.Error(err) - } - - // try a granted key for username based user - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3Put(cx, "bar", "bar", ""); err != nil { - cx.t.Error(err) - } - - // try a non granted key for both of them - cx.user, cx.pass = "", "" - if err := ctlV3PutFailPerm(cx, "baz", "bar"); err != nil { - cx.t.Error(err) - } - - cx.user, cx.pass = "test-user", "pass" - if err := ctlV3PutFailPerm(cx, "baz", "bar"); err != nil { - cx.t.Error(err) - } -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_compact_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_compact_test.go deleted file mode 100644 index 5b0c51eb4..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_compact_test.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "strconv" - "strings" - "testing" -) - -func TestCtlV3Compact(t *testing.T) { testCtl(t, compactTest) } -func TestCtlV3CompactPhysical(t *testing.T) { testCtl(t, compactTest, withCompactPhysical()) } - -func compactTest(cx ctlCtx) { - compactPhysical := cx.compactPhysical - if err := ctlV3Compact(cx, 2, compactPhysical); err != nil { - if !strings.Contains(err.Error(), "required revision is a future revision") { - cx.t.Fatal(err) - } - } else { - cx.t.Fatalf("expected '...future revision' error, got ") - } - - var kvs = []kv{{"key", "val1"}, {"key", "val2"}, {"key", "val3"}} - for i := range kvs { - if err := ctlV3Put(cx, kvs[i].key, kvs[i].val, ""); err != nil { - cx.t.Fatalf("compactTest #%d: ctlV3Put error (%v)", i, err) - } - } - - if err := ctlV3Get(cx, []string{"key", "--rev", "3"}, kvs[1:2]...); err != nil { - cx.t.Errorf("compactTest: ctlV3Get error (%v)", err) - } - - if err := ctlV3Compact(cx, 4, compactPhysical); err != nil { - cx.t.Fatal(err) - } - - if err := ctlV3Get(cx, []string{"key", "--rev", "3"}, kvs[1:2]...); err != nil { - if !strings.Contains(err.Error(), "required revision has been compacted") { - cx.t.Errorf("compactTest: ctlV3Get error (%v)", err) - } - } else { - cx.t.Fatalf("expected '...has been compacted' error, got ") - } - - if err := ctlV3Compact(cx, 2, compactPhysical); err != nil { - if !strings.Contains(err.Error(), "required revision has been compacted") { - cx.t.Fatal(err) - } - } else { - cx.t.Fatalf("expected '...has been compacted' error, got ") - } -} - -func ctlV3Compact(cx ctlCtx, rev int64, physical bool) error { - rs := strconv.FormatInt(rev, 10) - cmdArgs := append(cx.PrefixArgs(), "compact", rs) - if physical { - cmdArgs = append(cmdArgs, "--physical") - } - return spawnWithExpect(cmdArgs, "compacted revision "+rs) -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_defrag_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_defrag_test.go deleted file mode 100644 index 64c3bb9f0..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_defrag_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import "testing" - -func TestCtlV3Defrag(t *testing.T) { testCtl(t, defragTest) } - -func maintenanceInitKeys(cx ctlCtx) { - var kvs = []kv{{"key", "val1"}, {"key", "val2"}, {"key", "val3"}} - for i := range kvs { - if err := ctlV3Put(cx, kvs[i].key, kvs[i].val, ""); err != nil { - cx.t.Fatal(err) - } - } -} - -func defragTest(cx ctlCtx) { - maintenanceInitKeys(cx) - - if err := ctlV3Compact(cx, 4, cx.compactPhysical); err != nil { - cx.t.Fatal(err) - } - - if err := ctlV3Defrag(cx); err != nil { - cx.t.Fatalf("defragTest ctlV3Defrag error (%v)", err) - } -} - -func ctlV3Defrag(cx ctlCtx) error { - cmdArgs := append(cx.PrefixArgs(), "defrag") - lines := make([]string, cx.epc.cfg.clusterSize) - for i := range lines { - lines[i] = "Finished defragmenting etcd member" - } - return spawnWithExpects(cmdArgs, lines...) -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_elect_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_elect_test.go deleted file mode 100644 index 02c7090f7..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_elect_test.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "os" - "strings" - "testing" - "time" - - "github.com/coreos/etcd/pkg/expect" -) - -func TestCtlV3Elect(t *testing.T) { - oldenv := os.Getenv("EXPECT_DEBUG") - defer os.Setenv("EXPECT_DEBUG", oldenv) - os.Setenv("EXPECT_DEBUG", "1") - - testCtl(t, testElect) -} - -func testElect(cx ctlCtx) { - name := "a" - - holder, ch, err := ctlV3Elect(cx, name, "p1") - if err != nil { - cx.t.Fatal(err) - } - - l1 := "" - select { - case <-time.After(2 * time.Second): - cx.t.Fatalf("timed out electing") - case l1 = <-ch: - if !strings.HasPrefix(l1, name) { - cx.t.Errorf("got %q, expected %q prefix", l1, name) - } - } - - // blocked process that won't win the election - blocked, ch, err := ctlV3Elect(cx, name, "p2") - if err != nil { - cx.t.Fatal(err) - } - select { - case <-time.After(100 * time.Millisecond): - case <-ch: - cx.t.Fatalf("should block") - } - - // overlap with a blocker that will win the election - blockAcquire, ch, err := ctlV3Elect(cx, name, "p2") - if err != nil { - cx.t.Fatal(err) - } - defer blockAcquire.Stop() - select { - case <-time.After(100 * time.Millisecond): - case <-ch: - cx.t.Fatalf("should block") - } - - // kill blocked process with clean shutdown - if err = blocked.Signal(os.Interrupt); err != nil { - cx.t.Fatal(err) - } - if err = closeWithTimeout(blocked, time.Second); err != nil { - cx.t.Fatal(err) - } - - // kill the holder with clean shutdown - if err = holder.Signal(os.Interrupt); err != nil { - cx.t.Fatal(err) - } - if err = closeWithTimeout(holder, time.Second); err != nil { - cx.t.Fatal(err) - } - - // blockAcquire should win the election - select { - case <-time.After(time.Second): - cx.t.Fatalf("timed out from waiting to holding") - case l2 := <-ch: - if l1 == l2 || !strings.HasPrefix(l2, name) { - cx.t.Fatalf("expected different elect name, got l1=%q, l2=%q", l1, l2) - } - } -} - -// ctlV3Elect creates a elect process with a channel listening for when it wins the election. -func ctlV3Elect(cx ctlCtx, name, proposal string) (*expect.ExpectProcess, <-chan string, error) { - cmdArgs := append(cx.PrefixArgs(), "elect", name, proposal) - proc, err := spawnCmd(cmdArgs) - outc := make(chan string, 1) - if err != nil { - close(outc) - return proc, outc, err - } - go func() { - s, xerr := proc.ExpectFunc(func(string) bool { return true }) - if xerr != nil { - cx.t.Errorf("expect failed (%v)", xerr) - } - outc <- s - }() - return proc, outc, err -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_endpoint_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_endpoint_test.go deleted file mode 100644 index 821e77bb7..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_endpoint_test.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "context" - "fmt" - "net/url" - "testing" - "time" - - "github.com/coreos/etcd/clientv3" -) - -func TestCtlV3EndpointHealth(t *testing.T) { testCtl(t, endpointHealthTest, withQuorum()) } -func TestCtlV3EndpointStatus(t *testing.T) { testCtl(t, endpointStatusTest, withQuorum()) } -func TestCtlV3EndpointHashKV(t *testing.T) { testCtl(t, endpointHashKVTest, withQuorum()) } - -func endpointHealthTest(cx ctlCtx) { - if err := ctlV3EndpointHealth(cx); err != nil { - cx.t.Fatalf("endpointStatusTest ctlV3EndpointHealth error (%v)", err) - } -} - -func ctlV3EndpointHealth(cx ctlCtx) error { - cmdArgs := append(cx.PrefixArgs(), "endpoint", "health") - lines := make([]string, cx.epc.cfg.clusterSize) - for i := range lines { - lines[i] = "is healthy" - } - return spawnWithExpects(cmdArgs, lines...) -} - -func endpointStatusTest(cx ctlCtx) { - if err := ctlV3EndpointStatus(cx); err != nil { - cx.t.Fatalf("endpointStatusTest ctlV3EndpointStatus error (%v)", err) - } -} - -func ctlV3EndpointStatus(cx ctlCtx) error { - cmdArgs := append(cx.PrefixArgs(), "endpoint", "status") - var eps []string - for _, ep := range cx.epc.EndpointsV3() { - u, _ := url.Parse(ep) - eps = append(eps, u.Host) - } - return spawnWithExpects(cmdArgs, eps...) -} - -func endpointHashKVTest(cx ctlCtx) { - if err := ctlV3EndpointHashKV(cx); err != nil { - cx.t.Fatalf("endpointHashKVTest ctlV3EndpointHashKV error (%v)", err) - } -} - -func ctlV3EndpointHashKV(cx ctlCtx) error { - eps := cx.epc.EndpointsV3() - - // get latest hash to compare - cli, err := clientv3.New(clientv3.Config{ - Endpoints: eps, - DialTimeout: 3 * time.Second, - }) - if err != nil { - cx.t.Fatal(err) - } - defer cli.Close() - hresp, err := cli.HashKV(context.TODO(), eps[0], 0) - if err != nil { - cx.t.Fatal(err) - } - - cmdArgs := append(cx.PrefixArgs(), "endpoint", "hashkv") - var ss []string - for _, ep := range cx.epc.EndpointsV3() { - u, _ := url.Parse(ep) - ss = append(ss, fmt.Sprintf("%s, %d", u.Host, hresp.Hash)) - } - return spawnWithExpects(cmdArgs, ss...) -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_kv_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_kv_test.go deleted file mode 100644 index 2e14bea64..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_kv_test.go +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "fmt" - "strings" - "testing" -) - -func TestCtlV3Put(t *testing.T) { testCtl(t, putTest) } -func TestCtlV3PutNoTLS(t *testing.T) { testCtl(t, putTest, withCfg(configNoTLS)) } -func TestCtlV3PutClientTLS(t *testing.T) { testCtl(t, putTest, withCfg(configClientTLS)) } -func TestCtlV3PutClientAutoTLS(t *testing.T) { testCtl(t, putTest, withCfg(configClientAutoTLS)) } -func TestCtlV3PutPeerTLS(t *testing.T) { testCtl(t, putTest, withCfg(configPeerTLS)) } -func TestCtlV3PutTimeout(t *testing.T) { testCtl(t, putTest, withDialTimeout(0)) } -func TestCtlV3PutClientTLSFlagByEnv(t *testing.T) { - testCtl(t, putTest, withCfg(configClientTLS), withFlagByEnv()) -} -func TestCtlV3PutIgnoreValue(t *testing.T) { testCtl(t, putTestIgnoreValue) } -func TestCtlV3PutIgnoreLease(t *testing.T) { testCtl(t, putTestIgnoreLease) } - -func TestCtlV3Get(t *testing.T) { testCtl(t, getTest) } -func TestCtlV3GetNoTLS(t *testing.T) { testCtl(t, getTest, withCfg(configNoTLS)) } -func TestCtlV3GetClientTLS(t *testing.T) { testCtl(t, getTest, withCfg(configClientTLS)) } -func TestCtlV3GetClientAutoTLS(t *testing.T) { testCtl(t, getTest, withCfg(configClientAutoTLS)) } -func TestCtlV3GetPeerTLS(t *testing.T) { testCtl(t, getTest, withCfg(configPeerTLS)) } -func TestCtlV3GetTimeout(t *testing.T) { testCtl(t, getTest, withDialTimeout(0)) } -func TestCtlV3GetQuorum(t *testing.T) { testCtl(t, getTest, withQuorum()) } - -func TestCtlV3GetFormat(t *testing.T) { testCtl(t, getFormatTest) } -func TestCtlV3GetRev(t *testing.T) { testCtl(t, getRevTest) } -func TestCtlV3GetKeysOnly(t *testing.T) { testCtl(t, getKeysOnlyTest) } - -func TestCtlV3Del(t *testing.T) { testCtl(t, delTest) } -func TestCtlV3DelNoTLS(t *testing.T) { testCtl(t, delTest, withCfg(configNoTLS)) } -func TestCtlV3DelClientTLS(t *testing.T) { testCtl(t, delTest, withCfg(configClientTLS)) } -func TestCtlV3DelPeerTLS(t *testing.T) { testCtl(t, delTest, withCfg(configPeerTLS)) } -func TestCtlV3DelTimeout(t *testing.T) { testCtl(t, delTest, withDialTimeout(0)) } - -func TestCtlV3GetRevokedCRL(t *testing.T) { - cfg := etcdProcessClusterConfig{ - clusterSize: 1, - initialToken: "new", - clientTLS: clientTLS, - isClientCRL: true, - clientCertAuthEnabled: true, - } - testCtl(t, testGetRevokedCRL, withCfg(cfg)) -} - -func testGetRevokedCRL(cx ctlCtx) { - // test reject - if err := ctlV3Put(cx, "k", "v", ""); err == nil || !strings.Contains(err.Error(), "Error:") { - cx.t.Fatalf("expected reset connection on put, got %v", err) - } - // test accept - cx.epc.cfg.isClientCRL = false - if err := ctlV3Put(cx, "k", "v", ""); err != nil { - cx.t.Fatal(err) - } -} - -func putTest(cx ctlCtx) { - key, value := "foo", "bar" - - if err := ctlV3Put(cx, key, value, ""); err != nil { - if cx.dialTimeout > 0 && !isGRPCTimedout(err) { - cx.t.Fatalf("putTest ctlV3Put error (%v)", err) - } - } - if err := ctlV3Get(cx, []string{key}, kv{key, value}); err != nil { - if cx.dialTimeout > 0 && !isGRPCTimedout(err) { - cx.t.Fatalf("putTest ctlV3Get error (%v)", err) - } - } -} - -func putTestIgnoreValue(cx ctlCtx) { - if err := ctlV3Put(cx, "foo", "bar", ""); err != nil { - cx.t.Fatal(err) - } - if err := ctlV3Get(cx, []string{"foo"}, kv{"foo", "bar"}); err != nil { - cx.t.Fatal(err) - } - if err := ctlV3Put(cx, "foo", "", "", "--ignore-value"); err != nil { - cx.t.Fatal(err) - } - if err := ctlV3Get(cx, []string{"foo"}, kv{"foo", "bar"}); err != nil { - cx.t.Fatal(err) - } -} - -func putTestIgnoreLease(cx ctlCtx) { - leaseID, err := ctlV3LeaseGrant(cx, 10) - if err != nil { - cx.t.Fatalf("putTestIgnoreLease: ctlV3LeaseGrant error (%v)", err) - } - if err := ctlV3Put(cx, "foo", "bar", leaseID); err != nil { - cx.t.Fatalf("putTestIgnoreLease: ctlV3Put error (%v)", err) - } - if err := ctlV3Get(cx, []string{"foo"}, kv{"foo", "bar"}); err != nil { - cx.t.Fatalf("putTestIgnoreLease: ctlV3Get error (%v)", err) - } - if err := ctlV3Put(cx, "foo", "bar1", "", "--ignore-lease"); err != nil { - cx.t.Fatalf("putTestIgnoreLease: ctlV3Put error (%v)", err) - } - if err := ctlV3Get(cx, []string{"foo"}, kv{"foo", "bar1"}); err != nil { - cx.t.Fatalf("putTestIgnoreLease: ctlV3Get error (%v)", err) - } - if err := ctlV3LeaseRevoke(cx, leaseID); err != nil { - cx.t.Fatalf("putTestIgnoreLease: ctlV3LeaseRevok error (%v)", err) - } - if err := ctlV3Get(cx, []string{"key"}); err != nil { // expect no output - cx.t.Fatalf("putTestIgnoreLease: ctlV3Get error (%v)", err) - } -} - -func getTest(cx ctlCtx) { - var ( - kvs = []kv{{"key1", "val1"}, {"key2", "val2"}, {"key3", "val3"}} - revkvs = []kv{{"key3", "val3"}, {"key2", "val2"}, {"key1", "val1"}} - ) - for i := range kvs { - if err := ctlV3Put(cx, kvs[i].key, kvs[i].val, ""); err != nil { - cx.t.Fatalf("getTest #%d: ctlV3Put error (%v)", i, err) - } - } - - tests := []struct { - args []string - - wkv []kv - }{ - {[]string{"key1"}, []kv{{"key1", "val1"}}}, - {[]string{"", "--prefix"}, kvs}, - {[]string{"", "--from-key"}, kvs}, - {[]string{"key", "--prefix"}, kvs}, - {[]string{"key", "--prefix", "--limit=2"}, kvs[:2]}, - {[]string{"key", "--prefix", "--order=ASCEND", "--sort-by=MODIFY"}, kvs}, - {[]string{"key", "--prefix", "--order=ASCEND", "--sort-by=VERSION"}, kvs}, - {[]string{"key", "--prefix", "--sort-by=CREATE"}, kvs}, // ASCEND by default - {[]string{"key", "--prefix", "--order=DESCEND", "--sort-by=CREATE"}, revkvs}, - {[]string{"key", "--prefix", "--order=DESCEND", "--sort-by=KEY"}, revkvs}, - } - for i, tt := range tests { - if err := ctlV3Get(cx, tt.args, tt.wkv...); err != nil { - if cx.dialTimeout > 0 && !isGRPCTimedout(err) { - cx.t.Errorf("getTest #%d: ctlV3Get error (%v)", i, err) - } - } - } -} - -func getFormatTest(cx ctlCtx) { - if err := ctlV3Put(cx, "abc", "123", ""); err != nil { - cx.t.Fatal(err) - } - - tests := []struct { - format string - valueOnly bool - - wstr string - }{ - {"simple", false, "abc"}, - {"simple", true, "123"}, - {"json", false, `"kvs":[{"key":"YWJj"`}, - {"protobuf", false, "\x17\b\x93\xe7\xf6\x93\xd4ņ\xe14\x10\xed"}, - } - - for i, tt := range tests { - cmdArgs := append(cx.PrefixArgs(), "get") - cmdArgs = append(cmdArgs, "--write-out="+tt.format) - if tt.valueOnly { - cmdArgs = append(cmdArgs, "--print-value-only") - } - cmdArgs = append(cmdArgs, "abc") - if err := spawnWithExpect(cmdArgs, tt.wstr); err != nil { - cx.t.Errorf("#%d: error (%v), wanted %v", i, err, tt.wstr) - } - } -} - -func getRevTest(cx ctlCtx) { - var ( - kvs = []kv{{"key", "val1"}, {"key", "val2"}, {"key", "val3"}} - ) - for i := range kvs { - if err := ctlV3Put(cx, kvs[i].key, kvs[i].val, ""); err != nil { - cx.t.Fatalf("getRevTest #%d: ctlV3Put error (%v)", i, err) - } - } - - tests := []struct { - args []string - - wkv []kv - }{ - {[]string{"key", "--rev", "2"}, kvs[:1]}, - {[]string{"key", "--rev", "3"}, kvs[1:2]}, - {[]string{"key", "--rev", "4"}, kvs[2:]}, - } - - for i, tt := range tests { - if err := ctlV3Get(cx, tt.args, tt.wkv...); err != nil { - cx.t.Errorf("getTest #%d: ctlV3Get error (%v)", i, err) - } - } -} - -func getKeysOnlyTest(cx ctlCtx) { - if err := ctlV3Put(cx, "key", "val", ""); err != nil { - cx.t.Fatal(err) - } - cmdArgs := append(cx.PrefixArgs(), []string{"get", "--keys-only", "key"}...) - if err := spawnWithExpect(cmdArgs, "key"); err != nil { - cx.t.Fatal(err) - } - if err := spawnWithExpects(cmdArgs, "val"); err == nil { - cx.t.Fatalf("got value but passed --keys-only") - } -} - -func delTest(cx ctlCtx) { - tests := []struct { - puts []kv - args []string - - deletedNum int - }{ - { // delete all keys - []kv{{"foo1", "bar"}, {"foo2", "bar"}, {"foo3", "bar"}}, - []string{"", "--prefix"}, - 3, - }, - { // delete all keys - []kv{{"foo1", "bar"}, {"foo2", "bar"}, {"foo3", "bar"}}, - []string{"", "--from-key"}, - 3, - }, - { - []kv{{"this", "value"}}, - []string{"that"}, - 0, - }, - { - []kv{{"sample", "value"}}, - []string{"sample"}, - 1, - }, - { - []kv{{"key1", "val1"}, {"key2", "val2"}, {"key3", "val3"}}, - []string{"key", "--prefix"}, - 3, - }, - { - []kv{{"zoo1", "bar"}, {"zoo2", "bar2"}, {"zoo3", "bar3"}}, - []string{"zoo1", "--from-key"}, - 3, - }, - } - - for i, tt := range tests { - for j := range tt.puts { - if err := ctlV3Put(cx, tt.puts[j].key, tt.puts[j].val, ""); err != nil { - cx.t.Fatalf("delTest #%d-%d: ctlV3Put error (%v)", i, j, err) - } - } - if err := ctlV3Del(cx, tt.args, tt.deletedNum); err != nil { - if cx.dialTimeout > 0 && !isGRPCTimedout(err) { - cx.t.Fatalf("delTest #%d: ctlV3Del error (%v)", i, err) - } - } - } -} - -func ctlV3Put(cx ctlCtx, key, value, leaseID string, flags ...string) error { - skipValue := false - skipLease := false - for _, f := range flags { - if f == "--ignore-value" { - skipValue = true - } - if f == "--ignore-lease" { - skipLease = true - } - } - cmdArgs := append(cx.PrefixArgs(), "put", key) - if !skipValue { - cmdArgs = append(cmdArgs, value) - } - if leaseID != "" && !skipLease { - cmdArgs = append(cmdArgs, "--lease", leaseID) - } - if len(flags) != 0 { - cmdArgs = append(cmdArgs, flags...) - } - return spawnWithExpect(cmdArgs, "OK") -} - -type kv struct { - key, val string -} - -func ctlV3Get(cx ctlCtx, args []string, kvs ...kv) error { - cmdArgs := append(cx.PrefixArgs(), "get") - cmdArgs = append(cmdArgs, args...) - if !cx.quorum { - cmdArgs = append(cmdArgs, "--consistency", "s") - } - var lines []string - for _, elem := range kvs { - lines = append(lines, elem.key, elem.val) - } - return spawnWithExpects(cmdArgs, lines...) -} - -func ctlV3Del(cx ctlCtx, args []string, num int) error { - cmdArgs := append(cx.PrefixArgs(), "del") - cmdArgs = append(cmdArgs, args...) - return spawnWithExpects(cmdArgs, fmt.Sprintf("%d", num)) -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_lease_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_lease_test.go deleted file mode 100644 index f03f7bf3c..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_lease_test.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "fmt" - "strconv" - "strings" - "testing" - "time" -) - -func TestCtlV3LeaseGrantTimeToLive(t *testing.T) { testCtl(t, leaseTestGrantTimeToLive) } -func TestCtlV3LeaseGrantLeases(t *testing.T) { testCtl(t, leaseTestGrantLeasesList) } -func TestCtlV3LeaseTestTimeToLiveExpired(t *testing.T) { testCtl(t, leaseTestTimeToLiveExpired) } -func TestCtlV3LeaseKeepAlive(t *testing.T) { testCtl(t, leaseTestKeepAlive) } -func TestCtlV3LeaseKeepAliveOnce(t *testing.T) { testCtl(t, leaseTestKeepAliveOnce) } -func TestCtlV3LeaseRevoke(t *testing.T) { testCtl(t, leaseTestRevoke) } - -func leaseTestGrantTimeToLive(cx ctlCtx) { - id, err := ctlV3LeaseGrant(cx, 10) - if err != nil { - cx.t.Fatal(err) - } - - cmdArgs := append(cx.PrefixArgs(), "lease", "timetolive", id, "--keys") - proc, err := spawnCmd(cmdArgs) - if err != nil { - cx.t.Fatal(err) - } - line, err := proc.Expect(" granted with TTL(") - if err != nil { - cx.t.Fatal(err) - } - if err = proc.Close(); err != nil { - cx.t.Fatal(err) - } - if !strings.Contains(line, ", attached keys") { - cx.t.Fatalf("expected 'attached keys', got %q", line) - } - if !strings.Contains(line, id) { - cx.t.Fatalf("expected leaseID %q, got %q", id, line) - } -} - -func leaseTestGrantLeasesList(cx ctlCtx) { - id, err := ctlV3LeaseGrant(cx, 10) - if err != nil { - cx.t.Fatal(err) - } - - cmdArgs := append(cx.PrefixArgs(), "lease", "list") - proc, err := spawnCmd(cmdArgs) - if err != nil { - cx.t.Fatal(err) - } - _, err = proc.Expect(id) - if err != nil { - cx.t.Fatal(err) - } - if err = proc.Close(); err != nil { - cx.t.Fatal(err) - } -} - -func leaseTestTimeToLiveExpired(cx ctlCtx) { - err := leaseTestTimeToLiveExpire(cx, 3) - if err != nil { - cx.t.Fatal(err) - } -} - -func leaseTestTimeToLiveExpire(cx ctlCtx, ttl int) error { - leaseID, err := ctlV3LeaseGrant(cx, ttl) - if err != nil { - return err - } - - if err = ctlV3Put(cx, "key", "val", leaseID); err != nil { - return fmt.Errorf("leaseTestTimeToLiveExpire: ctlV3Put error (%v)", err) - } - // eliminate false positive - time.Sleep(time.Duration(ttl+1) * time.Second) - cmdArgs := append(cx.PrefixArgs(), "lease", "timetolive", leaseID) - exp := fmt.Sprintf("lease %s already expired", leaseID) - if err = spawnWithExpect(cmdArgs, exp); err != nil { - return err - } - if err := ctlV3Get(cx, []string{"key"}); err != nil { - return fmt.Errorf("leaseTestTimeToLiveExpire: ctlV3Get error (%v)", err) - } - return nil -} - -func leaseTestKeepAlive(cx ctlCtx) { - // put with TTL 10 seconds and keep-alive - leaseID, err := ctlV3LeaseGrant(cx, 10) - if err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3LeaseGrant error (%v)", err) - } - if err := ctlV3Put(cx, "key", "val", leaseID); err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3Put error (%v)", err) - } - if err := ctlV3LeaseKeepAlive(cx, leaseID); err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3LeaseKeepAlive error (%v)", err) - } - if err := ctlV3Get(cx, []string{"key"}, kv{"key", "val"}); err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3Get error (%v)", err) - } -} - -func leaseTestKeepAliveOnce(cx ctlCtx) { - // put with TTL 10 seconds and keep-alive once - leaseID, err := ctlV3LeaseGrant(cx, 10) - if err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3LeaseGrant error (%v)", err) - } - if err := ctlV3Put(cx, "key", "val", leaseID); err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3Put error (%v)", err) - } - if err := ctlV3LeaseKeepAliveOnce(cx, leaseID); err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3LeaseKeepAliveOnce error (%v)", err) - } - if err := ctlV3Get(cx, []string{"key"}, kv{"key", "val"}); err != nil { - cx.t.Fatalf("leaseTestKeepAlive: ctlV3Get error (%v)", err) - } -} - -func leaseTestRevoke(cx ctlCtx) { - // put with TTL 10 seconds and revoke - leaseID, err := ctlV3LeaseGrant(cx, 10) - if err != nil { - cx.t.Fatalf("leaseTestRevoke: ctlV3LeaseGrant error (%v)", err) - } - if err := ctlV3Put(cx, "key", "val", leaseID); err != nil { - cx.t.Fatalf("leaseTestRevoke: ctlV3Put error (%v)", err) - } - if err := ctlV3LeaseRevoke(cx, leaseID); err != nil { - cx.t.Fatalf("leaseTestRevoke: ctlV3LeaseRevok error (%v)", err) - } - if err := ctlV3Get(cx, []string{"key"}); err != nil { // expect no output - cx.t.Fatalf("leaseTestRevoke: ctlV3Get error (%v)", err) - } -} - -func ctlV3LeaseGrant(cx ctlCtx, ttl int) (string, error) { - cmdArgs := append(cx.PrefixArgs(), "lease", "grant", strconv.Itoa(ttl)) - proc, err := spawnCmd(cmdArgs) - if err != nil { - return "", err - } - - line, err := proc.Expect(" granted with TTL(") - if err != nil { - return "", err - } - if err = proc.Close(); err != nil { - return "", err - } - - // parse 'line LEASE_ID granted with TTL(5s)' to get lease ID - hs := strings.Split(line, " ") - if len(hs) < 2 { - return "", fmt.Errorf("lease grant failed with %q", line) - } - return hs[1], nil -} - -func ctlV3LeaseKeepAlive(cx ctlCtx, leaseID string) error { - cmdArgs := append(cx.PrefixArgs(), "lease", "keep-alive", leaseID) - - proc, err := spawnCmd(cmdArgs) - if err != nil { - return err - } - - if _, err = proc.Expect(fmt.Sprintf("lease %s keepalived with TTL(", leaseID)); err != nil { - return err - } - return proc.Stop() -} - -func ctlV3LeaseKeepAliveOnce(cx ctlCtx, leaseID string) error { - cmdArgs := append(cx.PrefixArgs(), "lease", "keep-alive", "--once", leaseID) - - proc, err := spawnCmd(cmdArgs) - if err != nil { - return err - } - - if _, err = proc.Expect(fmt.Sprintf("lease %s keepalived with TTL(", leaseID)); err != nil { - return err - } - return proc.Stop() -} - -func ctlV3LeaseRevoke(cx ctlCtx, leaseID string) error { - cmdArgs := append(cx.PrefixArgs(), "lease", "revoke", leaseID) - return spawnWithExpect(cmdArgs, fmt.Sprintf("lease %s revoked", leaseID)) -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_lock_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_lock_test.go deleted file mode 100644 index 6bcbe4de2..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_lock_test.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "os" - "strings" - "testing" - "time" - - "github.com/coreos/etcd/pkg/expect" -) - -func TestCtlV3Lock(t *testing.T) { - oldenv := os.Getenv("EXPECT_DEBUG") - defer os.Setenv("EXPECT_DEBUG", oldenv) - os.Setenv("EXPECT_DEBUG", "1") - - testCtl(t, testLock) -} - -func testLock(cx ctlCtx) { - name := "a" - - holder, ch, err := ctlV3Lock(cx, name) - if err != nil { - cx.t.Fatal(err) - } - - l1 := "" - select { - case <-time.After(2 * time.Second): - cx.t.Fatalf("timed out locking") - case l1 = <-ch: - if !strings.HasPrefix(l1, name) { - cx.t.Errorf("got %q, expected %q prefix", l1, name) - } - } - - // blocked process that won't acquire the lock - blocked, ch, err := ctlV3Lock(cx, name) - if err != nil { - cx.t.Fatal(err) - } - select { - case <-time.After(100 * time.Millisecond): - case <-ch: - cx.t.Fatalf("should block") - } - - // overlap with a blocker that will acquire the lock - blockAcquire, ch, err := ctlV3Lock(cx, name) - if err != nil { - cx.t.Fatal(err) - } - defer blockAcquire.Stop() - select { - case <-time.After(100 * time.Millisecond): - case <-ch: - cx.t.Fatalf("should block") - } - - // kill blocked process with clean shutdown - if err = blocked.Signal(os.Interrupt); err != nil { - cx.t.Fatal(err) - } - if err = closeWithTimeout(blocked, time.Second); err != nil { - cx.t.Fatal(err) - } - - // kill the holder with clean shutdown - if err = holder.Signal(os.Interrupt); err != nil { - cx.t.Fatal(err) - } - if err = closeWithTimeout(holder, time.Second); err != nil { - cx.t.Fatal(err) - } - - // blockAcquire should acquire the lock - select { - case <-time.After(time.Second): - cx.t.Fatalf("timed out from waiting to holding") - case l2 := <-ch: - if l1 == l2 || !strings.HasPrefix(l2, name) { - cx.t.Fatalf("expected different lock name, got l1=%q, l2=%q", l1, l2) - } - } -} - -// ctlV3Lock creates a lock process with a channel listening for when it acquires the lock. -func ctlV3Lock(cx ctlCtx, name string) (*expect.ExpectProcess, <-chan string, error) { - cmdArgs := append(cx.PrefixArgs(), "lock", name) - proc, err := spawnCmd(cmdArgs) - outc := make(chan string, 1) - if err != nil { - close(outc) - return proc, outc, err - } - go func() { - s, xerr := proc.ExpectFunc(func(string) bool { return true }) - if xerr != nil { - cx.t.Errorf("expect failed (%v)", xerr) - } - outc <- s - }() - return proc, outc, err -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_make_mirror_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_make_mirror_test.go deleted file mode 100644 index ef1cf24c5..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_make_mirror_test.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "fmt" - "testing" - "time" -) - -func TestCtlV3MakeMirror(t *testing.T) { testCtl(t, makeMirrorTest) } -func TestCtlV3MakeMirrorModifyDestPrefix(t *testing.T) { testCtl(t, makeMirrorModifyDestPrefixTest) } -func TestCtlV3MakeMirrorNoDestPrefix(t *testing.T) { testCtl(t, makeMirrorNoDestPrefixTest) } - -func makeMirrorTest(cx ctlCtx) { - var ( - flags = []string{} - kvs = []kv{{"key1", "val1"}, {"key2", "val2"}, {"key3", "val3"}} - kvs2 = []kvExec{{key: "key1", val: "val1"}, {key: "key2", val: "val2"}, {key: "key3", val: "val3"}} - prefix = "key" - ) - testMirrorCommand(cx, flags, kvs, kvs2, prefix, prefix) -} - -func makeMirrorModifyDestPrefixTest(cx ctlCtx) { - var ( - flags = []string{"--prefix", "o_", "--dest-prefix", "d_"} - kvs = []kv{{"o_key1", "val1"}, {"o_key2", "val2"}, {"o_key3", "val3"}} - kvs2 = []kvExec{{key: "d_key1", val: "val1"}, {key: "d_key2", val: "val2"}, {key: "d_key3", val: "val3"}} - srcprefix = "o_" - destprefix = "d_" - ) - testMirrorCommand(cx, flags, kvs, kvs2, srcprefix, destprefix) -} - -func makeMirrorNoDestPrefixTest(cx ctlCtx) { - var ( - flags = []string{"--prefix", "o_", "--no-dest-prefix"} - kvs = []kv{{"o_key1", "val1"}, {"o_key2", "val2"}, {"o_key3", "val3"}} - kvs2 = []kvExec{{key: "key1", val: "val1"}, {key: "key2", val: "val2"}, {key: "key3", val: "val3"}} - srcprefix = "o_" - destprefix = "key" - ) - - testMirrorCommand(cx, flags, kvs, kvs2, srcprefix, destprefix) -} - -func testMirrorCommand(cx ctlCtx, flags []string, sourcekvs []kv, destkvs []kvExec, srcprefix, destprefix string) { - // set up another cluster to mirror with - mirrorcfg := configAutoTLS - mirrorcfg.clusterSize = 1 - mirrorcfg.basePort = 10000 - mirrorctx := ctlCtx{ - t: cx.t, - cfg: mirrorcfg, - dialTimeout: 7 * time.Second, - } - - mirrorepc, err := newEtcdProcessCluster(&mirrorctx.cfg) - if err != nil { - cx.t.Fatalf("could not start etcd process cluster (%v)", err) - } - mirrorctx.epc = mirrorepc - - defer func() { - if err = mirrorctx.epc.Close(); err != nil { - cx.t.Fatalf("error closing etcd processes (%v)", err) - } - }() - - cmdArgs := append(cx.PrefixArgs(), "make-mirror") - cmdArgs = append(cmdArgs, flags...) - cmdArgs = append(cmdArgs, fmt.Sprintf("localhost:%d", mirrorcfg.basePort)) - proc, err := spawnCmd(cmdArgs) - if err != nil { - cx.t.Fatal(err) - } - defer func() { - err = proc.Stop() - if err != nil { - cx.t.Fatal(err) - } - }() - - for i := range sourcekvs { - if err = ctlV3Put(cx, sourcekvs[i].key, sourcekvs[i].val, ""); err != nil { - cx.t.Fatal(err) - } - } - if err = ctlV3Get(cx, []string{srcprefix, "--prefix"}, sourcekvs...); err != nil { - cx.t.Fatal(err) - } - - if err = ctlV3Watch(mirrorctx, []string{destprefix, "--rev", "1", "--prefix"}, destkvs...); err != nil { - cx.t.Fatal(err) - } -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_migrate_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_migrate_test.go deleted file mode 100644 index 1bad8c439..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_migrate_test.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "context" - "fmt" - "os" - "testing" - "time" - - "github.com/coreos/etcd/clientv3" - "github.com/coreos/etcd/pkg/testutil" -) - -func TestCtlV3Migrate(t *testing.T) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, &configNoTLS, false) - defer func() { - if errC := epc.Close(); errC != nil { - t.Fatalf("error closing etcd processes (%v)", errC) - } - }() - - keys := make([]string, 3) - vals := make([]string, 3) - for i := range keys { - keys[i] = fmt.Sprintf("foo_%d", i) - vals[i] = fmt.Sprintf("bar_%d", i) - } - for i := range keys { - if err := etcdctlSet(epc, keys[i], vals[i]); err != nil { - t.Fatal(err) - } - } - - dataDir := epc.procs[0].Config().dataDirPath - if err := epc.Stop(); err != nil { - t.Fatalf("error closing etcd processes (%v)", err) - } - - os.Setenv("ETCDCTL_API", "3") - defer os.Unsetenv("ETCDCTL_API") - cx := ctlCtx{ - t: t, - cfg: configNoTLS, - dialTimeout: 7 * time.Second, - epc: epc, - } - if err := ctlV3Migrate(cx, dataDir, ""); err != nil { - t.Fatal(err) - } - - epc.procs[0].Config().keepDataDir = true - if err := epc.Restart(); err != nil { - t.Fatal(err) - } - - // to ensure revision increment is continuous from migrated v2 data - if err := ctlV3Put(cx, "test", "value", ""); err != nil { - t.Fatal(err) - } - cli, err := clientv3.New(clientv3.Config{ - Endpoints: epc.EndpointsV3(), - DialTimeout: 3 * time.Second, - }) - if err != nil { - t.Fatal(err) - } - defer cli.Close() - resp, err := cli.Get(context.TODO(), "test") - if err != nil { - t.Fatal(err) - } - if len(resp.Kvs) != 1 { - t.Fatalf("len(resp.Kvs) expected 1, got %+v", resp.Kvs) - } - if resp.Kvs[0].CreateRevision != 7 { - t.Fatalf("resp.Kvs[0].CreateRevision expected 7, got %d", resp.Kvs[0].CreateRevision) - } -} - -func ctlV3Migrate(cx ctlCtx, dataDir, walDir string) error { - cmdArgs := append(cx.PrefixArgs(), "migrate", "--data-dir", dataDir, "--wal-dir", walDir) - return spawnWithExpects(cmdArgs, "finished transforming keys") -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_move_leader_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_move_leader_test.go deleted file mode 100644 index 0a7f168b2..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_move_leader_test.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2017 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "context" - "crypto/tls" - "fmt" - "os" - "testing" - "time" - - "github.com/coreos/etcd/clientv3" - "github.com/coreos/etcd/pkg/testutil" - "github.com/coreos/etcd/pkg/transport" - "github.com/coreos/etcd/pkg/types" -) - -func TestCtlV3MoveLeaderSecure(t *testing.T) { - testCtlV3MoveLeader(t, configTLS) -} - -func TestCtlV3MoveLeaderInsecure(t *testing.T) { - testCtlV3MoveLeader(t, configNoTLS) -} - -func testCtlV3MoveLeader(t *testing.T, cfg etcdProcessClusterConfig) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, &cfg, true) - defer func() { - if errC := epc.Close(); errC != nil { - t.Fatalf("error closing etcd processes (%v)", errC) - } - }() - - var tcfg *tls.Config - if cfg.clientTLS == clientTLS { - tinfo := transport.TLSInfo{ - CertFile: certPath, - KeyFile: privateKeyPath, - TrustedCAFile: caPath, - } - var err error - tcfg, err = tinfo.ClientConfig() - if err != nil { - t.Fatal(err) - } - } - - var leadIdx int - var leaderID uint64 - var transferee uint64 - for i, ep := range epc.EndpointsV3() { - cli, err := clientv3.New(clientv3.Config{ - Endpoints: []string{ep}, - DialTimeout: 3 * time.Second, - TLS: tcfg, - }) - if err != nil { - t.Fatal(err) - } - resp, err := cli.Status(context.Background(), ep) - if err != nil { - t.Fatal(err) - } - cli.Close() - - if resp.Header.GetMemberId() == resp.Leader { - leadIdx = i - leaderID = resp.Leader - } else { - transferee = resp.Header.GetMemberId() - } - } - - os.Setenv("ETCDCTL_API", "3") - defer os.Unsetenv("ETCDCTL_API") - cx := ctlCtx{ - t: t, - cfg: configNoTLS, - dialTimeout: 7 * time.Second, - epc: epc, - } - - tests := []struct { - prefixes []string - expect string - }{ - { // request to non-leader - cx.prefixArgs([]string{cx.epc.EndpointsV3()[(leadIdx+1)%3]}), - "no leader endpoint given at ", - }, - { // request to leader - cx.prefixArgs([]string{cx.epc.EndpointsV3()[leadIdx]}), - fmt.Sprintf("Leadership transferred from %s to %s", types.ID(leaderID), types.ID(transferee)), - }, - } - for i, tc := range tests { - cmdArgs := append(tc.prefixes, "move-leader", types.ID(transferee).String()) - if err := spawnWithExpect(cmdArgs, tc.expect); err != nil { - t.Fatalf("#%d: %v", i, err) - } - } -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_role_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_role_test.go deleted file mode 100644 index 68b77d0c1..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_role_test.go +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "fmt" - "testing" -) - -func TestCtlV3RoleAdd(t *testing.T) { testCtl(t, roleAddTest) } -func TestCtlV3RoleAddNoTLS(t *testing.T) { testCtl(t, roleAddTest, withCfg(configNoTLS)) } -func TestCtlV3RoleAddClientTLS(t *testing.T) { testCtl(t, roleAddTest, withCfg(configClientTLS)) } -func TestCtlV3RoleAddPeerTLS(t *testing.T) { testCtl(t, roleAddTest, withCfg(configPeerTLS)) } -func TestCtlV3RoleAddTimeout(t *testing.T) { testCtl(t, roleAddTest, withDialTimeout(0)) } - -func TestCtlV3RoleGrant(t *testing.T) { testCtl(t, roleGrantTest) } - -func roleAddTest(cx ctlCtx) { - cmdSet := []struct { - args []string - expectedStr string - }{ - // Add a role. - { - args: []string{"add", "root"}, - expectedStr: "Role root created", - }, - // Try adding the same role. - { - args: []string{"add", "root"}, - expectedStr: "role name already exists", - }, - } - - for i, cmd := range cmdSet { - if err := ctlV3Role(cx, cmd.args, cmd.expectedStr); err != nil { - if cx.dialTimeout > 0 && !isGRPCTimedout(err) { - cx.t.Fatalf("roleAddTest #%d: ctlV3Role error (%v)", i, err) - } - } - } -} - -func roleGrantTest(cx ctlCtx) { - cmdSet := []struct { - args []string - expectedStr string - }{ - // Add a role. - { - args: []string{"add", "root"}, - expectedStr: "Role root created", - }, - // Grant read permission to the role. - { - args: []string{"grant", "root", "read", "foo"}, - expectedStr: "Role root updated", - }, - // Grant write permission to the role. - { - args: []string{"grant", "root", "write", "foo"}, - expectedStr: "Role root updated", - }, - // Grant rw permission to the role. - { - args: []string{"grant", "root", "readwrite", "foo"}, - expectedStr: "Role root updated", - }, - // Try granting invalid permission to the role. - { - args: []string{"grant", "root", "123", "foo"}, - expectedStr: "invalid permission type", - }, - } - - for i, cmd := range cmdSet { - if err := ctlV3Role(cx, cmd.args, cmd.expectedStr); err != nil { - cx.t.Fatalf("roleGrantTest #%d: ctlV3Role error (%v)", i, err) - } - } -} - -func ctlV3Role(cx ctlCtx, args []string, expStr string) error { - cmdArgs := append(cx.PrefixArgs(), "role") - cmdArgs = append(cmdArgs, args...) - - return spawnWithExpect(cmdArgs, expStr) -} - -func ctlV3RoleGrantPermission(cx ctlCtx, rolename string, perm grantingPerm) error { - cmdArgs := append(cx.PrefixArgs(), "role", "grant-permission") - if perm.prefix { - cmdArgs = append(cmdArgs, "--prefix") - } else if len(perm.rangeEnd) == 1 && perm.rangeEnd[0] == '\x00' { - cmdArgs = append(cmdArgs, "--from-key") - } - - cmdArgs = append(cmdArgs, rolename) - cmdArgs = append(cmdArgs, grantingPermToArgs(perm)...) - - proc, err := spawnCmd(cmdArgs) - if err != nil { - return err - } - - expStr := fmt.Sprintf("Role %s updated", rolename) - _, err = proc.Expect(expStr) - return err -} - -func ctlV3RoleRevokePermission(cx ctlCtx, rolename string, key, rangeEnd string, fromKey bool) error { - cmdArgs := append(cx.PrefixArgs(), "role", "revoke-permission") - cmdArgs = append(cmdArgs, rolename) - cmdArgs = append(cmdArgs, key) - var expStr string - if len(rangeEnd) != 0 { - cmdArgs = append(cmdArgs, rangeEnd) - expStr = fmt.Sprintf("Permission of range [%s, %s) is revoked from role %s", key, rangeEnd, rolename) - } else if fromKey { - cmdArgs = append(cmdArgs, "--from-key") - expStr = fmt.Sprintf("Permission of range [%s, is revoked from role %s", key, rolename) - } else { - expStr = fmt.Sprintf("Permission of key %s is revoked from role %s", key, rolename) - } - - proc, err := spawnCmd(cmdArgs) - if err != nil { - return err - } - - _, err = proc.Expect(expStr) - return err -} - -type grantingPerm struct { - read bool - write bool - key string - rangeEnd string - prefix bool -} - -func grantingPermToArgs(perm grantingPerm) []string { - permstr := "" - - if perm.read { - permstr += "read" - } - - if perm.write { - permstr += "write" - } - - if len(permstr) == 0 { - panic("invalid granting permission") - } - - if len(perm.rangeEnd) == 0 { - return []string{permstr, perm.key} - } - - if len(perm.rangeEnd) == 1 && perm.rangeEnd[0] == '\x00' { - return []string{permstr, perm.key} - } - - return []string{permstr, perm.key, perm.rangeEnd} -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_snapshot_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_snapshot_test.go deleted file mode 100644 index ed09045eb..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_snapshot_test.go +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "encoding/json" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "testing" - "time" - - "github.com/coreos/etcd/pkg/expect" - "github.com/coreos/etcd/pkg/testutil" -) - -func TestCtlV3Snapshot(t *testing.T) { testCtl(t, snapshotTest) } - -func snapshotTest(cx ctlCtx) { - maintenanceInitKeys(cx) - - leaseID, err := ctlV3LeaseGrant(cx, 100) - if err != nil { - cx.t.Fatalf("snapshot: ctlV3LeaseGrant error (%v)", err) - } - if err = ctlV3Put(cx, "withlease", "withlease", leaseID); err != nil { - cx.t.Fatalf("snapshot: ctlV3Put error (%v)", err) - } - - fpath := "test.snapshot" - defer os.RemoveAll(fpath) - - if err = ctlV3SnapshotSave(cx, fpath); err != nil { - cx.t.Fatalf("snapshotTest ctlV3SnapshotSave error (%v)", err) - } - - st, err := getSnapshotStatus(cx, fpath) - if err != nil { - cx.t.Fatalf("snapshotTest getSnapshotStatus error (%v)", err) - } - if st.Revision != 5 { - cx.t.Fatalf("expected 4, got %d", st.Revision) - } - if st.TotalKey < 4 { - cx.t.Fatalf("expected at least 4, got %d", st.TotalKey) - } -} - -func TestCtlV3SnapshotCorrupt(t *testing.T) { testCtl(t, snapshotCorruptTest) } - -func snapshotCorruptTest(cx ctlCtx) { - fpath := "test.snapshot" - defer os.RemoveAll(fpath) - - if err := ctlV3SnapshotSave(cx, fpath); err != nil { - cx.t.Fatalf("snapshotTest ctlV3SnapshotSave error (%v)", err) - } - - // corrupt file - f, oerr := os.OpenFile(fpath, os.O_WRONLY, 0) - if oerr != nil { - cx.t.Fatal(oerr) - } - if _, err := f.Write(make([]byte, 512)); err != nil { - cx.t.Fatal(err) - } - f.Close() - - defer os.RemoveAll("snap.etcd") - serr := spawnWithExpect( - append(cx.PrefixArgs(), "snapshot", "restore", - "--data-dir", "snap.etcd", - fpath), - "expected sha256") - - if serr != nil { - cx.t.Fatal(serr) - } -} - -// This test ensures that the snapshot status does not modify the snapshot file -func TestCtlV3SnapshotStatusBeforeRestore(t *testing.T) { testCtl(t, snapshotStatusBeforeRestoreTest) } - -func snapshotStatusBeforeRestoreTest(cx ctlCtx) { - fpath := "test.snapshot" - defer os.RemoveAll(fpath) - - if err := ctlV3SnapshotSave(cx, fpath); err != nil { - cx.t.Fatalf("snapshotTest ctlV3SnapshotSave error (%v)", err) - } - - // snapshot status on the fresh snapshot file - _, err := getSnapshotStatus(cx, fpath) - if err != nil { - cx.t.Fatalf("snapshotTest getSnapshotStatus error (%v)", err) - } - - defer os.RemoveAll("snap.etcd") - serr := spawnWithExpect( - append(cx.PrefixArgs(), "snapshot", "restore", - "--data-dir", "snap.etcd", - fpath), - "added member") - - if serr != nil { - cx.t.Fatal(serr) - } -} - -func ctlV3SnapshotSave(cx ctlCtx, fpath string) error { - cmdArgs := append(cx.PrefixArgs(), "snapshot", "save", fpath) - return spawnWithExpect(cmdArgs, fmt.Sprintf("Snapshot saved at %s", fpath)) -} - -type snapshotStatus struct { - Hash uint32 `json:"hash"` - Revision int64 `json:"revision"` - TotalKey int `json:"totalKey"` - TotalSize int64 `json:"totalSize"` -} - -func getSnapshotStatus(cx ctlCtx, fpath string) (snapshotStatus, error) { - cmdArgs := append(cx.PrefixArgs(), "--write-out", "json", "snapshot", "status", fpath) - - proc, err := spawnCmd(cmdArgs) - if err != nil { - return snapshotStatus{}, err - } - var txt string - txt, err = proc.Expect("totalKey") - if err != nil { - return snapshotStatus{}, err - } - if err = proc.Close(); err != nil { - return snapshotStatus{}, err - } - - resp := snapshotStatus{} - dec := json.NewDecoder(strings.NewReader(txt)) - if err := dec.Decode(&resp); err == io.EOF { - return snapshotStatus{}, err - } - return resp, nil -} - -// TestIssue6361 ensures new member that starts with snapshot correctly -// syncs up with other members and serve correct data. -func TestIssue6361(t *testing.T) { - defer testutil.AfterTest(t) - mustEtcdctl(t) - os.Setenv("ETCDCTL_API", "3") - defer os.Unsetenv("ETCDCTL_API") - - epc, err := newEtcdProcessCluster(&etcdProcessClusterConfig{ - clusterSize: 1, - initialToken: "new", - keepDataDir: true, - }) - if err != nil { - t.Fatalf("could not start etcd process cluster (%v)", err) - } - defer func() { - if errC := epc.Close(); errC != nil { - t.Fatalf("error closing etcd processes (%v)", errC) - } - }() - - dialTimeout := 7 * time.Second - prefixArgs := []string{ctlBinPath, "--endpoints", strings.Join(epc.EndpointsV3(), ","), "--dial-timeout", dialTimeout.String()} - - // write some keys - kvs := []kv{{"foo1", "val1"}, {"foo2", "val2"}, {"foo3", "val3"}} - for i := range kvs { - if err = spawnWithExpect(append(prefixArgs, "put", kvs[i].key, kvs[i].val), "OK"); err != nil { - t.Fatal(err) - } - } - - fpath := filepath.Join(os.TempDir(), "test.snapshot") - defer os.RemoveAll(fpath) - - // etcdctl save snapshot - if err = spawnWithExpect(append(prefixArgs, "snapshot", "save", fpath), fmt.Sprintf("Snapshot saved at %s", fpath)); err != nil { - t.Fatal(err) - } - - if err = epc.procs[0].Stop(); err != nil { - t.Fatal(err) - } - - newDataDir := filepath.Join(os.TempDir(), "test.data") - defer os.RemoveAll(newDataDir) - - // etcdctl restore the snapshot - err = spawnWithExpect([]string{ctlBinPath, "snapshot", "restore", fpath, "--name", epc.procs[0].Config().name, "--initial-cluster", epc.procs[0].Config().initialCluster, "--initial-cluster-token", epc.procs[0].Config().initialToken, "--initial-advertise-peer-urls", epc.procs[0].Config().purl.String(), "--data-dir", newDataDir}, "membership: added member") - if err != nil { - t.Fatal(err) - } - - // start the etcd member using the restored snapshot - epc.procs[0].Config().dataDirPath = newDataDir - for i := range epc.procs[0].Config().args { - if epc.procs[0].Config().args[i] == "--data-dir" { - epc.procs[0].Config().args[i+1] = newDataDir - } - } - if err = epc.procs[0].Restart(); err != nil { - t.Fatal(err) - } - - // ensure the restored member has the correct data - for i := range kvs { - if err = spawnWithExpect(append(prefixArgs, "get", kvs[i].key), kvs[i].val); err != nil { - t.Fatal(err) - } - } - - // add a new member into the cluster - clientURL := fmt.Sprintf("http://localhost:%d", etcdProcessBasePort+30) - peerURL := fmt.Sprintf("http://localhost:%d", etcdProcessBasePort+31) - err = spawnWithExpect(append(prefixArgs, "member", "add", "newmember", fmt.Sprintf("--peer-urls=%s", peerURL)), " added to cluster ") - if err != nil { - t.Fatal(err) - } - - var newDataDir2 string - newDataDir2, err = ioutil.TempDir("", "newdata2") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(newDataDir2) - - name2 := "infra2" - initialCluster2 := epc.procs[0].Config().initialCluster + fmt.Sprintf(",%s=%s", name2, peerURL) - - // start the new member - var nepc *expect.ExpectProcess - nepc, err = spawnCmd([]string{epc.procs[0].Config().execPath, "--name", name2, - "--listen-client-urls", clientURL, "--advertise-client-urls", clientURL, - "--listen-peer-urls", peerURL, "--initial-advertise-peer-urls", peerURL, - "--initial-cluster", initialCluster2, "--initial-cluster-state", "existing", "--data-dir", newDataDir2}) - if err != nil { - t.Fatal(err) - } - if _, err = nepc.Expect("enabled capabilities for version"); err != nil { - t.Fatal(err) - } - - prefixArgs = []string{ctlBinPath, "--endpoints", clientURL, "--dial-timeout", dialTimeout.String()} - - // ensure added member has data from incoming snapshot - for i := range kvs { - if err = spawnWithExpect(append(prefixArgs, "get", kvs[i].key), kvs[i].val); err != nil { - t.Fatal(err) - } - } - - if err = nepc.Stop(); err != nil { - t.Fatal(err) - } -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_txn_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_txn_test.go deleted file mode 100644 index 960e7c06b..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_txn_test.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import "testing" - -func TestCtlV3TxnInteractiveSuccess(t *testing.T) { - testCtl(t, txnTestSuccess, withInteractive()) -} -func TestCtlV3TxnInteractiveSuccessNoTLS(t *testing.T) { - testCtl(t, txnTestSuccess, withInteractive(), withCfg(configNoTLS)) -} -func TestCtlV3TxnInteractiveSuccessClientTLS(t *testing.T) { - testCtl(t, txnTestSuccess, withInteractive(), withCfg(configClientTLS)) -} -func TestCtlV3TxnInteractiveSuccessPeerTLS(t *testing.T) { - testCtl(t, txnTestSuccess, withInteractive(), withCfg(configPeerTLS)) -} -func TestCtlV3TxnInteractiveFail(t *testing.T) { - testCtl(t, txnTestFail, withInteractive()) -} - -func txnTestSuccess(cx ctlCtx) { - if err := ctlV3Put(cx, "key1", "value1", ""); err != nil { - cx.t.Fatalf("txnTestSuccess ctlV3Put error (%v)", err) - } - if err := ctlV3Put(cx, "key2", "value2", ""); err != nil { - cx.t.Fatalf("txnTestSuccess ctlV3Put error (%v)", err) - } - rqs := []txnRequests{ - { - compare: []string{`value("key1") != "value2"`, `value("key2") != "value1"`}, - ifSucess: []string{"get key1", "get key2"}, - results: []string{"SUCCESS", "key1", "value1", "key2", "value2"}, - }, - { - compare: []string{`version("key1") = "1"`, `version("key2") = "1"`}, - ifSucess: []string{"get key1", "get key2", `put "key \"with\" space" "value \x23"`}, - ifFail: []string{`put key1 "fail"`, `put key2 "fail"`}, - results: []string{"SUCCESS", "key1", "value1", "key2", "value2"}, - }, - { - compare: []string{`version("key \"with\" space") = "1"`}, - ifSucess: []string{`get "key \"with\" space"`}, - results: []string{"SUCCESS", `key "with" space`, "value \x23"}, - }, - } - for _, rq := range rqs { - if err := ctlV3Txn(cx, rq); err != nil { - cx.t.Fatal(err) - } - } -} - -func txnTestFail(cx ctlCtx) { - if err := ctlV3Put(cx, "key1", "value1", ""); err != nil { - cx.t.Fatalf("txnTestSuccess ctlV3Put error (%v)", err) - } - rqs := []txnRequests{ - { - compare: []string{`version("key") < "0"`}, - ifSucess: []string{`put key "success"`}, - ifFail: []string{`put key "fail"`}, - results: []string{"FAILURE", "OK"}, - }, - { - compare: []string{`value("key1") != "value1"`}, - ifSucess: []string{`put key1 "success"`}, - ifFail: []string{`put key1 "fail"`}, - results: []string{"FAILURE", "OK"}, - }, - } - for _, rq := range rqs { - if err := ctlV3Txn(cx, rq); err != nil { - cx.t.Fatal(err) - } - } -} - -type txnRequests struct { - compare []string - ifSucess []string - ifFail []string - results []string -} - -func ctlV3Txn(cx ctlCtx, rqs txnRequests) error { - // TODO: support non-interactive mode - cmdArgs := append(cx.PrefixArgs(), "txn") - if cx.interactive { - cmdArgs = append(cmdArgs, "--interactive") - } - proc, err := spawnCmd(cmdArgs) - if err != nil { - return err - } - _, err = proc.Expect("compares:") - if err != nil { - return err - } - for _, req := range rqs.compare { - if err = proc.Send(req + "\r"); err != nil { - return err - } - } - if err = proc.Send("\r"); err != nil { - return err - } - - _, err = proc.Expect("success requests (get, put, del):") - if err != nil { - return err - } - for _, req := range rqs.ifSucess { - if err = proc.Send(req + "\r"); err != nil { - return err - } - } - if err = proc.Send("\r"); err != nil { - return err - } - - _, err = proc.Expect("failure requests (get, put, del):") - if err != nil { - return err - } - for _, req := range rqs.ifFail { - if err = proc.Send(req + "\r"); err != nil { - return err - } - } - if err = proc.Send("\r"); err != nil { - return err - } - - for _, line := range rqs.results { - _, err = proc.Expect(line) - if err != nil { - return err - } - } - return proc.Close() -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_user_test.go b/vendor/github.com/coreos/etcd/e2e/ctl_v3_user_test.go deleted file mode 100644 index 392ab4e42..000000000 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_user_test.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import "testing" - -func TestCtlV3UserAdd(t *testing.T) { testCtl(t, userAddTest) } -func TestCtlV3UserAddNoTLS(t *testing.T) { testCtl(t, userAddTest, withCfg(configNoTLS)) } -func TestCtlV3UserAddClientTLS(t *testing.T) { testCtl(t, userAddTest, withCfg(configClientTLS)) } -func TestCtlV3UserAddPeerTLS(t *testing.T) { testCtl(t, userAddTest, withCfg(configPeerTLS)) } -func TestCtlV3UserAddTimeout(t *testing.T) { testCtl(t, userAddTest, withDialTimeout(0)) } - -func TestCtlV3UserDelete(t *testing.T) { testCtl(t, userDelTest) } -func TestCtlV3UserPasswd(t *testing.T) { testCtl(t, userPasswdTest) } - -type userCmdDesc struct { - args []string - expectedStr string - stdIn []string -} - -func userAddTest(cx ctlCtx) { - cmdSet := []userCmdDesc{ - // Adds a user name. - { - args: []string{"add", "username", "--interactive=false"}, - expectedStr: "User username created", - stdIn: []string{"password"}, - }, - // Adds a user name using the usertest:password syntax. - { - args: []string{"add", "usertest:password"}, - expectedStr: "User usertest created", - stdIn: []string{}, - }, - // Tries to add a user with empty username. - { - args: []string{"add", ":password"}, - expectedStr: "empty user name is not allowed.", - stdIn: []string{}, - }, - // Tries to add a user name that already exists. - { - args: []string{"add", "username", "--interactive=false"}, - expectedStr: "user name already exists", - stdIn: []string{"password"}, - }, - } - - for i, cmd := range cmdSet { - if err := ctlV3User(cx, cmd.args, cmd.expectedStr, cmd.stdIn); err != nil { - if cx.dialTimeout > 0 && !isGRPCTimedout(err) { - cx.t.Fatalf("userAddTest #%d: ctlV3User error (%v)", i, err) - } - } - } -} - -func userDelTest(cx ctlCtx) { - cmdSet := []userCmdDesc{ - // Adds a user name. - { - args: []string{"add", "username", "--interactive=false"}, - expectedStr: "User username created", - stdIn: []string{"password"}, - }, - // Deletes the user name just added. - { - args: []string{"delete", "username"}, - expectedStr: "User username deleted", - }, - // Deletes a user name that is not present. - { - args: []string{"delete", "username"}, - expectedStr: "user name not found", - }, - } - - for i, cmd := range cmdSet { - if err := ctlV3User(cx, cmd.args, cmd.expectedStr, cmd.stdIn); err != nil { - cx.t.Fatalf("userDelTest #%d: ctlV3User error (%v)", i, err) - } - } -} - -func userPasswdTest(cx ctlCtx) { - cmdSet := []userCmdDesc{ - // Adds a user name. - { - args: []string{"add", "username", "--interactive=false"}, - expectedStr: "User username created", - stdIn: []string{"password"}, - }, - // Changes the password. - { - args: []string{"passwd", "username", "--interactive=false"}, - expectedStr: "Password updated", - stdIn: []string{"password1"}, - }, - } - - for i, cmd := range cmdSet { - if err := ctlV3User(cx, cmd.args, cmd.expectedStr, cmd.stdIn); err != nil { - cx.t.Fatalf("userPasswdTest #%d: ctlV3User error (%v)", i, err) - } - } -} - -func ctlV3User(cx ctlCtx, args []string, expStr string, stdIn []string) error { - cmdArgs := append(cx.PrefixArgs(), "user") - cmdArgs = append(cmdArgs, args...) - - proc, err := spawnCmd(cmdArgs) - if err != nil { - return err - } - - // Send 'stdIn' strings as input. - for _, s := range stdIn { - if err = proc.Send(s + "\r"); err != nil { - return err - } - } - - _, err = proc.Expect(expStr) - return err -} diff --git a/vendor/github.com/coreos/etcd/e2e/etcd_config_test.go b/vendor/github.com/coreos/etcd/e2e/etcd_config_test.go deleted file mode 100644 index f36235f75..000000000 --- a/vendor/github.com/coreos/etcd/e2e/etcd_config_test.go +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "fmt" - "io/ioutil" - "os" - "strings" - "testing" - - "github.com/coreos/etcd/pkg/expect" -) - -const exampleConfigFile = "../etcd.conf.yml.sample" - -func TestEtcdExampleConfig(t *testing.T) { - proc, err := spawnCmd([]string{binDir + "/etcd", "--config-file", exampleConfigFile}) - if err != nil { - t.Fatal(err) - } - if err = waitReadyExpectProc(proc, etcdServerReadyLines); err != nil { - t.Fatal(err) - } - if err = proc.Stop(); err != nil { - t.Fatal(err) - } -} - -func TestEtcdMultiPeer(t *testing.T) { - peers, tmpdirs := make([]string, 3), make([]string, 3) - for i := range peers { - peers[i] = fmt.Sprintf("e%d=http://127.0.0.1:%d", i, etcdProcessBasePort+i) - d, err := ioutil.TempDir("", fmt.Sprintf("e%d.etcd", i)) - if err != nil { - t.Fatal(err) - } - tmpdirs[i] = d - } - ic := strings.Join(peers, ",") - - procs := make([]*expect.ExpectProcess, len(peers)) - defer func() { - for i := range procs { - if procs[i] != nil { - procs[i].Stop() - } - os.RemoveAll(tmpdirs[i]) - } - }() - for i := range procs { - args := []string{ - binDir + "/etcd", - "--name", fmt.Sprintf("e%d", i), - "--listen-client-urls", "http://0.0.0.0:0", - "--data-dir", tmpdirs[i], - "--advertise-client-urls", "http://0.0.0.0:0", - "--listen-peer-urls", fmt.Sprintf("http://127.0.0.1:%d,http://127.0.0.1:%d", etcdProcessBasePort+i, etcdProcessBasePort+len(peers)+i), - "--initial-advertise-peer-urls", fmt.Sprintf("http://127.0.0.1:%d", etcdProcessBasePort+i), - "--initial-cluster", ic, - } - p, err := spawnCmd(args) - if err != nil { - t.Fatal(err) - } - procs[i] = p - } - - for _, p := range procs { - if err := waitReadyExpectProc(p, etcdServerReadyLines); err != nil { - t.Fatal(err) - } - } -} - -// TestEtcdUnixPeers checks that etcd will boot with unix socket peers. -func TestEtcdUnixPeers(t *testing.T) { - d, err := ioutil.TempDir("", "e1.etcd") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(d) - proc, err := spawnCmd( - []string{ - binDir + "/etcd", - "--data-dir", d, - "--name", "e1", - "--listen-peer-urls", "unix://etcd.unix:1", - "--initial-advertise-peer-urls", "unix://etcd.unix:1", - "--initial-cluster", "e1=unix://etcd.unix:1", - }, - ) - defer os.Remove("etcd.unix:1") - if err != nil { - t.Fatal(err) - } - if err = waitReadyExpectProc(proc, etcdServerReadyLines); err != nil { - t.Fatal(err) - } - if err = proc.Stop(); err != nil { - t.Fatal(err) - } -} - -// TestEtcdPeerCNAuth checks that the inter peer auth based on CN of cert is working correctly. -func TestEtcdPeerCNAuth(t *testing.T) { - peers, tmpdirs := make([]string, 3), make([]string, 3) - for i := range peers { - peers[i] = fmt.Sprintf("e%d=https://127.0.0.1:%d", i, etcdProcessBasePort+i) - d, err := ioutil.TempDir("", fmt.Sprintf("e%d.etcd", i)) - if err != nil { - t.Fatal(err) - } - tmpdirs[i] = d - } - ic := strings.Join(peers, ",") - - procs := make([]*expect.ExpectProcess, len(peers)) - defer func() { - for i := range procs { - if procs[i] != nil { - procs[i].Stop() - } - os.RemoveAll(tmpdirs[i]) - } - }() - - // node 0 and 1 have a cert with the correct CN, node 2 doesn't - for i := range procs { - commonArgs := []string{ - binDir + "/etcd", - "--name", fmt.Sprintf("e%d", i), - "--listen-client-urls", "http://0.0.0.0:0", - "--data-dir", tmpdirs[i], - "--advertise-client-urls", "http://0.0.0.0:0", - "--listen-peer-urls", fmt.Sprintf("https://127.0.0.1:%d,https://127.0.0.1:%d", etcdProcessBasePort+i, etcdProcessBasePort+len(peers)+i), - "--initial-advertise-peer-urls", fmt.Sprintf("https://127.0.0.1:%d", etcdProcessBasePort+i), - "--initial-cluster", ic, - } - - var args []string - if i <= 1 { - args = []string{ - "--peer-cert-file", certPath, - "--peer-key-file", privateKeyPath, - "--peer-trusted-ca-file", caPath, - "--peer-client-cert-auth", - "--peer-cert-allowed-cn", "example.com", - } - } else { - args = []string{ - "--peer-cert-file", certPath2, - "--peer-key-file", privateKeyPath2, - "--peer-trusted-ca-file", caPath, - "--peer-client-cert-auth", - "--peer-cert-allowed-cn", "example2.com", - } - } - - commonArgs = append(commonArgs, args...) - - p, err := spawnCmd(commonArgs) - if err != nil { - t.Fatal(err) - } - procs[i] = p - } - - for i, p := range procs { - var expect []string - if i <= 1 { - expect = etcdServerReadyLines - } else { - expect = []string{"remote error: tls: bad certificate"} - } - if err := waitReadyExpectProc(p, expect); err != nil { - t.Fatal(err) - } - } -} diff --git a/vendor/github.com/coreos/etcd/e2e/etcd_corrupt_test.go b/vendor/github.com/coreos/etcd/e2e/etcd_corrupt_test.go deleted file mode 100644 index a2bbb4c42..000000000 --- a/vendor/github.com/coreos/etcd/e2e/etcd_corrupt_test.go +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2017 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "context" - "errors" - "fmt" - "os" - "path/filepath" - "testing" - "time" - - "github.com/coreos/etcd/clientv3" - "github.com/coreos/etcd/mvcc/mvccpb" - - bolt "github.com/coreos/bbolt" -) - -// TODO: test with embedded etcd in integration package - -func TestEtcdCorruptHash(t *testing.T) { - oldenv := os.Getenv("EXPECT_DEBUG") - defer os.Setenv("EXPECT_DEBUG", oldenv) - os.Setenv("EXPECT_DEBUG", "1") - - cfg := configNoTLS - - // trigger snapshot so that restart member can load peers from disk - cfg.snapCount = 3 - - testCtl(t, corruptTest, withQuorum(), - withCfg(cfg), - withInitialCorruptCheck(), - withCorruptFunc(corruptHash), - ) -} - -func corruptTest(cx ctlCtx) { - for i := 0; i < 10; i++ { - if err := ctlV3Put(cx, fmt.Sprintf("foo%05d", i), fmt.Sprintf("v%05d", i), ""); err != nil { - if cx.dialTimeout > 0 && !isGRPCTimedout(err) { - cx.t.Fatalf("putTest ctlV3Put error (%v)", err) - } - } - } - // enough time for all nodes sync on the same data - time.Sleep(3 * time.Second) - - eps := cx.epc.EndpointsV3() - cli1, err := clientv3.New(clientv3.Config{Endpoints: []string{eps[1]}, DialTimeout: 3 * time.Second}) - if err != nil { - cx.t.Fatal(err) - } - defer cli1.Close() - - sresp, err := cli1.Status(context.TODO(), eps[0]) - if err != nil { - cx.t.Fatal(err) - } - id0 := sresp.Header.GetMemberId() - - cx.epc.procs[0].Stop() - - // corrupt first member by modifying backend offline. - fp := filepath.Join(cx.epc.procs[0].Config().dataDirPath, "member", "snap", "db") - if err = cx.corruptFunc(fp); err != nil { - cx.t.Fatal(err) - } - - ep := cx.epc.procs[0] - proc, err := spawnCmd(append([]string{ep.Config().execPath}, ep.Config().args...)) - if err != nil { - cx.t.Fatal(err) - } - defer proc.Stop() - - // restarting corrupted member should fail - waitReadyExpectProc(proc, []string{fmt.Sprintf("etcdmain: %016x found data inconsistency with peers", id0)}) -} - -func corruptHash(fpath string) error { - db, derr := bolt.Open(fpath, os.ModePerm, &bolt.Options{}) - if derr != nil { - return derr - } - defer db.Close() - - return db.Update(func(tx *bolt.Tx) error { - b := tx.Bucket([]byte("key")) - if b == nil { - return errors.New("got nil bucket for 'key'") - } - keys, vals := [][]byte{}, [][]byte{} - c := b.Cursor() - for k, v := c.First(); k != nil; k, v = c.Next() { - keys = append(keys, k) - var kv mvccpb.KeyValue - if uerr := kv.Unmarshal(v); uerr != nil { - return uerr - } - kv.Key[0]++ - kv.Value[0]++ - v2, v2err := kv.Marshal() - if v2err != nil { - return v2err - } - vals = append(vals, v2) - } - for i := range keys { - if perr := b.Put(keys[i], vals[i]); perr != nil { - return perr - } - } - return nil - }) -} diff --git a/vendor/github.com/coreos/etcd/e2e/etcd_spawn_cov.go b/vendor/github.com/coreos/etcd/e2e/etcd_spawn_cov.go deleted file mode 100644 index cf67d3776..000000000 --- a/vendor/github.com/coreos/etcd/e2e/etcd_spawn_cov.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2017 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build cov - -package e2e - -import ( - "fmt" - "os" - "path/filepath" - "strings" - "syscall" - "time" - - "github.com/coreos/etcd/pkg/expect" - "github.com/coreos/etcd/pkg/fileutil" - "github.com/coreos/etcd/pkg/flags" -) - -const noOutputLineCount = 2 // cov-enabled binaries emit PASS and coverage count lines - -func spawnCmd(args []string) (*expect.ExpectProcess, error) { - if args[0] == binPath { - return spawnEtcd(args) - } - if args[0] == ctlBinPath || args[0] == ctlBinPath+"3" { - // avoid test flag conflicts in coverage enabled etcdctl by putting flags in ETCDCTL_ARGS - env := []string{ - // was \xff, but that's used for testing boundary conditions; 0xe7cd should be safe - "ETCDCTL_ARGS=" + strings.Join(args, "\xe7\xcd"), - } - if args[0] == ctlBinPath+"3" { - env = append(env, "ETCDCTL_API=3") - } - - covArgs, err := getCovArgs() - if err != nil { - return nil, err - } - // when withFlagByEnv() is used in testCtl(), env variables for ctl is set to os.env. - // they must be included in ctl_cov_env. - env = append(env, os.Environ()...) - ep, err := expect.NewExpectWithEnv(binDir+"/etcdctl_test", covArgs, env) - if err != nil { - return nil, err - } - ep.StopSignal = syscall.SIGTERM - return ep, nil - } - - return expect.NewExpect(args[0], args[1:]...) -} - -func spawnEtcd(args []string) (*expect.ExpectProcess, error) { - covArgs, err := getCovArgs() - if err != nil { - return nil, err - } - - var env []string - if args[1] == "grpc-proxy" { - // avoid test flag conflicts in coverage enabled etcd by putting flags in ETCDCOV_ARGS - env = append(os.Environ(), "ETCDCOV_ARGS="+strings.Join(args, "\xe7\xcd")) - } else { - env = args2env(args[1:]) - } - - ep, err := expect.NewExpectWithEnv(binDir+"/etcd_test", covArgs, env) - if err != nil { - return nil, err - } - // ep sends SIGTERM to etcd_test process on ep.close() - // allowing the process to exit gracefully in order to generate a coverage report. - // note: go runtime ignores SIGINT but not SIGTERM - // if e2e test is run as a background process. - ep.StopSignal = syscall.SIGTERM - return ep, nil -} - -func getCovArgs() ([]string, error) { - coverPath := os.Getenv("COVERDIR") - if !filepath.IsAbs(coverPath) { - // COVERDIR is relative to etcd root but e2e test has its path set to be relative to the e2e folder. - // adding ".." in front of COVERDIR ensures that e2e saves coverage reports to the correct location. - coverPath = filepath.Join("..", coverPath) - } - if !fileutil.Exist(coverPath) { - return nil, fmt.Errorf("could not find coverage folder") - } - covArgs := []string{ - fmt.Sprintf("-test.coverprofile=e2e.%v.coverprofile", time.Now().UnixNano()), - "-test.outputdir=" + coverPath, - } - return covArgs, nil -} - -func args2env(args []string) []string { - var covEnvs []string - for i := range args { - if !strings.HasPrefix(args[i], "--") { - continue - } - flag := strings.Split(args[i], "--")[1] - val := "true" - // split the flag that has "=" - // e.g --auto-tls=true" => flag=auto-tls and val=true - if strings.Contains(args[i], "=") { - split := strings.Split(flag, "=") - flag = split[0] - val = split[1] - } - - if i+1 < len(args) { - if !strings.HasPrefix(args[i+1], "--") { - val = args[i+1] - } - } - covEnvs = append(covEnvs, flags.FlagToEnv("ETCD", flag)+"="+val) - } - return covEnvs -} diff --git a/vendor/github.com/coreos/etcd/e2e/gateway_test.go b/vendor/github.com/coreos/etcd/e2e/gateway_test.go deleted file mode 100644 index 6539e6f84..000000000 --- a/vendor/github.com/coreos/etcd/e2e/gateway_test.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "os" - "strings" - "testing" - - "github.com/coreos/etcd/pkg/expect" -) - -var ( - defaultGatewayEndpoint = "127.0.0.1:23790" -) - -func TestGateway(t *testing.T) { - ec, err := newEtcdProcessCluster(&configNoTLS) - if err != nil { - t.Fatal(err) - } - defer ec.Stop() - - eps := strings.Join(ec.EndpointsV3(), ",") - - p := startGateway(t, eps) - defer p.Stop() - - os.Setenv("ETCDCTL_API", "3") - defer os.Unsetenv("ETCDCTL_API") - - err = spawnWithExpect([]string{ctlBinPath, "--endpoints=" + defaultGatewayEndpoint, "put", "foo", "bar"}, "OK\r\n") - if err != nil { - t.Errorf("failed to finish put request through gateway: %v", err) - } -} - -func startGateway(t *testing.T, endpoints string) *expect.ExpectProcess { - p, err := expect.NewExpect(binPath, "gateway", "--endpoints="+endpoints, "start") - if err != nil { - t.Fatal(err) - } - _, err = p.Expect("tcpproxy: ready to proxy client requests to") - if err != nil { - t.Fatal(err) - } - return p -} diff --git a/vendor/github.com/coreos/etcd/e2e/metrics_test.go b/vendor/github.com/coreos/etcd/e2e/metrics_test.go deleted file mode 100644 index 8c548c920..000000000 --- a/vendor/github.com/coreos/etcd/e2e/metrics_test.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2017 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "fmt" - "testing" - - "github.com/coreos/etcd/version" -) - -func TestV3MetricsSecure(t *testing.T) { - cfg := configTLS - cfg.clusterSize = 1 - cfg.metricsURLScheme = "https" - testCtl(t, metricsTest) -} - -func TestV3MetricsInsecure(t *testing.T) { - cfg := configTLS - cfg.clusterSize = 1 - cfg.metricsURLScheme = "http" - testCtl(t, metricsTest) -} - -func metricsTest(cx ctlCtx) { - if err := ctlV3Put(cx, "k", "v", ""); err != nil { - cx.t.Fatal(err) - } - if err := cURLGet(cx.epc, cURLReq{endpoint: "/metrics", expected: `etcd_debugging_mvcc_keys_total 1`, metricsURLScheme: cx.cfg.metricsURLScheme}); err != nil { - cx.t.Fatalf("failed get with curl (%v)", err) - } - if err := cURLGet(cx.epc, cURLReq{endpoint: "/metrics", expected: fmt.Sprintf(`etcd_server_version{server_version="%s"} 1`, version.Version), metricsURLScheme: cx.cfg.metricsURLScheme}); err != nil { - cx.t.Fatalf("failed get with curl (%v)", err) - } - if err := cURLGet(cx.epc, cURLReq{endpoint: "/health", expected: `{"health":"true"}`, metricsURLScheme: cx.cfg.metricsURLScheme}); err != nil { - cx.t.Fatalf("failed get with curl (%v)", err) - } -} diff --git a/vendor/github.com/coreos/etcd/e2e/v2_curl_test.go b/vendor/github.com/coreos/etcd/e2e/v2_curl_test.go deleted file mode 100644 index fa6a78c02..000000000 --- a/vendor/github.com/coreos/etcd/e2e/v2_curl_test.go +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "fmt" - "math/rand" - "strings" - "testing" - - "github.com/coreos/etcd/pkg/testutil" -) - -func TestV2CurlNoTLS(t *testing.T) { testCurlPutGet(t, &configNoTLS) } -func TestV2CurlAutoTLS(t *testing.T) { testCurlPutGet(t, &configAutoTLS) } -func TestV2CurlAllTLS(t *testing.T) { testCurlPutGet(t, &configTLS) } -func TestV2CurlPeerTLS(t *testing.T) { testCurlPutGet(t, &configPeerTLS) } -func TestV2CurlClientTLS(t *testing.T) { testCurlPutGet(t, &configClientTLS) } -func TestV2CurlClientBoth(t *testing.T) { testCurlPutGet(t, &configClientBoth) } -func testCurlPutGet(t *testing.T, cfg *etcdProcessClusterConfig) { - defer testutil.AfterTest(t) - - // test doesn't use quorum gets, so ensure there are no followers to avoid - // stale reads that will break the test - cfg = configStandalone(*cfg) - - epc, err := newEtcdProcessCluster(cfg) - if err != nil { - t.Fatalf("could not start etcd process cluster (%v)", err) - } - defer func() { - if err := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", err) - } - }() - - var ( - expectPut = `{"action":"set","node":{"key":"/foo","value":"bar","` - expectGet = `{"action":"get","node":{"key":"/foo","value":"bar","` - ) - if err := cURLPut(epc, cURLReq{endpoint: "/v2/keys/foo", value: "bar", expected: expectPut}); err != nil { - t.Fatalf("failed put with curl (%v)", err) - } - if err := cURLGet(epc, cURLReq{endpoint: "/v2/keys/foo", expected: expectGet}); err != nil { - t.Fatalf("failed get with curl (%v)", err) - } - if cfg.clientTLS == clientTLSAndNonTLS { - if err := cURLGet(epc, cURLReq{endpoint: "/v2/keys/foo", expected: expectGet, isTLS: true}); err != nil { - t.Fatalf("failed get with curl (%v)", err) - } - } -} - -func TestV2CurlIssue5182(t *testing.T) { - defer testutil.AfterTest(t) - - epc := setupEtcdctlTest(t, &configNoTLS, false) - defer func() { - if err := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", err) - } - }() - - expectPut := `{"action":"set","node":{"key":"/foo","value":"bar","` - if err := cURLPut(epc, cURLReq{endpoint: "/v2/keys/foo", value: "bar", expected: expectPut}); err != nil { - t.Fatal(err) - } - - expectUserAdd := `{"user":"foo","roles":null}` - if err := cURLPut(epc, cURLReq{endpoint: "/v2/auth/users/foo", value: `{"user":"foo", "password":"pass"}`, expected: expectUserAdd}); err != nil { - t.Fatal(err) - } - expectRoleAdd := `{"role":"foo","permissions":{"kv":{"read":["/foo/*"],"write":null}}` - if err := cURLPut(epc, cURLReq{endpoint: "/v2/auth/roles/foo", value: `{"role":"foo", "permissions": {"kv": {"read": ["/foo/*"]}}}`, expected: expectRoleAdd}); err != nil { - t.Fatal(err) - } - expectUserUpdate := `{"user":"foo","roles":["foo"]}` - if err := cURLPut(epc, cURLReq{endpoint: "/v2/auth/users/foo", value: `{"user": "foo", "grant": ["foo"]}`, expected: expectUserUpdate}); err != nil { - t.Fatal(err) - } - - if err := etcdctlUserAdd(epc, "root", "a"); err != nil { - t.Fatal(err) - } - if err := etcdctlAuthEnable(epc); err != nil { - t.Fatal(err) - } - - if err := cURLGet(epc, cURLReq{endpoint: "/v2/keys/foo/", username: "root", password: "a", expected: "bar"}); err != nil { - t.Fatal(err) - } - if err := cURLGet(epc, cURLReq{endpoint: "/v2/keys/foo/", username: "foo", password: "pass", expected: "bar"}); err != nil { - t.Fatal(err) - } - if err := cURLGet(epc, cURLReq{endpoint: "/v2/keys/foo/", username: "foo", password: "", expected: "bar"}); err != nil { - if !strings.Contains(err.Error(), `The request requires user authentication`) { - t.Fatalf("expected 'The request requires user authentication' error, got %v", err) - } - } else { - t.Fatalf("expected 'The request requires user authentication' error") - } -} - -type cURLReq struct { - username string - password string - - isTLS bool - timeout int - - endpoint string - - value string - expected string - header string - - metricsURLScheme string - - ciphers string -} - -// cURLPrefixArgs builds the beginning of a curl command for a given key -// addressed to a random URL in the given cluster. -func cURLPrefixArgs(clus *etcdProcessCluster, method string, req cURLReq) []string { - var ( - cmdArgs = []string{"curl"} - acurl = clus.procs[rand.Intn(clus.cfg.clusterSize)].Config().acurl - ) - if req.metricsURLScheme != "https" { - if req.isTLS { - if clus.cfg.clientTLS != clientTLSAndNonTLS { - panic("should not use cURLPrefixArgsUseTLS when serving only TLS or non-TLS") - } - cmdArgs = append(cmdArgs, "--cacert", caPath, "--cert", certPath, "--key", privateKeyPath) - acurl = toTLS(clus.procs[rand.Intn(clus.cfg.clusterSize)].Config().acurl) - } else if clus.cfg.clientTLS == clientTLS { - cmdArgs = append(cmdArgs, "--cacert", caPath, "--cert", certPath, "--key", privateKeyPath) - } - } - if req.metricsURLScheme != "" { - acurl = clus.procs[rand.Intn(clus.cfg.clusterSize)].EndpointsMetrics()[0] - } - ep := acurl + req.endpoint - - if req.username != "" || req.password != "" { - cmdArgs = append(cmdArgs, "-L", "-u", fmt.Sprintf("%s:%s", req.username, req.password), ep) - } else { - cmdArgs = append(cmdArgs, "-L", ep) - } - if req.timeout != 0 { - cmdArgs = append(cmdArgs, "-m", fmt.Sprintf("%d", req.timeout)) - } - - if req.header != "" { - cmdArgs = append(cmdArgs, "-H", req.header) - } - - if req.ciphers != "" { - cmdArgs = append(cmdArgs, "--ciphers", req.ciphers) - } - - switch method { - case "POST", "PUT": - dt := req.value - if !strings.HasPrefix(dt, "{") { // for non-JSON value - dt = "value=" + dt - } - cmdArgs = append(cmdArgs, "-X", method, "-d", dt) - } - return cmdArgs -} - -func cURLPost(clus *etcdProcessCluster, req cURLReq) error { - return spawnWithExpect(cURLPrefixArgs(clus, "POST", req), req.expected) -} - -func cURLPut(clus *etcdProcessCluster, req cURLReq) error { - return spawnWithExpect(cURLPrefixArgs(clus, "PUT", req), req.expected) -} - -func cURLGet(clus *etcdProcessCluster, req cURLReq) error { - return spawnWithExpect(cURLPrefixArgs(clus, "GET", req), req.expected) -} diff --git a/vendor/github.com/coreos/etcd/e2e/v3_curl_test.go b/vendor/github.com/coreos/etcd/e2e/v3_curl_test.go deleted file mode 100644 index 138553fb5..000000000 --- a/vendor/github.com/coreos/etcd/e2e/v3_curl_test.go +++ /dev/null @@ -1,436 +0,0 @@ -// Copyright 2016 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package e2e - -import ( - "encoding/base64" - "encoding/json" - "fmt" - "path" - "strconv" - "testing" - - epb "github.com/coreos/etcd/etcdserver/api/v3election/v3electionpb" - pb "github.com/coreos/etcd/etcdserver/etcdserverpb" - "github.com/coreos/etcd/pkg/testutil" - "github.com/coreos/etcd/version" - - "github.com/grpc-ecosystem/grpc-gateway/runtime" -) - -// TODO: remove /v3alpha tests in 3.4 release - -func TestV3CurlPutGetNoTLSAlpha(t *testing.T) { testCurlPutGetGRPCGateway(t, &configNoTLS, "/v3alpha") } -func TestV3CurlPutGetNoTLSBeta(t *testing.T) { testCurlPutGetGRPCGateway(t, &configNoTLS, "/v3beta") } -func TestV3CurlPutGetAutoTLSAlpha(t *testing.T) { - testCurlPutGetGRPCGateway(t, &configAutoTLS, "/v3alpha") -} -func TestV3CurlPutGetAutoTLSBeta(t *testing.T) { - testCurlPutGetGRPCGateway(t, &configAutoTLS, "/v3beta") -} -func TestV3CurlPutGetAllTLSAlpha(t *testing.T) { testCurlPutGetGRPCGateway(t, &configTLS, "/v3alpha") } -func TestV3CurlPutGetAllTLSBeta(t *testing.T) { testCurlPutGetGRPCGateway(t, &configTLS, "/v3beta") } -func TestV3CurlPutGetPeerTLSAlpha(t *testing.T) { - testCurlPutGetGRPCGateway(t, &configPeerTLS, "/v3alpha") -} -func TestV3CurlPutGetPeerTLSBeta(t *testing.T) { - testCurlPutGetGRPCGateway(t, &configPeerTLS, "/v3beta") -} -func TestV3CurlPutGetClientTLSAlpha(t *testing.T) { - testCurlPutGetGRPCGateway(t, &configClientTLS, "/v3alpha") -} -func TestV3CurlPutGetClientTLSBeta(t *testing.T) { - testCurlPutGetGRPCGateway(t, &configClientTLS, "/v3beta") -} -func testCurlPutGetGRPCGateway(t *testing.T, cfg *etcdProcessClusterConfig, pathPrefix string) { - defer testutil.AfterTest(t) - - epc, err := newEtcdProcessCluster(cfg) - if err != nil { - t.Fatalf("could not start etcd process cluster (%v)", err) - } - defer func() { - if cerr := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", cerr) - } - }() - - var ( - key = []byte("foo") - value = []byte("bar") // this will be automatically base64-encoded by Go - - expectPut = `"revision":"` - expectGet = `"value":"` - ) - putData, err := json.Marshal(&pb.PutRequest{ - Key: key, - Value: value, - }) - if err != nil { - t.Fatal(err) - } - rangeData, err := json.Marshal(&pb.RangeRequest{ - Key: key, - }) - if err != nil { - t.Fatal(err) - } - - if err := cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/kv/put"), value: string(putData), expected: expectPut}); err != nil { - t.Fatalf("failed put with curl (%v)", err) - } - if err := cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/kv/range"), value: string(rangeData), expected: expectGet}); err != nil { - t.Fatalf("failed get with curl (%v)", err) - } - - if cfg.clientTLS == clientTLSAndNonTLS { - if err := cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/kv/range"), value: string(rangeData), expected: expectGet, isTLS: true}); err != nil { - t.Fatalf("failed get with curl (%v)", err) - } - } -} - -func TestV3CurlWatchAlpha(t *testing.T) { testV3CurlWatch(t, "/v3alpha") } -func TestV3CurlWatchBeta(t *testing.T) { testV3CurlWatch(t, "/v3beta") } -func testV3CurlWatch(t *testing.T, pathPrefix string) { - defer testutil.AfterTest(t) - - epc, err := newEtcdProcessCluster(&configNoTLS) - if err != nil { - t.Fatalf("could not start etcd process cluster (%v)", err) - } - defer func() { - if cerr := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", cerr) - } - }() - - // store "bar" into "foo" - putreq, err := json.Marshal(&pb.PutRequest{Key: []byte("foo"), Value: []byte("bar")}) - if err != nil { - t.Fatal(err) - } - if err = cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/kv/put"), value: string(putreq), expected: "revision"}); err != nil { - t.Fatalf("failed put with curl (%v)", err) - } - // watch for first update to "foo" - wcr := &pb.WatchCreateRequest{Key: []byte("foo"), StartRevision: 1} - wreq, err := json.Marshal(wcr) - if err != nil { - t.Fatal(err) - } - // marshaling the grpc to json gives: - // "{"RequestUnion":{"CreateRequest":{"key":"Zm9v","start_revision":1}}}" - // but the gprc-gateway expects a different format.. - wstr := `{"create_request" : ` + string(wreq) + "}" - // expects "bar", timeout after 2 seconds since stream waits forever - if err = cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/watch"), value: wstr, expected: `"YmFy"`, timeout: 2}); err != nil { - t.Fatal(err) - } -} - -func TestV3CurlTxnAlpha(t *testing.T) { testV3CurlTxn(t, "/v3alpha") } -func TestV3CurlTxnBeta(t *testing.T) { testV3CurlTxn(t, "/v3beta") } -func testV3CurlTxn(t *testing.T, pathPrefix string) { - defer testutil.AfterTest(t) - epc, err := newEtcdProcessCluster(&configNoTLS) - if err != nil { - t.Fatalf("could not start etcd process cluster (%v)", err) - } - defer func() { - if cerr := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", cerr) - } - }() - - txn := &pb.TxnRequest{ - Compare: []*pb.Compare{ - { - Key: []byte("foo"), - Result: pb.Compare_EQUAL, - Target: pb.Compare_CREATE, - TargetUnion: &pb.Compare_CreateRevision{0}, - }, - }, - Success: []*pb.RequestOp{ - { - Request: &pb.RequestOp_RequestPut{ - RequestPut: &pb.PutRequest{ - Key: []byte("foo"), - Value: []byte("bar"), - }, - }, - }, - }, - } - m := &runtime.JSONPb{} - jsonDat, jerr := m.Marshal(txn) - if jerr != nil { - t.Fatal(jerr) - } - expected := `"succeeded":true,"responses":[{"response_put":{"header":{"revision":"2"}}}]` - if err = cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/kv/txn"), value: string(jsonDat), expected: expected}); err != nil { - t.Fatalf("failed txn with curl (%v)", err) - } - - // was crashing etcd server - malformed := `{"compare":[{"result":0,"target":1,"key":"Zm9v","TargetUnion":null}],"success":[{"Request":{"RequestPut":{"key":"Zm9v","value":"YmFy"}}}]}` - if err = cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/kv/txn"), value: malformed, expected: "error"}); err != nil { - t.Fatalf("failed put with curl (%v)", err) - } -} - -func TestV3CurlAuthAlpha(t *testing.T) { testV3CurlAuth(t, "/v3alpha") } -func TestV3CurlAuthBeta(t *testing.T) { testV3CurlAuth(t, "/v3beta") } -func testV3CurlAuth(t *testing.T, pathPrefix string) { - defer testutil.AfterTest(t) - epc, err := newEtcdProcessCluster(&configNoTLS) - if err != nil { - t.Fatalf("could not start etcd process cluster (%v)", err) - } - defer func() { - if cerr := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", cerr) - } - }() - - // create root user - userreq, err := json.Marshal(&pb.AuthUserAddRequest{Name: string("root"), Password: string("toor")}) - testutil.AssertNil(t, err) - - if err = cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/auth/user/add"), value: string(userreq), expected: "revision"}); err != nil { - t.Fatalf("failed add user with curl (%v)", err) - } - - // create root role - rolereq, err := json.Marshal(&pb.AuthRoleAddRequest{Name: string("root")}) - testutil.AssertNil(t, err) - - if err = cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/auth/role/add"), value: string(rolereq), expected: "revision"}); err != nil { - t.Fatalf("failed create role with curl (%v)", err) - } - - // grant root role - grantrolereq, err := json.Marshal(&pb.AuthUserGrantRoleRequest{User: string("root"), Role: string("root")}) - testutil.AssertNil(t, err) - - if err = cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/auth/user/grant"), value: string(grantrolereq), expected: "revision"}); err != nil { - t.Fatalf("failed grant role with curl (%v)", err) - } - - // enable auth - if err = cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/auth/enable"), value: string("{}"), expected: "revision"}); err != nil { - t.Fatalf("failed enable auth with curl (%v)", err) - } - - // put "bar" into "foo" - putreq, err := json.Marshal(&pb.PutRequest{Key: []byte("foo"), Value: []byte("bar")}) - testutil.AssertNil(t, err) - - // fail put no auth - if err = cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/kv/put"), value: string(putreq), expected: "error"}); err != nil { - t.Fatalf("failed no auth put with curl (%v)", err) - } - - // auth request - authreq, err := json.Marshal(&pb.AuthenticateRequest{Name: string("root"), Password: string("toor")}) - testutil.AssertNil(t, err) - - var ( - authHeader string - cmdArgs []string - lineFunc = func(txt string) bool { return true } - ) - - cmdArgs = cURLPrefixArgs(epc, "POST", cURLReq{endpoint: path.Join(pathPrefix, "/auth/authenticate"), value: string(authreq)}) - proc, err := spawnCmd(cmdArgs) - testutil.AssertNil(t, err) - - cURLRes, err := proc.ExpectFunc(lineFunc) - testutil.AssertNil(t, err) - - authRes := make(map[string]interface{}) - testutil.AssertNil(t, json.Unmarshal([]byte(cURLRes), &authRes)) - - token, ok := authRes["token"].(string) - if !ok { - t.Fatalf("failed invalid token in authenticate response with curl") - } - - authHeader = "Authorization : " + token - - // put with auth - if err = cURLPost(epc, cURLReq{endpoint: path.Join(pathPrefix, "/kv/put"), value: string(putreq), header: authHeader, expected: "revision"}); err != nil { - t.Fatalf("failed auth put with curl (%v)", err) - } -} - -func TestV3CurlCampaignAlpha(t *testing.T) { testV3CurlCampaign(t, "/v3alpha") } -func TestV3CurlCampaignBeta(t *testing.T) { testV3CurlCampaign(t, "/v3beta") } -func testV3CurlCampaign(t *testing.T, pathPrefix string) { - defer testutil.AfterTest(t) - - epc, err := newEtcdProcessCluster(&configNoTLS) - if err != nil { - t.Fatalf("could not start etcd process cluster (%v)", err) - } - defer func() { - if cerr := epc.Close(); err != nil { - t.Fatalf("error closing etcd processes (%v)", cerr) - } - }() - - cdata, err := json.Marshal(&epb.CampaignRequest{ - Name: []byte("/election-prefix"), - Value: []byte("v1"), - }) - if err != nil { - t.Fatal(err) - } - cargs := cURLPrefixArgs(epc, "POST", cURLReq{ - endpoint: path.Join(pathPrefix, "/election/campaign"), - value: string(cdata), - }) - lines, err := spawnWithExpectLines(cargs, `"leader":{"name":"`) - if err != nil { - t.Fatalf("failed post campaign request (%s) (%v)", pathPrefix, err) - } - if len(lines) != 1 { - t.Fatalf("len(lines) expected 1, got %+v", lines) - } - - var cresp campaignResponse - if err = json.Unmarshal([]byte(lines[0]), &cresp); err != nil { - t.Fatalf("failed to unmarshal campaign response %v", err) - } - ndata, err := base64.StdEncoding.DecodeString(cresp.Leader.Name) - if err != nil { - t.Fatalf("failed to decode leader key %v", err) - } - kdata, err := base64.StdEncoding.DecodeString(cresp.Leader.Key) - if err != nil { - t.Fatalf("failed to decode leader key %v", err) - } - - rev, _ := strconv.ParseInt(cresp.Leader.Rev, 10, 64) - lease, _ := strconv.ParseInt(cresp.Leader.Lease, 10, 64) - pdata, err := json.Marshal(&epb.ProclaimRequest{ - Leader: &epb.LeaderKey{ - Name: ndata, - Key: kdata, - Rev: rev, - Lease: lease, - }, - Value: []byte("v2"), - }) - if err != nil { - t.Fatal(err) - } - if err = cURLPost(epc, cURLReq{ - endpoint: path.Join(pathPrefix, "/election/proclaim"), - value: string(pdata), - expected: `"revision":`, - }); err != nil { - t.Fatalf("failed post proclaim request (%s) (%v)", pathPrefix, err) - } -} - -func TestV3CurlProclaimMissiongLeaderKeyNoTLS(t *testing.T) { - testCtl(t, testV3CurlProclaimMissiongLeaderKey, withCfg(configNoTLS)) -} - -func testV3CurlProclaimMissiongLeaderKey(cx ctlCtx) { - pdata, err := json.Marshal(&epb.ProclaimRequest{Value: []byte("v2")}) - if err != nil { - cx.t.Fatal(err) - } - if err != nil { - cx.t.Fatal(err) - } - if err = cURLPost(cx.epc, cURLReq{ - endpoint: path.Join("/v3beta", "/election/proclaim"), - value: string(pdata), - expected: `{"error":"\"leader\" field must be provided","code":2}`, - }); err != nil { - cx.t.Fatalf("failed post proclaim request (%s) (%v)", "/v3beta", err) - } -} - -func TestV3CurlResignMissiongLeaderKeyNoTLS(t *testing.T) { - testCtl(t, testV3CurlResignMissiongLeaderKey, withCfg(configNoTLS)) -} - -func testV3CurlResignMissiongLeaderKey(cx ctlCtx) { - if err := cURLPost(cx.epc, cURLReq{ - endpoint: path.Join("/v3beta", "/election/resign"), - value: `{}`, - expected: `{"error":"\"leader\" field must be provided","code":2}`, - }); err != nil { - cx.t.Fatalf("failed post resign request (%s) (%v)", "/v3beta", err) - } -} - -// to manually decode; JSON marshals integer fields with -// string types, so can't unmarshal with epb.CampaignResponse -type campaignResponse struct { - Leader struct { - Name string `json:"name,omitempty"` - Key string `json:"key,omitempty"` - Rev string `json:"rev,omitempty"` - Lease string `json:"lease,omitempty"` - } `json:"leader,omitempty"` -} - -func TestV3CurlCipherSuitesValid(t *testing.T) { testV3CurlCipherSuites(t, true) } -func TestV3CurlCipherSuitesMismatch(t *testing.T) { testV3CurlCipherSuites(t, false) } -func testV3CurlCipherSuites(t *testing.T, valid bool) { - cc := configClientTLS - cc.clusterSize = 1 - cc.cipherSuites = []string{ - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", - "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", - "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", - "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", - "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", - } - testFunc := cipherSuiteTestValid - if !valid { - testFunc = cipherSuiteTestMismatch - } - testCtl(t, testFunc, withCfg(cc)) -} - -func cipherSuiteTestValid(cx ctlCtx) { - if err := cURLGet(cx.epc, cURLReq{ - endpoint: "/metrics", - expected: fmt.Sprintf(`etcd_server_version{server_version="%s"} 1`, version.Version), - metricsURLScheme: cx.cfg.metricsURLScheme, - ciphers: "ECDHE-RSA-AES128-GCM-SHA256", // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - }); err != nil { - cx.t.Logf("failed get with curl (%v)", err) - } -} - -func cipherSuiteTestMismatch(cx ctlCtx) { - if err := cURLGet(cx.epc, cURLReq{ - endpoint: "/metrics", - expected: "alert handshake failure", - metricsURLScheme: cx.cfg.metricsURLScheme, - ciphers: "ECDHE-RSA-DES-CBC3-SHA", // TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA - }); err != nil { - cx.t.Logf("failed get with curl (%v)", err) - } -} diff --git a/vendor/github.com/coreos/etcd/embed/config.go b/vendor/github.com/coreos/etcd/embed/config.go index 835e051a7..f74ed4b27 100644 --- a/vendor/github.com/coreos/etcd/embed/config.go +++ b/vendor/github.com/coreos/etcd/embed/config.go @@ -36,9 +36,9 @@ import ( "github.com/coreos/etcd/pkg/types" "github.com/coreos/pkg/capnslog" - "github.com/ghodss/yaml" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" + "sigs.k8s.io/yaml" ) const ( diff --git a/vendor/github.com/coreos/etcd/embed/config_test.go b/vendor/github.com/coreos/etcd/embed/config_test.go index c5db04bcb..0a6961b28 100644 --- a/vendor/github.com/coreos/etcd/embed/config_test.go +++ b/vendor/github.com/coreos/etcd/embed/config_test.go @@ -23,7 +23,7 @@ import ( "github.com/coreos/etcd/pkg/transport" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" ) func TestConfigFileOtherFields(t *testing.T) { diff --git a/vendor/github.com/coreos/etcd/etcdctl/ctlv2/command/util.go b/vendor/github.com/coreos/etcd/etcdctl/ctlv2/command/util.go index e4719d77a..4f3d2df69 100644 --- a/vendor/github.com/coreos/etcd/etcdctl/ctlv2/command/util.go +++ b/vendor/github.com/coreos/etcd/etcdctl/ctlv2/command/util.go @@ -104,7 +104,7 @@ func getDomainDiscoveryFlagValue(c *cli.Context) ([]string, error) { // strip insecure connections ret := []string{} for _, ep := range eps { - if strings.HasPrefix("http://", ep) { + if strings.HasPrefix(ep, "http://") { fmt.Fprintf(os.Stderr, "ignoring discovered insecure endpoint %q\n", ep) continue } diff --git a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/ep_command.go b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/ep_command.go index 88f0199fe..a45e24053 100644 --- a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/ep_command.go +++ b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/ep_command.go @@ -76,9 +76,17 @@ func newEpHashKVCommand() *cobra.Command { return hc } +type epHealth struct { + Ep string `json:"endpoint"` + Health bool `json:"health"` + Took string `json:"took"` + Error string `json:"error,omitempty"` +} + // epHealthCommandFunc executes the "endpoint-health" command. func epHealthCommandFunc(cmd *cobra.Command, args []string) { flags.SetPflagsFromEnv("ETCDCTL", cmd.InheritedFlags()) + initDisplayFromCmd(cmd) sec := secureCfgFromCmd(cmd) dt := dialTimeoutFromCmd(cmd) @@ -95,7 +103,7 @@ func epHealthCommandFunc(cmd *cobra.Command, args []string) { } var wg sync.WaitGroup - errc := make(chan error, len(cfgs)) + hch := make(chan epHealth, len(cfgs)) for _, cfg := range cfgs { wg.Add(1) go func(cfg *v3.Config) { @@ -103,7 +111,7 @@ func epHealthCommandFunc(cmd *cobra.Command, args []string) { ep := cfg.Endpoints[0] cli, err := v3.New(*cfg) if err != nil { - errc <- fmt.Errorf("%s is unhealthy: failed to connect: %v", ep, err) + hch <- epHealth{Ep: ep, Health: false, Error: err.Error()} return } st := time.Now() @@ -112,25 +120,29 @@ func epHealthCommandFunc(cmd *cobra.Command, args []string) { ctx, cancel := commandCtx(cmd) _, err = cli.Get(ctx, "health") cancel() + eh := epHealth{Ep: ep, Health: false, Took: time.Since(st).String()} // permission denied is OK since proposal goes through consensus to get it if err == nil || err == rpctypes.ErrPermissionDenied { - fmt.Printf("%s is healthy: successfully committed proposal: took = %v\n", ep, time.Since(st)) + eh.Health = true } else { - errc <- fmt.Errorf("%s is unhealthy: failed to commit proposal: %v", ep, err) + eh.Error = err.Error() } + hch <- eh }(cfg) } wg.Wait() - close(errc) + close(hch) errs := false - for err := range errc { - if err != nil { + healthList := []epHealth{} + for h := range hch { + healthList = append(healthList, h) + if h.Error != "" { errs = true - fmt.Fprintln(os.Stderr, err) } } + display.EndpointHealth(healthList) if errs { ExitWithError(ExitError, fmt.Errorf("unhealthy cluster")) } diff --git a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/global.go b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/global.go index 6b2f05e3e..c20c940f0 100644 --- a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/global.go +++ b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/global.go @@ -402,7 +402,7 @@ func endpointsFromFlagValue(cmd *cobra.Command) ([]string, error) { // strip insecure connections ret := []string{} for _, ep := range eps { - if strings.HasPrefix("http://", ep) { + if strings.HasPrefix(ep, "http://") { fmt.Fprintf(os.Stderr, "ignoring discovered insecure endpoint %q\n", ep) continue } diff --git a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer.go b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer.go index b0c2d6cad..e9511eea8 100644 --- a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer.go +++ b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer.go @@ -43,6 +43,7 @@ type printer interface { MemberUpdate(id uint64, r v3.MemberUpdateResponse) MemberList(v3.MemberListResponse) + EndpointHealth([]epHealth) EndpointStatus([]epStatus) EndpointHashKV([]epHashKV) MoveLeader(leader, target uint64, r v3.MoveLeaderResponse) @@ -148,6 +149,7 @@ func newPrinterUnsupported(n string) printer { return &printerUnsupported{printerRPC{nil, f}} } +func (p *printerUnsupported) EndpointHealth([]epHealth) { p.p(nil) } func (p *printerUnsupported) EndpointStatus([]epStatus) { p.p(nil) } func (p *printerUnsupported) EndpointHashKV([]epHashKV) { p.p(nil) } func (p *printerUnsupported) DBStatus(dbstatus) { p.p(nil) } @@ -172,6 +174,19 @@ func makeMemberListTable(r v3.MemberListResponse) (hdr []string, rows [][]string return hdr, rows } +func makeEndpointHealthTable(healthList []epHealth) (hdr []string, rows [][]string) { + hdr = []string{"endpoint", "health", "took", "error"} + for _, h := range healthList { + rows = append(rows, []string{ + h.Ep, + fmt.Sprintf("%v", h.Health), + h.Took, + h.Error, + }) + } + return hdr, rows +} + func makeEndpointStatusTable(statusList []epStatus) (hdr []string, rows [][]string) { hdr = []string{"endpoint", "ID", "version", "db size", "is leader", "raft term", "raft index"} for _, status := range statusList { diff --git a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_fields.go b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_fields.go index 24ff283a8..16af312a1 100644 --- a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_fields.go +++ b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_fields.go @@ -140,6 +140,16 @@ func (p *fieldsPrinter) MemberList(r v3.MemberListResponse) { } } +func (p *fieldsPrinter) EndpointHealth(hs []epHealth) { + for _, h := range hs { + fmt.Printf("\"Endpoint\" : %q\n", h.Ep) + fmt.Println(`"Health" :`, h.Health) + fmt.Println(`"Took" :`, h.Took) + fmt.Println(`"Error" :`, h.Error) + fmt.Println() + } +} + func (p *fieldsPrinter) EndpointStatus(eps []epStatus) { for _, ep := range eps { p.hdr(ep.Resp.Header) diff --git a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_json.go b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_json.go index 19b3a5e68..500a57d23 100644 --- a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_json.go +++ b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_json.go @@ -28,6 +28,7 @@ func newJSONPrinter() printer { } } +func (p *jsonPrinter) EndpointHealth(r []epHealth) { printJSON(r) } func (p *jsonPrinter) EndpointStatus(r []epStatus) { printJSON(r) } func (p *jsonPrinter) EndpointHashKV(r []epHashKV) { printJSON(r) } func (p *jsonPrinter) DBStatus(r dbstatus) { printJSON(r) } diff --git a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_simple.go b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_simple.go index 2f4f53201..c5e6a0c6d 100644 --- a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_simple.go +++ b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_simple.go @@ -16,6 +16,7 @@ package command import ( "fmt" + "os" "strings" v3 "github.com/coreos/etcd/clientv3" @@ -141,6 +142,16 @@ func (s *simplePrinter) MemberList(resp v3.MemberListResponse) { } } +func (s *simplePrinter) EndpointHealth(hs []epHealth) { + for _, h := range hs { + if h.Error == "" { + fmt.Fprintf(os.Stderr, "%s is healthy: successfully committed proposal: took = %v\n", h.Ep, h.Took) + } else { + fmt.Fprintf(os.Stderr, "%s is unhealthy: failed to commit proposal: %v\n", h.Ep, h.Error) + } + } +} + func (s *simplePrinter) EndpointStatus(statusList []epStatus) { _, rows := makeEndpointStatusTable(statusList) for _, row := range rows { diff --git a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_table.go b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_table.go index 1aea61a84..8ca05dcf4 100644 --- a/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_table.go +++ b/vendor/github.com/coreos/etcd/etcdctl/ctlv3/command/printer_table.go @@ -34,6 +34,16 @@ func (tp *tablePrinter) MemberList(r v3.MemberListResponse) { table.SetAlignment(tablewriter.ALIGN_RIGHT) table.Render() } +func (tp *tablePrinter) EndpointHealth(r []epHealth) { + hdr, rows := makeEndpointHealthTable(r) + table := tablewriter.NewWriter(os.Stdout) + table.SetHeader(hdr) + for _, row := range rows { + table.Append(row) + } + table.SetAlignment(tablewriter.ALIGN_RIGHT) + table.Render() +} func (tp *tablePrinter) EndpointStatus(r []epStatus) { hdr, rows := makeEndpointStatusTable(r) table := tablewriter.NewWriter(os.Stdout) diff --git a/vendor/github.com/coreos/etcd/etcdmain/config.go b/vendor/github.com/coreos/etcd/etcdmain/config.go index 2a5faa746..99f015365 100644 --- a/vendor/github.com/coreos/etcd/etcdmain/config.go +++ b/vendor/github.com/coreos/etcd/etcdmain/config.go @@ -30,7 +30,7 @@ import ( "github.com/coreos/etcd/pkg/types" "github.com/coreos/etcd/version" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" ) var ( diff --git a/vendor/github.com/coreos/etcd/etcdmain/config_test.go b/vendor/github.com/coreos/etcd/etcdmain/config_test.go index 6ba7cd957..2f768fa4d 100644 --- a/vendor/github.com/coreos/etcd/etcdmain/config_test.go +++ b/vendor/github.com/coreos/etcd/etcdmain/config_test.go @@ -24,7 +24,7 @@ import ( "testing" "github.com/coreos/etcd/embed" - "github.com/ghodss/yaml" + "sigs.k8s.io/yaml" ) func TestConfigParsingMemberFlags(t *testing.T) { diff --git a/vendor/github.com/coreos/etcd/etcdmain/grpc_proxy.go b/vendor/github.com/coreos/etcd/etcdmain/grpc_proxy.go index 6a8e39feb..16246bc1e 100644 --- a/vendor/github.com/coreos/etcd/etcdmain/grpc_proxy.go +++ b/vendor/github.com/coreos/etcd/etcdmain/grpc_proxy.go @@ -16,6 +16,8 @@ package etcdmain import ( "context" + "crypto/tls" + "crypto/x509" "fmt" "io/ioutil" "math" @@ -30,7 +32,6 @@ import ( "github.com/coreos/etcd/clientv3/leasing" "github.com/coreos/etcd/clientv3/namespace" "github.com/coreos/etcd/clientv3/ordering" - "github.com/coreos/etcd/etcdserver/api/etcdhttp" "github.com/coreos/etcd/etcdserver/api/v3election/v3electionpb" "github.com/coreos/etcd/etcdserver/api/v3lock/v3lockpb" pb "github.com/coreos/etcd/etcdserver/etcdserverpb" @@ -110,7 +111,7 @@ func newGRPCProxyStartCommand() *cobra.Command { cmd.Flags().StringVar(&grpcProxyListenAddr, "listen-addr", "127.0.0.1:23790", "listen address") cmd.Flags().StringVar(&grpcProxyDNSCluster, "discovery-srv", "", "DNS domain used to bootstrap initial cluster") - cmd.Flags().StringVar(&grpcProxyMetricsListenAddr, "metrics-addr", "", "listen for /metrics requests on an additional interface") + cmd.Flags().StringVar(&grpcProxyMetricsListenAddr, "metrics-addr", "", "listen for endpoint /metrics requests on an additional interface") cmd.Flags().BoolVar(&grpcProxyInsecureDiscovery, "insecure-discovery", false, "accept insecure SRV records") cmd.Flags().StringSliceVar(&grpcProxyEndpoints, "endpoints", []string{"127.0.0.1:2379"}, "comma separated etcd cluster endpoints") cmd.Flags().StringVar(&grpcProxyAdvertiseClientURL, "advertise-client-url", "127.0.0.1:23790", "advertise address to register (must be reachable by client)") @@ -180,6 +181,7 @@ func startGRPCProxy(cmd *cobra.Command, args []string) { }() client := mustNewClient() + httpClient := mustNewHTTPClient() srvhttp, httpl := mustHTTPListener(m, tlsinfo, client) errc := make(chan error) @@ -190,7 +192,7 @@ func startGRPCProxy(cmd *cobra.Command, args []string) { mhttpl := mustMetricsListener(tlsinfo) go func() { mux := http.NewServeMux() - etcdhttp.HandlePrometheus(mux) + grpcproxy.HandleMetrics(mux, httpClient, client.Endpoints()) grpcproxy.HandleHealth(mux, client) plog.Fatal(http.Serve(mhttpl, mux)) }() @@ -352,16 +354,14 @@ func newGRPCProxyServer(client *clientv3.Client) *grpc.Server { v3electionpb.RegisterElectionServer(server, electionp) v3lockpb.RegisterLockServer(server, lockp) - // set zero values for metrics registered for this grpc server - grpc_prometheus.Register(server) - return server } func mustHTTPListener(m cmux.CMux, tlsinfo *transport.TLSInfo, c *clientv3.Client) (*http.Server, net.Listener) { + httpClient := mustNewHTTPClient() httpmux := http.NewServeMux() httpmux.HandleFunc("/", http.NotFound) - etcdhttp.HandlePrometheus(httpmux) + grpcproxy.HandleMetrics(httpmux, httpClient, c.Endpoints()) grpcproxy.HandleHealth(httpmux, c) if grpcProxyEnablePprof { for p, h := range debugutil.PProfHandlers() { @@ -383,6 +383,43 @@ func mustHTTPListener(m cmux.CMux, tlsinfo *transport.TLSInfo, c *clientv3.Clien return srvhttp, m.Match(cmux.Any()) } +func mustNewHTTPClient() *http.Client { + transport, err := newHTTPTransport(grpcProxyCA, grpcProxyCert, grpcProxyKey) + if err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } + return &http.Client{Transport: transport} +} + +func newHTTPTransport(ca, cert, key string) (*http.Transport, error) { + tr := &http.Transport{} + + if ca != "" && cert != "" && key != "" { + caCert, err := ioutil.ReadFile(ca) + if err != nil { + return nil, err + } + keyPair, err := tls.LoadX509KeyPair(cert, key) + if err != nil { + return nil, err + } + caPool := x509.NewCertPool() + caPool.AppendCertsFromPEM(caCert) + + tlsConfig := &tls.Config{ + Certificates: []tls.Certificate{keyPair}, + RootCAs: caPool, + } + tlsConfig.BuildNameToCertificate() + tr.TLSClientConfig = tlsConfig + } else if grpcProxyInsecureSkipTLSVerify { + tlsConfig := &tls.Config{InsecureSkipVerify: grpcProxyInsecureSkipTLSVerify} + tr.TLSClientConfig = tlsConfig + } + return tr, nil +} + func mustMetricsListener(tlsinfo *transport.TLSInfo) net.Listener { murl, err := url.Parse(grpcProxyMetricsListenAddr) if err != nil { diff --git a/vendor/github.com/coreos/etcd/etcdserver/api/etcdhttp/metrics.go b/vendor/github.com/coreos/etcd/etcdserver/api/etcdhttp/metrics.go index aeaf350ef..e947abfdd 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/api/etcdhttp/metrics.go +++ b/vendor/github.com/coreos/etcd/etcdserver/api/etcdhttp/metrics.go @@ -29,19 +29,19 @@ import ( ) const ( - pathMetrics = "/metrics" + PathMetrics = "/metrics" PathHealth = "/health" ) // HandleMetricsHealth registers metrics and health handlers. func HandleMetricsHealth(mux *http.ServeMux, srv etcdserver.ServerV2) { - mux.Handle(pathMetrics, promhttp.Handler()) + mux.Handle(PathMetrics, promhttp.Handler()) mux.Handle(PathHealth, NewHealthHandler(func() Health { return checkHealth(srv) })) } // HandlePrometheus registers prometheus handler on '/metrics'. func HandlePrometheus(mux *http.ServeMux) { - mux.Handle(pathMetrics, promhttp.Handler()) + mux.Handle(PathMetrics, promhttp.Handler()) } // NewHealthHandler handles '/health' requests. diff --git a/vendor/github.com/coreos/etcd/etcdserver/api/v3election/v3electionpb/v3election.pb.go b/vendor/github.com/coreos/etcd/etcdserver/api/v3election/v3electionpb/v3election.pb.go index e298e4521..a31b04c84 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/api/v3election/v3electionpb/v3election.pb.go +++ b/vendor/github.com/coreos/etcd/etcdserver/api/v3election/v3electionpb/v3election.pb.go @@ -1,43 +1,23 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: v3election.proto -/* - Package v3electionpb is a generated protocol buffer package. - - It is generated from these files: - v3election.proto - - It has these top-level messages: - CampaignRequest - CampaignResponse - LeaderKey - LeaderRequest - LeaderResponse - ResignRequest - ResignResponse - ProclaimRequest - ProclaimResponse -*/ package v3electionpb import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - + context "context" + fmt "fmt" + io "io" math "math" - - _ "github.com/gogo/protobuf/gogoproto" + math_bits "math/bits" etcdserverpb "github.com/coreos/etcd/etcdserver/etcdserverpb" - mvccpb "github.com/coreos/etcd/mvcc/mvccpb" - - context "golang.org/x/net/context" - + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" - - io "io" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" ) // Reference imports to suppress errors if they are not otherwise used. @@ -60,13 +40,44 @@ type CampaignRequest struct { Lease int64 `protobuf:"varint,2,opt,name=lease,proto3" json:"lease,omitempty"` // value is the initial proclaimed value set when the campaigner wins the // election. - Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CampaignRequest) Reset() { *m = CampaignRequest{} } +func (m *CampaignRequest) String() string { return proto.CompactTextString(m) } +func (*CampaignRequest) ProtoMessage() {} +func (*CampaignRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c9b1f26cc432a035, []int{0} +} +func (m *CampaignRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CampaignRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CampaignRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CampaignRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CampaignRequest.Merge(m, src) +} +func (m *CampaignRequest) XXX_Size() int { + return m.Size() +} +func (m *CampaignRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CampaignRequest.DiscardUnknown(m) } -func (m *CampaignRequest) Reset() { *m = CampaignRequest{} } -func (m *CampaignRequest) String() string { return proto.CompactTextString(m) } -func (*CampaignRequest) ProtoMessage() {} -func (*CampaignRequest) Descriptor() ([]byte, []int) { return fileDescriptorV3Election, []int{0} } +var xxx_messageInfo_CampaignRequest proto.InternalMessageInfo func (m *CampaignRequest) GetName() []byte { if m != nil { @@ -90,15 +101,46 @@ func (m *CampaignRequest) GetValue() []byte { } type CampaignResponse struct { - Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // leader describes the resources used for holding leadereship of the election. - Leader *LeaderKey `protobuf:"bytes,2,opt,name=leader" json:"leader,omitempty"` + Leader *LeaderKey `protobuf:"bytes,2,opt,name=leader,proto3" json:"leader,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CampaignResponse) Reset() { *m = CampaignResponse{} } +func (m *CampaignResponse) String() string { return proto.CompactTextString(m) } +func (*CampaignResponse) ProtoMessage() {} +func (*CampaignResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c9b1f26cc432a035, []int{1} +} +func (m *CampaignResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CampaignResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CampaignResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CampaignResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CampaignResponse.Merge(m, src) +} +func (m *CampaignResponse) XXX_Size() int { + return m.Size() +} +func (m *CampaignResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CampaignResponse.DiscardUnknown(m) } -func (m *CampaignResponse) Reset() { *m = CampaignResponse{} } -func (m *CampaignResponse) String() string { return proto.CompactTextString(m) } -func (*CampaignResponse) ProtoMessage() {} -func (*CampaignResponse) Descriptor() ([]byte, []int) { return fileDescriptorV3Election, []int{1} } +var xxx_messageInfo_CampaignResponse proto.InternalMessageInfo func (m *CampaignResponse) GetHeader() *etcdserverpb.ResponseHeader { if m != nil { @@ -125,13 +167,44 @@ type LeaderKey struct { // matches rev. Rev int64 `protobuf:"varint,3,opt,name=rev,proto3" json:"rev,omitempty"` // lease is the lease ID of the election leader. - Lease int64 `protobuf:"varint,4,opt,name=lease,proto3" json:"lease,omitempty"` + Lease int64 `protobuf:"varint,4,opt,name=lease,proto3" json:"lease,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaderKey) Reset() { *m = LeaderKey{} } +func (m *LeaderKey) String() string { return proto.CompactTextString(m) } +func (*LeaderKey) ProtoMessage() {} +func (*LeaderKey) Descriptor() ([]byte, []int) { + return fileDescriptor_c9b1f26cc432a035, []int{2} +} +func (m *LeaderKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaderKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaderKey.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaderKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaderKey.Merge(m, src) +} +func (m *LeaderKey) XXX_Size() int { + return m.Size() +} +func (m *LeaderKey) XXX_DiscardUnknown() { + xxx_messageInfo_LeaderKey.DiscardUnknown(m) } -func (m *LeaderKey) Reset() { *m = LeaderKey{} } -func (m *LeaderKey) String() string { return proto.CompactTextString(m) } -func (*LeaderKey) ProtoMessage() {} -func (*LeaderKey) Descriptor() ([]byte, []int) { return fileDescriptorV3Election, []int{2} } +var xxx_messageInfo_LeaderKey proto.InternalMessageInfo func (m *LeaderKey) GetName() []byte { if m != nil { @@ -163,13 +236,44 @@ func (m *LeaderKey) GetLease() int64 { type LeaderRequest struct { // name is the election identifier for the leadership information. - Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaderRequest) Reset() { *m = LeaderRequest{} } +func (m *LeaderRequest) String() string { return proto.CompactTextString(m) } +func (*LeaderRequest) ProtoMessage() {} +func (*LeaderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c9b1f26cc432a035, []int{3} +} +func (m *LeaderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaderRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaderRequest.Merge(m, src) +} +func (m *LeaderRequest) XXX_Size() int { + return m.Size() +} +func (m *LeaderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LeaderRequest.DiscardUnknown(m) } -func (m *LeaderRequest) Reset() { *m = LeaderRequest{} } -func (m *LeaderRequest) String() string { return proto.CompactTextString(m) } -func (*LeaderRequest) ProtoMessage() {} -func (*LeaderRequest) Descriptor() ([]byte, []int) { return fileDescriptorV3Election, []int{3} } +var xxx_messageInfo_LeaderRequest proto.InternalMessageInfo func (m *LeaderRequest) GetName() []byte { if m != nil { @@ -179,15 +283,46 @@ func (m *LeaderRequest) GetName() []byte { } type LeaderResponse struct { - Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // kv is the key-value pair representing the latest leader update. - Kv *mvccpb.KeyValue `protobuf:"bytes,2,opt,name=kv" json:"kv,omitempty"` + Kv *mvccpb.KeyValue `protobuf:"bytes,2,opt,name=kv,proto3" json:"kv,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaderResponse) Reset() { *m = LeaderResponse{} } +func (m *LeaderResponse) String() string { return proto.CompactTextString(m) } +func (*LeaderResponse) ProtoMessage() {} +func (*LeaderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c9b1f26cc432a035, []int{4} +} +func (m *LeaderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaderResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaderResponse.Merge(m, src) +} +func (m *LeaderResponse) XXX_Size() int { + return m.Size() +} +func (m *LeaderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LeaderResponse.DiscardUnknown(m) } -func (m *LeaderResponse) Reset() { *m = LeaderResponse{} } -func (m *LeaderResponse) String() string { return proto.CompactTextString(m) } -func (*LeaderResponse) ProtoMessage() {} -func (*LeaderResponse) Descriptor() ([]byte, []int) { return fileDescriptorV3Election, []int{4} } +var xxx_messageInfo_LeaderResponse proto.InternalMessageInfo func (m *LeaderResponse) GetHeader() *etcdserverpb.ResponseHeader { if m != nil { @@ -205,13 +340,44 @@ func (m *LeaderResponse) GetKv() *mvccpb.KeyValue { type ResignRequest struct { // leader is the leadership to relinquish by resignation. - Leader *LeaderKey `protobuf:"bytes,1,opt,name=leader" json:"leader,omitempty"` + Leader *LeaderKey `protobuf:"bytes,1,opt,name=leader,proto3" json:"leader,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResignRequest) Reset() { *m = ResignRequest{} } +func (m *ResignRequest) String() string { return proto.CompactTextString(m) } +func (*ResignRequest) ProtoMessage() {} +func (*ResignRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c9b1f26cc432a035, []int{5} +} +func (m *ResignRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResignRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResignRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResignRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResignRequest.Merge(m, src) +} +func (m *ResignRequest) XXX_Size() int { + return m.Size() +} +func (m *ResignRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ResignRequest.DiscardUnknown(m) } -func (m *ResignRequest) Reset() { *m = ResignRequest{} } -func (m *ResignRequest) String() string { return proto.CompactTextString(m) } -func (*ResignRequest) ProtoMessage() {} -func (*ResignRequest) Descriptor() ([]byte, []int) { return fileDescriptorV3Election, []int{5} } +var xxx_messageInfo_ResignRequest proto.InternalMessageInfo func (m *ResignRequest) GetLeader() *LeaderKey { if m != nil { @@ -221,13 +387,44 @@ func (m *ResignRequest) GetLeader() *LeaderKey { } type ResignResponse struct { - Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResignResponse) Reset() { *m = ResignResponse{} } +func (m *ResignResponse) String() string { return proto.CompactTextString(m) } +func (*ResignResponse) ProtoMessage() {} +func (*ResignResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c9b1f26cc432a035, []int{6} +} +func (m *ResignResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResignResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResignResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResignResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResignResponse.Merge(m, src) +} +func (m *ResignResponse) XXX_Size() int { + return m.Size() +} +func (m *ResignResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ResignResponse.DiscardUnknown(m) } -func (m *ResignResponse) Reset() { *m = ResignResponse{} } -func (m *ResignResponse) String() string { return proto.CompactTextString(m) } -func (*ResignResponse) ProtoMessage() {} -func (*ResignResponse) Descriptor() ([]byte, []int) { return fileDescriptorV3Election, []int{6} } +var xxx_messageInfo_ResignResponse proto.InternalMessageInfo func (m *ResignResponse) GetHeader() *etcdserverpb.ResponseHeader { if m != nil { @@ -238,15 +435,46 @@ func (m *ResignResponse) GetHeader() *etcdserverpb.ResponseHeader { type ProclaimRequest struct { // leader is the leadership hold on the election. - Leader *LeaderKey `protobuf:"bytes,1,opt,name=leader" json:"leader,omitempty"` + Leader *LeaderKey `protobuf:"bytes,1,opt,name=leader,proto3" json:"leader,omitempty"` // value is an update meant to overwrite the leader's current value. - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProclaimRequest) Reset() { *m = ProclaimRequest{} } +func (m *ProclaimRequest) String() string { return proto.CompactTextString(m) } +func (*ProclaimRequest) ProtoMessage() {} +func (*ProclaimRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c9b1f26cc432a035, []int{7} +} +func (m *ProclaimRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProclaimRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProclaimRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProclaimRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProclaimRequest.Merge(m, src) +} +func (m *ProclaimRequest) XXX_Size() int { + return m.Size() +} +func (m *ProclaimRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ProclaimRequest.DiscardUnknown(m) } -func (m *ProclaimRequest) Reset() { *m = ProclaimRequest{} } -func (m *ProclaimRequest) String() string { return proto.CompactTextString(m) } -func (*ProclaimRequest) ProtoMessage() {} -func (*ProclaimRequest) Descriptor() ([]byte, []int) { return fileDescriptorV3Election, []int{7} } +var xxx_messageInfo_ProclaimRequest proto.InternalMessageInfo func (m *ProclaimRequest) GetLeader() *LeaderKey { if m != nil { @@ -263,13 +491,44 @@ func (m *ProclaimRequest) GetValue() []byte { } type ProclaimResponse struct { - Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProclaimResponse) Reset() { *m = ProclaimResponse{} } +func (m *ProclaimResponse) String() string { return proto.CompactTextString(m) } +func (*ProclaimResponse) ProtoMessage() {} +func (*ProclaimResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c9b1f26cc432a035, []int{8} +} +func (m *ProclaimResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProclaimResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProclaimResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProclaimResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProclaimResponse.Merge(m, src) +} +func (m *ProclaimResponse) XXX_Size() int { + return m.Size() +} +func (m *ProclaimResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ProclaimResponse.DiscardUnknown(m) } -func (m *ProclaimResponse) Reset() { *m = ProclaimResponse{} } -func (m *ProclaimResponse) String() string { return proto.CompactTextString(m) } -func (*ProclaimResponse) ProtoMessage() {} -func (*ProclaimResponse) Descriptor() ([]byte, []int) { return fileDescriptorV3Election, []int{8} } +var xxx_messageInfo_ProclaimResponse proto.InternalMessageInfo func (m *ProclaimResponse) GetHeader() *etcdserverpb.ResponseHeader { if m != nil { @@ -290,6 +549,46 @@ func init() { proto.RegisterType((*ProclaimResponse)(nil), "v3electionpb.ProclaimResponse") } +func init() { proto.RegisterFile("v3election.proto", fileDescriptor_c9b1f26cc432a035) } + +var fileDescriptor_c9b1f26cc432a035 = []byte{ + // 538 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x65, 0x9d, 0x10, 0xca, 0x90, 0xb6, 0x96, 0x55, 0xa9, 0x69, 0x48, 0xad, 0x68, 0x8b, 0x50, + 0x95, 0x83, 0x17, 0x35, 0x9c, 0x72, 0x42, 0x20, 0x50, 0xa5, 0x22, 0x01, 0x3e, 0x20, 0x38, 0xae, + 0xdd, 0x91, 0x1b, 0xc5, 0xf1, 0x1a, 0xdb, 0xb5, 0x94, 0x2b, 0xbf, 0xc0, 0x85, 0x7f, 0xe0, 0x47, + 0x38, 0x22, 0xf1, 0x03, 0x28, 0xf0, 0x21, 0x68, 0x77, 0x6d, 0xec, 0xb8, 0x21, 0x42, 0xe4, 0x62, + 0x8d, 0x67, 0x9e, 0xe7, 0xcd, 0x7b, 0x3b, 0x6b, 0x30, 0xf3, 0x31, 0x86, 0xe8, 0x67, 0x53, 0x11, + 0x39, 0x71, 0x22, 0x32, 0x61, 0x75, 0xab, 0x4c, 0xec, 0xf5, 0x0f, 0x02, 0x11, 0x08, 0x55, 0x60, + 0x32, 0xd2, 0x98, 0xfe, 0x43, 0xcc, 0xfc, 0x4b, 0x26, 0x1f, 0x29, 0x26, 0x39, 0x26, 0xb5, 0x30, + 0xf6, 0x58, 0x12, 0xfb, 0x05, 0xee, 0x48, 0xe1, 0xe6, 0xb9, 0xef, 0xab, 0x47, 0xec, 0xb1, 0x59, + 0x5e, 0x94, 0x06, 0x81, 0x10, 0x41, 0x88, 0x8c, 0xc7, 0x53, 0xc6, 0xa3, 0x48, 0x64, 0x5c, 0x32, + 0xa6, 0xba, 0x4a, 0xdf, 0xc0, 0xfe, 0x33, 0x3e, 0x8f, 0xf9, 0x34, 0x88, 0x5c, 0xfc, 0x70, 0x8d, + 0x69, 0x66, 0x59, 0xd0, 0x8e, 0xf8, 0x1c, 0x7b, 0x64, 0x48, 0x4e, 0xbb, 0xae, 0x8a, 0xad, 0x03, + 0xb8, 0x1d, 0x22, 0x4f, 0xb1, 0x67, 0x0c, 0xc9, 0x69, 0xcb, 0xd5, 0x2f, 0x32, 0x9b, 0xf3, 0xf0, + 0x1a, 0x7b, 0x2d, 0x05, 0xd5, 0x2f, 0x74, 0x01, 0x66, 0xd5, 0x32, 0x8d, 0x45, 0x94, 0xa2, 0xf5, + 0x18, 0x3a, 0x57, 0xc8, 0x2f, 0x31, 0x51, 0x5d, 0xef, 0x9d, 0x0d, 0x9c, 0xba, 0x10, 0xa7, 0xc4, + 0x9d, 0x2b, 0x8c, 0x5b, 0x60, 0x2d, 0x06, 0x9d, 0x50, 0x7f, 0x65, 0xa8, 0xaf, 0x0e, 0x9d, 0xba, + 0x65, 0xce, 0x4b, 0x55, 0xbb, 0xc0, 0x85, 0x5b, 0xc0, 0xe8, 0x7b, 0xb8, 0xfb, 0x27, 0xb9, 0x56, + 0x87, 0x09, 0xad, 0x19, 0x2e, 0x54, 0xbb, 0xae, 0x2b, 0x43, 0x99, 0x49, 0x30, 0x57, 0x0a, 0x5a, + 0xae, 0x0c, 0x2b, 0xad, 0xed, 0x9a, 0x56, 0x7a, 0x02, 0xbb, 0xba, 0xf5, 0x06, 0x9b, 0xe8, 0x15, + 0xec, 0x95, 0xa0, 0xad, 0x84, 0x0f, 0xc1, 0x98, 0xe5, 0x85, 0x68, 0xd3, 0xd1, 0x27, 0xea, 0x5c, + 0xe0, 0xe2, 0xad, 0x34, 0xd8, 0x35, 0x66, 0x39, 0x7d, 0x02, 0xbb, 0x2e, 0xa6, 0xb5, 0x53, 0xab, + 0xbc, 0x22, 0xff, 0xe6, 0xd5, 0x0b, 0xd8, 0x2b, 0x3b, 0x6c, 0x33, 0x2b, 0x7d, 0x07, 0xfb, 0xaf, + 0x13, 0xe1, 0x87, 0x7c, 0x3a, 0xff, 0xdf, 0x59, 0xaa, 0x45, 0x32, 0xea, 0x8b, 0x74, 0x0e, 0x66, + 0xd5, 0x79, 0x9b, 0x19, 0xcf, 0xbe, 0xb4, 0x61, 0xe7, 0x79, 0x31, 0x80, 0x25, 0x60, 0xa7, 0xdc, + 0x4f, 0xeb, 0x78, 0x75, 0xb2, 0xc6, 0x55, 0xe8, 0xdb, 0x7f, 0x2b, 0x6b, 0x16, 0xfa, 0xe0, 0xe3, + 0xf7, 0x5f, 0x9f, 0x0c, 0x9b, 0x1e, 0xb1, 0x7c, 0xec, 0x61, 0xc6, 0x59, 0x09, 0x66, 0x7e, 0x01, + 0x9d, 0x90, 0x91, 0x24, 0x2c, 0x75, 0x34, 0x09, 0x1b, 0xce, 0x35, 0x09, 0x9b, 0xf2, 0x37, 0x10, + 0xc6, 0x05, 0x54, 0x12, 0x06, 0xd0, 0xd1, 0x1e, 0x5b, 0xf7, 0xd7, 0x39, 0x5f, 0x92, 0x0d, 0xd6, + 0x17, 0x0b, 0x2a, 0xaa, 0xa8, 0x06, 0xf4, 0xf0, 0x06, 0x95, 0x3e, 0x34, 0x49, 0x34, 0x83, 0x3b, + 0xaf, 0x3c, 0x65, 0xfe, 0x36, 0x4c, 0x27, 0x8a, 0xe9, 0x98, 0xf6, 0x6e, 0x30, 0x09, 0xdd, 0x7c, + 0x42, 0x46, 0x8f, 0x88, 0x54, 0xa5, 0x17, 0xb6, 0xc9, 0xb5, 0x72, 0x11, 0x9a, 0x5c, 0xab, 0x3b, + 0xbe, 0x41, 0x55, 0xa2, 0x80, 0x13, 0x32, 0x7a, 0x6a, 0x7e, 0x5d, 0xda, 0xe4, 0xdb, 0xd2, 0x26, + 0x3f, 0x96, 0x36, 0xf9, 0xfc, 0xd3, 0xbe, 0xe5, 0x75, 0xd4, 0xcf, 0x72, 0xfc, 0x3b, 0x00, 0x00, + 0xff, 0xff, 0xdc, 0xa9, 0x0e, 0xdf, 0xc5, 0x05, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -298,8 +597,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for Election service - +// ElectionClient is the client API for Election service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ElectionClient interface { // Campaign waits to acquire leadership in an election, returning a LeaderKey // representing the leadership if successful. The LeaderKey can then be used @@ -328,7 +628,7 @@ func NewElectionClient(cc *grpc.ClientConn) ElectionClient { func (c *electionClient) Campaign(ctx context.Context, in *CampaignRequest, opts ...grpc.CallOption) (*CampaignResponse, error) { out := new(CampaignResponse) - err := grpc.Invoke(ctx, "/v3electionpb.Election/Campaign", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/v3electionpb.Election/Campaign", in, out, opts...) if err != nil { return nil, err } @@ -337,7 +637,7 @@ func (c *electionClient) Campaign(ctx context.Context, in *CampaignRequest, opts func (c *electionClient) Proclaim(ctx context.Context, in *ProclaimRequest, opts ...grpc.CallOption) (*ProclaimResponse, error) { out := new(ProclaimResponse) - err := grpc.Invoke(ctx, "/v3electionpb.Election/Proclaim", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/v3electionpb.Election/Proclaim", in, out, opts...) if err != nil { return nil, err } @@ -346,7 +646,7 @@ func (c *electionClient) Proclaim(ctx context.Context, in *ProclaimRequest, opts func (c *electionClient) Leader(ctx context.Context, in *LeaderRequest, opts ...grpc.CallOption) (*LeaderResponse, error) { out := new(LeaderResponse) - err := grpc.Invoke(ctx, "/v3electionpb.Election/Leader", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/v3electionpb.Election/Leader", in, out, opts...) if err != nil { return nil, err } @@ -354,7 +654,7 @@ func (c *electionClient) Leader(ctx context.Context, in *LeaderRequest, opts ... } func (c *electionClient) Observe(ctx context.Context, in *LeaderRequest, opts ...grpc.CallOption) (Election_ObserveClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Election_serviceDesc.Streams[0], c.cc, "/v3electionpb.Election/Observe", opts...) + stream, err := c.cc.NewStream(ctx, &_Election_serviceDesc.Streams[0], "/v3electionpb.Election/Observe", opts...) if err != nil { return nil, err } @@ -387,15 +687,14 @@ func (x *electionObserveClient) Recv() (*LeaderResponse, error) { func (c *electionClient) Resign(ctx context.Context, in *ResignRequest, opts ...grpc.CallOption) (*ResignResponse, error) { out := new(ResignResponse) - err := grpc.Invoke(ctx, "/v3electionpb.Election/Resign", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/v3electionpb.Election/Resign", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Election service - +// ElectionServer is the server API for Election service. type ElectionServer interface { // Campaign waits to acquire leadership in an election, returning a LeaderKey // representing the leadership if successful. The LeaderKey can then be used @@ -414,6 +713,26 @@ type ElectionServer interface { Resign(context.Context, *ResignRequest) (*ResignResponse, error) } +// UnimplementedElectionServer can be embedded to have forward compatible implementations. +type UnimplementedElectionServer struct { +} + +func (*UnimplementedElectionServer) Campaign(ctx context.Context, req *CampaignRequest) (*CampaignResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Campaign not implemented") +} +func (*UnimplementedElectionServer) Proclaim(ctx context.Context, req *ProclaimRequest) (*ProclaimResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proclaim not implemented") +} +func (*UnimplementedElectionServer) Leader(ctx context.Context, req *LeaderRequest) (*LeaderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Leader not implemented") +} +func (*UnimplementedElectionServer) Observe(req *LeaderRequest, srv Election_ObserveServer) error { + return status.Errorf(codes.Unimplemented, "method Observe not implemented") +} +func (*UnimplementedElectionServer) Resign(ctx context.Context, req *ResignRequest) (*ResignResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Resign not implemented") +} + func RegisterElectionServer(s *grpc.Server, srv ElectionServer) { s.RegisterService(&_Election_serviceDesc, srv) } @@ -545,7 +864,7 @@ var _Election_serviceDesc = grpc.ServiceDesc{ func (m *CampaignRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -553,34 +872,45 @@ func (m *CampaignRequest) Marshal() (dAtA []byte, err error) { } func (m *CampaignRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CampaignRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Election(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintV3Election(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x1a } if m.Lease != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintV3Election(dAtA, i, uint64(m.Lease)) + i-- + dAtA[i] = 0x10 } - if len(m.Value) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintV3Election(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintV3Election(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *CampaignResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -588,37 +918,50 @@ func (m *CampaignResponse) Marshal() (dAtA []byte, err error) { } func (m *CampaignResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CampaignResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Election(dAtA, i, uint64(m.Header.Size())) - n1, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Leader != nil { + { + size, err := m.Leader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintV3Election(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintV3Election(dAtA, i, uint64(m.Leader.Size())) - n2, err := m.Leader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintV3Election(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LeaderKey) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -626,39 +969,50 @@ func (m *LeaderKey) Marshal() (dAtA []byte, err error) { } func (m *LeaderKey) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaderKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Election(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintV3Election(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.Lease != 0 { + i = encodeVarintV3Election(dAtA, i, uint64(m.Lease)) + i-- + dAtA[i] = 0x20 } if m.Rev != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintV3Election(dAtA, i, uint64(m.Rev)) + i-- + dAtA[i] = 0x18 } - if m.Lease != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintV3Election(dAtA, i, uint64(m.Lease)) + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintV3Election(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 } - return i, nil + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintV3Election(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *LeaderRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -666,23 +1020,33 @@ func (m *LeaderRequest) Marshal() (dAtA []byte, err error) { } func (m *LeaderRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Name) + copy(dAtA[i:], m.Name) i = encodeVarintV3Election(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LeaderResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -690,37 +1054,50 @@ func (m *LeaderResponse) Marshal() (dAtA []byte, err error) { } func (m *LeaderResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Election(dAtA, i, uint64(m.Header.Size())) - n3, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Kv != nil { + { + size, err := m.Kv.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintV3Election(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintV3Election(dAtA, i, uint64(m.Kv.Size())) - n4, err := m.Kv.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintV3Election(dAtA, i, uint64(size)) } - i += n4 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ResignRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -728,27 +1105,38 @@ func (m *ResignRequest) Marshal() (dAtA []byte, err error) { } func (m *ResignRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResignRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Leader != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Election(dAtA, i, uint64(m.Leader.Size())) - n5, err := m.Leader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Leader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintV3Election(dAtA, i, uint64(size)) } - i += n5 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ResignResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -756,27 +1144,38 @@ func (m *ResignResponse) Marshal() (dAtA []byte, err error) { } func (m *ResignResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResignResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Election(dAtA, i, uint64(m.Header.Size())) - n6, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintV3Election(dAtA, i, uint64(size)) } - i += n6 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ProclaimRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -784,33 +1183,45 @@ func (m *ProclaimRequest) Marshal() (dAtA []byte, err error) { } func (m *ProclaimRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProclaimRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Leader != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Election(dAtA, i, uint64(m.Leader.Size())) - n7, err := m.Leader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n7 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Value) + copy(dAtA[i:], m.Value) i = encodeVarintV3Election(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + i-- + dAtA[i] = 0x12 } - return i, nil + if m.Leader != nil { + { + size, err := m.Leader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintV3Election(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ProclaimResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -818,33 +1229,49 @@ func (m *ProclaimResponse) Marshal() (dAtA []byte, err error) { } func (m *ProclaimResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProclaimResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Election(dAtA, i, uint64(m.Header.Size())) - n8, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintV3Election(dAtA, i, uint64(size)) } - i += n8 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintV3Election(dAtA []byte, offset int, v uint64) int { + offset -= sovV3Election(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *CampaignRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -858,10 +1285,16 @@ func (m *CampaignRequest) Size() (n int) { if l > 0 { n += 1 + l + sovV3Election(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *CampaignResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -872,10 +1305,16 @@ func (m *CampaignResponse) Size() (n int) { l = m.Leader.Size() n += 1 + l + sovV3Election(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaderKey) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -892,20 +1331,32 @@ func (m *LeaderKey) Size() (n int) { if m.Lease != 0 { n += 1 + sovV3Election(uint64(m.Lease)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaderRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) if l > 0 { n += 1 + l + sovV3Election(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaderResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -916,30 +1367,48 @@ func (m *LeaderResponse) Size() (n int) { l = m.Kv.Size() n += 1 + l + sovV3Election(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *ResignRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Leader != nil { l = m.Leader.Size() n += 1 + l + sovV3Election(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *ResignResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovV3Election(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *ProclaimRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Leader != nil { @@ -950,28 +1419,30 @@ func (m *ProclaimRequest) Size() (n int) { if l > 0 { n += 1 + l + sovV3Election(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *ProclaimResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovV3Election(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func sovV3Election(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozV3Election(x uint64) (n int) { return sovV3Election(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -991,7 +1462,7 @@ func (m *CampaignRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1019,7 +1490,7 @@ func (m *CampaignRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1028,6 +1499,9 @@ func (m *CampaignRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1050,7 +1524,7 @@ func (m *CampaignRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Lease |= (int64(b) & 0x7F) << shift + m.Lease |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -1069,7 +1543,7 @@ func (m *CampaignRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1078,6 +1552,9 @@ func (m *CampaignRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1095,9 +1572,13 @@ func (m *CampaignRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Election } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Election + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1122,7 +1603,7 @@ func (m *CampaignResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1150,7 +1631,7 @@ func (m *CampaignResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1159,6 +1640,9 @@ func (m *CampaignResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1183,7 +1667,7 @@ func (m *CampaignResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1192,6 +1676,9 @@ func (m *CampaignResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1211,9 +1698,13 @@ func (m *CampaignResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Election } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Election + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1238,7 +1729,7 @@ func (m *LeaderKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1266,7 +1757,7 @@ func (m *LeaderKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1275,6 +1766,9 @@ func (m *LeaderKey) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1297,7 +1791,7 @@ func (m *LeaderKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1306,6 +1800,9 @@ func (m *LeaderKey) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1328,7 +1825,7 @@ func (m *LeaderKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Rev |= (int64(b) & 0x7F) << shift + m.Rev |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -1347,7 +1844,7 @@ func (m *LeaderKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Lease |= (int64(b) & 0x7F) << shift + m.Lease |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -1361,9 +1858,13 @@ func (m *LeaderKey) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Election } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Election + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1388,7 +1889,7 @@ func (m *LeaderRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1416,7 +1917,7 @@ func (m *LeaderRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1425,6 +1926,9 @@ func (m *LeaderRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1442,9 +1946,13 @@ func (m *LeaderRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Election } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Election + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1469,7 +1977,7 @@ func (m *LeaderResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1497,7 +2005,7 @@ func (m *LeaderResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1506,6 +2014,9 @@ func (m *LeaderResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1530,7 +2041,7 @@ func (m *LeaderResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1539,6 +2050,9 @@ func (m *LeaderResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1558,9 +2072,13 @@ func (m *LeaderResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Election } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Election + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1585,7 +2103,7 @@ func (m *ResignRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1613,7 +2131,7 @@ func (m *ResignRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1622,6 +2140,9 @@ func (m *ResignRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1641,9 +2162,13 @@ func (m *ResignRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Election } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Election + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1668,7 +2193,7 @@ func (m *ResignResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1696,7 +2221,7 @@ func (m *ResignResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1705,6 +2230,9 @@ func (m *ResignResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1724,9 +2252,13 @@ func (m *ResignResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Election } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Election + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1751,7 +2283,7 @@ func (m *ProclaimRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1779,7 +2311,7 @@ func (m *ProclaimRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1788,6 +2320,9 @@ func (m *ProclaimRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1812,7 +2347,7 @@ func (m *ProclaimRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1821,6 +2356,9 @@ func (m *ProclaimRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1838,9 +2376,13 @@ func (m *ProclaimRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Election } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Election + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1865,7 +2407,7 @@ func (m *ProclaimResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1893,7 +2435,7 @@ func (m *ProclaimResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1902,6 +2444,9 @@ func (m *ProclaimResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Election } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthV3Election + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1921,9 +2466,13 @@ func (m *ProclaimResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Election } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Election + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1987,10 +2536,13 @@ func skipV3Election(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthV3Election } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthV3Election + } return iNdEx, nil case 3: for { @@ -2019,6 +2571,9 @@ func skipV3Election(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthV3Election + } } return iNdEx, nil case 4: @@ -2037,43 +2592,3 @@ var ( ErrInvalidLengthV3Election = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowV3Election = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("v3election.proto", fileDescriptorV3Election) } - -var fileDescriptorV3Election = []byte{ - // 538 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x65, 0x9d, 0x10, 0xca, 0x90, 0xb6, 0x96, 0x55, 0xa9, 0x69, 0x48, 0xad, 0x68, 0x8b, 0x50, - 0x95, 0x83, 0x17, 0x35, 0x9c, 0x72, 0x42, 0x20, 0x50, 0xa5, 0x22, 0x01, 0x3e, 0x20, 0x38, 0xae, - 0xdd, 0x91, 0x1b, 0xc5, 0xf1, 0x1a, 0xdb, 0xb5, 0x94, 0x2b, 0xbf, 0xc0, 0x85, 0x7f, 0xe0, 0x47, - 0x38, 0x22, 0xf1, 0x03, 0x28, 0xf0, 0x21, 0x68, 0x77, 0x6d, 0xec, 0xb8, 0x21, 0x42, 0xe4, 0x62, - 0x8d, 0x67, 0x9e, 0xe7, 0xcd, 0x7b, 0x3b, 0x6b, 0x30, 0xf3, 0x31, 0x86, 0xe8, 0x67, 0x53, 0x11, - 0x39, 0x71, 0x22, 0x32, 0x61, 0x75, 0xab, 0x4c, 0xec, 0xf5, 0x0f, 0x02, 0x11, 0x08, 0x55, 0x60, - 0x32, 0xd2, 0x98, 0xfe, 0x43, 0xcc, 0xfc, 0x4b, 0x26, 0x1f, 0x29, 0x26, 0x39, 0x26, 0xb5, 0x30, - 0xf6, 0x58, 0x12, 0xfb, 0x05, 0xee, 0x48, 0xe1, 0xe6, 0xb9, 0xef, 0xab, 0x47, 0xec, 0xb1, 0x59, - 0x5e, 0x94, 0x06, 0x81, 0x10, 0x41, 0x88, 0x8c, 0xc7, 0x53, 0xc6, 0xa3, 0x48, 0x64, 0x5c, 0x32, - 0xa6, 0xba, 0x4a, 0xdf, 0xc0, 0xfe, 0x33, 0x3e, 0x8f, 0xf9, 0x34, 0x88, 0x5c, 0xfc, 0x70, 0x8d, - 0x69, 0x66, 0x59, 0xd0, 0x8e, 0xf8, 0x1c, 0x7b, 0x64, 0x48, 0x4e, 0xbb, 0xae, 0x8a, 0xad, 0x03, - 0xb8, 0x1d, 0x22, 0x4f, 0xb1, 0x67, 0x0c, 0xc9, 0x69, 0xcb, 0xd5, 0x2f, 0x32, 0x9b, 0xf3, 0xf0, - 0x1a, 0x7b, 0x2d, 0x05, 0xd5, 0x2f, 0x74, 0x01, 0x66, 0xd5, 0x32, 0x8d, 0x45, 0x94, 0xa2, 0xf5, - 0x18, 0x3a, 0x57, 0xc8, 0x2f, 0x31, 0x51, 0x5d, 0xef, 0x9d, 0x0d, 0x9c, 0xba, 0x10, 0xa7, 0xc4, - 0x9d, 0x2b, 0x8c, 0x5b, 0x60, 0x2d, 0x06, 0x9d, 0x50, 0x7f, 0x65, 0xa8, 0xaf, 0x0e, 0x9d, 0xba, - 0x65, 0xce, 0x4b, 0x55, 0xbb, 0xc0, 0x85, 0x5b, 0xc0, 0xe8, 0x7b, 0xb8, 0xfb, 0x27, 0xb9, 0x56, - 0x87, 0x09, 0xad, 0x19, 0x2e, 0x54, 0xbb, 0xae, 0x2b, 0x43, 0x99, 0x49, 0x30, 0x57, 0x0a, 0x5a, - 0xae, 0x0c, 0x2b, 0xad, 0xed, 0x9a, 0x56, 0x7a, 0x02, 0xbb, 0xba, 0xf5, 0x06, 0x9b, 0xe8, 0x15, - 0xec, 0x95, 0xa0, 0xad, 0x84, 0x0f, 0xc1, 0x98, 0xe5, 0x85, 0x68, 0xd3, 0xd1, 0x27, 0xea, 0x5c, - 0xe0, 0xe2, 0xad, 0x34, 0xd8, 0x35, 0x66, 0x39, 0x7d, 0x02, 0xbb, 0x2e, 0xa6, 0xb5, 0x53, 0xab, - 0xbc, 0x22, 0xff, 0xe6, 0xd5, 0x0b, 0xd8, 0x2b, 0x3b, 0x6c, 0x33, 0x2b, 0x7d, 0x07, 0xfb, 0xaf, - 0x13, 0xe1, 0x87, 0x7c, 0x3a, 0xff, 0xdf, 0x59, 0xaa, 0x45, 0x32, 0xea, 0x8b, 0x74, 0x0e, 0x66, - 0xd5, 0x79, 0x9b, 0x19, 0xcf, 0xbe, 0xb4, 0x61, 0xe7, 0x79, 0x31, 0x80, 0x25, 0x60, 0xa7, 0xdc, - 0x4f, 0xeb, 0x78, 0x75, 0xb2, 0xc6, 0x55, 0xe8, 0xdb, 0x7f, 0x2b, 0x6b, 0x16, 0xfa, 0xe0, 0xe3, - 0xf7, 0x5f, 0x9f, 0x0c, 0x9b, 0x1e, 0xb1, 0x7c, 0xec, 0x61, 0xc6, 0x59, 0x09, 0x66, 0x7e, 0x01, - 0x9d, 0x90, 0x91, 0x24, 0x2c, 0x75, 0x34, 0x09, 0x1b, 0xce, 0x35, 0x09, 0x9b, 0xf2, 0x37, 0x10, - 0xc6, 0x05, 0x54, 0x12, 0x06, 0xd0, 0xd1, 0x1e, 0x5b, 0xf7, 0xd7, 0x39, 0x5f, 0x92, 0x0d, 0xd6, - 0x17, 0x0b, 0x2a, 0xaa, 0xa8, 0x06, 0xf4, 0xf0, 0x06, 0x95, 0x3e, 0x34, 0x49, 0x34, 0x83, 0x3b, - 0xaf, 0x3c, 0x65, 0xfe, 0x36, 0x4c, 0x27, 0x8a, 0xe9, 0x98, 0xf6, 0x6e, 0x30, 0x09, 0xdd, 0x7c, - 0x42, 0x46, 0x8f, 0x88, 0x54, 0xa5, 0x17, 0xb6, 0xc9, 0xb5, 0x72, 0x11, 0x9a, 0x5c, 0xab, 0x3b, - 0xbe, 0x41, 0x55, 0xa2, 0x80, 0x13, 0x32, 0x7a, 0x6a, 0x7e, 0x5d, 0xda, 0xe4, 0xdb, 0xd2, 0x26, - 0x3f, 0x96, 0x36, 0xf9, 0xfc, 0xd3, 0xbe, 0xe5, 0x75, 0xd4, 0xcf, 0x72, 0xfc, 0x3b, 0x00, 0x00, - 0xff, 0xff, 0xdc, 0xa9, 0x0e, 0xdf, 0xc5, 0x05, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/etcd/etcdserver/api/v3lock/v3lockpb/v3lock.pb.go b/vendor/github.com/coreos/etcd/etcdserver/api/v3lock/v3lockpb/v3lock.pb.go index 071d0ae24..1ece90bef 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/api/v3lock/v3lockpb/v3lock.pb.go +++ b/vendor/github.com/coreos/etcd/etcdserver/api/v3lock/v3lockpb/v3lock.pb.go @@ -1,36 +1,22 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: v3lock.proto -/* - Package v3lockpb is a generated protocol buffer package. - - It is generated from these files: - v3lock.proto - - It has these top-level messages: - LockRequest - LockResponse - UnlockRequest - UnlockResponse -*/ package v3lockpb import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - + context "context" + fmt "fmt" + io "io" math "math" - - _ "github.com/gogo/protobuf/gogoproto" + math_bits "math/bits" etcdserverpb "github.com/coreos/etcd/etcdserver/etcdserverpb" - - context "golang.org/x/net/context" - + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" - - io "io" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" ) // Reference imports to suppress errors if they are not otherwise used. @@ -52,13 +38,44 @@ type LockRequest struct { // the lock is automatically released. Calls to Lock with the same lease will // be treated as a single acquistion; locking twice with the same lease is a // no-op. - Lease int64 `protobuf:"varint,2,opt,name=lease,proto3" json:"lease,omitempty"` + Lease int64 `protobuf:"varint,2,opt,name=lease,proto3" json:"lease,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *LockRequest) Reset() { *m = LockRequest{} } -func (m *LockRequest) String() string { return proto.CompactTextString(m) } -func (*LockRequest) ProtoMessage() {} -func (*LockRequest) Descriptor() ([]byte, []int) { return fileDescriptorV3Lock, []int{0} } +func (m *LockRequest) Reset() { *m = LockRequest{} } +func (m *LockRequest) String() string { return proto.CompactTextString(m) } +func (*LockRequest) ProtoMessage() {} +func (*LockRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_52389b3e2f253201, []int{0} +} +func (m *LockRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LockRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LockRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LockRequest.Merge(m, src) +} +func (m *LockRequest) XXX_Size() int { + return m.Size() +} +func (m *LockRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LockRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_LockRequest proto.InternalMessageInfo func (m *LockRequest) GetName() []byte { if m != nil { @@ -75,17 +92,48 @@ func (m *LockRequest) GetLease() int64 { } type LockResponse struct { - Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // key is a key that will exist on etcd for the duration that the Lock caller // owns the lock. Users should not modify this key or the lock may exhibit // undefined behavior. - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LockResponse) Reset() { *m = LockResponse{} } +func (m *LockResponse) String() string { return proto.CompactTextString(m) } +func (*LockResponse) ProtoMessage() {} +func (*LockResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_52389b3e2f253201, []int{1} +} +func (m *LockResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LockResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LockResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LockResponse.Merge(m, src) +} +func (m *LockResponse) XXX_Size() int { + return m.Size() +} +func (m *LockResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LockResponse.DiscardUnknown(m) } -func (m *LockResponse) Reset() { *m = LockResponse{} } -func (m *LockResponse) String() string { return proto.CompactTextString(m) } -func (*LockResponse) ProtoMessage() {} -func (*LockResponse) Descriptor() ([]byte, []int) { return fileDescriptorV3Lock, []int{1} } +var xxx_messageInfo_LockResponse proto.InternalMessageInfo func (m *LockResponse) GetHeader() *etcdserverpb.ResponseHeader { if m != nil { @@ -103,13 +151,44 @@ func (m *LockResponse) GetKey() []byte { type UnlockRequest struct { // key is the lock ownership key granted by Lock. - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UnlockRequest) Reset() { *m = UnlockRequest{} } +func (m *UnlockRequest) String() string { return proto.CompactTextString(m) } +func (*UnlockRequest) ProtoMessage() {} +func (*UnlockRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_52389b3e2f253201, []int{2} +} +func (m *UnlockRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UnlockRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UnlockRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnlockRequest.Merge(m, src) +} +func (m *UnlockRequest) XXX_Size() int { + return m.Size() +} +func (m *UnlockRequest) XXX_DiscardUnknown() { + xxx_messageInfo_UnlockRequest.DiscardUnknown(m) } -func (m *UnlockRequest) Reset() { *m = UnlockRequest{} } -func (m *UnlockRequest) String() string { return proto.CompactTextString(m) } -func (*UnlockRequest) ProtoMessage() {} -func (*UnlockRequest) Descriptor() ([]byte, []int) { return fileDescriptorV3Lock, []int{2} } +var xxx_messageInfo_UnlockRequest proto.InternalMessageInfo func (m *UnlockRequest) GetKey() []byte { if m != nil { @@ -119,13 +198,44 @@ func (m *UnlockRequest) GetKey() []byte { } type UnlockResponse struct { - Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *etcdserverpb.ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UnlockResponse) Reset() { *m = UnlockResponse{} } +func (m *UnlockResponse) String() string { return proto.CompactTextString(m) } +func (*UnlockResponse) ProtoMessage() {} +func (*UnlockResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_52389b3e2f253201, []int{3} +} +func (m *UnlockResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UnlockResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UnlockResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnlockResponse.Merge(m, src) +} +func (m *UnlockResponse) XXX_Size() int { + return m.Size() +} +func (m *UnlockResponse) XXX_DiscardUnknown() { + xxx_messageInfo_UnlockResponse.DiscardUnknown(m) } -func (m *UnlockResponse) Reset() { *m = UnlockResponse{} } -func (m *UnlockResponse) String() string { return proto.CompactTextString(m) } -func (*UnlockResponse) ProtoMessage() {} -func (*UnlockResponse) Descriptor() ([]byte, []int) { return fileDescriptorV3Lock, []int{3} } +var xxx_messageInfo_UnlockResponse proto.InternalMessageInfo func (m *UnlockResponse) GetHeader() *etcdserverpb.ResponseHeader { if m != nil { @@ -141,6 +251,33 @@ func init() { proto.RegisterType((*UnlockResponse)(nil), "v3lockpb.UnlockResponse") } +func init() { proto.RegisterFile("v3lock.proto", fileDescriptor_52389b3e2f253201) } + +var fileDescriptor_52389b3e2f253201 = []byte{ + // 335 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x33, 0xce, 0xc9, + 0x4f, 0xce, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf0, 0x0a, 0x92, 0xa4, 0x44, + 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x82, 0xfa, 0x20, 0x16, 0x44, 0x5e, 0x4a, 0x2d, 0xb5, 0x24, 0x39, + 0x45, 0x1f, 0x44, 0x14, 0xa7, 0x16, 0x95, 0xa5, 0x16, 0x21, 0x31, 0x0b, 0x92, 0xf4, 0x8b, 0x0a, + 0x92, 0xa1, 0xea, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, + 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xb2, 0x4a, 0xe6, 0x5c, 0xdc, + 0x3e, 0xf9, 0xc9, 0xd9, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42, 0x5c, 0x2c, 0x79, + 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x60, 0xb6, 0x90, 0x08, 0x17, 0x6b, + 0x4e, 0x6a, 0x62, 0x71, 0xaa, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x73, 0x10, 0x84, 0xa3, 0x14, 0xc6, + 0xc5, 0x03, 0xd1, 0x58, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x2a, 0x64, 0xc2, 0xc5, 0x96, 0x91, 0x9a, + 0x98, 0x92, 0x5a, 0x04, 0xd6, 0xcb, 0x6d, 0x24, 0xa3, 0x87, 0xec, 0x1e, 0x3d, 0x98, 0x3a, 0x0f, + 0xb0, 0x9a, 0x20, 0xa8, 0x5a, 0x21, 0x01, 0x2e, 0xe6, 0xec, 0xd4, 0x4a, 0xb0, 0xc9, 0x3c, 0x41, + 0x20, 0xa6, 0x92, 0x22, 0x17, 0x6f, 0x68, 0x5e, 0x0e, 0x92, 0x93, 0xa0, 0x4a, 0x18, 0x11, 0x4a, + 0xdc, 0xb8, 0xf8, 0x60, 0x4a, 0x28, 0xb1, 0xdc, 0x68, 0x07, 0x23, 0x17, 0x0b, 0xc8, 0x0f, 0x42, + 0xc1, 0x50, 0x5a, 0x54, 0x0f, 0x16, 0xe6, 0x7a, 0x48, 0x81, 0x22, 0x25, 0x86, 0x2e, 0x0c, 0x31, + 0x4d, 0x49, 0xa6, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x62, 0x4a, 0x82, 0xfa, 0x65, 0xc6, 0x49, 0xa9, + 0x25, 0x89, 0xfa, 0x20, 0x45, 0x60, 0xc2, 0x8a, 0x51, 0x4b, 0x28, 0x9a, 0x8b, 0x0d, 0xe2, 0x4a, + 0x21, 0x71, 0x84, 0x7e, 0x14, 0xaf, 0x49, 0x49, 0x60, 0x4a, 0x40, 0x8d, 0x96, 0x03, 0x1b, 0x2d, + 0xa1, 0x24, 0x8c, 0x62, 0x74, 0x69, 0x1e, 0xd4, 0x70, 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f, + 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36, 0x70, 0x7c, + 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x10, 0x82, 0x89, 0xf0, 0x45, 0x02, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -149,8 +286,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for Lock service - +// LockClient is the client API for Lock service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type LockClient interface { // Lock acquires a distributed shared lock on a given named lock. // On success, it will return a unique key that exists so long as the @@ -175,7 +313,7 @@ func NewLockClient(cc *grpc.ClientConn) LockClient { func (c *lockClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) { out := new(LockResponse) - err := grpc.Invoke(ctx, "/v3lockpb.Lock/Lock", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/v3lockpb.Lock/Lock", in, out, opts...) if err != nil { return nil, err } @@ -184,15 +322,14 @@ func (c *lockClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.Cal func (c *lockClient) Unlock(ctx context.Context, in *UnlockRequest, opts ...grpc.CallOption) (*UnlockResponse, error) { out := new(UnlockResponse) - err := grpc.Invoke(ctx, "/v3lockpb.Lock/Unlock", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/v3lockpb.Lock/Unlock", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Lock service - +// LockServer is the server API for Lock service. type LockServer interface { // Lock acquires a distributed shared lock on a given named lock. // On success, it will return a unique key that exists so long as the @@ -207,6 +344,17 @@ type LockServer interface { Unlock(context.Context, *UnlockRequest) (*UnlockResponse, error) } +// UnimplementedLockServer can be embedded to have forward compatible implementations. +type UnimplementedLockServer struct { +} + +func (*UnimplementedLockServer) Lock(ctx context.Context, req *LockRequest) (*LockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented") +} +func (*UnimplementedLockServer) Unlock(ctx context.Context, req *UnlockRequest) (*UnlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Unlock not implemented") +} + func RegisterLockServer(s *grpc.Server, srv LockServer) { s.RegisterService(&_Lock_serviceDesc, srv) } @@ -267,7 +415,7 @@ var _Lock_serviceDesc = grpc.ServiceDesc{ func (m *LockRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -275,28 +423,38 @@ func (m *LockRequest) Marshal() (dAtA []byte, err error) { } func (m *LockRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Lease != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintV3Lock(dAtA, i, uint64(m.Lease)) + i-- + dAtA[i] = 0x10 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LockResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -304,33 +462,45 @@ func (m *LockResponse) Marshal() (dAtA []byte, err error) { } func (m *LockResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Lock(dAtA, i, uint64(m.Header.Size())) - n1, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Key) + copy(dAtA[i:], m.Key) i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + i-- + dAtA[i] = 0x12 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintV3Lock(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *UnlockRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -338,23 +508,33 @@ func (m *UnlockRequest) Marshal() (dAtA []byte, err error) { } func (m *UnlockRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UnlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Key) + copy(dAtA[i:], m.Key) i = encodeVarintV3Lock(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *UnlockResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -362,33 +542,49 @@ func (m *UnlockResponse) Marshal() (dAtA []byte, err error) { } func (m *UnlockResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UnlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintV3Lock(dAtA, i, uint64(m.Header.Size())) - n2, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintV3Lock(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintV3Lock(dAtA []byte, offset int, v uint64) int { + offset -= sovV3Lock(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *LockRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -398,10 +594,16 @@ func (m *LockRequest) Size() (n int) { if m.Lease != 0 { n += 1 + sovV3Lock(uint64(m.Lease)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LockResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -412,38 +614,46 @@ func (m *LockResponse) Size() (n int) { if l > 0 { n += 1 + l + sovV3Lock(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *UnlockRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Key) if l > 0 { n += 1 + l + sovV3Lock(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *UnlockResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovV3Lock(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func sovV3Lock(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozV3Lock(x uint64) (n int) { return sovV3Lock(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -463,7 +673,7 @@ func (m *LockRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -491,7 +701,7 @@ func (m *LockRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -500,6 +710,9 @@ func (m *LockRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Lock } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthV3Lock + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -522,7 +735,7 @@ func (m *LockRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Lease |= (int64(b) & 0x7F) << shift + m.Lease |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -536,9 +749,13 @@ func (m *LockRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Lock } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Lock + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -563,7 +780,7 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -591,7 +808,7 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -600,6 +817,9 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Lock } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthV3Lock + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -624,7 +844,7 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -633,6 +853,9 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Lock } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthV3Lock + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -650,9 +873,13 @@ func (m *LockResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Lock } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Lock + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -677,7 +904,7 @@ func (m *UnlockRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -705,7 +932,7 @@ func (m *UnlockRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -714,6 +941,9 @@ func (m *UnlockRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Lock } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthV3Lock + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -731,9 +961,13 @@ func (m *UnlockRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Lock } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Lock + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -758,7 +992,7 @@ func (m *UnlockResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -786,7 +1020,7 @@ func (m *UnlockResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -795,6 +1029,9 @@ func (m *UnlockResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthV3Lock } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthV3Lock + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -814,9 +1051,13 @@ func (m *UnlockResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthV3Lock } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthV3Lock + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -880,10 +1121,13 @@ func skipV3Lock(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthV3Lock } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthV3Lock + } return iNdEx, nil case 3: for { @@ -912,6 +1156,9 @@ func skipV3Lock(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthV3Lock + } } return iNdEx, nil case 4: @@ -930,30 +1177,3 @@ var ( ErrInvalidLengthV3Lock = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowV3Lock = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("v3lock.proto", fileDescriptorV3Lock) } - -var fileDescriptorV3Lock = []byte{ - // 335 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x33, 0xce, 0xc9, - 0x4f, 0xce, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf0, 0x0a, 0x92, 0xa4, 0x44, - 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x82, 0xfa, 0x20, 0x16, 0x44, 0x5e, 0x4a, 0x2d, 0xb5, 0x24, 0x39, - 0x45, 0x1f, 0x44, 0x14, 0xa7, 0x16, 0x95, 0xa5, 0x16, 0x21, 0x31, 0x0b, 0x92, 0xf4, 0x8b, 0x0a, - 0x92, 0xa1, 0xea, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, - 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xb2, 0x4a, 0xe6, 0x5c, 0xdc, - 0x3e, 0xf9, 0xc9, 0xd9, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42, 0x5c, 0x2c, 0x79, - 0x89, 0xb9, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x60, 0xb6, 0x90, 0x08, 0x17, 0x6b, - 0x4e, 0x6a, 0x62, 0x71, 0xaa, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x73, 0x10, 0x84, 0xa3, 0x14, 0xc6, - 0xc5, 0x03, 0xd1, 0x58, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x2a, 0x64, 0xc2, 0xc5, 0x96, 0x91, 0x9a, - 0x98, 0x92, 0x5a, 0x04, 0xd6, 0xcb, 0x6d, 0x24, 0xa3, 0x87, 0xec, 0x1e, 0x3d, 0x98, 0x3a, 0x0f, - 0xb0, 0x9a, 0x20, 0xa8, 0x5a, 0x21, 0x01, 0x2e, 0xe6, 0xec, 0xd4, 0x4a, 0xb0, 0xc9, 0x3c, 0x41, - 0x20, 0xa6, 0x92, 0x22, 0x17, 0x6f, 0x68, 0x5e, 0x0e, 0x92, 0x93, 0xa0, 0x4a, 0x18, 0x11, 0x4a, - 0xdc, 0xb8, 0xf8, 0x60, 0x4a, 0x28, 0xb1, 0xdc, 0x68, 0x07, 0x23, 0x17, 0x0b, 0xc8, 0x0f, 0x42, - 0xc1, 0x50, 0x5a, 0x54, 0x0f, 0x16, 0xe6, 0x7a, 0x48, 0x81, 0x22, 0x25, 0x86, 0x2e, 0x0c, 0x31, - 0x4d, 0x49, 0xa6, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x62, 0x4a, 0x82, 0xfa, 0x65, 0xc6, 0x49, 0xa9, - 0x25, 0x89, 0xfa, 0x20, 0x45, 0x60, 0xc2, 0x8a, 0x51, 0x4b, 0x28, 0x9a, 0x8b, 0x0d, 0xe2, 0x4a, - 0x21, 0x71, 0x84, 0x7e, 0x14, 0xaf, 0x49, 0x49, 0x60, 0x4a, 0x40, 0x8d, 0x96, 0x03, 0x1b, 0x2d, - 0xa1, 0x24, 0x8c, 0x62, 0x74, 0x69, 0x1e, 0xd4, 0x70, 0x27, 0x81, 0x13, 0x8f, 0xe4, 0x18, 0x2f, - 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x24, 0x36, 0x70, 0x7c, - 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x10, 0x82, 0x89, 0xf0, 0x45, 0x02, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/key.go b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/key.go index 9781bddda..5e4fbcf59 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/key.go +++ b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/key.go @@ -179,7 +179,7 @@ func checkTxnRequest(r *pb.TxnRequest, maxTxnOps int) error { // there is an overlap, returns an error. If no overlap, return put and delete // sets for recursive evaluation. func checkIntervals(reqs []*pb.RequestOp) (map[string]struct{}, adt.IntervalTree, error) { - var dels adt.IntervalTree + dels := adt.NewIntervalTree() // collect deletes from this level; build first to check lower level overlapped puts for _, req := range reqs { diff --git a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error.go b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error.go index 55eab38ef..bc1ad7bbd 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error.go +++ b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/error.go @@ -61,6 +61,7 @@ var ( ErrGRPCNoLeader = status.New(codes.Unavailable, "etcdserver: no leader").Err() ErrGRPCNotLeader = status.New(codes.FailedPrecondition, "etcdserver: not leader").Err() + ErrGRPCLeaderChanged = status.New(codes.Unavailable, "etcdserver: leader changed").Err() ErrGRPCNotCapable = status.New(codes.Unavailable, "etcdserver: not capable").Err() ErrGRPCStopped = status.New(codes.Unavailable, "etcdserver: server stopped").Err() ErrGRPCTimeout = status.New(codes.Unavailable, "etcdserver: request timed out").Err() @@ -163,6 +164,7 @@ var ( ErrNoLeader = Error(ErrGRPCNoLeader) ErrNotLeader = Error(ErrGRPCNotLeader) + ErrLeaderChanged = Error(ErrGRPCLeaderChanged) ErrNotCapable = Error(ErrGRPCNotCapable) ErrStopped = Error(ErrGRPCStopped) ErrTimeout = Error(ErrGRPCTimeout) diff --git a/vendor/github.com/coreos/etcd/e2e/doc.go b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/metadatafields.go similarity index 63% rename from vendor/github.com/coreos/etcd/e2e/doc.go rename to vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/metadatafields.go index a6887cfce..8f8ac60ff 100644 --- a/vendor/github.com/coreos/etcd/e2e/doc.go +++ b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/metadatafields.go @@ -1,4 +1,4 @@ -// Copyright 2016 The etcd Authors +// Copyright 2018 The etcd Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,13 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -/* -Package e2e implements tests built upon etcd binaries, and focus on -end-to-end testing. +package rpctypes -Features/goals of the end-to-end tests: -1. test command-line parsing and arguments. -2. test user-facing command-line API. -3. launch full processes and check for expected outputs. -*/ -package e2e +var ( + TokenFieldNameGRPC = "token" + TokenFieldNameSwagger = "authorization" +) diff --git a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/util.go b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/util.go index 799c1197d..c4a1ce042 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/util.go +++ b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/util.go @@ -44,6 +44,7 @@ var toGRPCErrorMap = map[error]error{ etcdserver.ErrNoLeader: rpctypes.ErrGRPCNoLeader, etcdserver.ErrNotLeader: rpctypes.ErrGRPCNotLeader, + etcdserver.ErrLeaderChanged: rpctypes.ErrGRPCLeaderChanged, etcdserver.ErrStopped: rpctypes.ErrGRPCStopped, etcdserver.ErrTimeout: rpctypes.ErrGRPCTimeout, etcdserver.ErrTimeoutDueToLeaderFail: rpctypes.ErrGRPCTimeoutDueToLeaderFail, diff --git a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/watch.go b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/watch.go index dd4f32951..9b46b0d75 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/watch.go +++ b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/watch.go @@ -31,6 +31,9 @@ import ( type watchServer struct { clusterID int64 memberID int64 + + maxRequestBytes int + raftTimer etcdserver.RaftTimer watchable mvcc.WatchableKV @@ -39,11 +42,12 @@ type watchServer struct { func NewWatchServer(s *etcdserver.EtcdServer) pb.WatchServer { return &watchServer{ - clusterID: int64(s.Cluster().ID()), - memberID: int64(s.ID()), - raftTimer: s, - watchable: s.Watchable(), - ag: s, + clusterID: int64(s.Cluster().ID()), + memberID: int64(s.ID()), + maxRequestBytes: int(s.Cfg.MaxRequestBytes + grpcOverheadBytes), + raftTimer: s, + watchable: s.Watchable(), + ag: s, } } @@ -83,6 +87,9 @@ const ( type serverWatchStream struct { clusterID int64 memberID int64 + + maxRequestBytes int + raftTimer etcdserver.RaftTimer watchable mvcc.WatchableKV @@ -92,12 +99,14 @@ type serverWatchStream struct { ctrlStream chan *pb.WatchResponse // mu protects progress, prevKV - mu sync.Mutex + mu sync.RWMutex // progress tracks the watchID that stream might need to send // progress to. // TODO: combine progress and prevKV into a single struct? progress map[mvcc.WatchID]bool prevKV map[mvcc.WatchID]bool + // records fragmented watch IDs + fragment map[mvcc.WatchID]bool // closec indicates the stream is closed. closec chan struct{} @@ -112,6 +121,9 @@ func (ws *watchServer) Watch(stream pb.Watch_WatchServer) (err error) { sws := serverWatchStream{ clusterID: ws.clusterID, memberID: ws.memberID, + + maxRequestBytes: ws.maxRequestBytes, + raftTimer: ws.raftTimer, watchable: ws.watchable, @@ -122,6 +134,7 @@ func (ws *watchServer) Watch(stream pb.Watch_WatchServer) (err error) { ctrlStream: make(chan *pb.WatchResponse, ctrlStreamBufLen), progress: make(map[mvcc.WatchID]bool), prevKV: make(map[mvcc.WatchID]bool), + fragment: make(map[mvcc.WatchID]bool), closec: make(chan struct{}), ag: ws.ag, @@ -238,6 +251,9 @@ func (sws *serverWatchStream) recvLoop() error { if creq.PrevKv { sws.prevKV[id] = true } + if creq.Fragment { + sws.fragment[id] = true + } sws.mu.Unlock() } wr := &pb.WatchResponse{ @@ -264,9 +280,17 @@ func (sws *serverWatchStream) recvLoop() error { sws.mu.Lock() delete(sws.progress, mvcc.WatchID(id)) delete(sws.prevKV, mvcc.WatchID(id)) + delete(sws.fragment, mvcc.WatchID(id)) sws.mu.Unlock() } } + case *pb.WatchRequest_ProgressRequest: + if uv.ProgressRequest != nil { + sws.ctrlStream <- &pb.WatchResponse{ + Header: sws.newResponseHeader(sws.watchStream.Rev()), + WatchId: -1, // response is not associated with any WatchId and will be broadcast to all watch channels + } + } default: // we probably should not shutdown the entire stream when // receive an valid command. @@ -310,9 +334,9 @@ func (sws *serverWatchStream) sendLoop() { // or define protocol buffer with []mvccpb.Event. evs := wresp.Events events := make([]*mvccpb.Event, len(evs)) - sws.mu.Lock() + sws.mu.RLock() needPrevKV := sws.prevKV[wresp.WatchID] - sws.mu.Unlock() + sws.mu.RUnlock() for i := range evs { events[i] = &evs[i] @@ -342,11 +366,23 @@ func (sws *serverWatchStream) sendLoop() { } mvcc.ReportEventReceived(len(evs)) - if err := sws.gRPCStream.Send(wr); err != nil { - if isClientCtxErr(sws.gRPCStream.Context().Err(), err) { - plog.Debugf("failed to send watch response to gRPC stream (%q)", err.Error()) + + sws.mu.RLock() + fragmented, ok := sws.fragment[wresp.WatchID] + sws.mu.RUnlock() + + var serr error + if !fragmented && !ok { + serr = sws.gRPCStream.Send(wr) + } else { + serr = sendFragments(wr, sws.maxRequestBytes, sws.gRPCStream.Send) + } + + if serr != nil { + if isClientCtxErr(sws.gRPCStream.Context().Err(), serr) { + plog.Debugf("failed to send watch response to gRPC stream (%q)", serr.Error()) } else { - plog.Warningf("failed to send watch response to gRPC stream (%q)", err.Error()) + plog.Warningf("failed to send watch response to gRPC stream (%q)", serr.Error()) } return } @@ -409,6 +445,45 @@ func (sws *serverWatchStream) sendLoop() { } } +func sendFragments( + wr *pb.WatchResponse, + maxRequestBytes int, + sendFunc func(*pb.WatchResponse) error) error { + // no need to fragment if total request size is smaller + // than max request limit or response contains only one event + if wr.Size() < maxRequestBytes || len(wr.Events) < 2 { + return sendFunc(wr) + } + + ow := *wr + ow.Events = make([]*mvccpb.Event, 0) + ow.Fragment = true + + var idx int + for { + cur := ow + for _, ev := range wr.Events[idx:] { + cur.Events = append(cur.Events, ev) + if len(cur.Events) > 1 && cur.Size() >= maxRequestBytes { + cur.Events = cur.Events[:len(cur.Events)-1] + break + } + idx++ + } + if idx == len(wr.Events) { + // last response has no more fragment + cur.Fragment = false + } + if err := sendFunc(&cur); err != nil { + return err + } + if !cur.Fragment { + break + } + } + return nil +} + func (sws *serverWatchStream) close() { sws.watchStream.Close() close(sws.closec) diff --git a/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/watch_test.go b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/watch_test.go new file mode 100644 index 000000000..eec3aa7bd --- /dev/null +++ b/vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/watch_test.go @@ -0,0 +1,95 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v3rpc + +import ( + "bytes" + "math" + "testing" + + pb "github.com/coreos/etcd/etcdserver/etcdserverpb" + "github.com/coreos/etcd/mvcc/mvccpb" +) + +func TestSendFragment(t *testing.T) { + tt := []struct { + wr *pb.WatchResponse + maxRequestBytes int + fragments int + werr error + }{ + { // large limit should not fragment + wr: createResponse(100, 1), + maxRequestBytes: math.MaxInt32, + fragments: 1, + }, + { // large limit for two messages, expect no fragment + wr: createResponse(10, 2), + maxRequestBytes: 50, + fragments: 1, + }, + { // limit is small but only one message, expect no fragment + wr: createResponse(1024, 1), + maxRequestBytes: 1, + fragments: 1, + }, + { // exceed limit only when combined, expect fragments + wr: createResponse(11, 5), + maxRequestBytes: 20, + fragments: 5, + }, + { // 5 events with each event exceeding limits, expect fragments + wr: createResponse(15, 5), + maxRequestBytes: 10, + fragments: 5, + }, + { // 4 events with some combined events exceeding limits + wr: createResponse(10, 4), + maxRequestBytes: 35, + fragments: 2, + }, + } + + for i := range tt { + fragmentedResp := make([]*pb.WatchResponse, 0) + testSend := func(wr *pb.WatchResponse) error { + fragmentedResp = append(fragmentedResp, wr) + return nil + } + err := sendFragments(tt[i].wr, tt[i].maxRequestBytes, testSend) + if err != tt[i].werr { + t.Errorf("#%d: expected error %v, got %v", i, tt[i].werr, err) + } + got := len(fragmentedResp) + if got != tt[i].fragments { + t.Errorf("#%d: expected response number %d, got %d", i, tt[i].fragments, got) + } + if got > 0 && fragmentedResp[got-1].Fragment { + t.Errorf("#%d: expected fragment=false in last response, got %+v", i, fragmentedResp[got-1]) + } + } +} + +func createResponse(dataSize, events int) (resp *pb.WatchResponse) { + resp = &pb.WatchResponse{Events: make([]*mvccpb.Event, events)} + for i := range resp.Events { + resp.Events[i] = &mvccpb.Event{ + Kv: &mvccpb.KeyValue{ + Key: bytes.Repeat([]byte("a"), dataSize), + }, + } + } + return resp +} \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/etcdserver/errors.go b/vendor/github.com/coreos/etcd/etcdserver/errors.go index fb93c4b2a..8cec52a17 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/errors.go +++ b/vendor/github.com/coreos/etcd/etcdserver/errors.go @@ -27,6 +27,7 @@ var ( ErrTimeoutDueToLeaderFail = errors.New("etcdserver: request timed out, possibly due to previous leader failure") ErrTimeoutDueToConnectionLost = errors.New("etcdserver: request timed out, possibly due to connection lost") ErrTimeoutLeaderTransfer = errors.New("etcdserver: request timed out, leader transfer took too long") + ErrLeaderChanged = errors.New("etcdserver: leader changed") ErrNotEnoughStartedMembers = errors.New("etcdserver: re-configuration failed due to not enough started members") ErrNoLeader = errors.New("etcdserver: no leader") ErrNotLeader = errors.New("etcdserver: not leader") diff --git a/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.pb.go b/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.pb.go index 90045a5c9..12b676397 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.pb.go +++ b/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.pb.go @@ -1,119 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: etcdserver.proto -/* - Package etcdserverpb is a generated protocol buffer package. - - It is generated from these files: - etcdserver.proto - raft_internal.proto - rpc.proto - - It has these top-level messages: - Request - Metadata - RequestHeader - InternalRaftRequest - EmptyResponse - InternalAuthenticateRequest - ResponseHeader - RangeRequest - RangeResponse - PutRequest - PutResponse - DeleteRangeRequest - DeleteRangeResponse - RequestOp - ResponseOp - Compare - TxnRequest - TxnResponse - CompactionRequest - CompactionResponse - HashRequest - HashKVRequest - HashKVResponse - HashResponse - SnapshotRequest - SnapshotResponse - WatchRequest - WatchCreateRequest - WatchCancelRequest - WatchResponse - LeaseGrantRequest - LeaseGrantResponse - LeaseRevokeRequest - LeaseRevokeResponse - LeaseKeepAliveRequest - LeaseKeepAliveResponse - LeaseTimeToLiveRequest - LeaseTimeToLiveResponse - LeaseLeasesRequest - LeaseStatus - LeaseLeasesResponse - Member - MemberAddRequest - MemberAddResponse - MemberRemoveRequest - MemberRemoveResponse - MemberUpdateRequest - MemberUpdateResponse - MemberListRequest - MemberListResponse - DefragmentRequest - DefragmentResponse - MoveLeaderRequest - MoveLeaderResponse - AlarmRequest - AlarmMember - AlarmResponse - StatusRequest - StatusResponse - AuthEnableRequest - AuthDisableRequest - AuthenticateRequest - AuthUserAddRequest - AuthUserGetRequest - AuthUserDeleteRequest - AuthUserChangePasswordRequest - AuthUserGrantRoleRequest - AuthUserRevokeRoleRequest - AuthRoleAddRequest - AuthRoleGetRequest - AuthUserListRequest - AuthRoleListRequest - AuthRoleDeleteRequest - AuthRoleGrantPermissionRequest - AuthRoleRevokePermissionRequest - AuthEnableResponse - AuthDisableResponse - AuthenticateResponse - AuthUserAddResponse - AuthUserGetResponse - AuthUserDeleteResponse - AuthUserChangePasswordResponse - AuthUserGrantRoleResponse - AuthUserRevokeRoleResponse - AuthRoleAddResponse - AuthRoleGetResponse - AuthRoleListResponse - AuthUserListResponse - AuthRoleDeleteResponse - AuthRoleGrantPermissionResponse - AuthRoleRevokePermissionResponse -*/ package etcdserverpb import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - + fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" - - io "io" + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -128,50 +25,141 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type Request struct { - ID uint64 `protobuf:"varint,1,opt,name=ID" json:"ID"` - Method string `protobuf:"bytes,2,opt,name=Method" json:"Method"` - Path string `protobuf:"bytes,3,opt,name=Path" json:"Path"` - Val string `protobuf:"bytes,4,opt,name=Val" json:"Val"` - Dir bool `protobuf:"varint,5,opt,name=Dir" json:"Dir"` - PrevValue string `protobuf:"bytes,6,opt,name=PrevValue" json:"PrevValue"` - PrevIndex uint64 `protobuf:"varint,7,opt,name=PrevIndex" json:"PrevIndex"` - PrevExist *bool `protobuf:"varint,8,opt,name=PrevExist" json:"PrevExist,omitempty"` - Expiration int64 `protobuf:"varint,9,opt,name=Expiration" json:"Expiration"` - Wait bool `protobuf:"varint,10,opt,name=Wait" json:"Wait"` - Since uint64 `protobuf:"varint,11,opt,name=Since" json:"Since"` - Recursive bool `protobuf:"varint,12,opt,name=Recursive" json:"Recursive"` - Sorted bool `protobuf:"varint,13,opt,name=Sorted" json:"Sorted"` - Quorum bool `protobuf:"varint,14,opt,name=Quorum" json:"Quorum"` - Time int64 `protobuf:"varint,15,opt,name=Time" json:"Time"` - Stream bool `protobuf:"varint,16,opt,name=Stream" json:"Stream"` - Refresh *bool `protobuf:"varint,17,opt,name=Refresh" json:"Refresh,omitempty"` - XXX_unrecognized []byte `json:"-"` + ID uint64 `protobuf:"varint,1,opt,name=ID" json:"ID"` + Method string `protobuf:"bytes,2,opt,name=Method" json:"Method"` + Path string `protobuf:"bytes,3,opt,name=Path" json:"Path"` + Val string `protobuf:"bytes,4,opt,name=Val" json:"Val"` + Dir bool `protobuf:"varint,5,opt,name=Dir" json:"Dir"` + PrevValue string `protobuf:"bytes,6,opt,name=PrevValue" json:"PrevValue"` + PrevIndex uint64 `protobuf:"varint,7,opt,name=PrevIndex" json:"PrevIndex"` + PrevExist *bool `protobuf:"varint,8,opt,name=PrevExist" json:"PrevExist,omitempty"` + Expiration int64 `protobuf:"varint,9,opt,name=Expiration" json:"Expiration"` + Wait bool `protobuf:"varint,10,opt,name=Wait" json:"Wait"` + Since uint64 `protobuf:"varint,11,opt,name=Since" json:"Since"` + Recursive bool `protobuf:"varint,12,opt,name=Recursive" json:"Recursive"` + Sorted bool `protobuf:"varint,13,opt,name=Sorted" json:"Sorted"` + Quorum bool `protobuf:"varint,14,opt,name=Quorum" json:"Quorum"` + Time int64 `protobuf:"varint,15,opt,name=Time" json:"Time"` + Stream bool `protobuf:"varint,16,opt,name=Stream" json:"Stream"` + Refresh *bool `protobuf:"varint,17,opt,name=Refresh" json:"Refresh,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptor_09ffbeb3bebbce7e, []int{0} +} +func (m *Request) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Request.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request.Merge(m, src) +} +func (m *Request) XXX_Size() int { + return m.Size() +} +func (m *Request) XXX_DiscardUnknown() { + xxx_messageInfo_Request.DiscardUnknown(m) } -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} -func (*Request) Descriptor() ([]byte, []int) { return fileDescriptorEtcdserver, []int{0} } +var xxx_messageInfo_Request proto.InternalMessageInfo type Metadata struct { - NodeID uint64 `protobuf:"varint,1,opt,name=NodeID" json:"NodeID"` - ClusterID uint64 `protobuf:"varint,2,opt,name=ClusterID" json:"ClusterID"` - XXX_unrecognized []byte `json:"-"` + NodeID uint64 `protobuf:"varint,1,opt,name=NodeID" json:"NodeID"` + ClusterID uint64 `protobuf:"varint,2,opt,name=ClusterID" json:"ClusterID"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Metadata) Reset() { *m = Metadata{} } +func (m *Metadata) String() string { return proto.CompactTextString(m) } +func (*Metadata) ProtoMessage() {} +func (*Metadata) Descriptor() ([]byte, []int) { + return fileDescriptor_09ffbeb3bebbce7e, []int{1} +} +func (m *Metadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Metadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_Metadata.Merge(m, src) +} +func (m *Metadata) XXX_Size() int { + return m.Size() +} +func (m *Metadata) XXX_DiscardUnknown() { + xxx_messageInfo_Metadata.DiscardUnknown(m) } -func (m *Metadata) Reset() { *m = Metadata{} } -func (m *Metadata) String() string { return proto.CompactTextString(m) } -func (*Metadata) ProtoMessage() {} -func (*Metadata) Descriptor() ([]byte, []int) { return fileDescriptorEtcdserver, []int{1} } +var xxx_messageInfo_Metadata proto.InternalMessageInfo func init() { proto.RegisterType((*Request)(nil), "etcdserverpb.Request") proto.RegisterType((*Metadata)(nil), "etcdserverpb.Metadata") } + +func init() { proto.RegisterFile("etcdserver.proto", fileDescriptor_09ffbeb3bebbce7e) } + +var fileDescriptor_09ffbeb3bebbce7e = []byte{ + // 380 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0xd2, 0xdd, 0x6e, 0xda, 0x30, + 0x14, 0x07, 0x70, 0x0c, 0xe1, 0xcb, 0x63, 0x1b, 0xb3, 0xd0, 0x74, 0x84, 0xa6, 0x2c, 0x42, 0xbb, + 0xc8, 0xd5, 0xf6, 0x0e, 0x2c, 0x5c, 0x44, 0x2a, 0x15, 0x0d, 0x15, 0xbd, 0x76, 0xc9, 0x29, 0x58, + 0x02, 0x4c, 0x1d, 0x07, 0xf1, 0x06, 0x7d, 0x85, 0x3e, 0x12, 0x97, 0x7d, 0x82, 0xaa, 0xa5, 0x2f, + 0x52, 0x39, 0x24, 0xc4, 0xed, 0x5d, 0xf4, 0xfb, 0x9f, 0x1c, 0x1f, 0x7f, 0xd0, 0x2e, 0xea, 0x79, + 0x9c, 0xa0, 0xda, 0xa1, 0xfa, 0xbb, 0x55, 0x52, 0x4b, 0xd6, 0x29, 0x65, 0x7b, 0xdb, 0xef, 0x2d, + 0xe4, 0x42, 0x66, 0xc1, 0x3f, 0xf3, 0x75, 0xaa, 0x19, 0x3c, 0x38, 0xb4, 0x19, 0xe1, 0x7d, 0x8a, + 0x89, 0x66, 0x3d, 0x5a, 0x0d, 0x03, 0x20, 0x1e, 0xf1, 0x9d, 0xa1, 0x73, 0x78, 0xfe, 0x5d, 0x89, + 0xaa, 0x61, 0xc0, 0x7e, 0xd1, 0xc6, 0x18, 0xf5, 0x52, 0xc6, 0x50, 0xf5, 0x88, 0xdf, 0xce, 0x93, + 0xdc, 0x18, 0x50, 0x67, 0xc2, 0xf5, 0x12, 0x6a, 0x56, 0x96, 0x09, 0xfb, 0x49, 0x6b, 0x33, 0xbe, + 0x02, 0xc7, 0x0a, 0x0c, 0x18, 0x0f, 0x84, 0x82, 0xba, 0x47, 0xfc, 0x56, 0xe1, 0x81, 0x50, 0x6c, + 0x40, 0xdb, 0x13, 0x85, 0xbb, 0x19, 0x5f, 0xa5, 0x08, 0x0d, 0xeb, 0xaf, 0x92, 0x8b, 0x9a, 0x70, + 0x13, 0xe3, 0x1e, 0x9a, 0xd6, 0xa0, 0x25, 0x17, 0x35, 0xa3, 0xbd, 0x48, 0x34, 0xb4, 0xce, 0xab, + 0x90, 0xa8, 0x64, 0xf6, 0x87, 0xd2, 0xd1, 0x7e, 0x2b, 0x14, 0xd7, 0x42, 0x6e, 0xa0, 0xed, 0x11, + 0xbf, 0x96, 0x37, 0xb2, 0xdc, 0xec, 0xed, 0x86, 0x0b, 0x0d, 0xd4, 0x1a, 0x35, 0x13, 0xd6, 0xa7, + 0xf5, 0xa9, 0xd8, 0xcc, 0x11, 0xbe, 0x58, 0x33, 0x9c, 0xc8, 0xac, 0x1f, 0xe1, 0x3c, 0x55, 0x89, + 0xd8, 0x21, 0x74, 0xac, 0x5f, 0x4b, 0x36, 0x67, 0x3a, 0x95, 0x4a, 0x63, 0x0c, 0x5f, 0xad, 0x82, + 0xdc, 0x4c, 0x7a, 0x95, 0x4a, 0x95, 0xae, 0xe1, 0x9b, 0x9d, 0x9e, 0xcc, 0x4c, 0x75, 0x2d, 0xd6, + 0x08, 0xdf, 0xad, 0xa9, 0x33, 0xc9, 0xba, 0x6a, 0x85, 0x7c, 0x0d, 0xdd, 0x0f, 0x5d, 0x33, 0x63, + 0xae, 0xb9, 0xe8, 0x3b, 0x85, 0xc9, 0x12, 0x7e, 0x58, 0xa7, 0x52, 0xe0, 0xe0, 0x82, 0xb6, 0xc6, + 0xa8, 0x79, 0xcc, 0x35, 0x37, 0x9d, 0x2e, 0x65, 0x8c, 0x9f, 0x5e, 0x43, 0x6e, 0x66, 0x87, 0xff, + 0x57, 0x69, 0xa2, 0x51, 0x85, 0x41, 0xf6, 0x28, 0xce, 0xb7, 0x70, 0xe6, 0x61, 0xef, 0xf0, 0xea, + 0x56, 0x0e, 0x47, 0x97, 0x3c, 0x1d, 0x5d, 0xf2, 0x72, 0x74, 0xc9, 0xe3, 0x9b, 0x5b, 0x79, 0x0f, + 0x00, 0x00, 0xff, 0xff, 0xee, 0x40, 0xba, 0xd6, 0xa4, 0x02, 0x00, 0x00, +} + func (m *Request) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -179,123 +167,133 @@ func (m *Request) Marshal() (dAtA []byte, err error) { } func (m *Request) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(m.ID)) - dAtA[i] = 0x12 - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Method))) - i += copy(dAtA[i:], m.Method) - dAtA[i] = 0x1a - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Path))) - i += copy(dAtA[i:], m.Path) - dAtA[i] = 0x22 - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Val))) - i += copy(dAtA[i:], m.Val) - dAtA[i] = 0x28 - i++ - if m.Dir { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - i++ - dAtA[i] = 0x32 - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.PrevValue))) - i += copy(dAtA[i:], m.PrevValue) - dAtA[i] = 0x38 - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(m.PrevIndex)) - if m.PrevExist != nil { - dAtA[i] = 0x40 - i++ - if *m.PrevExist { + if m.Refresh != nil { + i-- + if *m.Refresh { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 } - dAtA[i] = 0x48 - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(m.Expiration)) - dAtA[i] = 0x50 - i++ - if m.Wait { + i-- + if m.Stream { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ - dAtA[i] = 0x58 - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(m.Since)) - dAtA[i] = 0x60 - i++ - if m.Recursive { + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + i = encodeVarintEtcdserver(dAtA, i, uint64(m.Time)) + i-- + dAtA[i] = 0x78 + i-- + if m.Quorum { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ - dAtA[i] = 0x68 - i++ + i-- + dAtA[i] = 0x70 + i-- if m.Sorted { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ - dAtA[i] = 0x70 - i++ - if m.Quorum { + i-- + dAtA[i] = 0x68 + i-- + if m.Recursive { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ - dAtA[i] = 0x78 - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(m.Time)) - dAtA[i] = 0x80 - i++ - dAtA[i] = 0x1 - i++ - if m.Stream { + i-- + dAtA[i] = 0x60 + i = encodeVarintEtcdserver(dAtA, i, uint64(m.Since)) + i-- + dAtA[i] = 0x58 + i-- + if m.Wait { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ - if m.Refresh != nil { - dAtA[i] = 0x88 - i++ - dAtA[i] = 0x1 - i++ - if *m.Refresh { + i-- + dAtA[i] = 0x50 + i = encodeVarintEtcdserver(dAtA, i, uint64(m.Expiration)) + i-- + dAtA[i] = 0x48 + if m.PrevExist != nil { + i-- + if *m.PrevExist { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x40 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i = encodeVarintEtcdserver(dAtA, i, uint64(m.PrevIndex)) + i-- + dAtA[i] = 0x38 + i -= len(m.PrevValue) + copy(dAtA[i:], m.PrevValue) + i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.PrevValue))) + i-- + dAtA[i] = 0x32 + i-- + if m.Dir { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } - return i, nil + i-- + dAtA[i] = 0x28 + i -= len(m.Val) + copy(dAtA[i:], m.Val) + i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Val))) + i-- + dAtA[i] = 0x22 + i -= len(m.Path) + copy(dAtA[i:], m.Path) + i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Path))) + i-- + dAtA[i] = 0x1a + i -= len(m.Method) + copy(dAtA[i:], m.Method) + i = encodeVarintEtcdserver(dAtA, i, uint64(len(m.Method))) + i-- + dAtA[i] = 0x12 + i = encodeVarintEtcdserver(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil } func (m *Metadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -303,32 +301,43 @@ func (m *Metadata) Marshal() (dAtA []byte, err error) { } func (m *Metadata) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(m.NodeID)) - dAtA[i] = 0x10 - i++ - i = encodeVarintEtcdserver(dAtA, i, uint64(m.ClusterID)) if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + i = encodeVarintEtcdserver(dAtA, i, uint64(m.ClusterID)) + i-- + dAtA[i] = 0x10 + i = encodeVarintEtcdserver(dAtA, i, uint64(m.NodeID)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil } func encodeVarintEtcdserver(dAtA []byte, offset int, v uint64) int { + offset -= sovEtcdserver(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Request) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovEtcdserver(uint64(m.ID)) @@ -363,6 +372,9 @@ func (m *Request) Size() (n int) { } func (m *Metadata) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovEtcdserver(uint64(m.NodeID)) @@ -374,14 +386,7 @@ func (m *Metadata) Size() (n int) { } func sovEtcdserver(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozEtcdserver(x uint64) (n int) { return sovEtcdserver(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -401,7 +406,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -429,7 +434,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (uint64(b) & 0x7F) << shift + m.ID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -448,7 +453,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -458,6 +463,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthEtcdserver } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEtcdserver + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -477,7 +485,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -487,6 +495,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthEtcdserver } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEtcdserver + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -506,7 +517,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -516,6 +527,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthEtcdserver } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEtcdserver + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -535,7 +549,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -555,7 +569,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -565,6 +579,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthEtcdserver } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEtcdserver + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -584,7 +601,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.PrevIndex |= (uint64(b) & 0x7F) << shift + m.PrevIndex |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -603,7 +620,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -624,7 +641,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Expiration |= (int64(b) & 0x7F) << shift + m.Expiration |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -643,7 +660,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -663,7 +680,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Since |= (uint64(b) & 0x7F) << shift + m.Since |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -682,7 +699,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -702,7 +719,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -722,7 +739,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -742,7 +759,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Time |= (int64(b) & 0x7F) << shift + m.Time |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -761,7 +778,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -781,7 +798,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -797,6 +814,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthEtcdserver } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthEtcdserver + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -825,7 +845,7 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -853,7 +873,7 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NodeID |= (uint64(b) & 0x7F) << shift + m.NodeID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -872,7 +892,7 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ClusterID |= (uint64(b) & 0x7F) << shift + m.ClusterID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -886,6 +906,9 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthEtcdserver } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthEtcdserver + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -953,10 +976,13 @@ func skipEtcdserver(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthEtcdserver } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthEtcdserver + } return iNdEx, nil case 3: for { @@ -985,6 +1011,9 @@ func skipEtcdserver(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthEtcdserver + } } return iNdEx, nil case 4: @@ -1003,33 +1032,3 @@ var ( ErrInvalidLengthEtcdserver = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowEtcdserver = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("etcdserver.proto", fileDescriptorEtcdserver) } - -var fileDescriptorEtcdserver = []byte{ - // 380 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0xd2, 0xdd, 0x6e, 0xda, 0x30, - 0x14, 0x07, 0x70, 0x0c, 0xe1, 0xcb, 0x63, 0x1b, 0xb3, 0xd0, 0x74, 0x84, 0xa6, 0x2c, 0x42, 0xbb, - 0xc8, 0xd5, 0xf6, 0x0e, 0x2c, 0x5c, 0x44, 0x2a, 0x15, 0x0d, 0x15, 0xbd, 0x76, 0xc9, 0x29, 0x58, - 0x02, 0x4c, 0x1d, 0x07, 0xf1, 0x06, 0x7d, 0x85, 0x3e, 0x12, 0x97, 0x7d, 0x82, 0xaa, 0xa5, 0x2f, - 0x52, 0x39, 0x24, 0xc4, 0xed, 0x5d, 0xf4, 0xfb, 0x9f, 0x1c, 0x1f, 0x7f, 0xd0, 0x2e, 0xea, 0x79, - 0x9c, 0xa0, 0xda, 0xa1, 0xfa, 0xbb, 0x55, 0x52, 0x4b, 0xd6, 0x29, 0x65, 0x7b, 0xdb, 0xef, 0x2d, - 0xe4, 0x42, 0x66, 0xc1, 0x3f, 0xf3, 0x75, 0xaa, 0x19, 0x3c, 0x38, 0xb4, 0x19, 0xe1, 0x7d, 0x8a, - 0x89, 0x66, 0x3d, 0x5a, 0x0d, 0x03, 0x20, 0x1e, 0xf1, 0x9d, 0xa1, 0x73, 0x78, 0xfe, 0x5d, 0x89, - 0xaa, 0x61, 0xc0, 0x7e, 0xd1, 0xc6, 0x18, 0xf5, 0x52, 0xc6, 0x50, 0xf5, 0x88, 0xdf, 0xce, 0x93, - 0xdc, 0x18, 0x50, 0x67, 0xc2, 0xf5, 0x12, 0x6a, 0x56, 0x96, 0x09, 0xfb, 0x49, 0x6b, 0x33, 0xbe, - 0x02, 0xc7, 0x0a, 0x0c, 0x18, 0x0f, 0x84, 0x82, 0xba, 0x47, 0xfc, 0x56, 0xe1, 0x81, 0x50, 0x6c, - 0x40, 0xdb, 0x13, 0x85, 0xbb, 0x19, 0x5f, 0xa5, 0x08, 0x0d, 0xeb, 0xaf, 0x92, 0x8b, 0x9a, 0x70, - 0x13, 0xe3, 0x1e, 0x9a, 0xd6, 0xa0, 0x25, 0x17, 0x35, 0xa3, 0xbd, 0x48, 0x34, 0xb4, 0xce, 0xab, - 0x90, 0xa8, 0x64, 0xf6, 0x87, 0xd2, 0xd1, 0x7e, 0x2b, 0x14, 0xd7, 0x42, 0x6e, 0xa0, 0xed, 0x11, - 0xbf, 0x96, 0x37, 0xb2, 0xdc, 0xec, 0xed, 0x86, 0x0b, 0x0d, 0xd4, 0x1a, 0x35, 0x13, 0xd6, 0xa7, - 0xf5, 0xa9, 0xd8, 0xcc, 0x11, 0xbe, 0x58, 0x33, 0x9c, 0xc8, 0xac, 0x1f, 0xe1, 0x3c, 0x55, 0x89, - 0xd8, 0x21, 0x74, 0xac, 0x5f, 0x4b, 0x36, 0x67, 0x3a, 0x95, 0x4a, 0x63, 0x0c, 0x5f, 0xad, 0x82, - 0xdc, 0x4c, 0x7a, 0x95, 0x4a, 0x95, 0xae, 0xe1, 0x9b, 0x9d, 0x9e, 0xcc, 0x4c, 0x75, 0x2d, 0xd6, - 0x08, 0xdf, 0xad, 0xa9, 0x33, 0xc9, 0xba, 0x6a, 0x85, 0x7c, 0x0d, 0xdd, 0x0f, 0x5d, 0x33, 0x63, - 0xae, 0xb9, 0xe8, 0x3b, 0x85, 0xc9, 0x12, 0x7e, 0x58, 0xa7, 0x52, 0xe0, 0xe0, 0x82, 0xb6, 0xc6, - 0xa8, 0x79, 0xcc, 0x35, 0x37, 0x9d, 0x2e, 0x65, 0x8c, 0x9f, 0x5e, 0x43, 0x6e, 0x66, 0x87, 0xff, - 0x57, 0x69, 0xa2, 0x51, 0x85, 0x41, 0xf6, 0x28, 0xce, 0xb7, 0x70, 0xe6, 0x61, 0xef, 0xf0, 0xea, - 0x56, 0x0e, 0x47, 0x97, 0x3c, 0x1d, 0x5d, 0xf2, 0x72, 0x74, 0xc9, 0xe3, 0x9b, 0x5b, 0x79, 0x0f, - 0x00, 0x00, 0xff, 0xff, 0xee, 0x40, 0xba, 0xd6, 0xa4, 0x02, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.pb.go b/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.pb.go index 3084c6cbf..b3a199e9c 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.pb.go +++ b/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/raft_internal.pb.go @@ -4,15 +4,13 @@ package etcdserverpb import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - + fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" - - io "io" + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -20,63 +18,162 @@ 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 RequestHeader struct { ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` // username is a username that is associated with an auth token of gRPC connection Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // auth_revision is a revision number of auth.authStore. It is not related to mvcc - AuthRevision uint64 `protobuf:"varint,3,opt,name=auth_revision,json=authRevision,proto3" json:"auth_revision,omitempty"` + AuthRevision uint64 `protobuf:"varint,3,opt,name=auth_revision,json=authRevision,proto3" json:"auth_revision,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestHeader) Reset() { *m = RequestHeader{} } +func (m *RequestHeader) String() string { return proto.CompactTextString(m) } +func (*RequestHeader) ProtoMessage() {} +func (*RequestHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_b4c9a9be0cfca103, []int{0} +} +func (m *RequestHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RequestHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestHeader.Merge(m, src) +} +func (m *RequestHeader) XXX_Size() int { + return m.Size() +} +func (m *RequestHeader) XXX_DiscardUnknown() { + xxx_messageInfo_RequestHeader.DiscardUnknown(m) } -func (m *RequestHeader) Reset() { *m = RequestHeader{} } -func (m *RequestHeader) String() string { return proto.CompactTextString(m) } -func (*RequestHeader) ProtoMessage() {} -func (*RequestHeader) Descriptor() ([]byte, []int) { return fileDescriptorRaftInternal, []int{0} } +var xxx_messageInfo_RequestHeader proto.InternalMessageInfo // An InternalRaftRequest is the union of all requests which can be // sent via raft. type InternalRaftRequest struct { - Header *RequestHeader `protobuf:"bytes,100,opt,name=header" json:"header,omitempty"` + Header *RequestHeader `protobuf:"bytes,100,opt,name=header,proto3" json:"header,omitempty"` ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - V2 *Request `protobuf:"bytes,2,opt,name=v2" json:"v2,omitempty"` - Range *RangeRequest `protobuf:"bytes,3,opt,name=range" json:"range,omitempty"` - Put *PutRequest `protobuf:"bytes,4,opt,name=put" json:"put,omitempty"` - DeleteRange *DeleteRangeRequest `protobuf:"bytes,5,opt,name=delete_range,json=deleteRange" json:"delete_range,omitempty"` - Txn *TxnRequest `protobuf:"bytes,6,opt,name=txn" json:"txn,omitempty"` - Compaction *CompactionRequest `protobuf:"bytes,7,opt,name=compaction" json:"compaction,omitempty"` - LeaseGrant *LeaseGrantRequest `protobuf:"bytes,8,opt,name=lease_grant,json=leaseGrant" json:"lease_grant,omitempty"` - LeaseRevoke *LeaseRevokeRequest `protobuf:"bytes,9,opt,name=lease_revoke,json=leaseRevoke" json:"lease_revoke,omitempty"` - Alarm *AlarmRequest `protobuf:"bytes,10,opt,name=alarm" json:"alarm,omitempty"` - AuthEnable *AuthEnableRequest `protobuf:"bytes,1000,opt,name=auth_enable,json=authEnable" json:"auth_enable,omitempty"` - AuthDisable *AuthDisableRequest `protobuf:"bytes,1011,opt,name=auth_disable,json=authDisable" json:"auth_disable,omitempty"` - Authenticate *InternalAuthenticateRequest `protobuf:"bytes,1012,opt,name=authenticate" json:"authenticate,omitempty"` - AuthUserAdd *AuthUserAddRequest `protobuf:"bytes,1100,opt,name=auth_user_add,json=authUserAdd" json:"auth_user_add,omitempty"` - AuthUserDelete *AuthUserDeleteRequest `protobuf:"bytes,1101,opt,name=auth_user_delete,json=authUserDelete" json:"auth_user_delete,omitempty"` - AuthUserGet *AuthUserGetRequest `protobuf:"bytes,1102,opt,name=auth_user_get,json=authUserGet" json:"auth_user_get,omitempty"` - AuthUserChangePassword *AuthUserChangePasswordRequest `protobuf:"bytes,1103,opt,name=auth_user_change_password,json=authUserChangePassword" json:"auth_user_change_password,omitempty"` - AuthUserGrantRole *AuthUserGrantRoleRequest `protobuf:"bytes,1104,opt,name=auth_user_grant_role,json=authUserGrantRole" json:"auth_user_grant_role,omitempty"` - AuthUserRevokeRole *AuthUserRevokeRoleRequest `protobuf:"bytes,1105,opt,name=auth_user_revoke_role,json=authUserRevokeRole" json:"auth_user_revoke_role,omitempty"` - AuthUserList *AuthUserListRequest `protobuf:"bytes,1106,opt,name=auth_user_list,json=authUserList" json:"auth_user_list,omitempty"` - AuthRoleList *AuthRoleListRequest `protobuf:"bytes,1107,opt,name=auth_role_list,json=authRoleList" json:"auth_role_list,omitempty"` - AuthRoleAdd *AuthRoleAddRequest `protobuf:"bytes,1200,opt,name=auth_role_add,json=authRoleAdd" json:"auth_role_add,omitempty"` - AuthRoleDelete *AuthRoleDeleteRequest `protobuf:"bytes,1201,opt,name=auth_role_delete,json=authRoleDelete" json:"auth_role_delete,omitempty"` - AuthRoleGet *AuthRoleGetRequest `protobuf:"bytes,1202,opt,name=auth_role_get,json=authRoleGet" json:"auth_role_get,omitempty"` - AuthRoleGrantPermission *AuthRoleGrantPermissionRequest `protobuf:"bytes,1203,opt,name=auth_role_grant_permission,json=authRoleGrantPermission" json:"auth_role_grant_permission,omitempty"` - AuthRoleRevokePermission *AuthRoleRevokePermissionRequest `protobuf:"bytes,1204,opt,name=auth_role_revoke_permission,json=authRoleRevokePermission" json:"auth_role_revoke_permission,omitempty"` + V2 *Request `protobuf:"bytes,2,opt,name=v2,proto3" json:"v2,omitempty"` + Range *RangeRequest `protobuf:"bytes,3,opt,name=range,proto3" json:"range,omitempty"` + Put *PutRequest `protobuf:"bytes,4,opt,name=put,proto3" json:"put,omitempty"` + DeleteRange *DeleteRangeRequest `protobuf:"bytes,5,opt,name=delete_range,json=deleteRange,proto3" json:"delete_range,omitempty"` + Txn *TxnRequest `protobuf:"bytes,6,opt,name=txn,proto3" json:"txn,omitempty"` + Compaction *CompactionRequest `protobuf:"bytes,7,opt,name=compaction,proto3" json:"compaction,omitempty"` + LeaseGrant *LeaseGrantRequest `protobuf:"bytes,8,opt,name=lease_grant,json=leaseGrant,proto3" json:"lease_grant,omitempty"` + LeaseRevoke *LeaseRevokeRequest `protobuf:"bytes,9,opt,name=lease_revoke,json=leaseRevoke,proto3" json:"lease_revoke,omitempty"` + Alarm *AlarmRequest `protobuf:"bytes,10,opt,name=alarm,proto3" json:"alarm,omitempty"` + AuthEnable *AuthEnableRequest `protobuf:"bytes,1000,opt,name=auth_enable,json=authEnable,proto3" json:"auth_enable,omitempty"` + AuthDisable *AuthDisableRequest `protobuf:"bytes,1011,opt,name=auth_disable,json=authDisable,proto3" json:"auth_disable,omitempty"` + Authenticate *InternalAuthenticateRequest `protobuf:"bytes,1012,opt,name=authenticate,proto3" json:"authenticate,omitempty"` + AuthUserAdd *AuthUserAddRequest `protobuf:"bytes,1100,opt,name=auth_user_add,json=authUserAdd,proto3" json:"auth_user_add,omitempty"` + AuthUserDelete *AuthUserDeleteRequest `protobuf:"bytes,1101,opt,name=auth_user_delete,json=authUserDelete,proto3" json:"auth_user_delete,omitempty"` + AuthUserGet *AuthUserGetRequest `protobuf:"bytes,1102,opt,name=auth_user_get,json=authUserGet,proto3" json:"auth_user_get,omitempty"` + AuthUserChangePassword *AuthUserChangePasswordRequest `protobuf:"bytes,1103,opt,name=auth_user_change_password,json=authUserChangePassword,proto3" json:"auth_user_change_password,omitempty"` + AuthUserGrantRole *AuthUserGrantRoleRequest `protobuf:"bytes,1104,opt,name=auth_user_grant_role,json=authUserGrantRole,proto3" json:"auth_user_grant_role,omitempty"` + AuthUserRevokeRole *AuthUserRevokeRoleRequest `protobuf:"bytes,1105,opt,name=auth_user_revoke_role,json=authUserRevokeRole,proto3" json:"auth_user_revoke_role,omitempty"` + AuthUserList *AuthUserListRequest `protobuf:"bytes,1106,opt,name=auth_user_list,json=authUserList,proto3" json:"auth_user_list,omitempty"` + AuthRoleList *AuthRoleListRequest `protobuf:"bytes,1107,opt,name=auth_role_list,json=authRoleList,proto3" json:"auth_role_list,omitempty"` + AuthRoleAdd *AuthRoleAddRequest `protobuf:"bytes,1200,opt,name=auth_role_add,json=authRoleAdd,proto3" json:"auth_role_add,omitempty"` + AuthRoleDelete *AuthRoleDeleteRequest `protobuf:"bytes,1201,opt,name=auth_role_delete,json=authRoleDelete,proto3" json:"auth_role_delete,omitempty"` + AuthRoleGet *AuthRoleGetRequest `protobuf:"bytes,1202,opt,name=auth_role_get,json=authRoleGet,proto3" json:"auth_role_get,omitempty"` + AuthRoleGrantPermission *AuthRoleGrantPermissionRequest `protobuf:"bytes,1203,opt,name=auth_role_grant_permission,json=authRoleGrantPermission,proto3" json:"auth_role_grant_permission,omitempty"` + AuthRoleRevokePermission *AuthRoleRevokePermissionRequest `protobuf:"bytes,1204,opt,name=auth_role_revoke_permission,json=authRoleRevokePermission,proto3" json:"auth_role_revoke_permission,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *InternalRaftRequest) Reset() { *m = InternalRaftRequest{} } -func (m *InternalRaftRequest) String() string { return proto.CompactTextString(m) } -func (*InternalRaftRequest) ProtoMessage() {} -func (*InternalRaftRequest) Descriptor() ([]byte, []int) { return fileDescriptorRaftInternal, []int{1} } +func (m *InternalRaftRequest) Reset() { *m = InternalRaftRequest{} } +func (m *InternalRaftRequest) String() string { return proto.CompactTextString(m) } +func (*InternalRaftRequest) ProtoMessage() {} +func (*InternalRaftRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b4c9a9be0cfca103, []int{1} +} +func (m *InternalRaftRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *InternalRaftRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_InternalRaftRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *InternalRaftRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_InternalRaftRequest.Merge(m, src) +} +func (m *InternalRaftRequest) XXX_Size() int { + return m.Size() +} +func (m *InternalRaftRequest) XXX_DiscardUnknown() { + xxx_messageInfo_InternalRaftRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_InternalRaftRequest proto.InternalMessageInfo type EmptyResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *EmptyResponse) Reset() { *m = EmptyResponse{} } -func (m *EmptyResponse) String() string { return proto.CompactTextString(m) } -func (*EmptyResponse) ProtoMessage() {} -func (*EmptyResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftInternal, []int{2} } +func (m *EmptyResponse) Reset() { *m = EmptyResponse{} } +func (m *EmptyResponse) String() string { return proto.CompactTextString(m) } +func (*EmptyResponse) ProtoMessage() {} +func (*EmptyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b4c9a9be0cfca103, []int{2} +} +func (m *EmptyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EmptyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EmptyResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EmptyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_EmptyResponse.Merge(m, src) +} +func (m *EmptyResponse) XXX_Size() int { + return m.Size() +} +func (m *EmptyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_EmptyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_EmptyResponse proto.InternalMessageInfo // What is the difference between AuthenticateRequest (defined in rpc.proto) and InternalAuthenticateRequest? // InternalAuthenticateRequest has a member that is filled by etcdserver and shouldn't be user-facing. @@ -85,15 +182,44 @@ type InternalAuthenticateRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // simple_token is generated in API layer (etcdserver/v3_server.go) - SimpleToken string `protobuf:"bytes,3,opt,name=simple_token,json=simpleToken,proto3" json:"simple_token,omitempty"` + SimpleToken string `protobuf:"bytes,3,opt,name=simple_token,json=simpleToken,proto3" json:"simple_token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *InternalAuthenticateRequest) Reset() { *m = InternalAuthenticateRequest{} } func (m *InternalAuthenticateRequest) String() string { return proto.CompactTextString(m) } func (*InternalAuthenticateRequest) ProtoMessage() {} func (*InternalAuthenticateRequest) Descriptor() ([]byte, []int) { - return fileDescriptorRaftInternal, []int{3} + return fileDescriptor_b4c9a9be0cfca103, []int{3} +} +func (m *InternalAuthenticateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } +func (m *InternalAuthenticateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_InternalAuthenticateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *InternalAuthenticateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_InternalAuthenticateRequest.Merge(m, src) +} +func (m *InternalAuthenticateRequest) XXX_Size() int { + return m.Size() +} +func (m *InternalAuthenticateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_InternalAuthenticateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_InternalAuthenticateRequest proto.InternalMessageInfo func init() { proto.RegisterType((*RequestHeader)(nil), "etcdserverpb.RequestHeader") @@ -101,10 +227,70 @@ func init() { proto.RegisterType((*EmptyResponse)(nil), "etcdserverpb.EmptyResponse") proto.RegisterType((*InternalAuthenticateRequest)(nil), "etcdserverpb.InternalAuthenticateRequest") } + +func init() { proto.RegisterFile("raft_internal.proto", fileDescriptor_b4c9a9be0cfca103) } + +var fileDescriptor_b4c9a9be0cfca103 = []byte{ + // 840 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x96, 0xdb, 0x4e, 0xdb, 0x48, + 0x18, 0xc7, 0x71, 0x38, 0x66, 0x12, 0xb2, 0xec, 0x00, 0xbb, 0xb3, 0x41, 0xca, 0x86, 0xa0, 0xdd, + 0x65, 0x77, 0x5b, 0x5a, 0x85, 0x07, 0x68, 0x53, 0x82, 0x00, 0x09, 0x21, 0x64, 0x51, 0xa9, 0x52, + 0x2f, 0xdc, 0x21, 0xfe, 0x48, 0x5c, 0x1c, 0xdb, 0x1d, 0x4f, 0x52, 0xfa, 0x26, 0x7d, 0x8c, 0x9e, + 0x1e, 0x82, 0x8b, 0x1e, 0x68, 0xfb, 0x02, 0x2d, 0xbd, 0xe9, 0x55, 0x6f, 0xda, 0x07, 0xa8, 0xe6, + 0x60, 0x3b, 0x4e, 0x1c, 0xee, 0xec, 0x6f, 0xfe, 0xdf, 0xef, 0xfb, 0x0f, 0xf3, 0x37, 0x13, 0xb4, + 0xc8, 0xe8, 0x09, 0xb7, 0x1c, 0x8f, 0x03, 0xf3, 0xa8, 0xbb, 0x11, 0x30, 0x9f, 0xfb, 0xb8, 0x08, + 0xbc, 0x65, 0x87, 0xc0, 0xfa, 0xc0, 0x82, 0xe3, 0xf2, 0x52, 0xdb, 0x6f, 0xfb, 0x72, 0xe1, 0x86, + 0x78, 0x52, 0x9a, 0xf2, 0x42, 0xa2, 0xd1, 0x95, 0x3c, 0x0b, 0x5a, 0xea, 0xb1, 0xf6, 0x00, 0xcd, + 0x9b, 0xf0, 0xa8, 0x07, 0x21, 0xdf, 0x05, 0x6a, 0x03, 0xc3, 0x25, 0x94, 0xdb, 0x6b, 0x12, 0xa3, + 0x6a, 0xac, 0x4f, 0x99, 0xb9, 0xbd, 0x26, 0x2e, 0xa3, 0xb9, 0x5e, 0x28, 0x46, 0x76, 0x81, 0xe4, + 0xaa, 0xc6, 0x7a, 0xde, 0x8c, 0xdf, 0xf1, 0x1a, 0x9a, 0xa7, 0x3d, 0xde, 0xb1, 0x18, 0xf4, 0x9d, + 0xd0, 0xf1, 0x3d, 0x32, 0x29, 0xdb, 0x8a, 0xa2, 0x68, 0xea, 0x5a, 0xed, 0x5b, 0x09, 0x2d, 0xee, + 0x69, 0xd7, 0x26, 0x3d, 0xe1, 0x7a, 0x1c, 0xde, 0x44, 0x33, 0x1d, 0x39, 0x92, 0xd8, 0x55, 0x63, + 0xbd, 0x50, 0x5f, 0xd9, 0x18, 0xdc, 0xcb, 0x46, 0xca, 0x95, 0xa9, 0xa5, 0x23, 0xee, 0xfe, 0x42, + 0xb9, 0x7e, 0x5d, 0xfa, 0x2a, 0xd4, 0x97, 0x33, 0x01, 0x66, 0xae, 0x5f, 0xc7, 0x37, 0xd1, 0x34, + 0xa3, 0x5e, 0x1b, 0xa4, 0xc1, 0x42, 0xbd, 0x3c, 0xa4, 0x14, 0x4b, 0x91, 0x5c, 0x09, 0xf1, 0x7f, + 0x68, 0x32, 0xe8, 0x71, 0x32, 0x25, 0xf5, 0x24, 0xad, 0x3f, 0xec, 0x45, 0x9b, 0x30, 0x85, 0x08, + 0x6f, 0xa1, 0xa2, 0x0d, 0x2e, 0x70, 0xb0, 0xd4, 0x90, 0x69, 0xd9, 0x54, 0x4d, 0x37, 0x35, 0xa5, + 0x22, 0x35, 0xaa, 0x60, 0x27, 0x35, 0x31, 0x90, 0x9f, 0x79, 0x64, 0x26, 0x6b, 0xe0, 0xd1, 0x99, + 0x17, 0x0f, 0xe4, 0x67, 0x1e, 0xbe, 0x85, 0x50, 0xcb, 0xef, 0x06, 0xb4, 0xc5, 0xc5, 0x1f, 0x7d, + 0x56, 0xb6, 0xfc, 0x99, 0x6e, 0xd9, 0x8a, 0xd7, 0xa3, 0xce, 0x81, 0x16, 0x7c, 0x1b, 0x15, 0x5c, + 0xa0, 0x21, 0x58, 0x6d, 0x46, 0x3d, 0x4e, 0xe6, 0xb2, 0x08, 0xfb, 0x42, 0xb0, 0x23, 0xd6, 0x63, + 0x82, 0x1b, 0x97, 0xc4, 0x9e, 0x15, 0x81, 0x41, 0xdf, 0x3f, 0x05, 0x92, 0xcf, 0xda, 0xb3, 0x44, + 0x98, 0x52, 0x10, 0xef, 0xd9, 0x4d, 0x6a, 0xe2, 0x58, 0xa8, 0x4b, 0x59, 0x97, 0xa0, 0xac, 0x63, + 0x69, 0x88, 0xa5, 0xf8, 0x58, 0xa4, 0x10, 0x37, 0x50, 0x41, 0x26, 0x0e, 0x3c, 0x7a, 0xec, 0x02, + 0xf9, 0x9a, 0xb9, 0xf7, 0x46, 0x8f, 0x77, 0xb6, 0xa5, 0x20, 0x76, 0x4e, 0xe3, 0x12, 0x6e, 0x22, + 0x99, 0x4f, 0xcb, 0x76, 0x42, 0xc9, 0xf8, 0x3e, 0x9b, 0x65, 0x5d, 0x30, 0x9a, 0x4a, 0x11, 0x5b, + 0xa7, 0x49, 0x0d, 0x1f, 0x28, 0x0a, 0x78, 0xdc, 0x69, 0x51, 0x0e, 0xe4, 0x87, 0xa2, 0xfc, 0x9b, + 0xa6, 0x44, 0xb9, 0x6f, 0x0c, 0x48, 0x23, 0x5c, 0xaa, 0x1f, 0x6f, 0xeb, 0x4f, 0x49, 0x7c, 0x5b, + 0x16, 0xb5, 0x6d, 0xf2, 0x7a, 0x6e, 0x9c, 0xad, 0xbb, 0x21, 0xb0, 0x86, 0x6d, 0xa7, 0x6c, 0xe9, + 0x1a, 0x3e, 0x40, 0x0b, 0x09, 0x46, 0xc5, 0x8b, 0xbc, 0x51, 0xa4, 0xb5, 0x6c, 0x92, 0xce, 0xa5, + 0x86, 0x95, 0x68, 0xaa, 0x9c, 0xb6, 0xd5, 0x06, 0x4e, 0xde, 0x5e, 0x69, 0x6b, 0x07, 0xf8, 0x88, + 0xad, 0x1d, 0xe0, 0xb8, 0x8d, 0xfe, 0x48, 0x30, 0xad, 0x8e, 0x08, 0xbc, 0x15, 0xd0, 0x30, 0x7c, + 0xec, 0x33, 0x9b, 0xbc, 0x53, 0xc8, 0xff, 0xb3, 0x91, 0x5b, 0x52, 0x7d, 0xa8, 0xc5, 0x11, 0xfd, + 0x37, 0x9a, 0xb9, 0x8c, 0xef, 0xa1, 0xa5, 0x01, 0xbf, 0x22, 0xa9, 0x16, 0xf3, 0x5d, 0x20, 0x17, + 0x6a, 0xc6, 0xdf, 0x63, 0x6c, 0xcb, 0x94, 0xfb, 0xc9, 0x51, 0xff, 0x4a, 0x87, 0x57, 0xf0, 0x7d, + 0xb4, 0x9c, 0x90, 0x55, 0xe8, 0x15, 0xfa, 0xbd, 0x42, 0xff, 0x93, 0x8d, 0xd6, 0xe9, 0x1f, 0x60, + 0x63, 0x3a, 0xb2, 0x84, 0x77, 0x51, 0x29, 0x81, 0xbb, 0x4e, 0xc8, 0xc9, 0x07, 0x45, 0x5d, 0xcd, + 0xa6, 0xee, 0x3b, 0x21, 0x4f, 0xe5, 0x28, 0x2a, 0xc6, 0x24, 0x61, 0x4d, 0x91, 0x3e, 0x8e, 0x25, + 0x89, 0xd1, 0x23, 0xa4, 0xa8, 0x18, 0x1f, 0xbd, 0x24, 0x89, 0x44, 0x3e, 0xcb, 0x8f, 0x3b, 0x7a, + 0xd1, 0x33, 0x9c, 0x48, 0x5d, 0x8b, 0x13, 0x29, 0x31, 0x3a, 0x91, 0xcf, 0xf3, 0xe3, 0x12, 0x29, + 0xba, 0x32, 0x12, 0x99, 0x94, 0xd3, 0xb6, 0x44, 0x22, 0x5f, 0x5c, 0x69, 0x6b, 0x38, 0x91, 0xba, + 0x86, 0x1f, 0xa2, 0xf2, 0x00, 0x46, 0x06, 0x25, 0x00, 0xd6, 0x75, 0x42, 0x79, 0x8f, 0xbd, 0x54, + 0xcc, 0x6b, 0x63, 0x98, 0x42, 0x7e, 0x18, 0xab, 0x23, 0xfe, 0xef, 0x34, 0x7b, 0x1d, 0x77, 0xd1, + 0x4a, 0x32, 0x4b, 0x47, 0x67, 0x60, 0xd8, 0x2b, 0x35, 0xec, 0x7a, 0xf6, 0x30, 0x95, 0x92, 0xd1, + 0x69, 0x84, 0x8e, 0x11, 0xd4, 0x7e, 0x41, 0xf3, 0xdb, 0xdd, 0x80, 0x3f, 0x31, 0x21, 0x0c, 0x7c, + 0x2f, 0x84, 0x5a, 0x80, 0x56, 0xae, 0xf8, 0x47, 0x84, 0x31, 0x9a, 0x92, 0xb7, 0xbb, 0x21, 0x6f, + 0x77, 0xf9, 0x2c, 0x6e, 0xfd, 0xf8, 0xfb, 0xd4, 0xb7, 0x7e, 0xf4, 0x8e, 0x57, 0x51, 0x31, 0x74, + 0xba, 0x81, 0x0b, 0x16, 0xf7, 0x4f, 0x41, 0x5d, 0xfa, 0x79, 0xb3, 0xa0, 0x6a, 0x47, 0xa2, 0x74, + 0x67, 0xe9, 0xfc, 0x73, 0x65, 0xe2, 0xfc, 0xb2, 0x62, 0x5c, 0x5c, 0x56, 0x8c, 0x4f, 0x97, 0x15, + 0xe3, 0xe9, 0x97, 0xca, 0xc4, 0xf1, 0x8c, 0xfc, 0xc9, 0xb1, 0xf9, 0x33, 0x00, 0x00, 0xff, 0xff, + 0xa0, 0xbb, 0x20, 0x2c, 0xca, 0x08, 0x00, 0x00, +} + func (m *RequestHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -112,33 +298,43 @@ func (m *RequestHeader) Marshal() (dAtA []byte, err error) { } func (m *RequestHeader) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ID != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.ID)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.AuthRevision != 0 { + i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthRevision)) + i-- + dAtA[i] = 0x18 } if len(m.Username) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Username) + copy(dAtA[i:], m.Username) i = encodeVarintRaftInternal(dAtA, i, uint64(len(m.Username))) - i += copy(dAtA[i:], m.Username) + i-- + dAtA[i] = 0x12 } - if m.AuthRevision != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthRevision)) + if m.ID != 0 { + i = encodeVarintRaftInternal(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *InternalRaftRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -146,316 +342,377 @@ func (m *InternalRaftRequest) Marshal() (dAtA []byte, err error) { } func (m *InternalRaftRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *InternalRaftRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ID != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.ID)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.V2 != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.V2.Size())) - n1, err := m.V2.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.Range != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.Range.Size())) - n2, err := m.Range.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthRoleRevokePermission != nil { + { + size, err := m.AuthRoleRevokePermission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0x4b + i-- + dAtA[i] = 0xa2 } - if m.Put != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.Put.Size())) - n3, err := m.Put.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthRoleGrantPermission != nil { + { + size, err := m.AuthRoleGrantPermission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n3 + i-- + dAtA[i] = 0x4b + i-- + dAtA[i] = 0x9a } - if m.DeleteRange != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.DeleteRange.Size())) - n4, err := m.DeleteRange.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthRoleGet != nil { + { + size, err := m.AuthRoleGet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n4 + i-- + dAtA[i] = 0x4b + i-- + dAtA[i] = 0x92 } - if m.Txn != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.Txn.Size())) - n5, err := m.Txn.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthRoleDelete != nil { + { + size, err := m.AuthRoleDelete.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n5 + i-- + dAtA[i] = 0x4b + i-- + dAtA[i] = 0x8a } - if m.Compaction != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.Compaction.Size())) - n6, err := m.Compaction.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthRoleAdd != nil { + { + size, err := m.AuthRoleAdd.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n6 + i-- + dAtA[i] = 0x4b + i-- + dAtA[i] = 0x82 } - if m.LeaseGrant != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.LeaseGrant.Size())) - n7, err := m.LeaseGrant.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthRoleList != nil { + { + size, err := m.AuthRoleList.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n7 + i-- + dAtA[i] = 0x45 + i-- + dAtA[i] = 0x9a } - if m.LeaseRevoke != nil { - dAtA[i] = 0x4a - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.LeaseRevoke.Size())) - n8, err := m.LeaseRevoke.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthUserList != nil { + { + size, err := m.AuthUserList.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n8 + i-- + dAtA[i] = 0x45 + i-- + dAtA[i] = 0x92 } - if m.Alarm != nil { - dAtA[i] = 0x52 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.Alarm.Size())) - n9, err := m.Alarm.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthUserRevokeRole != nil { + { + size, err := m.AuthUserRevokeRole.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n9 + i-- + dAtA[i] = 0x45 + i-- + dAtA[i] = 0x8a } - if m.Header != nil { - dAtA[i] = 0xa2 - i++ - dAtA[i] = 0x6 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.Header.Size())) - n10, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthUserGrantRole != nil { + { + size, err := m.AuthUserGrantRole.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n10 + i-- + dAtA[i] = 0x45 + i-- + dAtA[i] = 0x82 } - if m.AuthEnable != nil { - dAtA[i] = 0xc2 - i++ - dAtA[i] = 0x3e - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthEnable.Size())) - n11, err := m.AuthEnable.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthUserChangePassword != nil { + { + size, err := m.AuthUserChangePassword.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n11 + i-- + dAtA[i] = 0x44 + i-- + dAtA[i] = 0xfa } - if m.AuthDisable != nil { - dAtA[i] = 0x9a - i++ - dAtA[i] = 0x3f - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthDisable.Size())) - n12, err := m.AuthDisable.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthUserGet != nil { + { + size, err := m.AuthUserGet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n12 + i-- + dAtA[i] = 0x44 + i-- + dAtA[i] = 0xf2 } - if m.Authenticate != nil { - dAtA[i] = 0xa2 - i++ - dAtA[i] = 0x3f - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.Authenticate.Size())) - n13, err := m.Authenticate.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthUserDelete != nil { + { + size, err := m.AuthUserDelete.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n13 + i-- + dAtA[i] = 0x44 + i-- + dAtA[i] = 0xea } if m.AuthUserAdd != nil { - dAtA[i] = 0xe2 - i++ + { + size, err := m.AuthUserAdd.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x44 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthUserAdd.Size())) - n14, err := m.AuthUserAdd.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + i-- + dAtA[i] = 0xe2 + } + if m.Authenticate != nil { + { + size, err := m.Authenticate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n14 + i-- + dAtA[i] = 0x3f + i-- + dAtA[i] = 0xa2 } - if m.AuthUserDelete != nil { - dAtA[i] = 0xea - i++ - dAtA[i] = 0x44 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthUserDelete.Size())) - n15, err := m.AuthUserDelete.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthDisable != nil { + { + size, err := m.AuthDisable.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n15 + i-- + dAtA[i] = 0x3f + i-- + dAtA[i] = 0x9a } - if m.AuthUserGet != nil { - dAtA[i] = 0xf2 - i++ - dAtA[i] = 0x44 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthUserGet.Size())) - n16, err := m.AuthUserGet.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.AuthEnable != nil { + { + size, err := m.AuthEnable.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n16 + i-- + dAtA[i] = 0x3e + i-- + dAtA[i] = 0xc2 } - if m.AuthUserChangePassword != nil { - dAtA[i] = 0xfa - i++ - dAtA[i] = 0x44 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthUserChangePassword.Size())) - n17, err := m.AuthUserChangePassword.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n17 + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0xa2 } - if m.AuthUserGrantRole != nil { - dAtA[i] = 0x82 - i++ - dAtA[i] = 0x45 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthUserGrantRole.Size())) - n18, err := m.AuthUserGrantRole.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Alarm != nil { + { + size, err := m.Alarm.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n18 + i-- + dAtA[i] = 0x52 } - if m.AuthUserRevokeRole != nil { - dAtA[i] = 0x8a - i++ - dAtA[i] = 0x45 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthUserRevokeRole.Size())) - n19, err := m.AuthUserRevokeRole.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.LeaseRevoke != nil { + { + size, err := m.LeaseRevoke.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n19 + i-- + dAtA[i] = 0x4a } - if m.AuthUserList != nil { - dAtA[i] = 0x92 - i++ - dAtA[i] = 0x45 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthUserList.Size())) - n20, err := m.AuthUserList.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.LeaseGrant != nil { + { + size, err := m.LeaseGrant.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n20 + i-- + dAtA[i] = 0x42 } - if m.AuthRoleList != nil { - dAtA[i] = 0x9a - i++ - dAtA[i] = 0x45 - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthRoleList.Size())) - n21, err := m.AuthRoleList.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Compaction != nil { + { + size, err := m.Compaction.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n21 + i-- + dAtA[i] = 0x3a } - if m.AuthRoleAdd != nil { - dAtA[i] = 0x82 - i++ - dAtA[i] = 0x4b - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthRoleAdd.Size())) - n22, err := m.AuthRoleAdd.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Txn != nil { + { + size, err := m.Txn.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n22 + i-- + dAtA[i] = 0x32 } - if m.AuthRoleDelete != nil { - dAtA[i] = 0x8a - i++ - dAtA[i] = 0x4b - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthRoleDelete.Size())) - n23, err := m.AuthRoleDelete.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.DeleteRange != nil { + { + size, err := m.DeleteRange.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n23 + i-- + dAtA[i] = 0x2a } - if m.AuthRoleGet != nil { - dAtA[i] = 0x92 - i++ - dAtA[i] = 0x4b - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthRoleGet.Size())) - n24, err := m.AuthRoleGet.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Put != nil { + { + size, err := m.Put.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n24 + i-- + dAtA[i] = 0x22 } - if m.AuthRoleGrantPermission != nil { - dAtA[i] = 0x9a - i++ - dAtA[i] = 0x4b - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthRoleGrantPermission.Size())) - n25, err := m.AuthRoleGrantPermission.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Range != nil { + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n25 + i-- + dAtA[i] = 0x1a } - if m.AuthRoleRevokePermission != nil { - dAtA[i] = 0xa2 - i++ - dAtA[i] = 0x4b - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(m.AuthRoleRevokePermission.Size())) - n26, err := m.AuthRoleRevokePermission.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.V2 != nil { + { + size, err := m.V2.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaftInternal(dAtA, i, uint64(size)) } - i += n26 + i-- + dAtA[i] = 0x12 } - return i, nil + if m.ID != 0 { + i = encodeVarintRaftInternal(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *EmptyResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -463,17 +720,26 @@ func (m *EmptyResponse) Marshal() (dAtA []byte, err error) { } func (m *EmptyResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EmptyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *InternalAuthenticateRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -481,41 +747,58 @@ func (m *InternalAuthenticateRequest) Marshal() (dAtA []byte, err error) { } func (m *InternalAuthenticateRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *InternalAuthenticateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SimpleToken) > 0 { + i -= len(m.SimpleToken) + copy(dAtA[i:], m.SimpleToken) + i = encodeVarintRaftInternal(dAtA, i, uint64(len(m.SimpleToken))) + i-- + dAtA[i] = 0x1a } if len(m.Password) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Password) + copy(dAtA[i:], m.Password) i = encodeVarintRaftInternal(dAtA, i, uint64(len(m.Password))) - i += copy(dAtA[i:], m.Password) + i-- + dAtA[i] = 0x12 } - if len(m.SimpleToken) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintRaftInternal(dAtA, i, uint64(len(m.SimpleToken))) - i += copy(dAtA[i:], m.SimpleToken) + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRaftInternal(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintRaftInternal(dAtA []byte, offset int, v uint64) int { + offset -= sovRaftInternal(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *RequestHeader) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ID != 0 { @@ -528,10 +811,16 @@ func (m *RequestHeader) Size() (n int) { if m.AuthRevision != 0 { n += 1 + sovRaftInternal(uint64(m.AuthRevision)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *InternalRaftRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ID != 0 { @@ -641,16 +930,28 @@ func (m *InternalRaftRequest) Size() (n int) { l = m.AuthRoleRevokePermission.Size() n += 2 + l + sovRaftInternal(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *EmptyResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *InternalAuthenticateRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -665,18 +966,14 @@ func (m *InternalAuthenticateRequest) Size() (n int) { if l > 0 { n += 1 + l + sovRaftInternal(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func sovRaftInternal(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRaftInternal(x uint64) (n int) { return sovRaftInternal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -696,7 +993,7 @@ func (m *RequestHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -724,7 +1021,7 @@ func (m *RequestHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (uint64(b) & 0x7F) << shift + m.ID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -743,7 +1040,7 @@ func (m *RequestHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -753,6 +1050,9 @@ func (m *RequestHeader) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -772,7 +1072,7 @@ func (m *RequestHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.AuthRevision |= (uint64(b) & 0x7F) << shift + m.AuthRevision |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -786,9 +1086,13 @@ func (m *RequestHeader) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaftInternal } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaftInternal + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -813,7 +1117,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -841,7 +1145,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (uint64(b) & 0x7F) << shift + m.ID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -860,7 +1164,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -869,6 +1173,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -893,7 +1200,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -902,6 +1209,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -926,7 +1236,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -935,6 +1245,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -959,7 +1272,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -968,6 +1281,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -992,7 +1308,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1001,6 +1317,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1025,7 +1344,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1034,6 +1353,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1058,7 +1380,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1067,6 +1389,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1091,7 +1416,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1100,6 +1425,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1124,7 +1452,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1133,6 +1461,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1157,7 +1488,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1166,6 +1497,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1190,7 +1524,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1199,6 +1533,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1223,7 +1560,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1232,6 +1569,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1256,7 +1596,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1265,6 +1605,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1289,7 +1632,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1298,6 +1641,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1322,7 +1668,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1331,6 +1677,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1355,7 +1704,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1364,6 +1713,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1388,7 +1740,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1397,6 +1749,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1421,7 +1776,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1430,6 +1785,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1454,7 +1812,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1463,6 +1821,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1487,7 +1848,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1496,6 +1857,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1520,7 +1884,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1529,6 +1893,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1553,7 +1920,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1562,6 +1929,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1586,7 +1956,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1595,6 +1965,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1619,7 +1992,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1628,6 +2001,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1652,7 +2028,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1661,6 +2037,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1685,7 +2064,7 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1694,6 +2073,9 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1713,9 +2095,13 @@ func (m *InternalRaftRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaftInternal } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaftInternal + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1740,7 +2126,7 @@ func (m *EmptyResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1763,9 +2149,13 @@ func (m *EmptyResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaftInternal } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaftInternal + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1790,7 +2180,7 @@ func (m *InternalAuthenticateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1818,7 +2208,7 @@ func (m *InternalAuthenticateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1828,6 +2218,9 @@ func (m *InternalAuthenticateRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1847,7 +2240,7 @@ func (m *InternalAuthenticateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1857,6 +2250,9 @@ func (m *InternalAuthenticateRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1876,7 +2272,7 @@ func (m *InternalAuthenticateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1886,6 +2282,9 @@ func (m *InternalAuthenticateRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaftInternal } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRaftInternal + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1900,9 +2299,13 @@ func (m *InternalAuthenticateRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaftInternal } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaftInternal + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1966,10 +2369,13 @@ func skipRaftInternal(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthRaftInternal } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthRaftInternal + } return iNdEx, nil case 3: for { @@ -1998,6 +2404,9 @@ func skipRaftInternal(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthRaftInternal + } } return iNdEx, nil case 4: @@ -2016,62 +2425,3 @@ var ( ErrInvalidLengthRaftInternal = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowRaftInternal = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("raft_internal.proto", fileDescriptorRaftInternal) } - -var fileDescriptorRaftInternal = []byte{ - // 837 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x96, 0xdd, 0x52, 0xd3, 0x40, - 0x14, 0xc7, 0x69, 0xf9, 0xec, 0xb6, 0x54, 0x5c, 0x40, 0xd7, 0x32, 0x53, 0xa1, 0x8c, 0x8a, 0x5f, - 0xe8, 0x94, 0x07, 0xd0, 0x4a, 0x19, 0x60, 0x86, 0x61, 0x98, 0x0c, 0xce, 0x38, 0xe3, 0x45, 0x5c, - 0x9a, 0x43, 0x1b, 0x49, 0x93, 0xb8, 0xd9, 0x56, 0x7c, 0x13, 0x1f, 0xc3, 0xaf, 0x87, 0xe0, 0xc2, - 0x0f, 0xd4, 0x17, 0x50, 0xbc, 0xf1, 0xca, 0x1b, 0x7d, 0x00, 0x67, 0x3f, 0x92, 0x34, 0x6d, 0xca, - 0x5d, 0x72, 0xce, 0xff, 0xfc, 0xce, 0xd9, 0xec, 0x7f, 0xbb, 0x45, 0xb3, 0x8c, 0x1e, 0x72, 0xd3, - 0x76, 0x39, 0x30, 0x97, 0x3a, 0xab, 0x3e, 0xf3, 0xb8, 0x87, 0x0b, 0xc0, 0x1b, 0x56, 0x00, 0xac, - 0x0b, 0xcc, 0x3f, 0x28, 0xcd, 0x35, 0xbd, 0xa6, 0x27, 0x13, 0xf7, 0xc4, 0x93, 0xd2, 0x94, 0x66, - 0x62, 0x8d, 0x8e, 0xe4, 0x98, 0xdf, 0x50, 0x8f, 0x95, 0x67, 0x68, 0xda, 0x80, 0x17, 0x1d, 0x08, - 0xf8, 0x16, 0x50, 0x0b, 0x18, 0x2e, 0xa2, 0xec, 0x76, 0x9d, 0x64, 0x16, 0x33, 0x2b, 0x63, 0x46, - 0x76, 0xbb, 0x8e, 0x4b, 0x68, 0xaa, 0x13, 0x88, 0x96, 0x6d, 0x20, 0xd9, 0xc5, 0xcc, 0x4a, 0xce, - 0x88, 0xde, 0xf1, 0x32, 0x9a, 0xa6, 0x1d, 0xde, 0x32, 0x19, 0x74, 0xed, 0xc0, 0xf6, 0x5c, 0x32, - 0x2a, 0xcb, 0x0a, 0x22, 0x68, 0xe8, 0x58, 0xe5, 0x4f, 0x11, 0xcd, 0x6e, 0xeb, 0xa9, 0x0d, 0x7a, - 0xc8, 0x75, 0xbb, 0x81, 0x46, 0xd7, 0x50, 0xb6, 0x5b, 0x95, 0x2d, 0xf2, 0xd5, 0xf9, 0xd5, 0xde, - 0x75, 0xad, 0xea, 0x12, 0x23, 0xdb, 0xad, 0xe2, 0xfb, 0x68, 0x9c, 0x51, 0xb7, 0x09, 0xb2, 0x57, - 0xbe, 0x5a, 0xea, 0x53, 0x8a, 0x54, 0x28, 0x57, 0x42, 0x7c, 0x0b, 0x8d, 0xfa, 0x1d, 0x4e, 0xc6, - 0xa4, 0x9e, 0x24, 0xf5, 0x7b, 0x9d, 0x70, 0x1e, 0x43, 0x88, 0xf0, 0x3a, 0x2a, 0x58, 0xe0, 0x00, - 0x07, 0x53, 0x35, 0x19, 0x97, 0x45, 0x8b, 0xc9, 0xa2, 0xba, 0x54, 0x24, 0x5a, 0xe5, 0xad, 0x38, - 0x26, 0x1a, 0xf2, 0x63, 0x97, 0x4c, 0xa4, 0x35, 0xdc, 0x3f, 0x76, 0xa3, 0x86, 0xfc, 0xd8, 0xc5, - 0x0f, 0x10, 0x6a, 0x78, 0x6d, 0x9f, 0x36, 0xb8, 0xf8, 0x7e, 0x93, 0xb2, 0xe4, 0x6a, 0xb2, 0x64, - 0x3d, 0xca, 0x87, 0x95, 0x3d, 0x25, 0xf8, 0x21, 0xca, 0x3b, 0x40, 0x03, 0x30, 0x9b, 0x8c, 0xba, - 0x9c, 0x4c, 0xa5, 0x11, 0x76, 0x84, 0x60, 0x53, 0xe4, 0x23, 0x82, 0x13, 0x85, 0xc4, 0x9a, 0x15, - 0x81, 0x41, 0xd7, 0x3b, 0x02, 0x92, 0x4b, 0x5b, 0xb3, 0x44, 0x18, 0x52, 0x10, 0xad, 0xd9, 0x89, - 0x63, 0x62, 0x5b, 0xa8, 0x43, 0x59, 0x9b, 0xa0, 0xb4, 0x6d, 0xa9, 0x89, 0x54, 0xb4, 0x2d, 0x52, - 0x88, 0xd7, 0xd0, 0x44, 0x4b, 0x5a, 0x8e, 0x58, 0xb2, 0x64, 0x21, 0x75, 0xcf, 0x95, 0x2b, 0x0d, - 0x2d, 0xc5, 0x35, 0x94, 0x97, 0x8e, 0x03, 0x97, 0x1e, 0x38, 0x40, 0x7e, 0xa7, 0x7e, 0xb0, 0x5a, - 0x87, 0xb7, 0x36, 0xa4, 0x20, 0x5a, 0x2e, 0x8d, 0x42, 0xb8, 0x8e, 0xa4, 0x3f, 0x4d, 0xcb, 0x0e, - 0x24, 0xe3, 0xef, 0x64, 0xda, 0x7a, 0x05, 0xa3, 0xae, 0x14, 0xd1, 0x7a, 0x69, 0x1c, 0xc3, 0xbb, - 0x8a, 0x02, 0x2e, 0xb7, 0x1b, 0x94, 0x03, 0xf9, 0xa7, 0x28, 0x37, 0x93, 0x94, 0xd0, 0xf7, 0xb5, - 0x1e, 0x69, 0x88, 0x4b, 0xd4, 0xe3, 0x0d, 0x7d, 0x94, 0xc4, 0xd9, 0x32, 0xa9, 0x65, 0x91, 0x8f, - 0x53, 0xc3, 0xc6, 0x7a, 0x1c, 0x00, 0xab, 0x59, 0x56, 0x62, 0x2c, 0x1d, 0xc3, 0xbb, 0x68, 0x26, - 0xc6, 0x28, 0x4f, 0x92, 0x4f, 0x8a, 0xb4, 0x9c, 0x4e, 0xd2, 0x66, 0xd6, 0xb0, 0x22, 0x4d, 0x84, - 0x93, 0x63, 0x35, 0x81, 0x93, 0xcf, 0xe7, 0x8e, 0xb5, 0x09, 0x7c, 0x60, 0xac, 0x4d, 0xe0, 0xb8, - 0x89, 0xae, 0xc4, 0x98, 0x46, 0x4b, 0x9c, 0x12, 0xd3, 0xa7, 0x41, 0xf0, 0xd2, 0x63, 0x16, 0xf9, - 0xa2, 0x90, 0xb7, 0xd3, 0x91, 0xeb, 0x52, 0xbd, 0xa7, 0xc5, 0x21, 0xfd, 0x12, 0x4d, 0x4d, 0xe3, - 0x27, 0x68, 0xae, 0x67, 0x5e, 0x61, 0x6f, 0x93, 0x79, 0x0e, 0x90, 0x53, 0xd5, 0xe3, 0xfa, 0x90, - 0xb1, 0xe5, 0xd1, 0xf0, 0xe2, 0xad, 0xbe, 0x48, 0xfb, 0x33, 0xf8, 0x29, 0x9a, 0x8f, 0xc9, 0xea, - 0xa4, 0x28, 0xf4, 0x57, 0x85, 0xbe, 0x91, 0x8e, 0xd6, 0x47, 0xa6, 0x87, 0x8d, 0xe9, 0x40, 0x0a, - 0x6f, 0xa1, 0x62, 0x0c, 0x77, 0xec, 0x80, 0x93, 0x6f, 0x8a, 0xba, 0x94, 0x4e, 0xdd, 0xb1, 0x03, - 0x9e, 0xf0, 0x51, 0x18, 0x8c, 0x48, 0x62, 0x34, 0x45, 0xfa, 0x3e, 0x94, 0x24, 0x5a, 0x0f, 0x90, - 0xc2, 0x60, 0xb4, 0xf5, 0x92, 0x24, 0x1c, 0xf9, 0x26, 0x37, 0x6c, 0xeb, 0x45, 0x4d, 0xbf, 0x23, - 0x75, 0x2c, 0x72, 0xa4, 0xc4, 0x68, 0x47, 0xbe, 0xcd, 0x0d, 0x73, 0xa4, 0xa8, 0x4a, 0x71, 0x64, - 0x1c, 0x4e, 0x8e, 0x25, 0x1c, 0xf9, 0xee, 0xdc, 0xb1, 0xfa, 0x1d, 0xa9, 0x63, 0xf8, 0x39, 0x2a, - 0xf5, 0x60, 0xa4, 0x51, 0x7c, 0x60, 0x6d, 0x3b, 0x90, 0xf7, 0xd8, 0x7b, 0xc5, 0xbc, 0x33, 0x84, - 0x29, 0xe4, 0x7b, 0x91, 0x3a, 0xe4, 0x5f, 0xa6, 0xe9, 0x79, 0xdc, 0x46, 0x0b, 0x71, 0x2f, 0x6d, - 0x9d, 0x9e, 0x66, 0x1f, 0x54, 0xb3, 0xbb, 0xe9, 0xcd, 0x94, 0x4b, 0x06, 0xbb, 0x11, 0x3a, 0x44, - 0x50, 0xb9, 0x80, 0xa6, 0x37, 0xda, 0x3e, 0x7f, 0x65, 0x40, 0xe0, 0x7b, 0x6e, 0x00, 0x15, 0x1f, - 0x2d, 0x9c, 0xf3, 0x43, 0x84, 0x31, 0x1a, 0x93, 0xb7, 0x7b, 0x46, 0xde, 0xee, 0xf2, 0x59, 0xdc, - 0xfa, 0xd1, 0xf9, 0xd4, 0xb7, 0x7e, 0xf8, 0x8e, 0x97, 0x50, 0x21, 0xb0, 0xdb, 0xbe, 0x03, 0x26, - 0xf7, 0x8e, 0x40, 0x5d, 0xfa, 0x39, 0x23, 0xaf, 0x62, 0xfb, 0x22, 0xf4, 0x68, 0xee, 0xe4, 0x67, - 0x79, 0xe4, 0xe4, 0xac, 0x9c, 0x39, 0x3d, 0x2b, 0x67, 0x7e, 0x9c, 0x95, 0x33, 0xaf, 0x7f, 0x95, - 0x47, 0x0e, 0x26, 0xe4, 0x5f, 0x8e, 0xb5, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xc9, 0xfc, - 0x0e, 0xca, 0x08, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.go b/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.go index 40147f935..a0cff8ffd 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.go +++ b/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.go @@ -4,23 +4,20 @@ package etcdserverpb import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - + context "context" + fmt "fmt" + io "io" math "math" - - _ "github.com/gogo/protobuf/gogoproto" - - mvccpb "github.com/coreos/etcd/mvcc/mvccpb" + math_bits "math/bits" authpb "github.com/coreos/etcd/auth/authpb" - - context "golang.org/x/net/context" - + mvccpb "github.com/coreos/etcd/mvcc/mvccpb" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" - - io "io" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" ) // Reference imports to suppress errors if they are not otherwise used. @@ -28,6 +25,12 @@ 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 AlarmType int32 const ( @@ -41,6 +44,7 @@ var AlarmType_name = map[int32]string{ 1: "NOSPACE", 2: "CORRUPT", } + var AlarmType_value = map[string]int32{ "NONE": 0, "NOSPACE": 1, @@ -50,7 +54,10 @@ var AlarmType_value = map[string]int32{ func (x AlarmType) String() string { return proto.EnumName(AlarmType_name, int32(x)) } -func (AlarmType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRpc, []int{0} } + +func (AlarmType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{0} +} type RangeRequest_SortOrder int32 @@ -65,6 +72,7 @@ var RangeRequest_SortOrder_name = map[int32]string{ 1: "ASCEND", 2: "DESCEND", } + var RangeRequest_SortOrder_value = map[string]int32{ "NONE": 0, "ASCEND": 1, @@ -74,7 +82,10 @@ var RangeRequest_SortOrder_value = map[string]int32{ func (x RangeRequest_SortOrder) String() string { return proto.EnumName(RangeRequest_SortOrder_name, int32(x)) } -func (RangeRequest_SortOrder) EnumDescriptor() ([]byte, []int) { return fileDescriptorRpc, []int{1, 0} } + +func (RangeRequest_SortOrder) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{1, 0} +} type RangeRequest_SortTarget int32 @@ -93,6 +104,7 @@ var RangeRequest_SortTarget_name = map[int32]string{ 3: "MOD", 4: "VALUE", } + var RangeRequest_SortTarget_value = map[string]int32{ "KEY": 0, "VERSION": 1, @@ -104,7 +116,10 @@ var RangeRequest_SortTarget_value = map[string]int32{ func (x RangeRequest_SortTarget) String() string { return proto.EnumName(RangeRequest_SortTarget_name, int32(x)) } -func (RangeRequest_SortTarget) EnumDescriptor() ([]byte, []int) { return fileDescriptorRpc, []int{1, 1} } + +func (RangeRequest_SortTarget) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{1, 1} +} type Compare_CompareResult int32 @@ -121,6 +136,7 @@ var Compare_CompareResult_name = map[int32]string{ 2: "LESS", 3: "NOT_EQUAL", } + var Compare_CompareResult_value = map[string]int32{ "EQUAL": 0, "GREATER": 1, @@ -131,7 +147,10 @@ var Compare_CompareResult_value = map[string]int32{ func (x Compare_CompareResult) String() string { return proto.EnumName(Compare_CompareResult_name, int32(x)) } -func (Compare_CompareResult) EnumDescriptor() ([]byte, []int) { return fileDescriptorRpc, []int{9, 0} } + +func (Compare_CompareResult) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{9, 0} +} type Compare_CompareTarget int32 @@ -150,6 +169,7 @@ var Compare_CompareTarget_name = map[int32]string{ 3: "VALUE", 4: "LEASE", } + var Compare_CompareTarget_value = map[string]int32{ "VERSION": 0, "CREATE": 1, @@ -161,7 +181,10 @@ var Compare_CompareTarget_value = map[string]int32{ func (x Compare_CompareTarget) String() string { return proto.EnumName(Compare_CompareTarget_name, int32(x)) } -func (Compare_CompareTarget) EnumDescriptor() ([]byte, []int) { return fileDescriptorRpc, []int{9, 1} } + +func (Compare_CompareTarget) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{9, 1} +} type WatchCreateRequest_FilterType int32 @@ -176,6 +199,7 @@ var WatchCreateRequest_FilterType_name = map[int32]string{ 0: "NOPUT", 1: "NODELETE", } + var WatchCreateRequest_FilterType_value = map[string]int32{ "NOPUT": 0, "NODELETE": 1, @@ -184,8 +208,9 @@ var WatchCreateRequest_FilterType_value = map[string]int32{ func (x WatchCreateRequest_FilterType) String() string { return proto.EnumName(WatchCreateRequest_FilterType_name, int32(x)) } + func (WatchCreateRequest_FilterType) EnumDescriptor() ([]byte, []int) { - return fileDescriptorRpc, []int{21, 0} + return fileDescriptor_77a6da22d6a3feb1, []int{21, 0} } type AlarmRequest_AlarmAction int32 @@ -201,6 +226,7 @@ var AlarmRequest_AlarmAction_name = map[int32]string{ 1: "ACTIVATE", 2: "DEACTIVATE", } + var AlarmRequest_AlarmAction_value = map[string]int32{ "GET": 0, "ACTIVATE": 1, @@ -210,8 +236,9 @@ var AlarmRequest_AlarmAction_value = map[string]int32{ func (x AlarmRequest_AlarmAction) String() string { return proto.EnumName(AlarmRequest_AlarmAction_name, int32(x)) } + func (AlarmRequest_AlarmAction) EnumDescriptor() ([]byte, []int) { - return fileDescriptorRpc, []int{48, 0} + return fileDescriptor_77a6da22d6a3feb1, []int{49, 0} } type ResponseHeader struct { @@ -220,15 +247,49 @@ type ResponseHeader struct { // member_id is the ID of the member which sent the response. MemberId uint64 `protobuf:"varint,2,opt,name=member_id,json=memberId,proto3" json:"member_id,omitempty"` // revision is the key-value store revision when the request was applied. + // For watch progress responses, the header.revision indicates progress. All future events + // recieved in this stream are guaranteed to have a higher revision number than the + // header.revision number. Revision int64 `protobuf:"varint,3,opt,name=revision,proto3" json:"revision,omitempty"` // raft_term is the raft term when the request was applied. - RaftTerm uint64 `protobuf:"varint,4,opt,name=raft_term,json=raftTerm,proto3" json:"raft_term,omitempty"` + RaftTerm uint64 `protobuf:"varint,4,opt,name=raft_term,json=raftTerm,proto3" json:"raft_term,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseHeader) Reset() { *m = ResponseHeader{} } +func (m *ResponseHeader) String() string { return proto.CompactTextString(m) } +func (*ResponseHeader) ProtoMessage() {} +func (*ResponseHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{0} +} +func (m *ResponseHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResponseHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResponseHeader.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResponseHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseHeader.Merge(m, src) +} +func (m *ResponseHeader) XXX_Size() int { + return m.Size() +} +func (m *ResponseHeader) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseHeader.DiscardUnknown(m) } -func (m *ResponseHeader) Reset() { *m = ResponseHeader{} } -func (m *ResponseHeader) String() string { return proto.CompactTextString(m) } -func (*ResponseHeader) ProtoMessage() {} -func (*ResponseHeader) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{0} } +var xxx_messageInfo_ResponseHeader proto.InternalMessageInfo func (m *ResponseHeader) GetClusterId() uint64 { if m != nil { @@ -300,13 +361,44 @@ type RangeRequest struct { MinCreateRevision int64 `protobuf:"varint,12,opt,name=min_create_revision,json=minCreateRevision,proto3" json:"min_create_revision,omitempty"` // max_create_revision is the upper bound for returned key create revisions; all keys with // greater create revisions will be filtered away. - MaxCreateRevision int64 `protobuf:"varint,13,opt,name=max_create_revision,json=maxCreateRevision,proto3" json:"max_create_revision,omitempty"` + MaxCreateRevision int64 `protobuf:"varint,13,opt,name=max_create_revision,json=maxCreateRevision,proto3" json:"max_create_revision,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RangeRequest) Reset() { *m = RangeRequest{} } +func (m *RangeRequest) String() string { return proto.CompactTextString(m) } +func (*RangeRequest) ProtoMessage() {} +func (*RangeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{1} +} +func (m *RangeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RangeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RangeRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RangeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_RangeRequest.Merge(m, src) +} +func (m *RangeRequest) XXX_Size() int { + return m.Size() +} +func (m *RangeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_RangeRequest.DiscardUnknown(m) } -func (m *RangeRequest) Reset() { *m = RangeRequest{} } -func (m *RangeRequest) String() string { return proto.CompactTextString(m) } -func (*RangeRequest) ProtoMessage() {} -func (*RangeRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{1} } +var xxx_messageInfo_RangeRequest proto.InternalMessageInfo func (m *RangeRequest) GetKey() []byte { if m != nil { @@ -400,20 +492,51 @@ func (m *RangeRequest) GetMaxCreateRevision() int64 { } type RangeResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // kvs is the list of key-value pairs matched by the range request. // kvs is empty when count is requested. - Kvs []*mvccpb.KeyValue `protobuf:"bytes,2,rep,name=kvs" json:"kvs,omitempty"` + Kvs []*mvccpb.KeyValue `protobuf:"bytes,2,rep,name=kvs,proto3" json:"kvs,omitempty"` // more indicates if there are more keys to return in the requested range. More bool `protobuf:"varint,3,opt,name=more,proto3" json:"more,omitempty"` // count is set to the number of keys within the range when requested. - Count int64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + Count int64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RangeResponse) Reset() { *m = RangeResponse{} } +func (m *RangeResponse) String() string { return proto.CompactTextString(m) } +func (*RangeResponse) ProtoMessage() {} +func (*RangeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{2} +} +func (m *RangeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RangeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RangeResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RangeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_RangeResponse.Merge(m, src) +} +func (m *RangeResponse) XXX_Size() int { + return m.Size() +} +func (m *RangeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_RangeResponse.DiscardUnknown(m) } -func (m *RangeResponse) Reset() { *m = RangeResponse{} } -func (m *RangeResponse) String() string { return proto.CompactTextString(m) } -func (*RangeResponse) ProtoMessage() {} -func (*RangeResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{2} } +var xxx_messageInfo_RangeResponse proto.InternalMessageInfo func (m *RangeResponse) GetHeader() *ResponseHeader { if m != nil { @@ -459,13 +582,44 @@ type PutRequest struct { IgnoreValue bool `protobuf:"varint,5,opt,name=ignore_value,json=ignoreValue,proto3" json:"ignore_value,omitempty"` // If ignore_lease is set, etcd updates the key using its current lease. // Returns an error if the key does not exist. - IgnoreLease bool `protobuf:"varint,6,opt,name=ignore_lease,json=ignoreLease,proto3" json:"ignore_lease,omitempty"` + IgnoreLease bool `protobuf:"varint,6,opt,name=ignore_lease,json=ignoreLease,proto3" json:"ignore_lease,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptor_77a6da22d6a3feb1, []int{3} +} +func (m *PutRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutRequest.Merge(m, src) +} +func (m *PutRequest) XXX_Size() int { + return m.Size() +} +func (m *PutRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PutRequest.DiscardUnknown(m) } -func (m *PutRequest) Reset() { *m = PutRequest{} } -func (m *PutRequest) String() string { return proto.CompactTextString(m) } -func (*PutRequest) ProtoMessage() {} -func (*PutRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{3} } +var xxx_messageInfo_PutRequest proto.InternalMessageInfo func (m *PutRequest) GetKey() []byte { if m != nil { @@ -510,15 +664,46 @@ func (m *PutRequest) GetIgnoreLease() bool { } type PutResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // if prev_kv is set in the request, the previous key-value pair will be returned. - PrevKv *mvccpb.KeyValue `protobuf:"bytes,2,opt,name=prev_kv,json=prevKv" json:"prev_kv,omitempty"` + PrevKv *mvccpb.KeyValue `protobuf:"bytes,2,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptor_77a6da22d6a3feb1, []int{4} +} +func (m *PutResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PutResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PutResponse.Merge(m, src) +} +func (m *PutResponse) XXX_Size() int { + return m.Size() +} +func (m *PutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PutResponse.DiscardUnknown(m) } -func (m *PutResponse) Reset() { *m = PutResponse{} } -func (m *PutResponse) String() string { return proto.CompactTextString(m) } -func (*PutResponse) ProtoMessage() {} -func (*PutResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{4} } +var xxx_messageInfo_PutResponse proto.InternalMessageInfo func (m *PutResponse) GetHeader() *ResponseHeader { if m != nil { @@ -545,13 +730,44 @@ type DeleteRangeRequest struct { RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` // If prev_kv is set, etcd gets the previous key-value pairs before deleting it. // The previous key-value pairs will be returned in the delete response. - PrevKv bool `protobuf:"varint,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + PrevKv bool `protobuf:"varint,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptor_77a6da22d6a3feb1, []int{5} +} +func (m *DeleteRangeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteRangeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteRangeRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteRangeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRangeRequest.Merge(m, src) +} +func (m *DeleteRangeRequest) XXX_Size() int { + return m.Size() +} +func (m *DeleteRangeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRangeRequest.DiscardUnknown(m) } -func (m *DeleteRangeRequest) Reset() { *m = DeleteRangeRequest{} } -func (m *DeleteRangeRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRangeRequest) ProtoMessage() {} -func (*DeleteRangeRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{5} } +var xxx_messageInfo_DeleteRangeRequest proto.InternalMessageInfo func (m *DeleteRangeRequest) GetKey() []byte { if m != nil { @@ -575,17 +791,48 @@ func (m *DeleteRangeRequest) GetPrevKv() bool { } type DeleteRangeResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // deleted is the number of keys deleted by the delete range request. Deleted int64 `protobuf:"varint,2,opt,name=deleted,proto3" json:"deleted,omitempty"` // if prev_kv is set in the request, the previous key-value pairs will be returned. - PrevKvs []*mvccpb.KeyValue `protobuf:"bytes,3,rep,name=prev_kvs,json=prevKvs" json:"prev_kvs,omitempty"` + PrevKvs []*mvccpb.KeyValue `protobuf:"bytes,3,rep,name=prev_kvs,json=prevKvs,proto3" json:"prev_kvs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptor_77a6da22d6a3feb1, []int{6} +} +func (m *DeleteRangeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeleteRangeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeleteRangeResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DeleteRangeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRangeResponse.Merge(m, src) +} +func (m *DeleteRangeResponse) XXX_Size() int { + return m.Size() +} +func (m *DeleteRangeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRangeResponse.DiscardUnknown(m) } -func (m *DeleteRangeResponse) Reset() { *m = DeleteRangeResponse{} } -func (m *DeleteRangeResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteRangeResponse) ProtoMessage() {} -func (*DeleteRangeResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{6} } +var xxx_messageInfo_DeleteRangeResponse proto.InternalMessageInfo func (m *DeleteRangeResponse) GetHeader() *ResponseHeader { if m != nil { @@ -616,13 +863,44 @@ type RequestOp struct { // *RequestOp_RequestPut // *RequestOp_RequestDeleteRange // *RequestOp_RequestTxn - Request isRequestOp_Request `protobuf_oneof:"request"` + Request isRequestOp_Request `protobuf_oneof:"request"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestOp) Reset() { *m = RequestOp{} } +func (m *RequestOp) String() string { return proto.CompactTextString(m) } +func (*RequestOp) ProtoMessage() {} +func (*RequestOp) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{7} +} +func (m *RequestOp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestOp.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RequestOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestOp.Merge(m, src) +} +func (m *RequestOp) XXX_Size() int { + return m.Size() +} +func (m *RequestOp) XXX_DiscardUnknown() { + xxx_messageInfo_RequestOp.DiscardUnknown(m) } -func (m *RequestOp) Reset() { *m = RequestOp{} } -func (m *RequestOp) String() string { return proto.CompactTextString(m) } -func (*RequestOp) ProtoMessage() {} -func (*RequestOp) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{7} } +var xxx_messageInfo_RequestOp proto.InternalMessageInfo type isRequestOp_Request interface { isRequestOp_Request() @@ -631,16 +909,16 @@ type isRequestOp_Request interface { } type RequestOp_RequestRange struct { - RequestRange *RangeRequest `protobuf:"bytes,1,opt,name=request_range,json=requestRange,oneof"` + RequestRange *RangeRequest `protobuf:"bytes,1,opt,name=request_range,json=requestRange,proto3,oneof"` } type RequestOp_RequestPut struct { - RequestPut *PutRequest `protobuf:"bytes,2,opt,name=request_put,json=requestPut,oneof"` + RequestPut *PutRequest `protobuf:"bytes,2,opt,name=request_put,json=requestPut,proto3,oneof"` } type RequestOp_RequestDeleteRange struct { - RequestDeleteRange *DeleteRangeRequest `protobuf:"bytes,3,opt,name=request_delete_range,json=requestDeleteRange,oneof"` + RequestDeleteRange *DeleteRangeRequest `protobuf:"bytes,3,opt,name=request_delete_range,json=requestDeleteRange,proto3,oneof"` } type RequestOp_RequestTxn struct { - RequestTxn *TxnRequest `protobuf:"bytes,4,opt,name=request_txn,json=requestTxn,oneof"` + RequestTxn *TxnRequest `protobuf:"bytes,4,opt,name=request_txn,json=requestTxn,proto3,oneof"` } func (*RequestOp_RequestRange) isRequestOp_Request() {} @@ -770,22 +1048,22 @@ func _RequestOp_OneofSizer(msg proto.Message) (n int) { switch x := m.Request.(type) { case *RequestOp_RequestRange: s := proto.Size(x.RequestRange) - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *RequestOp_RequestPut: s := proto.Size(x.RequestPut) - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *RequestOp_RequestDeleteRange: s := proto.Size(x.RequestDeleteRange) - n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *RequestOp_RequestTxn: s := proto.Size(x.RequestTxn) - n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: @@ -803,13 +1081,44 @@ type ResponseOp struct { // *ResponseOp_ResponsePut // *ResponseOp_ResponseDeleteRange // *ResponseOp_ResponseTxn - Response isResponseOp_Response `protobuf_oneof:"response"` + Response isResponseOp_Response `protobuf_oneof:"response"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResponseOp) Reset() { *m = ResponseOp{} } +func (m *ResponseOp) String() string { return proto.CompactTextString(m) } +func (*ResponseOp) ProtoMessage() {} +func (*ResponseOp) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{8} +} +func (m *ResponseOp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResponseOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResponseOp.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResponseOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseOp.Merge(m, src) +} +func (m *ResponseOp) XXX_Size() int { + return m.Size() +} +func (m *ResponseOp) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseOp.DiscardUnknown(m) } -func (m *ResponseOp) Reset() { *m = ResponseOp{} } -func (m *ResponseOp) String() string { return proto.CompactTextString(m) } -func (*ResponseOp) ProtoMessage() {} -func (*ResponseOp) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{8} } +var xxx_messageInfo_ResponseOp proto.InternalMessageInfo type isResponseOp_Response interface { isResponseOp_Response() @@ -818,16 +1127,16 @@ type isResponseOp_Response interface { } type ResponseOp_ResponseRange struct { - ResponseRange *RangeResponse `protobuf:"bytes,1,opt,name=response_range,json=responseRange,oneof"` + ResponseRange *RangeResponse `protobuf:"bytes,1,opt,name=response_range,json=responseRange,proto3,oneof"` } type ResponseOp_ResponsePut struct { - ResponsePut *PutResponse `protobuf:"bytes,2,opt,name=response_put,json=responsePut,oneof"` + ResponsePut *PutResponse `protobuf:"bytes,2,opt,name=response_put,json=responsePut,proto3,oneof"` } type ResponseOp_ResponseDeleteRange struct { - ResponseDeleteRange *DeleteRangeResponse `protobuf:"bytes,3,opt,name=response_delete_range,json=responseDeleteRange,oneof"` + ResponseDeleteRange *DeleteRangeResponse `protobuf:"bytes,3,opt,name=response_delete_range,json=responseDeleteRange,proto3,oneof"` } type ResponseOp_ResponseTxn struct { - ResponseTxn *TxnResponse `protobuf:"bytes,4,opt,name=response_txn,json=responseTxn,oneof"` + ResponseTxn *TxnResponse `protobuf:"bytes,4,opt,name=response_txn,json=responseTxn,proto3,oneof"` } func (*ResponseOp_ResponseRange) isResponseOp_Response() {} @@ -957,22 +1266,22 @@ func _ResponseOp_OneofSizer(msg proto.Message) (n int) { switch x := m.Response.(type) { case *ResponseOp_ResponseRange: s := proto.Size(x.ResponseRange) - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *ResponseOp_ResponsePut: s := proto.Size(x.ResponsePut) - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *ResponseOp_ResponseDeleteRange: s := proto.Size(x.ResponseDeleteRange) - n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *ResponseOp_ResponseTxn: s := proto.Size(x.ResponseTxn) - n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: @@ -998,13 +1307,44 @@ type Compare struct { TargetUnion isCompare_TargetUnion `protobuf_oneof:"target_union"` // range_end compares the given target to all keys in the range [key, range_end). // See RangeRequest for more details on key ranges. - RangeEnd []byte `protobuf:"bytes,64,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + RangeEnd []byte `protobuf:"bytes,64,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Compare) Reset() { *m = Compare{} } +func (m *Compare) String() string { return proto.CompactTextString(m) } +func (*Compare) ProtoMessage() {} +func (*Compare) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{9} +} +func (m *Compare) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Compare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Compare.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Compare) XXX_Merge(src proto.Message) { + xxx_messageInfo_Compare.Merge(m, src) +} +func (m *Compare) XXX_Size() int { + return m.Size() +} +func (m *Compare) XXX_DiscardUnknown() { + xxx_messageInfo_Compare.DiscardUnknown(m) } -func (m *Compare) Reset() { *m = Compare{} } -func (m *Compare) String() string { return proto.CompactTextString(m) } -func (*Compare) ProtoMessage() {} -func (*Compare) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{9} } +var xxx_messageInfo_Compare proto.InternalMessageInfo type isCompare_TargetUnion interface { isCompare_TargetUnion() @@ -1189,20 +1529,20 @@ func _Compare_OneofSizer(msg proto.Message) (n int) { // target_union switch x := m.TargetUnion.(type) { case *Compare_Version: - n += proto.SizeVarint(4<<3 | proto.WireVarint) + n += 1 // tag and wire n += proto.SizeVarint(uint64(x.Version)) case *Compare_CreateRevision: - n += proto.SizeVarint(5<<3 | proto.WireVarint) + n += 1 // tag and wire n += proto.SizeVarint(uint64(x.CreateRevision)) case *Compare_ModRevision: - n += proto.SizeVarint(6<<3 | proto.WireVarint) + n += 1 // tag and wire n += proto.SizeVarint(uint64(x.ModRevision)) case *Compare_Value: - n += proto.SizeVarint(7<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(len(x.Value))) n += len(x.Value) case *Compare_Lease: - n += proto.SizeVarint(8<<3 | proto.WireVarint) + n += 1 // tag and wire n += proto.SizeVarint(uint64(x.Lease)) case nil: default: @@ -1232,17 +1572,48 @@ type TxnRequest struct { // and the response will contain their respective responses in order. // If the comparisons fail, then the failure requests will be processed in order, // and the response will contain their respective responses in order. - Compare []*Compare `protobuf:"bytes,1,rep,name=compare" json:"compare,omitempty"` + Compare []*Compare `protobuf:"bytes,1,rep,name=compare,proto3" json:"compare,omitempty"` // success is a list of requests which will be applied when compare evaluates to true. - Success []*RequestOp `protobuf:"bytes,2,rep,name=success" json:"success,omitempty"` + Success []*RequestOp `protobuf:"bytes,2,rep,name=success,proto3" json:"success,omitempty"` // failure is a list of requests which will be applied when compare evaluates to false. - Failure []*RequestOp `protobuf:"bytes,3,rep,name=failure" json:"failure,omitempty"` + Failure []*RequestOp `protobuf:"bytes,3,rep,name=failure,proto3" json:"failure,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TxnRequest) Reset() { *m = TxnRequest{} } +func (m *TxnRequest) String() string { return proto.CompactTextString(m) } +func (*TxnRequest) ProtoMessage() {} +func (*TxnRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{10} +} +func (m *TxnRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxnRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxnRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TxnRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxnRequest.Merge(m, src) +} +func (m *TxnRequest) XXX_Size() int { + return m.Size() +} +func (m *TxnRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TxnRequest.DiscardUnknown(m) } -func (m *TxnRequest) Reset() { *m = TxnRequest{} } -func (m *TxnRequest) String() string { return proto.CompactTextString(m) } -func (*TxnRequest) ProtoMessage() {} -func (*TxnRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{10} } +var xxx_messageInfo_TxnRequest proto.InternalMessageInfo func (m *TxnRequest) GetCompare() []*Compare { if m != nil { @@ -1266,18 +1637,49 @@ func (m *TxnRequest) GetFailure() []*RequestOp { } type TxnResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // succeeded is set to true if the compare evaluated to true or false otherwise. Succeeded bool `protobuf:"varint,2,opt,name=succeeded,proto3" json:"succeeded,omitempty"` // responses is a list of responses corresponding to the results from applying // success if succeeded is true or failure if succeeded is false. - Responses []*ResponseOp `protobuf:"bytes,3,rep,name=responses" json:"responses,omitempty"` + Responses []*ResponseOp `protobuf:"bytes,3,rep,name=responses,proto3" json:"responses,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TxnResponse) Reset() { *m = TxnResponse{} } +func (m *TxnResponse) String() string { return proto.CompactTextString(m) } +func (*TxnResponse) ProtoMessage() {} +func (*TxnResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{11} +} +func (m *TxnResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxnResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TxnResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxnResponse.Merge(m, src) +} +func (m *TxnResponse) XXX_Size() int { + return m.Size() +} +func (m *TxnResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TxnResponse.DiscardUnknown(m) } -func (m *TxnResponse) Reset() { *m = TxnResponse{} } -func (m *TxnResponse) String() string { return proto.CompactTextString(m) } -func (*TxnResponse) ProtoMessage() {} -func (*TxnResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{11} } +var xxx_messageInfo_TxnResponse proto.InternalMessageInfo func (m *TxnResponse) GetHeader() *ResponseHeader { if m != nil { @@ -1308,13 +1710,44 @@ type CompactionRequest struct { // physical is set so the RPC will wait until the compaction is physically // applied to the local database such that compacted entries are totally // removed from the backend database. - Physical bool `protobuf:"varint,2,opt,name=physical,proto3" json:"physical,omitempty"` + Physical bool `protobuf:"varint,2,opt,name=physical,proto3" json:"physical,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompactionRequest) Reset() { *m = CompactionRequest{} } +func (m *CompactionRequest) String() string { return proto.CompactTextString(m) } +func (*CompactionRequest) ProtoMessage() {} +func (*CompactionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{12} +} +func (m *CompactionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CompactionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CompactionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CompactionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompactionRequest.Merge(m, src) +} +func (m *CompactionRequest) XXX_Size() int { + return m.Size() +} +func (m *CompactionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CompactionRequest.DiscardUnknown(m) } -func (m *CompactionRequest) Reset() { *m = CompactionRequest{} } -func (m *CompactionRequest) String() string { return proto.CompactTextString(m) } -func (*CompactionRequest) ProtoMessage() {} -func (*CompactionRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{12} } +var xxx_messageInfo_CompactionRequest proto.InternalMessageInfo func (m *CompactionRequest) GetRevision() int64 { if m != nil { @@ -1331,13 +1764,44 @@ func (m *CompactionRequest) GetPhysical() bool { } type CompactionResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CompactionResponse) Reset() { *m = CompactionResponse{} } +func (m *CompactionResponse) String() string { return proto.CompactTextString(m) } +func (*CompactionResponse) ProtoMessage() {} +func (*CompactionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{13} +} +func (m *CompactionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CompactionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CompactionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CompactionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompactionResponse.Merge(m, src) +} +func (m *CompactionResponse) XXX_Size() int { + return m.Size() +} +func (m *CompactionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CompactionResponse.DiscardUnknown(m) } -func (m *CompactionResponse) Reset() { *m = CompactionResponse{} } -func (m *CompactionResponse) String() string { return proto.CompactTextString(m) } -func (*CompactionResponse) ProtoMessage() {} -func (*CompactionResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{13} } +var xxx_messageInfo_CompactionResponse proto.InternalMessageInfo func (m *CompactionResponse) GetHeader() *ResponseHeader { if m != nil { @@ -1347,22 +1811,84 @@ func (m *CompactionResponse) GetHeader() *ResponseHeader { } type HashRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HashRequest) Reset() { *m = HashRequest{} } +func (m *HashRequest) String() string { return proto.CompactTextString(m) } +func (*HashRequest) ProtoMessage() {} +func (*HashRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{14} +} +func (m *HashRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HashRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HashRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HashRequest.Merge(m, src) +} +func (m *HashRequest) XXX_Size() int { + return m.Size() +} +func (m *HashRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HashRequest.DiscardUnknown(m) } -func (m *HashRequest) Reset() { *m = HashRequest{} } -func (m *HashRequest) String() string { return proto.CompactTextString(m) } -func (*HashRequest) ProtoMessage() {} -func (*HashRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{14} } +var xxx_messageInfo_HashRequest proto.InternalMessageInfo type HashKVRequest struct { // revision is the key-value store revision for the hash operation. - Revision int64 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"` + Revision int64 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HashKVRequest) Reset() { *m = HashKVRequest{} } +func (m *HashKVRequest) String() string { return proto.CompactTextString(m) } +func (*HashKVRequest) ProtoMessage() {} +func (*HashKVRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{15} +} +func (m *HashKVRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HashKVRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HashKVRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HashKVRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_HashKVRequest.Merge(m, src) +} +func (m *HashKVRequest) XXX_Size() int { + return m.Size() +} +func (m *HashKVRequest) XXX_DiscardUnknown() { + xxx_messageInfo_HashKVRequest.DiscardUnknown(m) } -func (m *HashKVRequest) Reset() { *m = HashKVRequest{} } -func (m *HashKVRequest) String() string { return proto.CompactTextString(m) } -func (*HashKVRequest) ProtoMessage() {} -func (*HashKVRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{15} } +var xxx_messageInfo_HashKVRequest proto.InternalMessageInfo func (m *HashKVRequest) GetRevision() int64 { if m != nil { @@ -1372,17 +1898,48 @@ func (m *HashKVRequest) GetRevision() int64 { } type HashKVResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // hash is the hash value computed from the responding member's MVCC keys up to a given revision. Hash uint32 `protobuf:"varint,2,opt,name=hash,proto3" json:"hash,omitempty"` // compact_revision is the compacted revision of key-value store when hash begins. - CompactRevision int64 `protobuf:"varint,3,opt,name=compact_revision,json=compactRevision,proto3" json:"compact_revision,omitempty"` + CompactRevision int64 `protobuf:"varint,3,opt,name=compact_revision,json=compactRevision,proto3" json:"compact_revision,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HashKVResponse) Reset() { *m = HashKVResponse{} } +func (m *HashKVResponse) String() string { return proto.CompactTextString(m) } +func (*HashKVResponse) ProtoMessage() {} +func (*HashKVResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{16} +} +func (m *HashKVResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HashKVResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HashKVResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HashKVResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HashKVResponse.Merge(m, src) +} +func (m *HashKVResponse) XXX_Size() int { + return m.Size() +} +func (m *HashKVResponse) XXX_DiscardUnknown() { + xxx_messageInfo_HashKVResponse.DiscardUnknown(m) } -func (m *HashKVResponse) Reset() { *m = HashKVResponse{} } -func (m *HashKVResponse) String() string { return proto.CompactTextString(m) } -func (*HashKVResponse) ProtoMessage() {} -func (*HashKVResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{16} } +var xxx_messageInfo_HashKVResponse proto.InternalMessageInfo func (m *HashKVResponse) GetHeader() *ResponseHeader { if m != nil { @@ -1406,15 +1963,46 @@ func (m *HashKVResponse) GetCompactRevision() int64 { } type HashResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // hash is the hash value computed from the responding member's KV's backend. - Hash uint32 `protobuf:"varint,2,opt,name=hash,proto3" json:"hash,omitempty"` + Hash uint32 `protobuf:"varint,2,opt,name=hash,proto3" json:"hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HashResponse) Reset() { *m = HashResponse{} } +func (m *HashResponse) String() string { return proto.CompactTextString(m) } +func (*HashResponse) ProtoMessage() {} +func (*HashResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{17} +} +func (m *HashResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HashResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HashResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_HashResponse.Merge(m, src) +} +func (m *HashResponse) XXX_Size() int { + return m.Size() +} +func (m *HashResponse) XXX_DiscardUnknown() { + xxx_messageInfo_HashResponse.DiscardUnknown(m) } -func (m *HashResponse) Reset() { *m = HashResponse{} } -func (m *HashResponse) String() string { return proto.CompactTextString(m) } -func (*HashResponse) ProtoMessage() {} -func (*HashResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{17} } +var xxx_messageInfo_HashResponse proto.InternalMessageInfo func (m *HashResponse) GetHeader() *ResponseHeader { if m != nil { @@ -1431,27 +2019,89 @@ func (m *HashResponse) GetHash() uint32 { } type SnapshotRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SnapshotRequest) Reset() { *m = SnapshotRequest{} } +func (m *SnapshotRequest) String() string { return proto.CompactTextString(m) } +func (*SnapshotRequest) ProtoMessage() {} +func (*SnapshotRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{18} +} +func (m *SnapshotRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SnapshotRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SnapshotRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SnapshotRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SnapshotRequest.Merge(m, src) +} +func (m *SnapshotRequest) XXX_Size() int { + return m.Size() +} +func (m *SnapshotRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SnapshotRequest.DiscardUnknown(m) } -func (m *SnapshotRequest) Reset() { *m = SnapshotRequest{} } -func (m *SnapshotRequest) String() string { return proto.CompactTextString(m) } -func (*SnapshotRequest) ProtoMessage() {} -func (*SnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{18} } +var xxx_messageInfo_SnapshotRequest proto.InternalMessageInfo type SnapshotResponse struct { // header has the current key-value store information. The first header in the snapshot // stream indicates the point in time of the snapshot. - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // remaining_bytes is the number of blob bytes to be sent after this message RemainingBytes uint64 `protobuf:"varint,2,opt,name=remaining_bytes,json=remainingBytes,proto3" json:"remaining_bytes,omitempty"` // blob contains the next chunk of the snapshot in the snapshot stream. - Blob []byte `protobuf:"bytes,3,opt,name=blob,proto3" json:"blob,omitempty"` + Blob []byte `protobuf:"bytes,3,opt,name=blob,proto3" json:"blob,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SnapshotResponse) Reset() { *m = SnapshotResponse{} } +func (m *SnapshotResponse) String() string { return proto.CompactTextString(m) } +func (*SnapshotResponse) ProtoMessage() {} +func (*SnapshotResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{19} +} +func (m *SnapshotResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SnapshotResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SnapshotResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SnapshotResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SnapshotResponse.Merge(m, src) +} +func (m *SnapshotResponse) XXX_Size() int { + return m.Size() +} +func (m *SnapshotResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SnapshotResponse.DiscardUnknown(m) } -func (m *SnapshotResponse) Reset() { *m = SnapshotResponse{} } -func (m *SnapshotResponse) String() string { return proto.CompactTextString(m) } -func (*SnapshotResponse) ProtoMessage() {} -func (*SnapshotResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{19} } +var xxx_messageInfo_SnapshotResponse proto.InternalMessageInfo func (m *SnapshotResponse) GetHeader() *ResponseHeader { if m != nil { @@ -1480,13 +2130,45 @@ type WatchRequest struct { // Types that are valid to be assigned to RequestUnion: // *WatchRequest_CreateRequest // *WatchRequest_CancelRequest - RequestUnion isWatchRequest_RequestUnion `protobuf_oneof:"request_union"` + // *WatchRequest_ProgressRequest + RequestUnion isWatchRequest_RequestUnion `protobuf_oneof:"request_union"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WatchRequest) Reset() { *m = WatchRequest{} } +func (m *WatchRequest) String() string { return proto.CompactTextString(m) } +func (*WatchRequest) ProtoMessage() {} +func (*WatchRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{20} +} +func (m *WatchRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WatchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WatchRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WatchRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_WatchRequest.Merge(m, src) +} +func (m *WatchRequest) XXX_Size() int { + return m.Size() +} +func (m *WatchRequest) XXX_DiscardUnknown() { + xxx_messageInfo_WatchRequest.DiscardUnknown(m) } -func (m *WatchRequest) Reset() { *m = WatchRequest{} } -func (m *WatchRequest) String() string { return proto.CompactTextString(m) } -func (*WatchRequest) ProtoMessage() {} -func (*WatchRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{20} } +var xxx_messageInfo_WatchRequest proto.InternalMessageInfo type isWatchRequest_RequestUnion interface { isWatchRequest_RequestUnion() @@ -1495,14 +2177,18 @@ type isWatchRequest_RequestUnion interface { } type WatchRequest_CreateRequest struct { - CreateRequest *WatchCreateRequest `protobuf:"bytes,1,opt,name=create_request,json=createRequest,oneof"` + CreateRequest *WatchCreateRequest `protobuf:"bytes,1,opt,name=create_request,json=createRequest,proto3,oneof"` } type WatchRequest_CancelRequest struct { - CancelRequest *WatchCancelRequest `protobuf:"bytes,2,opt,name=cancel_request,json=cancelRequest,oneof"` + CancelRequest *WatchCancelRequest `protobuf:"bytes,2,opt,name=cancel_request,json=cancelRequest,proto3,oneof"` +} +type WatchRequest_ProgressRequest struct { + ProgressRequest *WatchProgressRequest `protobuf:"bytes,3,opt,name=progress_request,json=progressRequest,proto3,oneof"` } -func (*WatchRequest_CreateRequest) isWatchRequest_RequestUnion() {} -func (*WatchRequest_CancelRequest) isWatchRequest_RequestUnion() {} +func (*WatchRequest_CreateRequest) isWatchRequest_RequestUnion() {} +func (*WatchRequest_CancelRequest) isWatchRequest_RequestUnion() {} +func (*WatchRequest_ProgressRequest) isWatchRequest_RequestUnion() {} func (m *WatchRequest) GetRequestUnion() isWatchRequest_RequestUnion { if m != nil { @@ -1525,11 +2211,19 @@ func (m *WatchRequest) GetCancelRequest() *WatchCancelRequest { return nil } +func (m *WatchRequest) GetProgressRequest() *WatchProgressRequest { + if x, ok := m.GetRequestUnion().(*WatchRequest_ProgressRequest); ok { + return x.ProgressRequest + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*WatchRequest) 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 _WatchRequest_OneofMarshaler, _WatchRequest_OneofUnmarshaler, _WatchRequest_OneofSizer, []interface{}{ (*WatchRequest_CreateRequest)(nil), (*WatchRequest_CancelRequest)(nil), + (*WatchRequest_ProgressRequest)(nil), } } @@ -1547,6 +2241,11 @@ func _WatchRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { if err := b.EncodeMessage(x.CancelRequest); err != nil { return err } + case *WatchRequest_ProgressRequest: + _ = b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ProgressRequest); err != nil { + return err + } case nil: default: return fmt.Errorf("WatchRequest.RequestUnion has unexpected type %T", x) @@ -1573,6 +2272,14 @@ func _WatchRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.B err := b.DecodeMessage(msg) m.RequestUnion = &WatchRequest_CancelRequest{msg} return true, err + case 3: // request_union.progress_request + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(WatchProgressRequest) + err := b.DecodeMessage(msg) + m.RequestUnion = &WatchRequest_ProgressRequest{msg} + return true, err default: return false, nil } @@ -1584,12 +2291,17 @@ func _WatchRequest_OneofSizer(msg proto.Message) (n int) { switch x := m.RequestUnion.(type) { case *WatchRequest_CreateRequest: s := proto.Size(x.CreateRequest) - n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case *WatchRequest_CancelRequest: s := proto.Size(x.CancelRequest) - n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *WatchRequest_ProgressRequest: + s := proto.Size(x.ProgressRequest) + n += 1 // tag and wire n += proto.SizeVarint(uint64(s)) n += s case nil: @@ -1616,16 +2328,55 @@ type WatchCreateRequest struct { // The etcd server may decide how often it will send notifications based on current load. ProgressNotify bool `protobuf:"varint,4,opt,name=progress_notify,json=progressNotify,proto3" json:"progress_notify,omitempty"` // filters filter the events at server side before it sends back to the watcher. - Filters []WatchCreateRequest_FilterType `protobuf:"varint,5,rep,packed,name=filters,enum=etcdserverpb.WatchCreateRequest_FilterType" json:"filters,omitempty"` + Filters []WatchCreateRequest_FilterType `protobuf:"varint,5,rep,packed,name=filters,proto3,enum=etcdserverpb.WatchCreateRequest_FilterType" json:"filters,omitempty"` // If prev_kv is set, created watcher gets the previous KV before the event happens. // If the previous KV is already compacted, nothing will be returned. PrevKv bool `protobuf:"varint,6,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + // If watch_id is provided and non-zero, it will be assigned to this watcher. + // Since creating a watcher in etcd is not a synchronous operation, + // this can be used ensure that ordering is correct when creating multiple + // watchers on the same stream. Creating a watcher with an ID already in + // use on the stream will cause an error to be returned. + WatchId int64 `protobuf:"varint,7,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` + // fragment enables splitting large revisions into multiple watch responses. + Fragment bool `protobuf:"varint,8,opt,name=fragment,proto3" json:"fragment,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WatchCreateRequest) Reset() { *m = WatchCreateRequest{} } +func (m *WatchCreateRequest) String() string { return proto.CompactTextString(m) } +func (*WatchCreateRequest) ProtoMessage() {} +func (*WatchCreateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{21} +} +func (m *WatchCreateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WatchCreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WatchCreateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WatchCreateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_WatchCreateRequest.Merge(m, src) +} +func (m *WatchCreateRequest) XXX_Size() int { + return m.Size() +} +func (m *WatchCreateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_WatchCreateRequest.DiscardUnknown(m) } -func (m *WatchCreateRequest) Reset() { *m = WatchCreateRequest{} } -func (m *WatchCreateRequest) String() string { return proto.CompactTextString(m) } -func (*WatchCreateRequest) ProtoMessage() {} -func (*WatchCreateRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{21} } +var xxx_messageInfo_WatchCreateRequest proto.InternalMessageInfo func (m *WatchCreateRequest) GetKey() []byte { if m != nil { @@ -1669,15 +2420,60 @@ func (m *WatchCreateRequest) GetPrevKv() bool { return false } +func (m *WatchCreateRequest) GetWatchId() int64 { + if m != nil { + return m.WatchId + } + return 0 +} + +func (m *WatchCreateRequest) GetFragment() bool { + if m != nil { + return m.Fragment + } + return false +} + type WatchCancelRequest struct { // watch_id is the watcher id to cancel so that no more events are transmitted. - WatchId int64 `protobuf:"varint,1,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` + WatchId int64 `protobuf:"varint,1,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WatchCancelRequest) Reset() { *m = WatchCancelRequest{} } +func (m *WatchCancelRequest) String() string { return proto.CompactTextString(m) } +func (*WatchCancelRequest) ProtoMessage() {} +func (*WatchCancelRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{22} +} +func (m *WatchCancelRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WatchCancelRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WatchCancelRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WatchCancelRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_WatchCancelRequest.Merge(m, src) +} +func (m *WatchCancelRequest) XXX_Size() int { + return m.Size() +} +func (m *WatchCancelRequest) XXX_DiscardUnknown() { + xxx_messageInfo_WatchCancelRequest.DiscardUnknown(m) } -func (m *WatchCancelRequest) Reset() { *m = WatchCancelRequest{} } -func (m *WatchCancelRequest) String() string { return proto.CompactTextString(m) } -func (*WatchCancelRequest) ProtoMessage() {} -func (*WatchCancelRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{22} } +var xxx_messageInfo_WatchCancelRequest proto.InternalMessageInfo func (m *WatchCancelRequest) GetWatchId() int64 { if m != nil { @@ -1686,8 +2482,49 @@ func (m *WatchCancelRequest) GetWatchId() int64 { return 0 } +// Requests the a watch stream progress status be sent in the watch response stream as soon as +// possible. +type WatchProgressRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WatchProgressRequest) Reset() { *m = WatchProgressRequest{} } +func (m *WatchProgressRequest) String() string { return proto.CompactTextString(m) } +func (*WatchProgressRequest) ProtoMessage() {} +func (*WatchProgressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{23} +} +func (m *WatchProgressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WatchProgressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WatchProgressRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WatchProgressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_WatchProgressRequest.Merge(m, src) +} +func (m *WatchProgressRequest) XXX_Size() int { + return m.Size() +} +func (m *WatchProgressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_WatchProgressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_WatchProgressRequest proto.InternalMessageInfo + type WatchResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // watch_id is the ID of the watcher that corresponds to the response. WatchId int64 `protobuf:"varint,2,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` // created is set to true if the response is for a create watch request. @@ -1708,14 +2545,47 @@ type WatchResponse struct { // watcher with the same start_revision again. CompactRevision int64 `protobuf:"varint,5,opt,name=compact_revision,json=compactRevision,proto3" json:"compact_revision,omitempty"` // cancel_reason indicates the reason for canceling the watcher. - CancelReason string `protobuf:"bytes,6,opt,name=cancel_reason,json=cancelReason,proto3" json:"cancel_reason,omitempty"` - Events []*mvccpb.Event `protobuf:"bytes,11,rep,name=events" json:"events,omitempty"` + CancelReason string `protobuf:"bytes,6,opt,name=cancel_reason,json=cancelReason,proto3" json:"cancel_reason,omitempty"` + // framgment is true if large watch response was split over multiple responses. + Fragment bool `protobuf:"varint,7,opt,name=fragment,proto3" json:"fragment,omitempty"` + Events []*mvccpb.Event `protobuf:"bytes,11,rep,name=events,proto3" json:"events,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WatchResponse) Reset() { *m = WatchResponse{} } +func (m *WatchResponse) String() string { return proto.CompactTextString(m) } +func (*WatchResponse) ProtoMessage() {} +func (*WatchResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{24} +} +func (m *WatchResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WatchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WatchResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WatchResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_WatchResponse.Merge(m, src) +} +func (m *WatchResponse) XXX_Size() int { + return m.Size() +} +func (m *WatchResponse) XXX_DiscardUnknown() { + xxx_messageInfo_WatchResponse.DiscardUnknown(m) } -func (m *WatchResponse) Reset() { *m = WatchResponse{} } -func (m *WatchResponse) String() string { return proto.CompactTextString(m) } -func (*WatchResponse) ProtoMessage() {} -func (*WatchResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{23} } +var xxx_messageInfo_WatchResponse proto.InternalMessageInfo func (m *WatchResponse) GetHeader() *ResponseHeader { if m != nil { @@ -1759,6 +2629,13 @@ func (m *WatchResponse) GetCancelReason() string { return "" } +func (m *WatchResponse) GetFragment() bool { + if m != nil { + return m.Fragment + } + return false +} + func (m *WatchResponse) GetEvents() []*mvccpb.Event { if m != nil { return m.Events @@ -1770,13 +2647,44 @@ type LeaseGrantRequest struct { // TTL is the advisory time-to-live in seconds. Expired lease will return -1. TTL int64 `protobuf:"varint,1,opt,name=TTL,proto3" json:"TTL,omitempty"` // ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID. - ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` + ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseGrantRequest) Reset() { *m = LeaseGrantRequest{} } +func (m *LeaseGrantRequest) String() string { return proto.CompactTextString(m) } +func (*LeaseGrantRequest) ProtoMessage() {} +func (*LeaseGrantRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{25} +} +func (m *LeaseGrantRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseGrantRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseGrantRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseGrantRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseGrantRequest.Merge(m, src) +} +func (m *LeaseGrantRequest) XXX_Size() int { + return m.Size() +} +func (m *LeaseGrantRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseGrantRequest.DiscardUnknown(m) } -func (m *LeaseGrantRequest) Reset() { *m = LeaseGrantRequest{} } -func (m *LeaseGrantRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseGrantRequest) ProtoMessage() {} -func (*LeaseGrantRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{24} } +var xxx_messageInfo_LeaseGrantRequest proto.InternalMessageInfo func (m *LeaseGrantRequest) GetTTL() int64 { if m != nil { @@ -1793,18 +2701,49 @@ func (m *LeaseGrantRequest) GetID() int64 { } type LeaseGrantResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // ID is the lease ID for the granted lease. ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` // TTL is the server chosen lease time-to-live in seconds. - TTL int64 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` - Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` + TTL int64 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseGrantResponse) Reset() { *m = LeaseGrantResponse{} } +func (m *LeaseGrantResponse) String() string { return proto.CompactTextString(m) } +func (*LeaseGrantResponse) ProtoMessage() {} +func (*LeaseGrantResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{26} +} +func (m *LeaseGrantResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseGrantResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseGrantResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseGrantResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseGrantResponse.Merge(m, src) +} +func (m *LeaseGrantResponse) XXX_Size() int { + return m.Size() +} +func (m *LeaseGrantResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseGrantResponse.DiscardUnknown(m) } -func (m *LeaseGrantResponse) Reset() { *m = LeaseGrantResponse{} } -func (m *LeaseGrantResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseGrantResponse) ProtoMessage() {} -func (*LeaseGrantResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{25} } +var xxx_messageInfo_LeaseGrantResponse proto.InternalMessageInfo func (m *LeaseGrantResponse) GetHeader() *ResponseHeader { if m != nil { @@ -1836,13 +2775,44 @@ func (m *LeaseGrantResponse) GetError() string { type LeaseRevokeRequest struct { // ID is the lease ID to revoke. When the ID is revoked, all associated keys will be deleted. - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseRevokeRequest) Reset() { *m = LeaseRevokeRequest{} } +func (m *LeaseRevokeRequest) String() string { return proto.CompactTextString(m) } +func (*LeaseRevokeRequest) ProtoMessage() {} +func (*LeaseRevokeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{27} +} +func (m *LeaseRevokeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseRevokeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseRevokeRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseRevokeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseRevokeRequest.Merge(m, src) +} +func (m *LeaseRevokeRequest) XXX_Size() int { + return m.Size() +} +func (m *LeaseRevokeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseRevokeRequest.DiscardUnknown(m) } -func (m *LeaseRevokeRequest) Reset() { *m = LeaseRevokeRequest{} } -func (m *LeaseRevokeRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseRevokeRequest) ProtoMessage() {} -func (*LeaseRevokeRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{26} } +var xxx_messageInfo_LeaseRevokeRequest proto.InternalMessageInfo func (m *LeaseRevokeRequest) GetID() int64 { if m != nil { @@ -1852,13 +2822,44 @@ func (m *LeaseRevokeRequest) GetID() int64 { } type LeaseRevokeResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseRevokeResponse) Reset() { *m = LeaseRevokeResponse{} } +func (m *LeaseRevokeResponse) String() string { return proto.CompactTextString(m) } +func (*LeaseRevokeResponse) ProtoMessage() {} +func (*LeaseRevokeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{28} +} +func (m *LeaseRevokeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseRevokeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseRevokeResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseRevokeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseRevokeResponse.Merge(m, src) +} +func (m *LeaseRevokeResponse) XXX_Size() int { + return m.Size() +} +func (m *LeaseRevokeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseRevokeResponse.DiscardUnknown(m) } -func (m *LeaseRevokeResponse) Reset() { *m = LeaseRevokeResponse{} } -func (m *LeaseRevokeResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseRevokeResponse) ProtoMessage() {} -func (*LeaseRevokeResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{27} } +var xxx_messageInfo_LeaseRevokeResponse proto.InternalMessageInfo func (m *LeaseRevokeResponse) GetHeader() *ResponseHeader { if m != nil { @@ -1869,13 +2870,44 @@ func (m *LeaseRevokeResponse) GetHeader() *ResponseHeader { type LeaseKeepAliveRequest struct { // ID is the lease ID for the lease to keep alive. - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseKeepAliveRequest) Reset() { *m = LeaseKeepAliveRequest{} } +func (m *LeaseKeepAliveRequest) String() string { return proto.CompactTextString(m) } +func (*LeaseKeepAliveRequest) ProtoMessage() {} +func (*LeaseKeepAliveRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{29} +} +func (m *LeaseKeepAliveRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseKeepAliveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseKeepAliveRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseKeepAliveRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseKeepAliveRequest.Merge(m, src) +} +func (m *LeaseKeepAliveRequest) XXX_Size() int { + return m.Size() +} +func (m *LeaseKeepAliveRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseKeepAliveRequest.DiscardUnknown(m) } -func (m *LeaseKeepAliveRequest) Reset() { *m = LeaseKeepAliveRequest{} } -func (m *LeaseKeepAliveRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseKeepAliveRequest) ProtoMessage() {} -func (*LeaseKeepAliveRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{28} } +var xxx_messageInfo_LeaseKeepAliveRequest proto.InternalMessageInfo func (m *LeaseKeepAliveRequest) GetID() int64 { if m != nil { @@ -1885,17 +2917,48 @@ func (m *LeaseKeepAliveRequest) GetID() int64 { } type LeaseKeepAliveResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // ID is the lease ID from the keep alive request. ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` // TTL is the new time-to-live for the lease. - TTL int64 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + TTL int64 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseKeepAliveResponse) Reset() { *m = LeaseKeepAliveResponse{} } +func (m *LeaseKeepAliveResponse) String() string { return proto.CompactTextString(m) } +func (*LeaseKeepAliveResponse) ProtoMessage() {} +func (*LeaseKeepAliveResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{30} +} +func (m *LeaseKeepAliveResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseKeepAliveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseKeepAliveResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseKeepAliveResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseKeepAliveResponse.Merge(m, src) +} +func (m *LeaseKeepAliveResponse) XXX_Size() int { + return m.Size() +} +func (m *LeaseKeepAliveResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseKeepAliveResponse.DiscardUnknown(m) } -func (m *LeaseKeepAliveResponse) Reset() { *m = LeaseKeepAliveResponse{} } -func (m *LeaseKeepAliveResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseKeepAliveResponse) ProtoMessage() {} -func (*LeaseKeepAliveResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{29} } +var xxx_messageInfo_LeaseKeepAliveResponse proto.InternalMessageInfo func (m *LeaseKeepAliveResponse) GetHeader() *ResponseHeader { if m != nil { @@ -1922,13 +2985,44 @@ type LeaseTimeToLiveRequest struct { // ID is the lease ID for the lease. ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` // keys is true to query all the keys attached to this lease. - Keys bool `protobuf:"varint,2,opt,name=keys,proto3" json:"keys,omitempty"` + Keys bool `protobuf:"varint,2,opt,name=keys,proto3" json:"keys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseTimeToLiveRequest) Reset() { *m = LeaseTimeToLiveRequest{} } +func (m *LeaseTimeToLiveRequest) String() string { return proto.CompactTextString(m) } +func (*LeaseTimeToLiveRequest) ProtoMessage() {} +func (*LeaseTimeToLiveRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{31} +} +func (m *LeaseTimeToLiveRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseTimeToLiveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseTimeToLiveRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseTimeToLiveRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseTimeToLiveRequest.Merge(m, src) +} +func (m *LeaseTimeToLiveRequest) XXX_Size() int { + return m.Size() +} +func (m *LeaseTimeToLiveRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseTimeToLiveRequest.DiscardUnknown(m) } -func (m *LeaseTimeToLiveRequest) Reset() { *m = LeaseTimeToLiveRequest{} } -func (m *LeaseTimeToLiveRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseTimeToLiveRequest) ProtoMessage() {} -func (*LeaseTimeToLiveRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{30} } +var xxx_messageInfo_LeaseTimeToLiveRequest proto.InternalMessageInfo func (m *LeaseTimeToLiveRequest) GetID() int64 { if m != nil { @@ -1945,7 +3039,7 @@ func (m *LeaseTimeToLiveRequest) GetKeys() bool { } type LeaseTimeToLiveResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // ID is the lease ID from the keep alive request. ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` // TTL is the remaining TTL in seconds for the lease; the lease will expire in under TTL+1 seconds. @@ -1953,13 +3047,44 @@ type LeaseTimeToLiveResponse struct { // GrantedTTL is the initial granted time in seconds upon lease creation/renewal. GrantedTTL int64 `protobuf:"varint,4,opt,name=grantedTTL,proto3" json:"grantedTTL,omitempty"` // Keys is the list of keys attached to this lease. - Keys [][]byte `protobuf:"bytes,5,rep,name=keys" json:"keys,omitempty"` + Keys [][]byte `protobuf:"bytes,5,rep,name=keys,proto3" json:"keys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseTimeToLiveResponse) Reset() { *m = LeaseTimeToLiveResponse{} } +func (m *LeaseTimeToLiveResponse) String() string { return proto.CompactTextString(m) } +func (*LeaseTimeToLiveResponse) ProtoMessage() {} +func (*LeaseTimeToLiveResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{32} +} +func (m *LeaseTimeToLiveResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseTimeToLiveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseTimeToLiveResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseTimeToLiveResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseTimeToLiveResponse.Merge(m, src) +} +func (m *LeaseTimeToLiveResponse) XXX_Size() int { + return m.Size() +} +func (m *LeaseTimeToLiveResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseTimeToLiveResponse.DiscardUnknown(m) } -func (m *LeaseTimeToLiveResponse) Reset() { *m = LeaseTimeToLiveResponse{} } -func (m *LeaseTimeToLiveResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseTimeToLiveResponse) ProtoMessage() {} -func (*LeaseTimeToLiveResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{31} } +var xxx_messageInfo_LeaseTimeToLiveResponse proto.InternalMessageInfo func (m *LeaseTimeToLiveResponse) GetHeader() *ResponseHeader { if m != nil { @@ -1997,21 +3122,83 @@ func (m *LeaseTimeToLiveResponse) GetKeys() [][]byte { } type LeaseLeasesRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseLeasesRequest) Reset() { *m = LeaseLeasesRequest{} } +func (m *LeaseLeasesRequest) String() string { return proto.CompactTextString(m) } +func (*LeaseLeasesRequest) ProtoMessage() {} +func (*LeaseLeasesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{33} +} +func (m *LeaseLeasesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseLeasesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseLeasesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseLeasesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseLeasesRequest.Merge(m, src) +} +func (m *LeaseLeasesRequest) XXX_Size() int { + return m.Size() +} +func (m *LeaseLeasesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseLeasesRequest.DiscardUnknown(m) } -func (m *LeaseLeasesRequest) Reset() { *m = LeaseLeasesRequest{} } -func (m *LeaseLeasesRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseLeasesRequest) ProtoMessage() {} -func (*LeaseLeasesRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{32} } +var xxx_messageInfo_LeaseLeasesRequest proto.InternalMessageInfo type LeaseStatus struct { - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseStatus) Reset() { *m = LeaseStatus{} } +func (m *LeaseStatus) String() string { return proto.CompactTextString(m) } +func (*LeaseStatus) ProtoMessage() {} +func (*LeaseStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{34} +} +func (m *LeaseStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseStatus.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseStatus.Merge(m, src) +} +func (m *LeaseStatus) XXX_Size() int { + return m.Size() +} +func (m *LeaseStatus) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseStatus.DiscardUnknown(m) } -func (m *LeaseStatus) Reset() { *m = LeaseStatus{} } -func (m *LeaseStatus) String() string { return proto.CompactTextString(m) } -func (*LeaseStatus) ProtoMessage() {} -func (*LeaseStatus) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{33} } +var xxx_messageInfo_LeaseStatus proto.InternalMessageInfo func (m *LeaseStatus) GetID() int64 { if m != nil { @@ -2021,14 +3208,45 @@ func (m *LeaseStatus) GetID() int64 { } type LeaseLeasesResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - Leases []*LeaseStatus `protobuf:"bytes,2,rep,name=leases" json:"leases,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Leases []*LeaseStatus `protobuf:"bytes,2,rep,name=leases,proto3" json:"leases,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LeaseLeasesResponse) Reset() { *m = LeaseLeasesResponse{} } +func (m *LeaseLeasesResponse) String() string { return proto.CompactTextString(m) } +func (*LeaseLeasesResponse) ProtoMessage() {} +func (*LeaseLeasesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{35} +} +func (m *LeaseLeasesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseLeasesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseLeasesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseLeasesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseLeasesResponse.Merge(m, src) +} +func (m *LeaseLeasesResponse) XXX_Size() int { + return m.Size() +} +func (m *LeaseLeasesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseLeasesResponse.DiscardUnknown(m) } -func (m *LeaseLeasesResponse) Reset() { *m = LeaseLeasesResponse{} } -func (m *LeaseLeasesResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseLeasesResponse) ProtoMessage() {} -func (*LeaseLeasesResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{34} } +var xxx_messageInfo_LeaseLeasesResponse proto.InternalMessageInfo func (m *LeaseLeasesResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2050,15 +3268,46 @@ type Member struct { // name is the human-readable name of the member. If the member is not started, the name will be an empty string. Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // peerURLs is the list of URLs the member exposes to the cluster for communication. - PeerURLs []string `protobuf:"bytes,3,rep,name=peerURLs" json:"peerURLs,omitempty"` + PeerURLs []string `protobuf:"bytes,3,rep,name=peerURLs,proto3" json:"peerURLs,omitempty"` // clientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty. - ClientURLs []string `protobuf:"bytes,4,rep,name=clientURLs" json:"clientURLs,omitempty"` + ClientURLs []string `protobuf:"bytes,4,rep,name=clientURLs,proto3" json:"clientURLs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Member) Reset() { *m = Member{} } +func (m *Member) String() string { return proto.CompactTextString(m) } +func (*Member) ProtoMessage() {} +func (*Member) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{36} +} +func (m *Member) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Member) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Member.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Member) XXX_Merge(src proto.Message) { + xxx_messageInfo_Member.Merge(m, src) +} +func (m *Member) XXX_Size() int { + return m.Size() +} +func (m *Member) XXX_DiscardUnknown() { + xxx_messageInfo_Member.DiscardUnknown(m) } -func (m *Member) Reset() { *m = Member{} } -func (m *Member) String() string { return proto.CompactTextString(m) } -func (*Member) ProtoMessage() {} -func (*Member) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{35} } +var xxx_messageInfo_Member proto.InternalMessageInfo func (m *Member) GetID() uint64 { if m != nil { @@ -2090,13 +3339,44 @@ func (m *Member) GetClientURLs() []string { type MemberAddRequest struct { // peerURLs is the list of URLs the added member will use to communicate with the cluster. - PeerURLs []string `protobuf:"bytes,1,rep,name=peerURLs" json:"peerURLs,omitempty"` + PeerURLs []string `protobuf:"bytes,1,rep,name=peerURLs,proto3" json:"peerURLs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberAddRequest) Reset() { *m = MemberAddRequest{} } +func (m *MemberAddRequest) String() string { return proto.CompactTextString(m) } +func (*MemberAddRequest) ProtoMessage() {} +func (*MemberAddRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{37} +} +func (m *MemberAddRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemberAddRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemberAddRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemberAddRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberAddRequest.Merge(m, src) +} +func (m *MemberAddRequest) XXX_Size() int { + return m.Size() +} +func (m *MemberAddRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemberAddRequest.DiscardUnknown(m) } -func (m *MemberAddRequest) Reset() { *m = MemberAddRequest{} } -func (m *MemberAddRequest) String() string { return proto.CompactTextString(m) } -func (*MemberAddRequest) ProtoMessage() {} -func (*MemberAddRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{36} } +var xxx_messageInfo_MemberAddRequest proto.InternalMessageInfo func (m *MemberAddRequest) GetPeerURLs() []string { if m != nil { @@ -2106,17 +3386,48 @@ func (m *MemberAddRequest) GetPeerURLs() []string { } type MemberAddResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // member is the member information for the added member. - Member *Member `protobuf:"bytes,2,opt,name=member" json:"member,omitempty"` + Member *Member `protobuf:"bytes,2,opt,name=member,proto3" json:"member,omitempty"` // members is a list of all members after adding the new member. - Members []*Member `protobuf:"bytes,3,rep,name=members" json:"members,omitempty"` + Members []*Member `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberAddResponse) Reset() { *m = MemberAddResponse{} } +func (m *MemberAddResponse) String() string { return proto.CompactTextString(m) } +func (*MemberAddResponse) ProtoMessage() {} +func (*MemberAddResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{38} +} +func (m *MemberAddResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemberAddResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemberAddResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemberAddResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberAddResponse.Merge(m, src) +} +func (m *MemberAddResponse) XXX_Size() int { + return m.Size() +} +func (m *MemberAddResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemberAddResponse.DiscardUnknown(m) } -func (m *MemberAddResponse) Reset() { *m = MemberAddResponse{} } -func (m *MemberAddResponse) String() string { return proto.CompactTextString(m) } -func (*MemberAddResponse) ProtoMessage() {} -func (*MemberAddResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{37} } +var xxx_messageInfo_MemberAddResponse proto.InternalMessageInfo func (m *MemberAddResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2141,13 +3452,44 @@ func (m *MemberAddResponse) GetMembers() []*Member { type MemberRemoveRequest struct { // ID is the member ID of the member to remove. - ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberRemoveRequest) Reset() { *m = MemberRemoveRequest{} } +func (m *MemberRemoveRequest) String() string { return proto.CompactTextString(m) } +func (*MemberRemoveRequest) ProtoMessage() {} +func (*MemberRemoveRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{39} +} +func (m *MemberRemoveRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemberRemoveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemberRemoveRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemberRemoveRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberRemoveRequest.Merge(m, src) +} +func (m *MemberRemoveRequest) XXX_Size() int { + return m.Size() +} +func (m *MemberRemoveRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemberRemoveRequest.DiscardUnknown(m) } -func (m *MemberRemoveRequest) Reset() { *m = MemberRemoveRequest{} } -func (m *MemberRemoveRequest) String() string { return proto.CompactTextString(m) } -func (*MemberRemoveRequest) ProtoMessage() {} -func (*MemberRemoveRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{38} } +var xxx_messageInfo_MemberRemoveRequest proto.InternalMessageInfo func (m *MemberRemoveRequest) GetID() uint64 { if m != nil { @@ -2157,15 +3499,46 @@ func (m *MemberRemoveRequest) GetID() uint64 { } type MemberRemoveResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // members is a list of all members after removing the member. - Members []*Member `protobuf:"bytes,2,rep,name=members" json:"members,omitempty"` + Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberRemoveResponse) Reset() { *m = MemberRemoveResponse{} } +func (m *MemberRemoveResponse) String() string { return proto.CompactTextString(m) } +func (*MemberRemoveResponse) ProtoMessage() {} +func (*MemberRemoveResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{40} +} +func (m *MemberRemoveResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemberRemoveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemberRemoveResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemberRemoveResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberRemoveResponse.Merge(m, src) +} +func (m *MemberRemoveResponse) XXX_Size() int { + return m.Size() +} +func (m *MemberRemoveResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemberRemoveResponse.DiscardUnknown(m) } -func (m *MemberRemoveResponse) Reset() { *m = MemberRemoveResponse{} } -func (m *MemberRemoveResponse) String() string { return proto.CompactTextString(m) } -func (*MemberRemoveResponse) ProtoMessage() {} -func (*MemberRemoveResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{39} } +var xxx_messageInfo_MemberRemoveResponse proto.InternalMessageInfo func (m *MemberRemoveResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2185,13 +3558,44 @@ type MemberUpdateRequest struct { // ID is the member ID of the member to update. ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` // peerURLs is the new list of URLs the member will use to communicate with the cluster. - PeerURLs []string `protobuf:"bytes,2,rep,name=peerURLs" json:"peerURLs,omitempty"` + PeerURLs []string `protobuf:"bytes,2,rep,name=peerURLs,proto3" json:"peerURLs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberUpdateRequest) Reset() { *m = MemberUpdateRequest{} } +func (m *MemberUpdateRequest) String() string { return proto.CompactTextString(m) } +func (*MemberUpdateRequest) ProtoMessage() {} +func (*MemberUpdateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{41} +} +func (m *MemberUpdateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemberUpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemberUpdateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemberUpdateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberUpdateRequest.Merge(m, src) +} +func (m *MemberUpdateRequest) XXX_Size() int { + return m.Size() +} +func (m *MemberUpdateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemberUpdateRequest.DiscardUnknown(m) } -func (m *MemberUpdateRequest) Reset() { *m = MemberUpdateRequest{} } -func (m *MemberUpdateRequest) String() string { return proto.CompactTextString(m) } -func (*MemberUpdateRequest) ProtoMessage() {} -func (*MemberUpdateRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{40} } +var xxx_messageInfo_MemberUpdateRequest proto.InternalMessageInfo func (m *MemberUpdateRequest) GetID() uint64 { if m != nil { @@ -2208,15 +3612,46 @@ func (m *MemberUpdateRequest) GetPeerURLs() []string { } type MemberUpdateResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // members is a list of all members after updating the member. - Members []*Member `protobuf:"bytes,2,rep,name=members" json:"members,omitempty"` + Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberUpdateResponse) Reset() { *m = MemberUpdateResponse{} } +func (m *MemberUpdateResponse) String() string { return proto.CompactTextString(m) } +func (*MemberUpdateResponse) ProtoMessage() {} +func (*MemberUpdateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{42} +} +func (m *MemberUpdateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemberUpdateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemberUpdateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemberUpdateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberUpdateResponse.Merge(m, src) +} +func (m *MemberUpdateResponse) XXX_Size() int { + return m.Size() +} +func (m *MemberUpdateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemberUpdateResponse.DiscardUnknown(m) } -func (m *MemberUpdateResponse) Reset() { *m = MemberUpdateResponse{} } -func (m *MemberUpdateResponse) String() string { return proto.CompactTextString(m) } -func (*MemberUpdateResponse) ProtoMessage() {} -func (*MemberUpdateResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{41} } +var xxx_messageInfo_MemberUpdateResponse proto.InternalMessageInfo func (m *MemberUpdateResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2233,23 +3668,85 @@ func (m *MemberUpdateResponse) GetMembers() []*Member { } type MemberListRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberListRequest) Reset() { *m = MemberListRequest{} } +func (m *MemberListRequest) String() string { return proto.CompactTextString(m) } +func (*MemberListRequest) ProtoMessage() {} +func (*MemberListRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{43} +} +func (m *MemberListRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemberListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemberListRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemberListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberListRequest.Merge(m, src) +} +func (m *MemberListRequest) XXX_Size() int { + return m.Size() +} +func (m *MemberListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MemberListRequest.DiscardUnknown(m) } -func (m *MemberListRequest) Reset() { *m = MemberListRequest{} } -func (m *MemberListRequest) String() string { return proto.CompactTextString(m) } -func (*MemberListRequest) ProtoMessage() {} -func (*MemberListRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{42} } +var xxx_messageInfo_MemberListRequest proto.InternalMessageInfo type MemberListResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // members is a list of all members associated with the cluster. - Members []*Member `protobuf:"bytes,2,rep,name=members" json:"members,omitempty"` + Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberListResponse) Reset() { *m = MemberListResponse{} } +func (m *MemberListResponse) String() string { return proto.CompactTextString(m) } +func (*MemberListResponse) ProtoMessage() {} +func (*MemberListResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{44} +} +func (m *MemberListResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemberListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemberListResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemberListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberListResponse.Merge(m, src) +} +func (m *MemberListResponse) XXX_Size() int { + return m.Size() +} +func (m *MemberListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MemberListResponse.DiscardUnknown(m) } -func (m *MemberListResponse) Reset() { *m = MemberListResponse{} } -func (m *MemberListResponse) String() string { return proto.CompactTextString(m) } -func (*MemberListResponse) ProtoMessage() {} -func (*MemberListResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{43} } +var xxx_messageInfo_MemberListResponse proto.InternalMessageInfo func (m *MemberListResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2266,21 +3763,83 @@ func (m *MemberListResponse) GetMembers() []*Member { } type DefragmentRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DefragmentRequest) Reset() { *m = DefragmentRequest{} } +func (m *DefragmentRequest) String() string { return proto.CompactTextString(m) } +func (*DefragmentRequest) ProtoMessage() {} +func (*DefragmentRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{45} +} +func (m *DefragmentRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DefragmentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DefragmentRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DefragmentRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DefragmentRequest.Merge(m, src) +} +func (m *DefragmentRequest) XXX_Size() int { + return m.Size() +} +func (m *DefragmentRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DefragmentRequest.DiscardUnknown(m) } -func (m *DefragmentRequest) Reset() { *m = DefragmentRequest{} } -func (m *DefragmentRequest) String() string { return proto.CompactTextString(m) } -func (*DefragmentRequest) ProtoMessage() {} -func (*DefragmentRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{44} } +var xxx_messageInfo_DefragmentRequest proto.InternalMessageInfo type DefragmentResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DefragmentResponse) Reset() { *m = DefragmentResponse{} } +func (m *DefragmentResponse) String() string { return proto.CompactTextString(m) } +func (*DefragmentResponse) ProtoMessage() {} +func (*DefragmentResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{46} +} +func (m *DefragmentResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DefragmentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DefragmentResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DefragmentResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DefragmentResponse.Merge(m, src) +} +func (m *DefragmentResponse) XXX_Size() int { + return m.Size() +} +func (m *DefragmentResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DefragmentResponse.DiscardUnknown(m) } -func (m *DefragmentResponse) Reset() { *m = DefragmentResponse{} } -func (m *DefragmentResponse) String() string { return proto.CompactTextString(m) } -func (*DefragmentResponse) ProtoMessage() {} -func (*DefragmentResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{45} } +var xxx_messageInfo_DefragmentResponse proto.InternalMessageInfo func (m *DefragmentResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2291,13 +3850,44 @@ func (m *DefragmentResponse) GetHeader() *ResponseHeader { type MoveLeaderRequest struct { // targetID is the node ID for the new leader. - TargetID uint64 `protobuf:"varint,1,opt,name=targetID,proto3" json:"targetID,omitempty"` + TargetID uint64 `protobuf:"varint,1,opt,name=targetID,proto3" json:"targetID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MoveLeaderRequest) Reset() { *m = MoveLeaderRequest{} } +func (m *MoveLeaderRequest) String() string { return proto.CompactTextString(m) } +func (*MoveLeaderRequest) ProtoMessage() {} +func (*MoveLeaderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{47} +} +func (m *MoveLeaderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MoveLeaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MoveLeaderRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MoveLeaderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MoveLeaderRequest.Merge(m, src) +} +func (m *MoveLeaderRequest) XXX_Size() int { + return m.Size() +} +func (m *MoveLeaderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MoveLeaderRequest.DiscardUnknown(m) } -func (m *MoveLeaderRequest) Reset() { *m = MoveLeaderRequest{} } -func (m *MoveLeaderRequest) String() string { return proto.CompactTextString(m) } -func (*MoveLeaderRequest) ProtoMessage() {} -func (*MoveLeaderRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{46} } +var xxx_messageInfo_MoveLeaderRequest proto.InternalMessageInfo func (m *MoveLeaderRequest) GetTargetID() uint64 { if m != nil { @@ -2307,13 +3897,44 @@ func (m *MoveLeaderRequest) GetTargetID() uint64 { } type MoveLeaderResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MoveLeaderResponse) Reset() { *m = MoveLeaderResponse{} } +func (m *MoveLeaderResponse) String() string { return proto.CompactTextString(m) } +func (*MoveLeaderResponse) ProtoMessage() {} +func (*MoveLeaderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{48} +} +func (m *MoveLeaderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MoveLeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MoveLeaderResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MoveLeaderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MoveLeaderResponse.Merge(m, src) +} +func (m *MoveLeaderResponse) XXX_Size() int { + return m.Size() +} +func (m *MoveLeaderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MoveLeaderResponse.DiscardUnknown(m) } -func (m *MoveLeaderResponse) Reset() { *m = MoveLeaderResponse{} } -func (m *MoveLeaderResponse) String() string { return proto.CompactTextString(m) } -func (*MoveLeaderResponse) ProtoMessage() {} -func (*MoveLeaderResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{47} } +var xxx_messageInfo_MoveLeaderResponse proto.InternalMessageInfo func (m *MoveLeaderResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2331,13 +3952,44 @@ type AlarmRequest struct { // alarm request covers all members. MemberID uint64 `protobuf:"varint,2,opt,name=memberID,proto3" json:"memberID,omitempty"` // alarm is the type of alarm to consider for this request. - Alarm AlarmType `protobuf:"varint,3,opt,name=alarm,proto3,enum=etcdserverpb.AlarmType" json:"alarm,omitempty"` + Alarm AlarmType `protobuf:"varint,3,opt,name=alarm,proto3,enum=etcdserverpb.AlarmType" json:"alarm,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AlarmRequest) Reset() { *m = AlarmRequest{} } +func (m *AlarmRequest) String() string { return proto.CompactTextString(m) } +func (*AlarmRequest) ProtoMessage() {} +func (*AlarmRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{49} +} +func (m *AlarmRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlarmRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AlarmRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AlarmRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlarmRequest.Merge(m, src) +} +func (m *AlarmRequest) XXX_Size() int { + return m.Size() +} +func (m *AlarmRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AlarmRequest.DiscardUnknown(m) } -func (m *AlarmRequest) Reset() { *m = AlarmRequest{} } -func (m *AlarmRequest) String() string { return proto.CompactTextString(m) } -func (*AlarmRequest) ProtoMessage() {} -func (*AlarmRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{48} } +var xxx_messageInfo_AlarmRequest proto.InternalMessageInfo func (m *AlarmRequest) GetAction() AlarmRequest_AlarmAction { if m != nil { @@ -2364,13 +4016,44 @@ type AlarmMember struct { // memberID is the ID of the member associated with the raised alarm. MemberID uint64 `protobuf:"varint,1,opt,name=memberID,proto3" json:"memberID,omitempty"` // alarm is the type of alarm which has been raised. - Alarm AlarmType `protobuf:"varint,2,opt,name=alarm,proto3,enum=etcdserverpb.AlarmType" json:"alarm,omitempty"` + Alarm AlarmType `protobuf:"varint,2,opt,name=alarm,proto3,enum=etcdserverpb.AlarmType" json:"alarm,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AlarmMember) Reset() { *m = AlarmMember{} } +func (m *AlarmMember) String() string { return proto.CompactTextString(m) } +func (*AlarmMember) ProtoMessage() {} +func (*AlarmMember) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{50} +} +func (m *AlarmMember) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlarmMember) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AlarmMember.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AlarmMember) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlarmMember.Merge(m, src) +} +func (m *AlarmMember) XXX_Size() int { + return m.Size() +} +func (m *AlarmMember) XXX_DiscardUnknown() { + xxx_messageInfo_AlarmMember.DiscardUnknown(m) } -func (m *AlarmMember) Reset() { *m = AlarmMember{} } -func (m *AlarmMember) String() string { return proto.CompactTextString(m) } -func (*AlarmMember) ProtoMessage() {} -func (*AlarmMember) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{49} } +var xxx_messageInfo_AlarmMember proto.InternalMessageInfo func (m *AlarmMember) GetMemberID() uint64 { if m != nil { @@ -2387,15 +4070,46 @@ func (m *AlarmMember) GetAlarm() AlarmType { } type AlarmResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // alarms is a list of alarms associated with the alarm request. - Alarms []*AlarmMember `protobuf:"bytes,2,rep,name=alarms" json:"alarms,omitempty"` + Alarms []*AlarmMember `protobuf:"bytes,2,rep,name=alarms,proto3" json:"alarms,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AlarmResponse) Reset() { *m = AlarmResponse{} } +func (m *AlarmResponse) String() string { return proto.CompactTextString(m) } +func (*AlarmResponse) ProtoMessage() {} +func (*AlarmResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{51} +} +func (m *AlarmResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlarmResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AlarmResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AlarmResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlarmResponse.Merge(m, src) +} +func (m *AlarmResponse) XXX_Size() int { + return m.Size() +} +func (m *AlarmResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AlarmResponse.DiscardUnknown(m) } -func (m *AlarmResponse) Reset() { *m = AlarmResponse{} } -func (m *AlarmResponse) String() string { return proto.CompactTextString(m) } -func (*AlarmResponse) ProtoMessage() {} -func (*AlarmResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{50} } +var xxx_messageInfo_AlarmResponse proto.InternalMessageInfo func (m *AlarmResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2412,15 +4126,46 @@ func (m *AlarmResponse) GetAlarms() []*AlarmMember { } type StatusRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptor_77a6da22d6a3feb1, []int{52} +} +func (m *StatusRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StatusRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatusRequest.Merge(m, src) +} +func (m *StatusRequest) XXX_Size() int { + return m.Size() +} +func (m *StatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StatusRequest.DiscardUnknown(m) } -func (m *StatusRequest) Reset() { *m = StatusRequest{} } -func (m *StatusRequest) String() string { return proto.CompactTextString(m) } -func (*StatusRequest) ProtoMessage() {} -func (*StatusRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{51} } +var xxx_messageInfo_StatusRequest proto.InternalMessageInfo type StatusResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // version is the cluster protocol version used by the responding member. Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // dbSize is the size of the backend database, in bytes, of the responding member. @@ -2430,13 +4175,44 @@ type StatusResponse struct { // raftIndex is the current raft index of the responding member. RaftIndex uint64 `protobuf:"varint,5,opt,name=raftIndex,proto3" json:"raftIndex,omitempty"` // raftTerm is the current raft term of the responding member. - RaftTerm uint64 `protobuf:"varint,6,opt,name=raftTerm,proto3" json:"raftTerm,omitempty"` + RaftTerm uint64 `protobuf:"varint,6,opt,name=raftTerm,proto3" json:"raftTerm,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptor_77a6da22d6a3feb1, []int{53} +} +func (m *StatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StatusResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatusResponse.Merge(m, src) +} +func (m *StatusResponse) XXX_Size() int { + return m.Size() +} +func (m *StatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StatusResponse.DiscardUnknown(m) } -func (m *StatusResponse) Reset() { *m = StatusResponse{} } -func (m *StatusResponse) String() string { return proto.CompactTextString(m) } -func (*StatusResponse) ProtoMessage() {} -func (*StatusResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{52} } +var xxx_messageInfo_StatusResponse proto.InternalMessageInfo func (m *StatusResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2481,30 +4257,123 @@ func (m *StatusResponse) GetRaftTerm() uint64 { } type AuthEnableRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthEnableRequest) Reset() { *m = AuthEnableRequest{} } +func (m *AuthEnableRequest) String() string { return proto.CompactTextString(m) } +func (*AuthEnableRequest) ProtoMessage() {} +func (*AuthEnableRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{54} +} +func (m *AuthEnableRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthEnableRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthEnableRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthEnableRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthEnableRequest.Merge(m, src) +} +func (m *AuthEnableRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthEnableRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthEnableRequest.DiscardUnknown(m) } -func (m *AuthEnableRequest) Reset() { *m = AuthEnableRequest{} } -func (m *AuthEnableRequest) String() string { return proto.CompactTextString(m) } -func (*AuthEnableRequest) ProtoMessage() {} -func (*AuthEnableRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{53} } +var xxx_messageInfo_AuthEnableRequest proto.InternalMessageInfo type AuthDisableRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthDisableRequest) Reset() { *m = AuthDisableRequest{} } +func (m *AuthDisableRequest) String() string { return proto.CompactTextString(m) } +func (*AuthDisableRequest) ProtoMessage() {} +func (*AuthDisableRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{55} +} +func (m *AuthDisableRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthDisableRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthDisableRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthDisableRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthDisableRequest.Merge(m, src) +} +func (m *AuthDisableRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthDisableRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthDisableRequest.DiscardUnknown(m) } -func (m *AuthDisableRequest) Reset() { *m = AuthDisableRequest{} } -func (m *AuthDisableRequest) String() string { return proto.CompactTextString(m) } -func (*AuthDisableRequest) ProtoMessage() {} -func (*AuthDisableRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{54} } +var xxx_messageInfo_AuthDisableRequest proto.InternalMessageInfo type AuthenticateRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthenticateRequest) Reset() { *m = AuthenticateRequest{} } +func (m *AuthenticateRequest) String() string { return proto.CompactTextString(m) } +func (*AuthenticateRequest) ProtoMessage() {} +func (*AuthenticateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{56} +} +func (m *AuthenticateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthenticateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthenticateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthenticateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthenticateRequest.Merge(m, src) +} +func (m *AuthenticateRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthenticateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthenticateRequest.DiscardUnknown(m) } -func (m *AuthenticateRequest) Reset() { *m = AuthenticateRequest{} } -func (m *AuthenticateRequest) String() string { return proto.CompactTextString(m) } -func (*AuthenticateRequest) ProtoMessage() {} -func (*AuthenticateRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{55} } +var xxx_messageInfo_AuthenticateRequest proto.InternalMessageInfo func (m *AuthenticateRequest) GetName() string { if m != nil { @@ -2521,14 +4390,45 @@ func (m *AuthenticateRequest) GetPassword() string { } type AuthUserAddRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserAddRequest) Reset() { *m = AuthUserAddRequest{} } +func (m *AuthUserAddRequest) String() string { return proto.CompactTextString(m) } +func (*AuthUserAddRequest) ProtoMessage() {} +func (*AuthUserAddRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{57} +} +func (m *AuthUserAddRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserAddRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserAddRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserAddRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserAddRequest.Merge(m, src) +} +func (m *AuthUserAddRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthUserAddRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserAddRequest.DiscardUnknown(m) } -func (m *AuthUserAddRequest) Reset() { *m = AuthUserAddRequest{} } -func (m *AuthUserAddRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserAddRequest) ProtoMessage() {} -func (*AuthUserAddRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{56} } +var xxx_messageInfo_AuthUserAddRequest proto.InternalMessageInfo func (m *AuthUserAddRequest) GetName() string { if m != nil { @@ -2545,13 +4445,44 @@ func (m *AuthUserAddRequest) GetPassword() string { } type AuthUserGetRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserGetRequest) Reset() { *m = AuthUserGetRequest{} } +func (m *AuthUserGetRequest) String() string { return proto.CompactTextString(m) } +func (*AuthUserGetRequest) ProtoMessage() {} +func (*AuthUserGetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{58} +} +func (m *AuthUserGetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserGetRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserGetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserGetRequest.Merge(m, src) +} +func (m *AuthUserGetRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthUserGetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserGetRequest.DiscardUnknown(m) } -func (m *AuthUserGetRequest) Reset() { *m = AuthUserGetRequest{} } -func (m *AuthUserGetRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserGetRequest) ProtoMessage() {} -func (*AuthUserGetRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{57} } +var xxx_messageInfo_AuthUserGetRequest proto.InternalMessageInfo func (m *AuthUserGetRequest) GetName() string { if m != nil { @@ -2562,13 +4493,44 @@ func (m *AuthUserGetRequest) GetName() string { type AuthUserDeleteRequest struct { // name is the name of the user to delete. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserDeleteRequest) Reset() { *m = AuthUserDeleteRequest{} } +func (m *AuthUserDeleteRequest) String() string { return proto.CompactTextString(m) } +func (*AuthUserDeleteRequest) ProtoMessage() {} +func (*AuthUserDeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{59} +} +func (m *AuthUserDeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserDeleteRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserDeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserDeleteRequest.Merge(m, src) +} +func (m *AuthUserDeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthUserDeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserDeleteRequest.DiscardUnknown(m) } -func (m *AuthUserDeleteRequest) Reset() { *m = AuthUserDeleteRequest{} } -func (m *AuthUserDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserDeleteRequest) ProtoMessage() {} -func (*AuthUserDeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{58} } +var xxx_messageInfo_AuthUserDeleteRequest proto.InternalMessageInfo func (m *AuthUserDeleteRequest) GetName() string { if m != nil { @@ -2581,16 +4543,45 @@ type AuthUserChangePasswordRequest struct { // name is the name of the user whose password is being changed. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // password is the new password for the user. - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *AuthUserChangePasswordRequest) Reset() { *m = AuthUserChangePasswordRequest{} } func (m *AuthUserChangePasswordRequest) String() string { return proto.CompactTextString(m) } func (*AuthUserChangePasswordRequest) ProtoMessage() {} func (*AuthUserChangePasswordRequest) Descriptor() ([]byte, []int) { - return fileDescriptorRpc, []int{59} + return fileDescriptor_77a6da22d6a3feb1, []int{60} +} +func (m *AuthUserChangePasswordRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserChangePasswordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserChangePasswordRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserChangePasswordRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserChangePasswordRequest.Merge(m, src) +} +func (m *AuthUserChangePasswordRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthUserChangePasswordRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserChangePasswordRequest.DiscardUnknown(m) } +var xxx_messageInfo_AuthUserChangePasswordRequest proto.InternalMessageInfo + func (m *AuthUserChangePasswordRequest) GetName() string { if m != nil { return m.Name @@ -2609,13 +4600,44 @@ type AuthUserGrantRoleRequest struct { // user is the name of the user which should be granted a given role. User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` // role is the name of the role to grant to the user. - Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` + Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserGrantRoleRequest) Reset() { *m = AuthUserGrantRoleRequest{} } +func (m *AuthUserGrantRoleRequest) String() string { return proto.CompactTextString(m) } +func (*AuthUserGrantRoleRequest) ProtoMessage() {} +func (*AuthUserGrantRoleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{61} +} +func (m *AuthUserGrantRoleRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserGrantRoleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserGrantRoleRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserGrantRoleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserGrantRoleRequest.Merge(m, src) +} +func (m *AuthUserGrantRoleRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthUserGrantRoleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserGrantRoleRequest.DiscardUnknown(m) } -func (m *AuthUserGrantRoleRequest) Reset() { *m = AuthUserGrantRoleRequest{} } -func (m *AuthUserGrantRoleRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserGrantRoleRequest) ProtoMessage() {} -func (*AuthUserGrantRoleRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{60} } +var xxx_messageInfo_AuthUserGrantRoleRequest proto.InternalMessageInfo func (m *AuthUserGrantRoleRequest) GetUser() string { if m != nil { @@ -2632,14 +4654,45 @@ func (m *AuthUserGrantRoleRequest) GetRole() string { } type AuthUserRevokeRoleRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserRevokeRoleRequest) Reset() { *m = AuthUserRevokeRoleRequest{} } +func (m *AuthUserRevokeRoleRequest) String() string { return proto.CompactTextString(m) } +func (*AuthUserRevokeRoleRequest) ProtoMessage() {} +func (*AuthUserRevokeRoleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{62} +} +func (m *AuthUserRevokeRoleRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserRevokeRoleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserRevokeRoleRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserRevokeRoleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserRevokeRoleRequest.Merge(m, src) +} +func (m *AuthUserRevokeRoleRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthUserRevokeRoleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserRevokeRoleRequest.DiscardUnknown(m) } -func (m *AuthUserRevokeRoleRequest) Reset() { *m = AuthUserRevokeRoleRequest{} } -func (m *AuthUserRevokeRoleRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserRevokeRoleRequest) ProtoMessage() {} -func (*AuthUserRevokeRoleRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{61} } +var xxx_messageInfo_AuthUserRevokeRoleRequest proto.InternalMessageInfo func (m *AuthUserRevokeRoleRequest) GetName() string { if m != nil { @@ -2657,13 +4710,44 @@ func (m *AuthUserRevokeRoleRequest) GetRole() string { type AuthRoleAddRequest struct { // name is the name of the role to add to the authentication system. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthRoleAddRequest) Reset() { *m = AuthRoleAddRequest{} } +func (m *AuthRoleAddRequest) String() string { return proto.CompactTextString(m) } +func (*AuthRoleAddRequest) ProtoMessage() {} +func (*AuthRoleAddRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{63} +} +func (m *AuthRoleAddRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleAddRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleAddRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleAddRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleAddRequest.Merge(m, src) +} +func (m *AuthRoleAddRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleAddRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleAddRequest.DiscardUnknown(m) } -func (m *AuthRoleAddRequest) Reset() { *m = AuthRoleAddRequest{} } -func (m *AuthRoleAddRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRoleAddRequest) ProtoMessage() {} -func (*AuthRoleAddRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{62} } +var xxx_messageInfo_AuthRoleAddRequest proto.InternalMessageInfo func (m *AuthRoleAddRequest) GetName() string { if m != nil { @@ -2673,13 +4757,44 @@ func (m *AuthRoleAddRequest) GetName() string { } type AuthRoleGetRequest struct { - Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthRoleGetRequest) Reset() { *m = AuthRoleGetRequest{} } +func (m *AuthRoleGetRequest) String() string { return proto.CompactTextString(m) } +func (*AuthRoleGetRequest) ProtoMessage() {} +func (*AuthRoleGetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{64} +} +func (m *AuthRoleGetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleGetRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleGetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleGetRequest.Merge(m, src) +} +func (m *AuthRoleGetRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleGetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleGetRequest.DiscardUnknown(m) } -func (m *AuthRoleGetRequest) Reset() { *m = AuthRoleGetRequest{} } -func (m *AuthRoleGetRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRoleGetRequest) ProtoMessage() {} -func (*AuthRoleGetRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{63} } +var xxx_messageInfo_AuthRoleGetRequest proto.InternalMessageInfo func (m *AuthRoleGetRequest) GetRole() string { if m != nil { @@ -2689,29 +4804,122 @@ func (m *AuthRoleGetRequest) GetRole() string { } type AuthUserListRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserListRequest) Reset() { *m = AuthUserListRequest{} } +func (m *AuthUserListRequest) String() string { return proto.CompactTextString(m) } +func (*AuthUserListRequest) ProtoMessage() {} +func (*AuthUserListRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{65} +} +func (m *AuthUserListRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserListRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserListRequest.Merge(m, src) +} +func (m *AuthUserListRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthUserListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserListRequest.DiscardUnknown(m) } -func (m *AuthUserListRequest) Reset() { *m = AuthUserListRequest{} } -func (m *AuthUserListRequest) String() string { return proto.CompactTextString(m) } -func (*AuthUserListRequest) ProtoMessage() {} -func (*AuthUserListRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{64} } +var xxx_messageInfo_AuthUserListRequest proto.InternalMessageInfo type AuthRoleListRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthRoleListRequest) Reset() { *m = AuthRoleListRequest{} } +func (m *AuthRoleListRequest) String() string { return proto.CompactTextString(m) } +func (*AuthRoleListRequest) ProtoMessage() {} +func (*AuthRoleListRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{66} +} +func (m *AuthRoleListRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleListRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleListRequest.Merge(m, src) +} +func (m *AuthRoleListRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleListRequest.DiscardUnknown(m) } -func (m *AuthRoleListRequest) Reset() { *m = AuthRoleListRequest{} } -func (m *AuthRoleListRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRoleListRequest) ProtoMessage() {} -func (*AuthRoleListRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{65} } +var xxx_messageInfo_AuthRoleListRequest proto.InternalMessageInfo type AuthRoleDeleteRequest struct { - Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthRoleDeleteRequest) Reset() { *m = AuthRoleDeleteRequest{} } +func (m *AuthRoleDeleteRequest) String() string { return proto.CompactTextString(m) } +func (*AuthRoleDeleteRequest) ProtoMessage() {} +func (*AuthRoleDeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{67} +} +func (m *AuthRoleDeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleDeleteRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleDeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleDeleteRequest.Merge(m, src) +} +func (m *AuthRoleDeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleDeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleDeleteRequest.DiscardUnknown(m) } -func (m *AuthRoleDeleteRequest) Reset() { *m = AuthRoleDeleteRequest{} } -func (m *AuthRoleDeleteRequest) String() string { return proto.CompactTextString(m) } -func (*AuthRoleDeleteRequest) ProtoMessage() {} -func (*AuthRoleDeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{66} } +var xxx_messageInfo_AuthRoleDeleteRequest proto.InternalMessageInfo func (m *AuthRoleDeleteRequest) GetRole() string { if m != nil { @@ -2724,15 +4932,44 @@ type AuthRoleGrantPermissionRequest struct { // name is the name of the role which will be granted the permission. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // perm is the permission to grant to the role. - Perm *authpb.Permission `protobuf:"bytes,2,opt,name=perm" json:"perm,omitempty"` + Perm *authpb.Permission `protobuf:"bytes,2,opt,name=perm,proto3" json:"perm,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *AuthRoleGrantPermissionRequest) Reset() { *m = AuthRoleGrantPermissionRequest{} } func (m *AuthRoleGrantPermissionRequest) String() string { return proto.CompactTextString(m) } func (*AuthRoleGrantPermissionRequest) ProtoMessage() {} func (*AuthRoleGrantPermissionRequest) Descriptor() ([]byte, []int) { - return fileDescriptorRpc, []int{67} + return fileDescriptor_77a6da22d6a3feb1, []int{68} +} +func (m *AuthRoleGrantPermissionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleGrantPermissionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleGrantPermissionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleGrantPermissionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleGrantPermissionRequest.Merge(m, src) +} +func (m *AuthRoleGrantPermissionRequest) XXX_Size() int { + return m.Size() } +func (m *AuthRoleGrantPermissionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleGrantPermissionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuthRoleGrantPermissionRequest proto.InternalMessageInfo func (m *AuthRoleGrantPermissionRequest) GetName() string { if m != nil { @@ -2749,23 +4986,52 @@ func (m *AuthRoleGrantPermissionRequest) GetPerm() *authpb.Permission { } type AuthRoleRevokePermissionRequest struct { - Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - RangeEnd string `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + RangeEnd string `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *AuthRoleRevokePermissionRequest) Reset() { *m = AuthRoleRevokePermissionRequest{} } func (m *AuthRoleRevokePermissionRequest) String() string { return proto.CompactTextString(m) } func (*AuthRoleRevokePermissionRequest) ProtoMessage() {} func (*AuthRoleRevokePermissionRequest) Descriptor() ([]byte, []int) { - return fileDescriptorRpc, []int{68} + return fileDescriptor_77a6da22d6a3feb1, []int{69} } - -func (m *AuthRoleRevokePermissionRequest) GetRole() string { - if m != nil { - return m.Role - } - return "" +func (m *AuthRoleRevokePermissionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleRevokePermissionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleRevokePermissionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleRevokePermissionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleRevokePermissionRequest.Merge(m, src) +} +func (m *AuthRoleRevokePermissionRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleRevokePermissionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleRevokePermissionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuthRoleRevokePermissionRequest proto.InternalMessageInfo + +func (m *AuthRoleRevokePermissionRequest) GetRole() string { + if m != nil { + return m.Role + } + return "" } func (m *AuthRoleRevokePermissionRequest) GetKey() string { @@ -2783,13 +5049,44 @@ func (m *AuthRoleRevokePermissionRequest) GetRangeEnd() string { } type AuthEnableResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthEnableResponse) Reset() { *m = AuthEnableResponse{} } +func (m *AuthEnableResponse) String() string { return proto.CompactTextString(m) } +func (*AuthEnableResponse) ProtoMessage() {} +func (*AuthEnableResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{70} +} +func (m *AuthEnableResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthEnableResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthEnableResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthEnableResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthEnableResponse.Merge(m, src) +} +func (m *AuthEnableResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthEnableResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthEnableResponse.DiscardUnknown(m) } -func (m *AuthEnableResponse) Reset() { *m = AuthEnableResponse{} } -func (m *AuthEnableResponse) String() string { return proto.CompactTextString(m) } -func (*AuthEnableResponse) ProtoMessage() {} -func (*AuthEnableResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{69} } +var xxx_messageInfo_AuthEnableResponse proto.InternalMessageInfo func (m *AuthEnableResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2799,13 +5096,44 @@ func (m *AuthEnableResponse) GetHeader() *ResponseHeader { } type AuthDisableResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthDisableResponse) Reset() { *m = AuthDisableResponse{} } +func (m *AuthDisableResponse) String() string { return proto.CompactTextString(m) } +func (*AuthDisableResponse) ProtoMessage() {} +func (*AuthDisableResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{71} +} +func (m *AuthDisableResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthDisableResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthDisableResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthDisableResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthDisableResponse.Merge(m, src) +} +func (m *AuthDisableResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthDisableResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthDisableResponse.DiscardUnknown(m) } -func (m *AuthDisableResponse) Reset() { *m = AuthDisableResponse{} } -func (m *AuthDisableResponse) String() string { return proto.CompactTextString(m) } -func (*AuthDisableResponse) ProtoMessage() {} -func (*AuthDisableResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{70} } +var xxx_messageInfo_AuthDisableResponse proto.InternalMessageInfo func (m *AuthDisableResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2815,15 +5143,46 @@ func (m *AuthDisableResponse) GetHeader() *ResponseHeader { } type AuthenticateResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` // token is an authorized token that can be used in succeeding RPCs - Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthenticateResponse) Reset() { *m = AuthenticateResponse{} } +func (m *AuthenticateResponse) String() string { return proto.CompactTextString(m) } +func (*AuthenticateResponse) ProtoMessage() {} +func (*AuthenticateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{72} +} +func (m *AuthenticateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthenticateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthenticateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthenticateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthenticateResponse.Merge(m, src) +} +func (m *AuthenticateResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthenticateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthenticateResponse.DiscardUnknown(m) } -func (m *AuthenticateResponse) Reset() { *m = AuthenticateResponse{} } -func (m *AuthenticateResponse) String() string { return proto.CompactTextString(m) } -func (*AuthenticateResponse) ProtoMessage() {} -func (*AuthenticateResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{71} } +var xxx_messageInfo_AuthenticateResponse proto.InternalMessageInfo func (m *AuthenticateResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2840,13 +5199,44 @@ func (m *AuthenticateResponse) GetToken() string { } type AuthUserAddResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserAddResponse) Reset() { *m = AuthUserAddResponse{} } +func (m *AuthUserAddResponse) String() string { return proto.CompactTextString(m) } +func (*AuthUserAddResponse) ProtoMessage() {} +func (*AuthUserAddResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{73} +} +func (m *AuthUserAddResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserAddResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserAddResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserAddResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserAddResponse.Merge(m, src) +} +func (m *AuthUserAddResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthUserAddResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserAddResponse.DiscardUnknown(m) } -func (m *AuthUserAddResponse) Reset() { *m = AuthUserAddResponse{} } -func (m *AuthUserAddResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserAddResponse) ProtoMessage() {} -func (*AuthUserAddResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{72} } +var xxx_messageInfo_AuthUserAddResponse proto.InternalMessageInfo func (m *AuthUserAddResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2856,14 +5246,45 @@ func (m *AuthUserAddResponse) GetHeader() *ResponseHeader { } type AuthUserGetResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - Roles []string `protobuf:"bytes,2,rep,name=roles" json:"roles,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserGetResponse) Reset() { *m = AuthUserGetResponse{} } +func (m *AuthUserGetResponse) String() string { return proto.CompactTextString(m) } +func (*AuthUserGetResponse) ProtoMessage() {} +func (*AuthUserGetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{74} +} +func (m *AuthUserGetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserGetResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserGetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserGetResponse.Merge(m, src) +} +func (m *AuthUserGetResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthUserGetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserGetResponse.DiscardUnknown(m) } -func (m *AuthUserGetResponse) Reset() { *m = AuthUserGetResponse{} } -func (m *AuthUserGetResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserGetResponse) ProtoMessage() {} -func (*AuthUserGetResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{73} } +var xxx_messageInfo_AuthUserGetResponse proto.InternalMessageInfo func (m *AuthUserGetResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2880,13 +5301,44 @@ func (m *AuthUserGetResponse) GetRoles() []string { } type AuthUserDeleteResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserDeleteResponse) Reset() { *m = AuthUserDeleteResponse{} } +func (m *AuthUserDeleteResponse) String() string { return proto.CompactTextString(m) } +func (*AuthUserDeleteResponse) ProtoMessage() {} +func (*AuthUserDeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{75} +} +func (m *AuthUserDeleteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserDeleteResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserDeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserDeleteResponse.Merge(m, src) +} +func (m *AuthUserDeleteResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthUserDeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserDeleteResponse.DiscardUnknown(m) } -func (m *AuthUserDeleteResponse) Reset() { *m = AuthUserDeleteResponse{} } -func (m *AuthUserDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserDeleteResponse) ProtoMessage() {} -func (*AuthUserDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{74} } +var xxx_messageInfo_AuthUserDeleteResponse proto.InternalMessageInfo func (m *AuthUserDeleteResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2896,15 +5348,44 @@ func (m *AuthUserDeleteResponse) GetHeader() *ResponseHeader { } type AuthUserChangePasswordResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *AuthUserChangePasswordResponse) Reset() { *m = AuthUserChangePasswordResponse{} } func (m *AuthUserChangePasswordResponse) String() string { return proto.CompactTextString(m) } func (*AuthUserChangePasswordResponse) ProtoMessage() {} func (*AuthUserChangePasswordResponse) Descriptor() ([]byte, []int) { - return fileDescriptorRpc, []int{75} + return fileDescriptor_77a6da22d6a3feb1, []int{76} +} +func (m *AuthUserChangePasswordResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserChangePasswordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserChangePasswordResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } +func (m *AuthUserChangePasswordResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserChangePasswordResponse.Merge(m, src) +} +func (m *AuthUserChangePasswordResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthUserChangePasswordResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserChangePasswordResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuthUserChangePasswordResponse proto.InternalMessageInfo func (m *AuthUserChangePasswordResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2914,13 +5395,44 @@ func (m *AuthUserChangePasswordResponse) GetHeader() *ResponseHeader { } type AuthUserGrantRoleResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserGrantRoleResponse) Reset() { *m = AuthUserGrantRoleResponse{} } +func (m *AuthUserGrantRoleResponse) String() string { return proto.CompactTextString(m) } +func (*AuthUserGrantRoleResponse) ProtoMessage() {} +func (*AuthUserGrantRoleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{77} +} +func (m *AuthUserGrantRoleResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserGrantRoleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserGrantRoleResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserGrantRoleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserGrantRoleResponse.Merge(m, src) +} +func (m *AuthUserGrantRoleResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthUserGrantRoleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserGrantRoleResponse.DiscardUnknown(m) } -func (m *AuthUserGrantRoleResponse) Reset() { *m = AuthUserGrantRoleResponse{} } -func (m *AuthUserGrantRoleResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserGrantRoleResponse) ProtoMessage() {} -func (*AuthUserGrantRoleResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{76} } +var xxx_messageInfo_AuthUserGrantRoleResponse proto.InternalMessageInfo func (m *AuthUserGrantRoleResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2930,13 +5442,44 @@ func (m *AuthUserGrantRoleResponse) GetHeader() *ResponseHeader { } type AuthUserRevokeRoleResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserRevokeRoleResponse) Reset() { *m = AuthUserRevokeRoleResponse{} } +func (m *AuthUserRevokeRoleResponse) String() string { return proto.CompactTextString(m) } +func (*AuthUserRevokeRoleResponse) ProtoMessage() {} +func (*AuthUserRevokeRoleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{78} +} +func (m *AuthUserRevokeRoleResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserRevokeRoleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserRevokeRoleResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserRevokeRoleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserRevokeRoleResponse.Merge(m, src) +} +func (m *AuthUserRevokeRoleResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthUserRevokeRoleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserRevokeRoleResponse.DiscardUnknown(m) } -func (m *AuthUserRevokeRoleResponse) Reset() { *m = AuthUserRevokeRoleResponse{} } -func (m *AuthUserRevokeRoleResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserRevokeRoleResponse) ProtoMessage() {} -func (*AuthUserRevokeRoleResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{77} } +var xxx_messageInfo_AuthUserRevokeRoleResponse proto.InternalMessageInfo func (m *AuthUserRevokeRoleResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2946,13 +5489,44 @@ func (m *AuthUserRevokeRoleResponse) GetHeader() *ResponseHeader { } type AuthRoleAddResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthRoleAddResponse) Reset() { *m = AuthRoleAddResponse{} } +func (m *AuthRoleAddResponse) String() string { return proto.CompactTextString(m) } +func (*AuthRoleAddResponse) ProtoMessage() {} +func (*AuthRoleAddResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{79} +} +func (m *AuthRoleAddResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleAddResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleAddResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleAddResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleAddResponse.Merge(m, src) +} +func (m *AuthRoleAddResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleAddResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleAddResponse.DiscardUnknown(m) } -func (m *AuthRoleAddResponse) Reset() { *m = AuthRoleAddResponse{} } -func (m *AuthRoleAddResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRoleAddResponse) ProtoMessage() {} -func (*AuthRoleAddResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{78} } +var xxx_messageInfo_AuthRoleAddResponse proto.InternalMessageInfo func (m *AuthRoleAddResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2962,14 +5536,45 @@ func (m *AuthRoleAddResponse) GetHeader() *ResponseHeader { } type AuthRoleGetResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - Perm []*authpb.Permission `protobuf:"bytes,2,rep,name=perm" json:"perm,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Perm []*authpb.Permission `protobuf:"bytes,2,rep,name=perm,proto3" json:"perm,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthRoleGetResponse) Reset() { *m = AuthRoleGetResponse{} } +func (m *AuthRoleGetResponse) String() string { return proto.CompactTextString(m) } +func (*AuthRoleGetResponse) ProtoMessage() {} +func (*AuthRoleGetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{80} +} +func (m *AuthRoleGetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleGetResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleGetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleGetResponse.Merge(m, src) +} +func (m *AuthRoleGetResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleGetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleGetResponse.DiscardUnknown(m) } -func (m *AuthRoleGetResponse) Reset() { *m = AuthRoleGetResponse{} } -func (m *AuthRoleGetResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRoleGetResponse) ProtoMessage() {} -func (*AuthRoleGetResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{79} } +var xxx_messageInfo_AuthRoleGetResponse proto.InternalMessageInfo func (m *AuthRoleGetResponse) GetHeader() *ResponseHeader { if m != nil { @@ -2986,14 +5591,45 @@ func (m *AuthRoleGetResponse) GetPerm() []*authpb.Permission { } type AuthRoleListResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - Roles []string `protobuf:"bytes,2,rep,name=roles" json:"roles,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthRoleListResponse) Reset() { *m = AuthRoleListResponse{} } +func (m *AuthRoleListResponse) String() string { return proto.CompactTextString(m) } +func (*AuthRoleListResponse) ProtoMessage() {} +func (*AuthRoleListResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{81} +} +func (m *AuthRoleListResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleListResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleListResponse.Merge(m, src) +} +func (m *AuthRoleListResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleListResponse.DiscardUnknown(m) } -func (m *AuthRoleListResponse) Reset() { *m = AuthRoleListResponse{} } -func (m *AuthRoleListResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRoleListResponse) ProtoMessage() {} -func (*AuthRoleListResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{80} } +var xxx_messageInfo_AuthRoleListResponse proto.InternalMessageInfo func (m *AuthRoleListResponse) GetHeader() *ResponseHeader { if m != nil { @@ -3010,14 +5646,45 @@ func (m *AuthRoleListResponse) GetRoles() []string { } type AuthUserListResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - Users []string `protobuf:"bytes,2,rep,name=users" json:"users,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Users []string `protobuf:"bytes,2,rep,name=users,proto3" json:"users,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthUserListResponse) Reset() { *m = AuthUserListResponse{} } +func (m *AuthUserListResponse) String() string { return proto.CompactTextString(m) } +func (*AuthUserListResponse) ProtoMessage() {} +func (*AuthUserListResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{82} +} +func (m *AuthUserListResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthUserListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthUserListResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthUserListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthUserListResponse.Merge(m, src) +} +func (m *AuthUserListResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthUserListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthUserListResponse.DiscardUnknown(m) } -func (m *AuthUserListResponse) Reset() { *m = AuthUserListResponse{} } -func (m *AuthUserListResponse) String() string { return proto.CompactTextString(m) } -func (*AuthUserListResponse) ProtoMessage() {} -func (*AuthUserListResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{81} } +var xxx_messageInfo_AuthUserListResponse proto.InternalMessageInfo func (m *AuthUserListResponse) GetHeader() *ResponseHeader { if m != nil { @@ -3034,13 +5701,44 @@ func (m *AuthUserListResponse) GetUsers() []string { } type AuthRoleDeleteResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthRoleDeleteResponse) Reset() { *m = AuthRoleDeleteResponse{} } +func (m *AuthRoleDeleteResponse) String() string { return proto.CompactTextString(m) } +func (*AuthRoleDeleteResponse) ProtoMessage() {} +func (*AuthRoleDeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_77a6da22d6a3feb1, []int{83} +} +func (m *AuthRoleDeleteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleDeleteResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleDeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleDeleteResponse.Merge(m, src) +} +func (m *AuthRoleDeleteResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleDeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleDeleteResponse.DiscardUnknown(m) } -func (m *AuthRoleDeleteResponse) Reset() { *m = AuthRoleDeleteResponse{} } -func (m *AuthRoleDeleteResponse) String() string { return proto.CompactTextString(m) } -func (*AuthRoleDeleteResponse) ProtoMessage() {} -func (*AuthRoleDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorRpc, []int{82} } +var xxx_messageInfo_AuthRoleDeleteResponse proto.InternalMessageInfo func (m *AuthRoleDeleteResponse) GetHeader() *ResponseHeader { if m != nil { @@ -3050,16 +5748,45 @@ func (m *AuthRoleDeleteResponse) GetHeader() *ResponseHeader { } type AuthRoleGrantPermissionResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *AuthRoleGrantPermissionResponse) Reset() { *m = AuthRoleGrantPermissionResponse{} } func (m *AuthRoleGrantPermissionResponse) String() string { return proto.CompactTextString(m) } func (*AuthRoleGrantPermissionResponse) ProtoMessage() {} func (*AuthRoleGrantPermissionResponse) Descriptor() ([]byte, []int) { - return fileDescriptorRpc, []int{83} + return fileDescriptor_77a6da22d6a3feb1, []int{84} +} +func (m *AuthRoleGrantPermissionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthRoleGrantPermissionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleGrantPermissionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleGrantPermissionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleGrantPermissionResponse.Merge(m, src) +} +func (m *AuthRoleGrantPermissionResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleGrantPermissionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleGrantPermissionResponse.DiscardUnknown(m) } +var xxx_messageInfo_AuthRoleGrantPermissionResponse proto.InternalMessageInfo + func (m *AuthRoleGrantPermissionResponse) GetHeader() *ResponseHeader { if m != nil { return m.Header @@ -3068,15 +5795,44 @@ func (m *AuthRoleGrantPermissionResponse) GetHeader() *ResponseHeader { } type AuthRoleRevokePermissionResponse struct { - Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *AuthRoleRevokePermissionResponse) Reset() { *m = AuthRoleRevokePermissionResponse{} } func (m *AuthRoleRevokePermissionResponse) String() string { return proto.CompactTextString(m) } func (*AuthRoleRevokePermissionResponse) ProtoMessage() {} func (*AuthRoleRevokePermissionResponse) Descriptor() ([]byte, []int) { - return fileDescriptorRpc, []int{84} + return fileDescriptor_77a6da22d6a3feb1, []int{85} +} +func (m *AuthRoleRevokePermissionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } +func (m *AuthRoleRevokePermissionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthRoleRevokePermissionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthRoleRevokePermissionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthRoleRevokePermissionResponse.Merge(m, src) +} +func (m *AuthRoleRevokePermissionResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthRoleRevokePermissionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthRoleRevokePermissionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuthRoleRevokePermissionResponse proto.InternalMessageInfo func (m *AuthRoleRevokePermissionResponse) GetHeader() *ResponseHeader { if m != nil { @@ -3086,6 +5842,13 @@ func (m *AuthRoleRevokePermissionResponse) GetHeader() *ResponseHeader { } func init() { + proto.RegisterEnum("etcdserverpb.AlarmType", AlarmType_name, AlarmType_value) + proto.RegisterEnum("etcdserverpb.RangeRequest_SortOrder", RangeRequest_SortOrder_name, RangeRequest_SortOrder_value) + proto.RegisterEnum("etcdserverpb.RangeRequest_SortTarget", RangeRequest_SortTarget_name, RangeRequest_SortTarget_value) + proto.RegisterEnum("etcdserverpb.Compare_CompareResult", Compare_CompareResult_name, Compare_CompareResult_value) + proto.RegisterEnum("etcdserverpb.Compare_CompareTarget", Compare_CompareTarget_name, Compare_CompareTarget_value) + proto.RegisterEnum("etcdserverpb.WatchCreateRequest_FilterType", WatchCreateRequest_FilterType_name, WatchCreateRequest_FilterType_value) + proto.RegisterEnum("etcdserverpb.AlarmRequest_AlarmAction", AlarmRequest_AlarmAction_name, AlarmRequest_AlarmAction_value) proto.RegisterType((*ResponseHeader)(nil), "etcdserverpb.ResponseHeader") proto.RegisterType((*RangeRequest)(nil), "etcdserverpb.RangeRequest") proto.RegisterType((*RangeResponse)(nil), "etcdserverpb.RangeResponse") @@ -3109,6 +5872,7 @@ func init() { proto.RegisterType((*WatchRequest)(nil), "etcdserverpb.WatchRequest") proto.RegisterType((*WatchCreateRequest)(nil), "etcdserverpb.WatchCreateRequest") proto.RegisterType((*WatchCancelRequest)(nil), "etcdserverpb.WatchCancelRequest") + proto.RegisterType((*WatchProgressRequest)(nil), "etcdserverpb.WatchProgressRequest") proto.RegisterType((*WatchResponse)(nil), "etcdserverpb.WatchResponse") proto.RegisterType((*LeaseGrantRequest)(nil), "etcdserverpb.LeaseGrantRequest") proto.RegisterType((*LeaseGrantResponse)(nil), "etcdserverpb.LeaseGrantResponse") @@ -3171,13 +5935,244 @@ func init() { proto.RegisterType((*AuthRoleDeleteResponse)(nil), "etcdserverpb.AuthRoleDeleteResponse") proto.RegisterType((*AuthRoleGrantPermissionResponse)(nil), "etcdserverpb.AuthRoleGrantPermissionResponse") proto.RegisterType((*AuthRoleRevokePermissionResponse)(nil), "etcdserverpb.AuthRoleRevokePermissionResponse") - proto.RegisterEnum("etcdserverpb.AlarmType", AlarmType_name, AlarmType_value) - proto.RegisterEnum("etcdserverpb.RangeRequest_SortOrder", RangeRequest_SortOrder_name, RangeRequest_SortOrder_value) - proto.RegisterEnum("etcdserverpb.RangeRequest_SortTarget", RangeRequest_SortTarget_name, RangeRequest_SortTarget_value) - proto.RegisterEnum("etcdserverpb.Compare_CompareResult", Compare_CompareResult_name, Compare_CompareResult_value) - proto.RegisterEnum("etcdserverpb.Compare_CompareTarget", Compare_CompareTarget_name, Compare_CompareTarget_value) - proto.RegisterEnum("etcdserverpb.WatchCreateRequest_FilterType", WatchCreateRequest_FilterType_name, WatchCreateRequest_FilterType_value) - proto.RegisterEnum("etcdserverpb.AlarmRequest_AlarmAction", AlarmRequest_AlarmAction_name, AlarmRequest_AlarmAction_value) +} + +func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) } + +var fileDescriptor_77a6da22d6a3feb1 = []byte{ + // 3711 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x5b, 0x5b, 0x73, 0x1b, 0x47, + 0x76, 0xe6, 0x00, 0x04, 0x40, 0x1c, 0x5c, 0x08, 0x35, 0x29, 0x09, 0x84, 0x24, 0x8a, 0x6a, 0xdd, + 0xa8, 0x8b, 0x09, 0x9b, 0x76, 0xf2, 0xa0, 0xa4, 0x5c, 0xa6, 0x48, 0x58, 0xa4, 0x49, 0x91, 0xf4, + 0x10, 0x94, 0x9d, 0x2a, 0x27, 0xac, 0x21, 0xd0, 0x22, 0x11, 0x02, 0x33, 0xc8, 0xcc, 0x00, 0x22, + 0x15, 0x57, 0x52, 0xe5, 0x38, 0xae, 0x3c, 0xc7, 0x55, 0xa9, 0x24, 0xaf, 0x5b, 0x5b, 0x2e, 0xff, + 0x82, 0xfd, 0x0b, 0x5b, 0xfb, 0xb2, 0xbb, 0xb5, 0x7f, 0x60, 0xcb, 0xbb, 0x2f, 0xfb, 0x0b, 0xf6, + 0xf2, 0xb4, 0xd5, 0xb7, 0x99, 0x9e, 0x1b, 0x48, 0x1b, 0xb6, 0x5f, 0xa8, 0xe9, 0xd3, 0xa7, 0xcf, + 0x39, 0x7d, 0xba, 0xcf, 0x39, 0xdd, 0x5f, 0x43, 0x90, 0xb7, 0xfb, 0xad, 0xa5, 0xbe, 0x6d, 0xb9, + 0x16, 0x2a, 0x12, 0xb7, 0xd5, 0x76, 0x88, 0x3d, 0x24, 0x76, 0xff, 0xb0, 0x36, 0x7b, 0x64, 0x1d, + 0x59, 0xac, 0xa3, 0x4e, 0xbf, 0x38, 0x4f, 0x6d, 0x8e, 0xf2, 0xd4, 0x7b, 0xc3, 0x56, 0x8b, 0xfd, + 0xe9, 0x1f, 0xd6, 0x4f, 0x86, 0xa2, 0xeb, 0x1a, 0xeb, 0x32, 0x06, 0xee, 0x31, 0xfb, 0xd3, 0x3f, + 0x64, 0xff, 0x88, 0xce, 0xeb, 0x47, 0x96, 0x75, 0xd4, 0x25, 0x75, 0xa3, 0xdf, 0xa9, 0x1b, 0xa6, + 0x69, 0xb9, 0x86, 0xdb, 0xb1, 0x4c, 0x87, 0xf7, 0xe2, 0xff, 0xd4, 0xa0, 0xac, 0x13, 0xa7, 0x6f, + 0x99, 0x0e, 0x59, 0x27, 0x46, 0x9b, 0xd8, 0xe8, 0x06, 0x40, 0xab, 0x3b, 0x70, 0x5c, 0x62, 0x1f, + 0x74, 0xda, 0x55, 0x6d, 0x41, 0x5b, 0x9c, 0xd4, 0xf3, 0x82, 0xb2, 0xd1, 0x46, 0xd7, 0x20, 0xdf, + 0x23, 0xbd, 0x43, 0xde, 0x9b, 0x62, 0xbd, 0x53, 0x9c, 0xb0, 0xd1, 0x46, 0x35, 0x98, 0xb2, 0xc9, + 0xb0, 0xe3, 0x74, 0x2c, 0xb3, 0x9a, 0x5e, 0xd0, 0x16, 0xd3, 0xba, 0xd7, 0xa6, 0x03, 0x6d, 0xe3, + 0xa5, 0x7b, 0xe0, 0x12, 0xbb, 0x57, 0x9d, 0xe4, 0x03, 0x29, 0xa1, 0x49, 0xec, 0x1e, 0xfe, 0x3c, + 0x03, 0x45, 0xdd, 0x30, 0x8f, 0x88, 0x4e, 0xfe, 0x65, 0x40, 0x1c, 0x17, 0x55, 0x20, 0x7d, 0x42, + 0xce, 0x98, 0xfa, 0xa2, 0x4e, 0x3f, 0xf9, 0x78, 0xf3, 0x88, 0x1c, 0x10, 0x93, 0x2b, 0x2e, 0xd2, + 0xf1, 0xe6, 0x11, 0x69, 0x98, 0x6d, 0x34, 0x0b, 0x99, 0x6e, 0xa7, 0xd7, 0x71, 0x85, 0x56, 0xde, + 0x08, 0x98, 0x33, 0x19, 0x32, 0x67, 0x15, 0xc0, 0xb1, 0x6c, 0xf7, 0xc0, 0xb2, 0xdb, 0xc4, 0xae, + 0x66, 0x16, 0xb4, 0xc5, 0xf2, 0xf2, 0x9d, 0x25, 0x75, 0x21, 0x96, 0x54, 0x83, 0x96, 0xf6, 0x2c, + 0xdb, 0xdd, 0xa1, 0xbc, 0x7a, 0xde, 0x91, 0x9f, 0xe8, 0x7d, 0x28, 0x30, 0x21, 0xae, 0x61, 0x1f, + 0x11, 0xb7, 0x9a, 0x65, 0x52, 0xee, 0x9e, 0x23, 0xa5, 0xc9, 0x98, 0x75, 0xa6, 0x9e, 0x7f, 0x23, + 0x0c, 0x45, 0x87, 0xd8, 0x1d, 0xa3, 0xdb, 0x79, 0x6d, 0x1c, 0x76, 0x49, 0x35, 0xb7, 0xa0, 0x2d, + 0x4e, 0xe9, 0x01, 0x1a, 0x9d, 0xff, 0x09, 0x39, 0x73, 0x0e, 0x2c, 0xb3, 0x7b, 0x56, 0x9d, 0x62, + 0x0c, 0x53, 0x94, 0xb0, 0x63, 0x76, 0xcf, 0xd8, 0xa2, 0x59, 0x03, 0xd3, 0xe5, 0xbd, 0x79, 0xd6, + 0x9b, 0x67, 0x14, 0xd6, 0xbd, 0x08, 0x95, 0x5e, 0xc7, 0x3c, 0xe8, 0x59, 0xed, 0x03, 0xcf, 0x21, + 0xc0, 0x1c, 0x52, 0xee, 0x75, 0xcc, 0xe7, 0x56, 0x5b, 0x97, 0x6e, 0xa1, 0x9c, 0xc6, 0x69, 0x90, + 0xb3, 0x20, 0x38, 0x8d, 0x53, 0x95, 0x73, 0x09, 0x66, 0xa8, 0xcc, 0x96, 0x4d, 0x0c, 0x97, 0xf8, + 0xcc, 0x45, 0xc6, 0x7c, 0xa9, 0xd7, 0x31, 0x57, 0x59, 0x4f, 0x80, 0xdf, 0x38, 0x8d, 0xf0, 0x97, + 0x04, 0xbf, 0x71, 0x1a, 0xe4, 0xc7, 0x4b, 0x90, 0xf7, 0x7c, 0x8e, 0xa6, 0x60, 0x72, 0x7b, 0x67, + 0xbb, 0x51, 0x99, 0x40, 0x00, 0xd9, 0x95, 0xbd, 0xd5, 0xc6, 0xf6, 0x5a, 0x45, 0x43, 0x05, 0xc8, + 0xad, 0x35, 0x78, 0x23, 0x85, 0x9f, 0x02, 0xf8, 0xde, 0x45, 0x39, 0x48, 0x6f, 0x36, 0xfe, 0xa1, + 0x32, 0x41, 0x79, 0x5e, 0x34, 0xf4, 0xbd, 0x8d, 0x9d, 0xed, 0x8a, 0x46, 0x07, 0xaf, 0xea, 0x8d, + 0x95, 0x66, 0xa3, 0x92, 0xa2, 0x1c, 0xcf, 0x77, 0xd6, 0x2a, 0x69, 0x94, 0x87, 0xcc, 0x8b, 0x95, + 0xad, 0xfd, 0x46, 0x65, 0x12, 0x7f, 0xa9, 0x41, 0x49, 0xac, 0x17, 0x8f, 0x09, 0xf4, 0x0e, 0x64, + 0x8f, 0x59, 0x5c, 0xb0, 0xad, 0x58, 0x58, 0xbe, 0x1e, 0x5a, 0xdc, 0x40, 0xec, 0xe8, 0x82, 0x17, + 0x61, 0x48, 0x9f, 0x0c, 0x9d, 0x6a, 0x6a, 0x21, 0xbd, 0x58, 0x58, 0xae, 0x2c, 0xf1, 0x80, 0x5d, + 0xda, 0x24, 0x67, 0x2f, 0x8c, 0xee, 0x80, 0xe8, 0xb4, 0x13, 0x21, 0x98, 0xec, 0x59, 0x36, 0x61, + 0x3b, 0x76, 0x4a, 0x67, 0xdf, 0x74, 0x1b, 0xb3, 0x45, 0x13, 0xbb, 0x95, 0x37, 0xf0, 0xd7, 0x1a, + 0xc0, 0xee, 0xc0, 0x4d, 0x0e, 0x8d, 0x59, 0xc8, 0x0c, 0xa9, 0x60, 0x11, 0x16, 0xbc, 0xc1, 0x62, + 0x82, 0x18, 0x0e, 0xf1, 0x62, 0x82, 0x36, 0xd0, 0x55, 0xc8, 0xf5, 0x6d, 0x32, 0x3c, 0x38, 0x19, + 0x32, 0x25, 0x53, 0x7a, 0x96, 0x36, 0x37, 0x87, 0xe8, 0x16, 0x14, 0x3b, 0x47, 0xa6, 0x65, 0x93, + 0x03, 0x2e, 0x2b, 0xc3, 0x7a, 0x0b, 0x9c, 0xc6, 0xec, 0x56, 0x58, 0xb8, 0xe0, 0xac, 0xca, 0xb2, + 0x45, 0x49, 0xd8, 0x84, 0x02, 0x33, 0x75, 0x2c, 0xf7, 0x3d, 0xf0, 0x6d, 0x4c, 0xb1, 0x61, 0x51, + 0x17, 0x0a, 0xab, 0xf1, 0x27, 0x80, 0xd6, 0x48, 0x97, 0xb8, 0x64, 0x9c, 0xec, 0xa1, 0xf8, 0x24, + 0xad, 0xfa, 0x04, 0xff, 0xb7, 0x06, 0x33, 0x01, 0xf1, 0x63, 0x4d, 0xab, 0x0a, 0xb9, 0x36, 0x13, + 0xc6, 0x2d, 0x48, 0xeb, 0xb2, 0x89, 0x1e, 0xc1, 0x94, 0x30, 0xc0, 0xa9, 0xa6, 0x13, 0x36, 0x4d, + 0x8e, 0xdb, 0xe4, 0xe0, 0xaf, 0x53, 0x90, 0x17, 0x13, 0xdd, 0xe9, 0xa3, 0x15, 0x28, 0xd9, 0xbc, + 0x71, 0xc0, 0xe6, 0x23, 0x2c, 0xaa, 0x25, 0x27, 0xa1, 0xf5, 0x09, 0xbd, 0x28, 0x86, 0x30, 0x32, + 0xfa, 0x3b, 0x28, 0x48, 0x11, 0xfd, 0x81, 0x2b, 0x5c, 0x5e, 0x0d, 0x0a, 0xf0, 0xf7, 0xdf, 0xfa, + 0x84, 0x0e, 0x82, 0x7d, 0x77, 0xe0, 0xa2, 0x26, 0xcc, 0xca, 0xc1, 0x7c, 0x36, 0xc2, 0x8c, 0x34, + 0x93, 0xb2, 0x10, 0x94, 0x12, 0x5d, 0xaa, 0xf5, 0x09, 0x1d, 0x89, 0xf1, 0x4a, 0xa7, 0x6a, 0x92, + 0x7b, 0xca, 0x93, 0x77, 0xc4, 0xa4, 0xe6, 0xa9, 0x19, 0x35, 0xa9, 0x79, 0x6a, 0x3e, 0xcd, 0x43, + 0x4e, 0xb4, 0xf0, 0xcf, 0x52, 0x00, 0x72, 0x35, 0x76, 0xfa, 0x68, 0x0d, 0xca, 0xb6, 0x68, 0x05, + 0xbc, 0x75, 0x2d, 0xd6, 0x5b, 0x62, 0x11, 0x27, 0xf4, 0x92, 0x1c, 0xc4, 0x8d, 0x7b, 0x17, 0x8a, + 0x9e, 0x14, 0xdf, 0x61, 0x73, 0x31, 0x0e, 0xf3, 0x24, 0x14, 0xe4, 0x00, 0xea, 0xb2, 0x8f, 0xe0, + 0xb2, 0x37, 0x3e, 0xc6, 0x67, 0xb7, 0x46, 0xf8, 0xcc, 0x13, 0x38, 0x23, 0x25, 0xa8, 0x5e, 0x53, + 0x0d, 0xf3, 0xdd, 0x36, 0x17, 0xe3, 0xb6, 0xa8, 0x61, 0xd4, 0x71, 0x40, 0xeb, 0x25, 0x6f, 0xe2, + 0x3f, 0xa4, 0x21, 0xb7, 0x6a, 0xf5, 0xfa, 0x86, 0x4d, 0x57, 0x23, 0x6b, 0x13, 0x67, 0xd0, 0x75, + 0x99, 0xbb, 0xca, 0xcb, 0xb7, 0x83, 0x12, 0x05, 0x9b, 0xfc, 0x57, 0x67, 0xac, 0xba, 0x18, 0x42, + 0x07, 0x8b, 0xf2, 0x98, 0xba, 0xc0, 0x60, 0x51, 0x1c, 0xc5, 0x10, 0x19, 0xc8, 0x69, 0x3f, 0x90, + 0x6b, 0x90, 0x1b, 0x12, 0xdb, 0x2f, 0xe9, 0xeb, 0x13, 0xba, 0x24, 0xa0, 0x07, 0x30, 0x1d, 0x2e, + 0x2f, 0x19, 0xc1, 0x53, 0x6e, 0x05, 0xab, 0xd1, 0x6d, 0x28, 0x06, 0x6a, 0x5c, 0x56, 0xf0, 0x15, + 0x7a, 0x4a, 0x89, 0xbb, 0x22, 0xf3, 0x2a, 0xad, 0xc7, 0xc5, 0xf5, 0x09, 0x99, 0x59, 0xaf, 0xc8, + 0xcc, 0x3a, 0x25, 0x46, 0x89, 0xdc, 0x1a, 0x48, 0x32, 0xef, 0x05, 0x93, 0x0c, 0x7e, 0x0f, 0x4a, + 0x01, 0x07, 0xd1, 0xba, 0xd3, 0xf8, 0x70, 0x7f, 0x65, 0x8b, 0x17, 0xa9, 0x67, 0xac, 0x2e, 0xe9, + 0x15, 0x8d, 0xd6, 0xba, 0xad, 0xc6, 0xde, 0x5e, 0x25, 0x85, 0x4a, 0x90, 0xdf, 0xde, 0x69, 0x1e, + 0x70, 0xae, 0x34, 0x7e, 0xe6, 0x49, 0x10, 0x45, 0x4e, 0xa9, 0x6d, 0x13, 0x4a, 0x6d, 0xd3, 0x64, + 0x6d, 0x4b, 0xf9, 0xb5, 0x8d, 0x95, 0xb9, 0xad, 0xc6, 0xca, 0x5e, 0xa3, 0x32, 0xf9, 0xb4, 0x0c, + 0x45, 0xee, 0xdf, 0x83, 0x81, 0x49, 0x4b, 0xed, 0x4f, 0x34, 0x00, 0x3f, 0x9a, 0x50, 0x1d, 0x72, + 0x2d, 0xae, 0xa7, 0xaa, 0xb1, 0x64, 0x74, 0x39, 0x76, 0xc9, 0x74, 0xc9, 0x85, 0xde, 0x82, 0x9c, + 0x33, 0x68, 0xb5, 0x88, 0x23, 0x4b, 0xde, 0xd5, 0x70, 0x3e, 0x14, 0xd9, 0x4a, 0x97, 0x7c, 0x74, + 0xc8, 0x4b, 0xa3, 0xd3, 0x1d, 0xb0, 0x02, 0x38, 0x7a, 0x88, 0xe0, 0xc3, 0xff, 0xa7, 0x41, 0x41, + 0xd9, 0xbc, 0xdf, 0x31, 0x09, 0x5f, 0x87, 0x3c, 0xb3, 0x81, 0xb4, 0x45, 0x1a, 0x9e, 0xd2, 0x7d, + 0x02, 0xfa, 0x5b, 0xc8, 0xcb, 0x08, 0x90, 0x99, 0xb8, 0x1a, 0x2f, 0x76, 0xa7, 0xaf, 0xfb, 0xac, + 0x78, 0x13, 0x2e, 0x31, 0xaf, 0xb4, 0xe8, 0xe1, 0x5a, 0xfa, 0x51, 0x3d, 0x7e, 0x6a, 0xa1, 0xe3, + 0x67, 0x0d, 0xa6, 0xfa, 0xc7, 0x67, 0x4e, 0xa7, 0x65, 0x74, 0x85, 0x15, 0x5e, 0x1b, 0x7f, 0x00, + 0x48, 0x15, 0x36, 0xce, 0x74, 0x71, 0x09, 0x0a, 0xeb, 0x86, 0x73, 0x2c, 0x4c, 0xc2, 0x8f, 0xa0, + 0x44, 0x9b, 0x9b, 0x2f, 0x2e, 0x60, 0x23, 0xbb, 0x1c, 0x48, 0xee, 0xb1, 0x7c, 0x8e, 0x60, 0xf2, + 0xd8, 0x70, 0x8e, 0xd9, 0x44, 0x4b, 0x3a, 0xfb, 0x46, 0x0f, 0xa0, 0xd2, 0xe2, 0x93, 0x3c, 0x08, + 0x5d, 0x19, 0xa6, 0x05, 0xdd, 0x3b, 0x09, 0x7e, 0x0c, 0x45, 0x3e, 0x87, 0xef, 0xdb, 0x08, 0x7c, + 0x09, 0xa6, 0xf7, 0x4c, 0xa3, 0xef, 0x1c, 0x5b, 0xb2, 0xba, 0xd1, 0x49, 0x57, 0x7c, 0xda, 0x58, + 0x1a, 0xef, 0xc3, 0xb4, 0x4d, 0x7a, 0x46, 0xc7, 0xec, 0x98, 0x47, 0x07, 0x87, 0x67, 0x2e, 0x71, + 0xc4, 0x85, 0xa9, 0xec, 0x91, 0x9f, 0x52, 0x2a, 0x35, 0xed, 0xb0, 0x6b, 0x1d, 0x8a, 0x34, 0xc7, + 0xbe, 0xf1, 0x17, 0x29, 0x28, 0x7e, 0x64, 0xb8, 0x2d, 0xb9, 0x74, 0x68, 0x03, 0xca, 0x5e, 0x72, + 0x63, 0x14, 0x61, 0x4b, 0xa8, 0xc4, 0xb2, 0x31, 0xf2, 0x28, 0x2d, 0xab, 0x63, 0xa9, 0xa5, 0x12, + 0x98, 0x28, 0xc3, 0x6c, 0x91, 0xae, 0x27, 0x2a, 0x95, 0x2c, 0x8a, 0x31, 0xaa, 0xa2, 0x54, 0x02, + 0xda, 0x81, 0x4a, 0xdf, 0xb6, 0x8e, 0x6c, 0xe2, 0x38, 0x9e, 0x30, 0x5e, 0xc6, 0x70, 0x8c, 0xb0, + 0x5d, 0xc1, 0xea, 0x8b, 0x9b, 0xee, 0x07, 0x49, 0x4f, 0xa7, 0xfd, 0xf3, 0x0c, 0x4f, 0x4e, 0xbf, + 0x4e, 0x01, 0x8a, 0x4e, 0xea, 0xdb, 0x1e, 0xf1, 0xee, 0x42, 0xd9, 0x71, 0x0d, 0x3b, 0xb2, 0xd9, + 0x4a, 0x8c, 0xea, 0x65, 0xfc, 0xfb, 0xe0, 0x19, 0x74, 0x60, 0x5a, 0x6e, 0xe7, 0xe5, 0x99, 0x38, + 0x25, 0x97, 0x25, 0x79, 0x9b, 0x51, 0x51, 0x03, 0x72, 0x2f, 0x3b, 0x5d, 0x97, 0xd8, 0x4e, 0x35, + 0xb3, 0x90, 0x5e, 0x2c, 0x2f, 0x3f, 0x3a, 0x6f, 0x19, 0x96, 0xde, 0x67, 0xfc, 0xcd, 0xb3, 0x3e, + 0xd1, 0xe5, 0x58, 0xf5, 0xe4, 0x99, 0x0d, 0x9c, 0xc6, 0xe7, 0x60, 0xea, 0x15, 0x15, 0x41, 0x6f, + 0xd9, 0x39, 0x7e, 0x58, 0x64, 0x6d, 0x7e, 0xc9, 0x7e, 0x69, 0x1b, 0x47, 0x3d, 0x62, 0xba, 0xf2, + 0x1e, 0x28, 0xdb, 0xf8, 0x2e, 0x80, 0xaf, 0x86, 0xa6, 0xfc, 0xed, 0x9d, 0xdd, 0xfd, 0x66, 0x65, + 0x02, 0x15, 0x61, 0x6a, 0x7b, 0x67, 0xad, 0xb1, 0xd5, 0xa0, 0xf5, 0x01, 0xd7, 0xa5, 0x4b, 0x03, + 0x6b, 0xa9, 0xea, 0xd4, 0x02, 0x3a, 0xf1, 0x15, 0x98, 0x8d, 0x5b, 0x40, 0x7a, 0x16, 0x2d, 0x89, + 0x5d, 0x3a, 0x56, 0xa8, 0xa8, 0xaa, 0x53, 0xc1, 0xe9, 0x56, 0x21, 0xc7, 0x77, 0x6f, 0x5b, 0x1c, + 0xce, 0x65, 0x93, 0x3a, 0x82, 0x6f, 0x46, 0xd2, 0x16, 0xab, 0xe4, 0xb5, 0x63, 0xd3, 0x4b, 0x26, + 0x36, 0xbd, 0xa0, 0xdb, 0x50, 0xf2, 0xa2, 0xc1, 0x70, 0xc4, 0x59, 0x20, 0xaf, 0x17, 0xe5, 0x46, + 0xa7, 0xb4, 0x80, 0xd3, 0x73, 0x41, 0xa7, 0xa3, 0xbb, 0x90, 0x25, 0x43, 0x62, 0xba, 0x4e, 0xb5, + 0xc0, 0x2a, 0x46, 0x49, 0x9e, 0xdd, 0x1b, 0x94, 0xaa, 0x8b, 0x4e, 0xfc, 0x37, 0x70, 0x89, 0xdd, + 0x91, 0x9e, 0xd9, 0x86, 0xa9, 0x5e, 0xe6, 0x9a, 0xcd, 0x2d, 0xe1, 0x6e, 0xfa, 0x89, 0xca, 0x90, + 0xda, 0x58, 0x13, 0x4e, 0x48, 0x6d, 0xac, 0xe1, 0xcf, 0x34, 0x40, 0xea, 0xb8, 0xb1, 0xfc, 0x1c, + 0x12, 0x2e, 0xd5, 0xa7, 0x7d, 0xf5, 0xb3, 0x90, 0x21, 0xb6, 0x6d, 0xd9, 0xcc, 0xa3, 0x79, 0x9d, + 0x37, 0xf0, 0x1d, 0x61, 0x83, 0x4e, 0x86, 0xd6, 0x89, 0x17, 0x83, 0x5c, 0x9a, 0xe6, 0x99, 0xba, + 0x09, 0x33, 0x01, 0xae, 0xb1, 0x2a, 0xd7, 0x7d, 0xb8, 0xcc, 0x84, 0x6d, 0x12, 0xd2, 0x5f, 0xe9, + 0x76, 0x86, 0x89, 0x5a, 0xfb, 0x70, 0x25, 0xcc, 0xf8, 0xc3, 0xfa, 0x08, 0xff, 0xbd, 0xd0, 0xd8, + 0xec, 0xf4, 0x48, 0xd3, 0xda, 0x4a, 0xb6, 0x8d, 0x66, 0xf6, 0x13, 0x72, 0xe6, 0x88, 0x12, 0xcf, + 0xbe, 0xf1, 0x4f, 0x35, 0xb8, 0x1a, 0x19, 0xfe, 0x03, 0xaf, 0xea, 0x3c, 0xc0, 0x11, 0xdd, 0x3e, + 0xa4, 0x4d, 0x3b, 0x38, 0xba, 0xa0, 0x50, 0x3c, 0x3b, 0x69, 0x2e, 0x2b, 0x0a, 0x3b, 0x67, 0xc5, + 0x9a, 0xb3, 0x3f, 0x5e, 0xc4, 0xdf, 0x80, 0x02, 0x23, 0xec, 0xb9, 0x86, 0x3b, 0x70, 0x22, 0x8b, + 0xf1, 0x6f, 0x62, 0x0b, 0xc8, 0x41, 0x63, 0xcd, 0xeb, 0x2d, 0xc8, 0xb2, 0x83, 0xb5, 0x3c, 0x56, + 0x86, 0x6e, 0x32, 0x8a, 0x1d, 0xba, 0x60, 0xc4, 0xc7, 0x90, 0x7d, 0xce, 0xd0, 0x48, 0xc5, 0xb2, + 0x49, 0xb9, 0x14, 0xa6, 0xd1, 0xe3, 0x18, 0x49, 0x5e, 0x67, 0xdf, 0xec, 0x14, 0x46, 0x88, 0xbd, + 0xaf, 0x6f, 0xf1, 0xd3, 0x5e, 0x5e, 0xf7, 0xda, 0xd4, 0x65, 0xad, 0x6e, 0x87, 0x98, 0x2e, 0xeb, + 0x9d, 0x64, 0xbd, 0x0a, 0x05, 0x2f, 0x41, 0x85, 0x6b, 0x5a, 0x69, 0xb7, 0x95, 0xd3, 0x94, 0x27, + 0x4f, 0x0b, 0xca, 0xc3, 0x5f, 0x69, 0x70, 0x49, 0x19, 0x30, 0x96, 0x63, 0x1e, 0x43, 0x96, 0x63, + 0xae, 0xa2, 0x70, 0xcf, 0x06, 0x47, 0x71, 0x35, 0xba, 0xe0, 0x41, 0x4b, 0x90, 0xe3, 0x5f, 0xf2, + 0x48, 0x1b, 0xcf, 0x2e, 0x99, 0xf0, 0x5d, 0x98, 0x11, 0x24, 0xd2, 0xb3, 0xe2, 0xf6, 0x36, 0x73, + 0x28, 0xfe, 0x14, 0x66, 0x83, 0x6c, 0x63, 0x4d, 0x49, 0x31, 0x32, 0x75, 0x11, 0x23, 0x57, 0xa4, + 0x91, 0xfb, 0xfd, 0xb6, 0x72, 0x2c, 0x08, 0xaf, 0xba, 0xba, 0x22, 0xa9, 0xd0, 0x8a, 0x78, 0x13, + 0x90, 0x22, 0x7e, 0xd4, 0x09, 0xcc, 0xc8, 0xed, 0xb0, 0xd5, 0x71, 0xbc, 0xd3, 0xe7, 0x6b, 0x40, + 0x2a, 0xf1, 0xc7, 0x36, 0x68, 0x8d, 0xc8, 0xa2, 0x26, 0x0d, 0xfa, 0x00, 0x90, 0x4a, 0x1c, 0x2b, + 0xa3, 0xd7, 0xe1, 0xd2, 0x73, 0x6b, 0x48, 0x53, 0x03, 0xa5, 0xfa, 0x21, 0xc3, 0xef, 0xa2, 0xde, + 0xb2, 0x79, 0x6d, 0xaa, 0x5c, 0x1d, 0x30, 0x96, 0xf2, 0x5f, 0x6a, 0x50, 0x5c, 0xe9, 0x1a, 0x76, + 0x4f, 0x2a, 0x7e, 0x17, 0xb2, 0xfc, 0x86, 0x25, 0x40, 0x8d, 0x7b, 0x41, 0x31, 0x2a, 0x2f, 0x6f, + 0xac, 0xf0, 0xfb, 0x98, 0x18, 0x45, 0x0d, 0x17, 0xef, 0x1e, 0x6b, 0xa1, 0x77, 0x90, 0x35, 0xf4, + 0x06, 0x64, 0x0c, 0x3a, 0x84, 0xa5, 0xe0, 0x72, 0xf8, 0x6e, 0xcb, 0xa4, 0xb1, 0x73, 0x20, 0xe7, + 0xc2, 0xef, 0x40, 0x41, 0xd1, 0x40, 0x6f, 0xef, 0xcf, 0x1a, 0xe2, 0xd0, 0xb6, 0xb2, 0xda, 0xdc, + 0x78, 0xc1, 0x2f, 0xf5, 0x65, 0x80, 0xb5, 0x86, 0xd7, 0x4e, 0xe1, 0x8f, 0xc5, 0x28, 0x91, 0xef, + 0x54, 0x7b, 0xb4, 0x24, 0x7b, 0x52, 0x17, 0xb2, 0xe7, 0x14, 0x4a, 0x62, 0xfa, 0xe3, 0xa6, 0x6f, + 0x26, 0x2f, 0x21, 0x7d, 0x2b, 0xc6, 0xeb, 0x82, 0x11, 0x4f, 0x43, 0x49, 0x24, 0x74, 0xb1, 0xff, + 0x7e, 0xa1, 0x41, 0x59, 0x52, 0xc6, 0x05, 0x5f, 0x25, 0x6e, 0xc4, 0x2b, 0x80, 0x87, 0x1a, 0x5d, + 0x81, 0x6c, 0xfb, 0x70, 0xaf, 0xf3, 0x5a, 0x02, 0xe5, 0xa2, 0x45, 0xe9, 0x5d, 0xae, 0x87, 0xbf, + 0x56, 0x89, 0x16, 0xba, 0xce, 0x1f, 0xb2, 0x36, 0xcc, 0x36, 0x39, 0x65, 0x67, 0xca, 0x49, 0xdd, + 0x27, 0xb0, 0x0b, 0xb5, 0x78, 0xd5, 0x62, 0x07, 0x49, 0xf5, 0x95, 0x6b, 0x06, 0x2e, 0xad, 0x0c, + 0xdc, 0xe3, 0x86, 0x69, 0x1c, 0x76, 0x65, 0xc6, 0xa2, 0x65, 0x96, 0x12, 0xd7, 0x3a, 0x8e, 0x4a, + 0x6d, 0xc0, 0x0c, 0xa5, 0x12, 0xd3, 0xed, 0xb4, 0x94, 0xf4, 0x26, 0x8b, 0x98, 0x16, 0x2a, 0x62, + 0x86, 0xe3, 0xbc, 0xb2, 0xec, 0xb6, 0x98, 0x9a, 0xd7, 0xc6, 0x6b, 0x5c, 0xf8, 0xbe, 0x13, 0x28, + 0x53, 0xdf, 0x56, 0xca, 0xa2, 0x2f, 0xe5, 0x19, 0x71, 0x47, 0x48, 0xc1, 0x8f, 0xe0, 0xb2, 0xe4, + 0x14, 0xc0, 0xe4, 0x08, 0xe6, 0x1d, 0xb8, 0x21, 0x99, 0x57, 0x8f, 0xe9, 0x45, 0x6d, 0x57, 0x28, + 0xfc, 0xae, 0x76, 0x3e, 0x85, 0xaa, 0x67, 0x27, 0x3b, 0x2c, 0x5b, 0x5d, 0xd5, 0x80, 0x81, 0x23, + 0xf6, 0x4c, 0x5e, 0x67, 0xdf, 0x94, 0x66, 0x5b, 0x5d, 0xef, 0x48, 0x40, 0xbf, 0xf1, 0x2a, 0xcc, + 0x49, 0x19, 0xe2, 0x18, 0x1b, 0x14, 0x12, 0x31, 0x28, 0x4e, 0x88, 0x70, 0x18, 0x1d, 0x3a, 0xda, + 0xed, 0x2a, 0x67, 0xd0, 0xb5, 0x4c, 0xa6, 0xa6, 0xc8, 0xbc, 0xcc, 0x77, 0x04, 0x35, 0x4c, 0xad, + 0x18, 0x82, 0x4c, 0x05, 0xa8, 0x64, 0xb1, 0x10, 0x94, 0x1c, 0x59, 0x88, 0x88, 0xe8, 0x4f, 0x60, + 0xde, 0x33, 0x82, 0xfa, 0x6d, 0x97, 0xd8, 0xbd, 0x8e, 0xe3, 0x28, 0x50, 0x56, 0xdc, 0xc4, 0xef, + 0xc1, 0x64, 0x9f, 0x88, 0x9c, 0x52, 0x58, 0x46, 0x4b, 0xfc, 0xed, 0x79, 0x49, 0x19, 0xcc, 0xfa, + 0x71, 0x1b, 0x6e, 0x4a, 0xe9, 0xdc, 0xa3, 0xb1, 0xe2, 0xc3, 0x46, 0xc9, 0x0b, 0x3e, 0x77, 0x6b, + 0xf4, 0x82, 0x9f, 0xe6, 0x6b, 0xef, 0xc1, 0xab, 0x1f, 0x70, 0x47, 0xca, 0xd8, 0x1a, 0xab, 0x56, + 0x6c, 0x72, 0x9f, 0x7a, 0x21, 0x39, 0x96, 0xb0, 0x43, 0x98, 0x0d, 0x46, 0xf2, 0x58, 0x69, 0x6c, + 0x16, 0x32, 0xae, 0x75, 0x42, 0x64, 0x12, 0xe3, 0x0d, 0x69, 0xb0, 0x17, 0xe6, 0x63, 0x19, 0x6c, + 0xf8, 0xc2, 0xd8, 0x96, 0x1c, 0xd7, 0x5e, 0xba, 0x9a, 0xf2, 0xf0, 0xc5, 0x1b, 0x78, 0x1b, 0xae, + 0x84, 0xd3, 0xc4, 0x58, 0x26, 0xbf, 0xe0, 0x1b, 0x38, 0x2e, 0x93, 0x8c, 0x25, 0xf7, 0x43, 0x3f, + 0x19, 0x28, 0x09, 0x65, 0x2c, 0x91, 0x3a, 0xd4, 0xe2, 0xf2, 0xcb, 0xf7, 0xb1, 0x5f, 0xbd, 0x74, + 0x33, 0x96, 0x30, 0xc7, 0x17, 0x36, 0xfe, 0xf2, 0xfb, 0x39, 0x22, 0x3d, 0x32, 0x47, 0x88, 0x20, + 0xf1, 0xb3, 0xd8, 0x0f, 0xb0, 0xe9, 0x84, 0x0e, 0x3f, 0x81, 0x8e, 0xab, 0x83, 0xd6, 0x10, 0x4f, + 0x07, 0x6b, 0xc8, 0x8d, 0xad, 0xa6, 0xdd, 0xb1, 0x16, 0xe3, 0x23, 0x3f, 0x77, 0x46, 0x32, 0xf3, + 0x58, 0x82, 0x3f, 0x86, 0x85, 0xe4, 0xa4, 0x3c, 0x8e, 0xe4, 0x87, 0x75, 0xc8, 0x7b, 0x07, 0x4a, + 0xe5, 0x77, 0x1b, 0x05, 0xc8, 0x6d, 0xef, 0xec, 0xed, 0xae, 0xac, 0x36, 0xf8, 0x0f, 0x37, 0x56, + 0x77, 0x74, 0x7d, 0x7f, 0xb7, 0x59, 0x49, 0x2d, 0xff, 0x29, 0x0d, 0xa9, 0xcd, 0x17, 0xe8, 0x1f, + 0x21, 0xc3, 0x5f, 0x31, 0x47, 0x3c, 0x5d, 0xd7, 0x46, 0x3d, 0xd4, 0xe2, 0x6b, 0x9f, 0xfd, 0xe6, + 0xf7, 0x5f, 0xa6, 0x2e, 0xe3, 0x4a, 0x7d, 0xf8, 0xf6, 0x21, 0x71, 0x8d, 0xfa, 0xc9, 0xb0, 0xce, + 0xea, 0xc3, 0x13, 0xed, 0x21, 0xda, 0x87, 0xf4, 0xee, 0xc0, 0x45, 0x89, 0xcf, 0xda, 0xb5, 0xe4, + 0xf7, 0x5b, 0x3c, 0xc7, 0x04, 0xcf, 0xe0, 0xb2, 0x22, 0xb8, 0x3f, 0x70, 0xa9, 0xd8, 0x01, 0x14, + 0xd4, 0x17, 0xd8, 0x73, 0xdf, 0xbb, 0x6b, 0xe7, 0xbf, 0xee, 0xe2, 0x5b, 0x4c, 0xdd, 0x35, 0x7c, + 0x45, 0x51, 0xc7, 0xdf, 0x89, 0xd5, 0xd9, 0x34, 0x4f, 0x4d, 0x94, 0xf8, 0x22, 0x5e, 0x4b, 0x7e, + 0xf4, 0x8d, 0x9d, 0x8d, 0x7b, 0x6a, 0x52, 0xb1, 0xa6, 0x78, 0xf3, 0x6d, 0xb9, 0xe8, 0x66, 0xcc, + 0x9b, 0x9f, 0xfa, 0xba, 0x55, 0x5b, 0x48, 0x66, 0x10, 0x8a, 0x16, 0x98, 0xa2, 0x1a, 0xbe, 0xac, + 0x28, 0x6a, 0x79, 0x6c, 0x4f, 0xb4, 0x87, 0xcb, 0x47, 0x90, 0x61, 0xe8, 0x31, 0xfa, 0x27, 0xf9, + 0x51, 0x8b, 0x81, 0xd1, 0x13, 0x16, 0x3f, 0x80, 0x3b, 0xe3, 0x2a, 0x53, 0x86, 0x70, 0x49, 0x2a, + 0x63, 0xf8, 0xf1, 0x13, 0xed, 0xe1, 0xa2, 0xf6, 0xa6, 0xb6, 0xfc, 0xc7, 0x49, 0xc8, 0x30, 0xb8, + 0x08, 0x59, 0x00, 0x3e, 0x9a, 0x1a, 0x9e, 0x65, 0x04, 0x9f, 0x0d, 0xcf, 0x32, 0x0a, 0xc4, 0xe2, + 0x79, 0xa6, 0xb8, 0x8a, 0x67, 0xa4, 0x62, 0x86, 0x44, 0xd5, 0x19, 0xb8, 0x46, 0x7d, 0x3a, 0x14, + 0x80, 0x19, 0x0f, 0x33, 0x14, 0x27, 0x30, 0x80, 0xaa, 0x86, 0x77, 0x48, 0x0c, 0xa2, 0x8a, 0x31, + 0xd3, 0x79, 0x1d, 0x5f, 0x55, 0x3c, 0xcb, 0xd5, 0xda, 0x8c, 0x91, 0xea, 0xfd, 0x0f, 0x0d, 0xca, + 0x41, 0x5c, 0x14, 0xdd, 0x8e, 0x91, 0x1c, 0x86, 0x57, 0x6b, 0x77, 0x46, 0x33, 0x25, 0x59, 0xc0, + 0xd5, 0x9f, 0x10, 0xd2, 0x37, 0x28, 0xa3, 0x70, 0x3c, 0xfa, 0x42, 0x83, 0xe9, 0x10, 0xd8, 0x89, + 0xe2, 0x34, 0x44, 0xa0, 0xd4, 0xda, 0xdd, 0x73, 0xb8, 0x84, 0x21, 0xf7, 0x98, 0x21, 0x0b, 0xf8, + 0x5a, 0xc4, 0x15, 0x6e, 0xa7, 0x47, 0x5c, 0x4b, 0x18, 0xe3, 0x2d, 0x03, 0x07, 0x26, 0x63, 0x97, + 0x21, 0x00, 0x74, 0xc6, 0x2e, 0x43, 0x10, 0xd5, 0x1c, 0xb1, 0x0c, 0x1c, 0x8d, 0xa4, 0x5b, 0xfc, + 0xcf, 0x69, 0xc8, 0xad, 0xf2, 0x5f, 0x4f, 0x22, 0x07, 0xf2, 0x1e, 0x02, 0x88, 0xe6, 0xe3, 0xd0, + 0x18, 0xff, 0xb6, 0x50, 0xbb, 0x99, 0xd8, 0x2f, 0xb4, 0xdf, 0x65, 0xda, 0x6f, 0xe2, 0x9a, 0xd4, + 0x2e, 0x7e, 0xa4, 0x59, 0xe7, 0xd7, 0xfe, 0xba, 0xd1, 0x6e, 0xd3, 0x89, 0xff, 0x3b, 0x14, 0x55, + 0x98, 0x0e, 0xdd, 0x8a, 0x45, 0x81, 0x54, 0xa4, 0xaf, 0x86, 0x47, 0xb1, 0x08, 0xed, 0x8b, 0x4c, + 0x3b, 0xc6, 0x37, 0x12, 0xb4, 0xdb, 0x8c, 0x3d, 0x60, 0x00, 0x87, 0xd9, 0xe2, 0x0d, 0x08, 0xa0, + 0x78, 0xf1, 0x06, 0x04, 0x51, 0xba, 0x73, 0x0d, 0x18, 0x30, 0x76, 0x6a, 0xc0, 0x2b, 0x00, 0x1f, + 0x54, 0x43, 0xb1, 0x7e, 0x55, 0xae, 0x4e, 0xe1, 0x90, 0x8f, 0xe2, 0x71, 0xd1, 0x3d, 0x17, 0x52, + 0xdd, 0xed, 0x38, 0x34, 0xf4, 0x97, 0xbf, 0xca, 0x42, 0xe1, 0xb9, 0xd1, 0x31, 0x5d, 0x62, 0x1a, + 0x66, 0x8b, 0xa0, 0x97, 0x90, 0x61, 0xa5, 0x31, 0x9c, 0xe5, 0x54, 0xac, 0x29, 0x9c, 0xe5, 0x02, + 0x40, 0x0c, 0xbe, 0xc3, 0x34, 0xcf, 0xe3, 0x39, 0xa9, 0xb9, 0xe7, 0x8b, 0xaf, 0x33, 0x0c, 0x85, + 0x4e, 0xf8, 0x9f, 0x21, 0x2b, 0xe0, 0xf9, 0x90, 0xb0, 0x00, 0xb6, 0x52, 0xbb, 0x1e, 0xdf, 0x99, + 0xb4, 0xbd, 0x54, 0x55, 0x0e, 0xe3, 0xa5, 0xba, 0x5e, 0x03, 0xf8, 0x00, 0x61, 0xd8, 0xb9, 0x11, + 0x3c, 0xb1, 0xb6, 0x90, 0xcc, 0x20, 0xf4, 0x3e, 0x60, 0x7a, 0x6f, 0xe3, 0xf9, 0x38, 0xbd, 0x6d, + 0x8f, 0x9f, 0xea, 0x3e, 0x84, 0xc9, 0x75, 0xc3, 0x39, 0x46, 0xa1, 0x62, 0xa7, 0xfc, 0xe0, 0xa1, + 0x56, 0x8b, 0xeb, 0x12, 0x9a, 0x6e, 0x33, 0x4d, 0x37, 0x70, 0x35, 0x4e, 0xd3, 0xb1, 0xe1, 0xd0, + 0xea, 0x81, 0x8e, 0x21, 0xcb, 0x7f, 0x03, 0x11, 0xf6, 0x65, 0xe0, 0x77, 0x14, 0x61, 0x5f, 0x06, + 0x7f, 0x36, 0x71, 0x31, 0x4d, 0x2e, 0x4c, 0xc9, 0x1f, 0x1e, 0xa0, 0x1b, 0xa1, 0xa5, 0x09, 0xfe, + 0x48, 0xa1, 0x36, 0x9f, 0xd4, 0x2d, 0xf4, 0xdd, 0x67, 0xfa, 0x6e, 0xe1, 0xeb, 0xb1, 0x6b, 0x27, + 0xb8, 0x9f, 0x68, 0x0f, 0xdf, 0xd4, 0x68, 0x99, 0x00, 0x1f, 0x64, 0x8d, 0x44, 0x47, 0x18, 0xaf, + 0x8d, 0x44, 0x47, 0x04, 0x9f, 0xc5, 0xcb, 0x4c, 0xf9, 0x63, 0x7c, 0x3f, 0x4e, 0xb9, 0x6b, 0x1b, + 0xa6, 0xf3, 0x92, 0xd8, 0x6f, 0x70, 0x30, 0xcd, 0x39, 0xee, 0xf4, 0x69, 0xa4, 0xfc, 0x65, 0x1a, + 0x26, 0xe9, 0x79, 0x94, 0x96, 0x67, 0xff, 0x1a, 0x1f, 0xb6, 0x26, 0x02, 0x9e, 0x85, 0xad, 0x89, + 0x22, 0x00, 0xd1, 0xf2, 0xcc, 0x7e, 0x27, 0x4f, 0x18, 0x13, 0xf5, 0xba, 0x03, 0x05, 0xe5, 0xae, + 0x8f, 0x62, 0x04, 0x06, 0x91, 0xb9, 0x70, 0x5d, 0x88, 0x01, 0x0a, 0xf0, 0x4d, 0xa6, 0x73, 0x0e, + 0xcf, 0x06, 0x74, 0xb6, 0x39, 0x17, 0x55, 0xfa, 0xaf, 0x50, 0x54, 0x31, 0x01, 0x14, 0x23, 0x33, + 0x84, 0xfc, 0x85, 0x53, 0x62, 0x1c, 0xa4, 0x10, 0xcd, 0x0e, 0xde, 0xff, 0x09, 0x90, 0xac, 0x54, + 0x79, 0x1f, 0x72, 0x02, 0x28, 0x88, 0x9b, 0x6d, 0x10, 0x2a, 0x8c, 0x9b, 0x6d, 0x08, 0x65, 0x88, + 0x1e, 0xf3, 0x98, 0x56, 0x7a, 0x1f, 0x92, 0x25, 0x48, 0x68, 0x7c, 0x46, 0xdc, 0x24, 0x8d, 0x3e, + 0xf6, 0x95, 0xa4, 0x51, 0xb9, 0x8b, 0x8e, 0xd2, 0x78, 0x44, 0x5c, 0x11, 0x4b, 0xf2, 0x9e, 0x87, + 0x12, 0x04, 0xaa, 0x29, 0x1f, 0x8f, 0x62, 0x49, 0x3a, 0x95, 0xfb, 0x4a, 0x45, 0xbe, 0x47, 0x9f, + 0x02, 0xf8, 0x90, 0x46, 0xf8, 0xb4, 0x15, 0x8b, 0x8b, 0x86, 0x4f, 0x5b, 0xf1, 0xa8, 0x48, 0x34, + 0x7f, 0xf8, 0xba, 0xf9, 0xc5, 0x80, 0x6a, 0xff, 0x1f, 0x0d, 0x50, 0x14, 0x01, 0x41, 0x8f, 0xe2, + 0x35, 0xc4, 0x22, 0xae, 0xb5, 0xc7, 0x17, 0x63, 0x4e, 0x2a, 0x11, 0xbe, 0x59, 0x2d, 0x36, 0xa2, + 0xff, 0x8a, 0x1a, 0xf6, 0xb9, 0x06, 0xa5, 0x00, 0x84, 0x82, 0xee, 0x25, 0xac, 0x71, 0x08, 0xb4, + 0xad, 0xdd, 0x3f, 0x97, 0x2f, 0xe9, 0x24, 0xa6, 0xec, 0x08, 0x79, 0x10, 0xff, 0x2f, 0x0d, 0xca, + 0x41, 0xd8, 0x05, 0x25, 0xc8, 0x8f, 0x00, 0xbf, 0xb5, 0xc5, 0xf3, 0x19, 0xcf, 0x5f, 0x2a, 0xff, + 0x6c, 0xde, 0x87, 0x9c, 0x00, 0x6b, 0xe2, 0x02, 0x22, 0x08, 0x1b, 0xc7, 0x05, 0x44, 0x08, 0xe9, + 0x49, 0x08, 0x08, 0xdb, 0xea, 0x12, 0x25, 0x04, 0x05, 0xa2, 0x93, 0xa4, 0x71, 0x74, 0x08, 0x86, + 0xe0, 0xa0, 0x51, 0x1a, 0xfd, 0x10, 0x94, 0x70, 0x0e, 0x4a, 0x10, 0x78, 0x4e, 0x08, 0x86, 0xd1, + 0xa0, 0x84, 0x10, 0x64, 0x4a, 0x95, 0x10, 0xf4, 0xc1, 0x97, 0xb8, 0x10, 0x8c, 0x20, 0xe2, 0x71, + 0x21, 0x18, 0xc5, 0x6f, 0x12, 0xd6, 0x95, 0xe9, 0x0e, 0x84, 0xe0, 0x4c, 0x0c, 0x56, 0x83, 0x1e, + 0x27, 0x38, 0x34, 0x16, 0x6c, 0xaf, 0xbd, 0x71, 0x41, 0xee, 0x91, 0x7b, 0x9f, 0x2f, 0x85, 0xdc, + 0xfb, 0xff, 0xaf, 0xc1, 0x6c, 0x1c, 0xd6, 0x83, 0x12, 0x74, 0x25, 0x00, 0xf5, 0xb5, 0xa5, 0x8b, + 0xb2, 0x9f, 0xef, 0x35, 0x2f, 0x1a, 0x9e, 0x56, 0x7e, 0xfe, 0xcd, 0xbc, 0xf6, 0xab, 0x6f, 0xe6, + 0xb5, 0xdf, 0x7e, 0x33, 0xaf, 0xfd, 0xef, 0xef, 0xe6, 0x27, 0x0e, 0xb3, 0xec, 0x7f, 0xa7, 0xbd, + 0xfd, 0xd7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x77, 0x6b, 0x63, 0x24, 0x37, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3188,8 +6183,9 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for KV service - +// KVClient is the client API for KV service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type KVClient interface { // Range gets the keys in the range from the key-value store. Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error) @@ -3222,7 +6218,7 @@ func NewKVClient(cc *grpc.ClientConn) KVClient { func (c *kVClient) Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error) { out := new(RangeResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.KV/Range", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.KV/Range", in, out, opts...) if err != nil { return nil, err } @@ -3231,7 +6227,7 @@ func (c *kVClient) Range(ctx context.Context, in *RangeRequest, opts ...grpc.Cal func (c *kVClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { out := new(PutResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.KV/Put", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.KV/Put", in, out, opts...) if err != nil { return nil, err } @@ -3240,7 +6236,7 @@ func (c *kVClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOpt func (c *kVClient) DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts ...grpc.CallOption) (*DeleteRangeResponse, error) { out := new(DeleteRangeResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.KV/DeleteRange", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.KV/DeleteRange", in, out, opts...) if err != nil { return nil, err } @@ -3249,7 +6245,7 @@ func (c *kVClient) DeleteRange(ctx context.Context, in *DeleteRangeRequest, opts func (c *kVClient) Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error) { out := new(TxnResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.KV/Txn", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.KV/Txn", in, out, opts...) if err != nil { return nil, err } @@ -3258,15 +6254,14 @@ func (c *kVClient) Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOpt func (c *kVClient) Compact(ctx context.Context, in *CompactionRequest, opts ...grpc.CallOption) (*CompactionResponse, error) { out := new(CompactionResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.KV/Compact", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.KV/Compact", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for KV service - +// KVServer is the server API for KV service. type KVServer interface { // Range gets the keys in the range from the key-value store. Range(context.Context, *RangeRequest) (*RangeResponse, error) @@ -3289,6 +6284,26 @@ type KVServer interface { Compact(context.Context, *CompactionRequest) (*CompactionResponse, error) } +// UnimplementedKVServer can be embedded to have forward compatible implementations. +type UnimplementedKVServer struct { +} + +func (*UnimplementedKVServer) Range(ctx context.Context, req *RangeRequest) (*RangeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Range not implemented") +} +func (*UnimplementedKVServer) Put(ctx context.Context, req *PutRequest) (*PutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (*UnimplementedKVServer) DeleteRange(ctx context.Context, req *DeleteRangeRequest) (*DeleteRangeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteRange not implemented") +} +func (*UnimplementedKVServer) Txn(ctx context.Context, req *TxnRequest) (*TxnResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Txn not implemented") +} +func (*UnimplementedKVServer) Compact(ctx context.Context, req *CompactionRequest) (*CompactionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Compact not implemented") +} + func RegisterKVServer(s *grpc.Server, srv KVServer) { s.RegisterService(&_KV_serviceDesc, srv) } @@ -3412,8 +6427,9 @@ var _KV_serviceDesc = grpc.ServiceDesc{ Metadata: "rpc.proto", } -// Client API for Watch service - +// WatchClient is the client API for Watch service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type WatchClient interface { // Watch watches for events happening or that have happened. Both input and output // are streams; the input stream is for creating and canceling watchers and the output @@ -3432,7 +6448,7 @@ func NewWatchClient(cc *grpc.ClientConn) WatchClient { } func (c *watchClient) Watch(ctx context.Context, opts ...grpc.CallOption) (Watch_WatchClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Watch_serviceDesc.Streams[0], c.cc, "/etcdserverpb.Watch/Watch", opts...) + stream, err := c.cc.NewStream(ctx, &_Watch_serviceDesc.Streams[0], "/etcdserverpb.Watch/Watch", opts...) if err != nil { return nil, err } @@ -3462,8 +6478,7 @@ func (x *watchWatchClient) Recv() (*WatchResponse, error) { return m, nil } -// Server API for Watch service - +// WatchServer is the server API for Watch service. type WatchServer interface { // Watch watches for events happening or that have happened. Both input and output // are streams; the input stream is for creating and canceling watchers and the output @@ -3473,6 +6488,14 @@ type WatchServer interface { Watch(Watch_WatchServer) error } +// UnimplementedWatchServer can be embedded to have forward compatible implementations. +type UnimplementedWatchServer struct { +} + +func (*UnimplementedWatchServer) Watch(srv Watch_WatchServer) error { + return status.Errorf(codes.Unimplemented, "method Watch not implemented") +} + func RegisterWatchServer(s *grpc.Server, srv WatchServer) { s.RegisterService(&_Watch_serviceDesc, srv) } @@ -3518,8 +6541,9 @@ var _Watch_serviceDesc = grpc.ServiceDesc{ Metadata: "rpc.proto", } -// Client API for Lease service - +// LeaseClient is the client API for Lease service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type LeaseClient interface { // LeaseGrant creates a lease which expires if the server does not receive a keepAlive // within a given time to live period. All keys attached to the lease will be expired and @@ -3546,7 +6570,7 @@ func NewLeaseClient(cc *grpc.ClientConn) LeaseClient { func (c *leaseClient) LeaseGrant(ctx context.Context, in *LeaseGrantRequest, opts ...grpc.CallOption) (*LeaseGrantResponse, error) { out := new(LeaseGrantResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Lease/LeaseGrant", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Lease/LeaseGrant", in, out, opts...) if err != nil { return nil, err } @@ -3555,7 +6579,7 @@ func (c *leaseClient) LeaseGrant(ctx context.Context, in *LeaseGrantRequest, opt func (c *leaseClient) LeaseRevoke(ctx context.Context, in *LeaseRevokeRequest, opts ...grpc.CallOption) (*LeaseRevokeResponse, error) { out := new(LeaseRevokeResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Lease/LeaseRevoke", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Lease/LeaseRevoke", in, out, opts...) if err != nil { return nil, err } @@ -3563,7 +6587,7 @@ func (c *leaseClient) LeaseRevoke(ctx context.Context, in *LeaseRevokeRequest, o } func (c *leaseClient) LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (Lease_LeaseKeepAliveClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Lease_serviceDesc.Streams[0], c.cc, "/etcdserverpb.Lease/LeaseKeepAlive", opts...) + stream, err := c.cc.NewStream(ctx, &_Lease_serviceDesc.Streams[0], "/etcdserverpb.Lease/LeaseKeepAlive", opts...) if err != nil { return nil, err } @@ -3595,7 +6619,7 @@ func (x *leaseLeaseKeepAliveClient) Recv() (*LeaseKeepAliveResponse, error) { func (c *leaseClient) LeaseTimeToLive(ctx context.Context, in *LeaseTimeToLiveRequest, opts ...grpc.CallOption) (*LeaseTimeToLiveResponse, error) { out := new(LeaseTimeToLiveResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Lease/LeaseTimeToLive", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Lease/LeaseTimeToLive", in, out, opts...) if err != nil { return nil, err } @@ -3604,15 +6628,14 @@ func (c *leaseClient) LeaseTimeToLive(ctx context.Context, in *LeaseTimeToLiveRe func (c *leaseClient) LeaseLeases(ctx context.Context, in *LeaseLeasesRequest, opts ...grpc.CallOption) (*LeaseLeasesResponse, error) { out := new(LeaseLeasesResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Lease/LeaseLeases", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Lease/LeaseLeases", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Lease service - +// LeaseServer is the server API for Lease service. type LeaseServer interface { // LeaseGrant creates a lease which expires if the server does not receive a keepAlive // within a given time to live period. All keys attached to the lease will be expired and @@ -3629,6 +6652,26 @@ type LeaseServer interface { LeaseLeases(context.Context, *LeaseLeasesRequest) (*LeaseLeasesResponse, error) } +// UnimplementedLeaseServer can be embedded to have forward compatible implementations. +type UnimplementedLeaseServer struct { +} + +func (*UnimplementedLeaseServer) LeaseGrant(ctx context.Context, req *LeaseGrantRequest) (*LeaseGrantResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LeaseGrant not implemented") +} +func (*UnimplementedLeaseServer) LeaseRevoke(ctx context.Context, req *LeaseRevokeRequest) (*LeaseRevokeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LeaseRevoke not implemented") +} +func (*UnimplementedLeaseServer) LeaseKeepAlive(srv Lease_LeaseKeepAliveServer) error { + return status.Errorf(codes.Unimplemented, "method LeaseKeepAlive not implemented") +} +func (*UnimplementedLeaseServer) LeaseTimeToLive(ctx context.Context, req *LeaseTimeToLiveRequest) (*LeaseTimeToLiveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LeaseTimeToLive not implemented") +} +func (*UnimplementedLeaseServer) LeaseLeases(ctx context.Context, req *LeaseLeasesRequest) (*LeaseLeasesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LeaseLeases not implemented") +} + func RegisterLeaseServer(s *grpc.Server, srv LeaseServer) { s.RegisterService(&_Lease_serviceDesc, srv) } @@ -3763,8 +6806,9 @@ var _Lease_serviceDesc = grpc.ServiceDesc{ Metadata: "rpc.proto", } -// Client API for Cluster service - +// ClusterClient is the client API for Cluster service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ClusterClient interface { // MemberAdd adds a member into the cluster. MemberAdd(ctx context.Context, in *MemberAddRequest, opts ...grpc.CallOption) (*MemberAddResponse, error) @@ -3786,7 +6830,7 @@ func NewClusterClient(cc *grpc.ClientConn) ClusterClient { func (c *clusterClient) MemberAdd(ctx context.Context, in *MemberAddRequest, opts ...grpc.CallOption) (*MemberAddResponse, error) { out := new(MemberAddResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Cluster/MemberAdd", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Cluster/MemberAdd", in, out, opts...) if err != nil { return nil, err } @@ -3795,7 +6839,7 @@ func (c *clusterClient) MemberAdd(ctx context.Context, in *MemberAddRequest, opt func (c *clusterClient) MemberRemove(ctx context.Context, in *MemberRemoveRequest, opts ...grpc.CallOption) (*MemberRemoveResponse, error) { out := new(MemberRemoveResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Cluster/MemberRemove", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Cluster/MemberRemove", in, out, opts...) if err != nil { return nil, err } @@ -3804,7 +6848,7 @@ func (c *clusterClient) MemberRemove(ctx context.Context, in *MemberRemoveReques func (c *clusterClient) MemberUpdate(ctx context.Context, in *MemberUpdateRequest, opts ...grpc.CallOption) (*MemberUpdateResponse, error) { out := new(MemberUpdateResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Cluster/MemberUpdate", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Cluster/MemberUpdate", in, out, opts...) if err != nil { return nil, err } @@ -3813,15 +6857,14 @@ func (c *clusterClient) MemberUpdate(ctx context.Context, in *MemberUpdateReques func (c *clusterClient) MemberList(ctx context.Context, in *MemberListRequest, opts ...grpc.CallOption) (*MemberListResponse, error) { out := new(MemberListResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Cluster/MemberList", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Cluster/MemberList", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Cluster service - +// ClusterServer is the server API for Cluster service. type ClusterServer interface { // MemberAdd adds a member into the cluster. MemberAdd(context.Context, *MemberAddRequest) (*MemberAddResponse, error) @@ -3833,6 +6876,23 @@ type ClusterServer interface { MemberList(context.Context, *MemberListRequest) (*MemberListResponse, error) } +// UnimplementedClusterServer can be embedded to have forward compatible implementations. +type UnimplementedClusterServer struct { +} + +func (*UnimplementedClusterServer) MemberAdd(ctx context.Context, req *MemberAddRequest) (*MemberAddResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MemberAdd not implemented") +} +func (*UnimplementedClusterServer) MemberRemove(ctx context.Context, req *MemberRemoveRequest) (*MemberRemoveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MemberRemove not implemented") +} +func (*UnimplementedClusterServer) MemberUpdate(ctx context.Context, req *MemberUpdateRequest) (*MemberUpdateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MemberUpdate not implemented") +} +func (*UnimplementedClusterServer) MemberList(ctx context.Context, req *MemberListRequest) (*MemberListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MemberList not implemented") +} + func RegisterClusterServer(s *grpc.Server, srv ClusterServer) { s.RegisterService(&_Cluster_serviceDesc, srv) } @@ -3934,8 +6994,9 @@ var _Cluster_serviceDesc = grpc.ServiceDesc{ Metadata: "rpc.proto", } -// Client API for Maintenance service - +// MaintenanceClient is the client API for Maintenance service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MaintenanceClient interface { // Alarm activates, deactivates, and queries alarms regarding cluster health. Alarm(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*AlarmResponse, error) @@ -3965,7 +7026,7 @@ func NewMaintenanceClient(cc *grpc.ClientConn) MaintenanceClient { func (c *maintenanceClient) Alarm(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*AlarmResponse, error) { out := new(AlarmResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Maintenance/Alarm", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/Alarm", in, out, opts...) if err != nil { return nil, err } @@ -3974,7 +7035,7 @@ func (c *maintenanceClient) Alarm(ctx context.Context, in *AlarmRequest, opts .. func (c *maintenanceClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { out := new(StatusResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Maintenance/Status", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/Status", in, out, opts...) if err != nil { return nil, err } @@ -3983,7 +7044,7 @@ func (c *maintenanceClient) Status(ctx context.Context, in *StatusRequest, opts func (c *maintenanceClient) Defragment(ctx context.Context, in *DefragmentRequest, opts ...grpc.CallOption) (*DefragmentResponse, error) { out := new(DefragmentResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Maintenance/Defragment", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/Defragment", in, out, opts...) if err != nil { return nil, err } @@ -3992,7 +7053,7 @@ func (c *maintenanceClient) Defragment(ctx context.Context, in *DefragmentReques func (c *maintenanceClient) Hash(ctx context.Context, in *HashRequest, opts ...grpc.CallOption) (*HashResponse, error) { out := new(HashResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Maintenance/Hash", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/Hash", in, out, opts...) if err != nil { return nil, err } @@ -4001,7 +7062,7 @@ func (c *maintenanceClient) Hash(ctx context.Context, in *HashRequest, opts ...g func (c *maintenanceClient) HashKV(ctx context.Context, in *HashKVRequest, opts ...grpc.CallOption) (*HashKVResponse, error) { out := new(HashKVResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Maintenance/HashKV", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/HashKV", in, out, opts...) if err != nil { return nil, err } @@ -4009,7 +7070,7 @@ func (c *maintenanceClient) HashKV(ctx context.Context, in *HashKVRequest, opts } func (c *maintenanceClient) Snapshot(ctx context.Context, in *SnapshotRequest, opts ...grpc.CallOption) (Maintenance_SnapshotClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Maintenance_serviceDesc.Streams[0], c.cc, "/etcdserverpb.Maintenance/Snapshot", opts...) + stream, err := c.cc.NewStream(ctx, &_Maintenance_serviceDesc.Streams[0], "/etcdserverpb.Maintenance/Snapshot", opts...) if err != nil { return nil, err } @@ -4042,15 +7103,14 @@ func (x *maintenanceSnapshotClient) Recv() (*SnapshotResponse, error) { func (c *maintenanceClient) MoveLeader(ctx context.Context, in *MoveLeaderRequest, opts ...grpc.CallOption) (*MoveLeaderResponse, error) { out := new(MoveLeaderResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Maintenance/MoveLeader", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Maintenance/MoveLeader", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Maintenance service - +// MaintenanceServer is the server API for Maintenance service. type MaintenanceServer interface { // Alarm activates, deactivates, and queries alarms regarding cluster health. Alarm(context.Context, *AlarmRequest) (*AlarmResponse, error) @@ -4070,6 +7130,32 @@ type MaintenanceServer interface { MoveLeader(context.Context, *MoveLeaderRequest) (*MoveLeaderResponse, error) } +// UnimplementedMaintenanceServer can be embedded to have forward compatible implementations. +type UnimplementedMaintenanceServer struct { +} + +func (*UnimplementedMaintenanceServer) Alarm(ctx context.Context, req *AlarmRequest) (*AlarmResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Alarm not implemented") +} +func (*UnimplementedMaintenanceServer) Status(ctx context.Context, req *StatusRequest) (*StatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") +} +func (*UnimplementedMaintenanceServer) Defragment(ctx context.Context, req *DefragmentRequest) (*DefragmentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Defragment not implemented") +} +func (*UnimplementedMaintenanceServer) Hash(ctx context.Context, req *HashRequest) (*HashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Hash not implemented") +} +func (*UnimplementedMaintenanceServer) HashKV(ctx context.Context, req *HashKVRequest) (*HashKVResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HashKV not implemented") +} +func (*UnimplementedMaintenanceServer) Snapshot(req *SnapshotRequest, srv Maintenance_SnapshotServer) error { + return status.Errorf(codes.Unimplemented, "method Snapshot not implemented") +} +func (*UnimplementedMaintenanceServer) MoveLeader(ctx context.Context, req *MoveLeaderRequest) (*MoveLeaderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MoveLeader not implemented") +} + func RegisterMaintenanceServer(s *grpc.Server, srv MaintenanceServer) { s.RegisterService(&_Maintenance_serviceDesc, srv) } @@ -4242,8 +7328,9 @@ var _Maintenance_serviceDesc = grpc.ServiceDesc{ Metadata: "rpc.proto", } -// Client API for Auth service - +// AuthClient is the client API for Auth service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type AuthClient interface { // AuthEnable enables authentication. AuthEnable(ctx context.Context, in *AuthEnableRequest, opts ...grpc.CallOption) (*AuthEnableResponse, error) @@ -4289,7 +7376,7 @@ func NewAuthClient(cc *grpc.ClientConn) AuthClient { func (c *authClient) AuthEnable(ctx context.Context, in *AuthEnableRequest, opts ...grpc.CallOption) (*AuthEnableResponse, error) { out := new(AuthEnableResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/AuthEnable", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/AuthEnable", in, out, opts...) if err != nil { return nil, err } @@ -4298,7 +7385,7 @@ func (c *authClient) AuthEnable(ctx context.Context, in *AuthEnableRequest, opts func (c *authClient) AuthDisable(ctx context.Context, in *AuthDisableRequest, opts ...grpc.CallOption) (*AuthDisableResponse, error) { out := new(AuthDisableResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/AuthDisable", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/AuthDisable", in, out, opts...) if err != nil { return nil, err } @@ -4307,7 +7394,7 @@ func (c *authClient) AuthDisable(ctx context.Context, in *AuthDisableRequest, op func (c *authClient) Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) { out := new(AuthenticateResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/Authenticate", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/Authenticate", in, out, opts...) if err != nil { return nil, err } @@ -4316,7 +7403,7 @@ func (c *authClient) Authenticate(ctx context.Context, in *AuthenticateRequest, func (c *authClient) UserAdd(ctx context.Context, in *AuthUserAddRequest, opts ...grpc.CallOption) (*AuthUserAddResponse, error) { out := new(AuthUserAddResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserAdd", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserAdd", in, out, opts...) if err != nil { return nil, err } @@ -4325,7 +7412,7 @@ func (c *authClient) UserAdd(ctx context.Context, in *AuthUserAddRequest, opts . func (c *authClient) UserGet(ctx context.Context, in *AuthUserGetRequest, opts ...grpc.CallOption) (*AuthUserGetResponse, error) { out := new(AuthUserGetResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserGet", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserGet", in, out, opts...) if err != nil { return nil, err } @@ -4334,7 +7421,7 @@ func (c *authClient) UserGet(ctx context.Context, in *AuthUserGetRequest, opts . func (c *authClient) UserList(ctx context.Context, in *AuthUserListRequest, opts ...grpc.CallOption) (*AuthUserListResponse, error) { out := new(AuthUserListResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserList", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserList", in, out, opts...) if err != nil { return nil, err } @@ -4343,7 +7430,7 @@ func (c *authClient) UserList(ctx context.Context, in *AuthUserListRequest, opts func (c *authClient) UserDelete(ctx context.Context, in *AuthUserDeleteRequest, opts ...grpc.CallOption) (*AuthUserDeleteResponse, error) { out := new(AuthUserDeleteResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserDelete", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserDelete", in, out, opts...) if err != nil { return nil, err } @@ -4352,7 +7439,7 @@ func (c *authClient) UserDelete(ctx context.Context, in *AuthUserDeleteRequest, func (c *authClient) UserChangePassword(ctx context.Context, in *AuthUserChangePasswordRequest, opts ...grpc.CallOption) (*AuthUserChangePasswordResponse, error) { out := new(AuthUserChangePasswordResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserChangePassword", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserChangePassword", in, out, opts...) if err != nil { return nil, err } @@ -4361,7 +7448,7 @@ func (c *authClient) UserChangePassword(ctx context.Context, in *AuthUserChangeP func (c *authClient) UserGrantRole(ctx context.Context, in *AuthUserGrantRoleRequest, opts ...grpc.CallOption) (*AuthUserGrantRoleResponse, error) { out := new(AuthUserGrantRoleResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserGrantRole", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserGrantRole", in, out, opts...) if err != nil { return nil, err } @@ -4370,7 +7457,7 @@ func (c *authClient) UserGrantRole(ctx context.Context, in *AuthUserGrantRoleReq func (c *authClient) UserRevokeRole(ctx context.Context, in *AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (*AuthUserRevokeRoleResponse, error) { out := new(AuthUserRevokeRoleResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/UserRevokeRole", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/UserRevokeRole", in, out, opts...) if err != nil { return nil, err } @@ -4379,7 +7466,7 @@ func (c *authClient) UserRevokeRole(ctx context.Context, in *AuthUserRevokeRoleR func (c *authClient) RoleAdd(ctx context.Context, in *AuthRoleAddRequest, opts ...grpc.CallOption) (*AuthRoleAddResponse, error) { out := new(AuthRoleAddResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleAdd", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleAdd", in, out, opts...) if err != nil { return nil, err } @@ -4388,7 +7475,7 @@ func (c *authClient) RoleAdd(ctx context.Context, in *AuthRoleAddRequest, opts . func (c *authClient) RoleGet(ctx context.Context, in *AuthRoleGetRequest, opts ...grpc.CallOption) (*AuthRoleGetResponse, error) { out := new(AuthRoleGetResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleGet", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleGet", in, out, opts...) if err != nil { return nil, err } @@ -4397,7 +7484,7 @@ func (c *authClient) RoleGet(ctx context.Context, in *AuthRoleGetRequest, opts . func (c *authClient) RoleList(ctx context.Context, in *AuthRoleListRequest, opts ...grpc.CallOption) (*AuthRoleListResponse, error) { out := new(AuthRoleListResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleList", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleList", in, out, opts...) if err != nil { return nil, err } @@ -4406,7 +7493,7 @@ func (c *authClient) RoleList(ctx context.Context, in *AuthRoleListRequest, opts func (c *authClient) RoleDelete(ctx context.Context, in *AuthRoleDeleteRequest, opts ...grpc.CallOption) (*AuthRoleDeleteResponse, error) { out := new(AuthRoleDeleteResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleDelete", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleDelete", in, out, opts...) if err != nil { return nil, err } @@ -4415,7 +7502,7 @@ func (c *authClient) RoleDelete(ctx context.Context, in *AuthRoleDeleteRequest, func (c *authClient) RoleGrantPermission(ctx context.Context, in *AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (*AuthRoleGrantPermissionResponse, error) { out := new(AuthRoleGrantPermissionResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleGrantPermission", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleGrantPermission", in, out, opts...) if err != nil { return nil, err } @@ -4424,15 +7511,14 @@ func (c *authClient) RoleGrantPermission(ctx context.Context, in *AuthRoleGrantP func (c *authClient) RoleRevokePermission(ctx context.Context, in *AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (*AuthRoleRevokePermissionResponse, error) { out := new(AuthRoleRevokePermissionResponse) - err := grpc.Invoke(ctx, "/etcdserverpb.Auth/RoleRevokePermission", in, out, c.cc, opts...) + err := c.cc.Invoke(ctx, "/etcdserverpb.Auth/RoleRevokePermission", in, out, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Auth service - +// AuthServer is the server API for Auth service. type AuthServer interface { // AuthEnable enables authentication. AuthEnable(context.Context, *AuthEnableRequest) (*AuthEnableResponse, error) @@ -4468,6 +7554,59 @@ type AuthServer interface { RoleRevokePermission(context.Context, *AuthRoleRevokePermissionRequest) (*AuthRoleRevokePermissionResponse, error) } +// UnimplementedAuthServer can be embedded to have forward compatible implementations. +type UnimplementedAuthServer struct { +} + +func (*UnimplementedAuthServer) AuthEnable(ctx context.Context, req *AuthEnableRequest) (*AuthEnableResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuthEnable not implemented") +} +func (*UnimplementedAuthServer) AuthDisable(ctx context.Context, req *AuthDisableRequest) (*AuthDisableResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuthDisable not implemented") +} +func (*UnimplementedAuthServer) Authenticate(ctx context.Context, req *AuthenticateRequest) (*AuthenticateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Authenticate not implemented") +} +func (*UnimplementedAuthServer) UserAdd(ctx context.Context, req *AuthUserAddRequest) (*AuthUserAddResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserAdd not implemented") +} +func (*UnimplementedAuthServer) UserGet(ctx context.Context, req *AuthUserGetRequest) (*AuthUserGetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserGet not implemented") +} +func (*UnimplementedAuthServer) UserList(ctx context.Context, req *AuthUserListRequest) (*AuthUserListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserList not implemented") +} +func (*UnimplementedAuthServer) UserDelete(ctx context.Context, req *AuthUserDeleteRequest) (*AuthUserDeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserDelete not implemented") +} +func (*UnimplementedAuthServer) UserChangePassword(ctx context.Context, req *AuthUserChangePasswordRequest) (*AuthUserChangePasswordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserChangePassword not implemented") +} +func (*UnimplementedAuthServer) UserGrantRole(ctx context.Context, req *AuthUserGrantRoleRequest) (*AuthUserGrantRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserGrantRole not implemented") +} +func (*UnimplementedAuthServer) UserRevokeRole(ctx context.Context, req *AuthUserRevokeRoleRequest) (*AuthUserRevokeRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserRevokeRole not implemented") +} +func (*UnimplementedAuthServer) RoleAdd(ctx context.Context, req *AuthRoleAddRequest) (*AuthRoleAddResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleAdd not implemented") +} +func (*UnimplementedAuthServer) RoleGet(ctx context.Context, req *AuthRoleGetRequest) (*AuthRoleGetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleGet not implemented") +} +func (*UnimplementedAuthServer) RoleList(ctx context.Context, req *AuthRoleListRequest) (*AuthRoleListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleList not implemented") +} +func (*UnimplementedAuthServer) RoleDelete(ctx context.Context, req *AuthRoleDeleteRequest) (*AuthRoleDeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleDelete not implemented") +} +func (*UnimplementedAuthServer) RoleGrantPermission(ctx context.Context, req *AuthRoleGrantPermissionRequest) (*AuthRoleGrantPermissionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleGrantPermission not implemented") +} +func (*UnimplementedAuthServer) RoleRevokePermission(ctx context.Context, req *AuthRoleRevokePermissionRequest) (*AuthRoleRevokePermissionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleRevokePermission not implemented") +} + func RegisterAuthServer(s *grpc.Server, srv AuthServer) { s.RegisterService(&_Auth_serviceDesc, srv) } @@ -4836,7 +7975,7 @@ var _Auth_serviceDesc = grpc.ServiceDesc{ func (m *ResponseHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -4844,37 +7983,46 @@ func (m *ResponseHeader) Marshal() (dAtA []byte, err error) { } func (m *ResponseHeader) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ClusterId != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.ClusterId)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.MemberId != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.MemberId)) + if m.RaftTerm != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.RaftTerm)) + i-- + dAtA[i] = 0x20 } if m.Revision != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.Revision)) + i-- + dAtA[i] = 0x18 } - if m.RaftTerm != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.RaftTerm)) + if m.MemberId != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.MemberId)) + i-- + dAtA[i] = 0x10 } - return i, nil + if m.ClusterId != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.ClusterId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *RangeRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -4882,99 +8030,110 @@ func (m *RangeRequest) Marshal() (dAtA []byte, err error) { } func (m *RangeRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.RangeEnd) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) - i += copy(dAtA[i:], m.RangeEnd) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.Limit != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Limit)) + if m.MaxCreateRevision != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.MaxCreateRevision)) + i-- + dAtA[i] = 0x68 } - if m.Revision != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Revision)) + if m.MinCreateRevision != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.MinCreateRevision)) + i-- + dAtA[i] = 0x60 } - if m.SortOrder != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.SortOrder)) + if m.MaxModRevision != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.MaxModRevision)) + i-- + dAtA[i] = 0x58 } - if m.SortTarget != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.SortTarget)) + if m.MinModRevision != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.MinModRevision)) + i-- + dAtA[i] = 0x50 } - if m.Serializable { - dAtA[i] = 0x38 - i++ - if m.Serializable { + if m.CountOnly { + i-- + if m.CountOnly { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x48 } if m.KeysOnly { - dAtA[i] = 0x40 - i++ + i-- if m.KeysOnly { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x40 } - if m.CountOnly { - dAtA[i] = 0x48 - i++ - if m.CountOnly { + if m.Serializable { + i-- + if m.Serializable { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x38 } - if m.MinModRevision != 0 { - dAtA[i] = 0x50 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.MinModRevision)) + if m.SortTarget != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.SortTarget)) + i-- + dAtA[i] = 0x30 } - if m.MaxModRevision != 0 { - dAtA[i] = 0x58 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.MaxModRevision)) + if m.SortOrder != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.SortOrder)) + i-- + dAtA[i] = 0x28 } - if m.MinCreateRevision != 0 { - dAtA[i] = 0x60 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.MinCreateRevision)) + if m.Revision != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.Revision)) + i-- + dAtA[i] = 0x20 } - if m.MaxCreateRevision != 0 { - dAtA[i] = 0x68 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.MaxCreateRevision)) + if m.Limit != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.Limit)) + i-- + dAtA[i] = 0x18 } - return i, nil + if len(m.RangeEnd) > 0 { + i -= len(m.RangeEnd) + copy(dAtA[i:], m.RangeEnd) + i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *RangeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -4982,54 +8141,67 @@ func (m *RangeResponse) Marshal() (dAtA []byte, err error) { } func (m *RangeResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n1, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Kvs) > 0 { - for _, msg := range m.Kvs { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if m.Count != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.Count)) + i-- + dAtA[i] = 0x20 } if m.More { - dAtA[i] = 0x18 - i++ + i-- if m.More { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x18 } - if m.Count != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Count)) + if len(m.Kvs) > 0 { + for iNdEx := len(m.Kvs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Kvs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } } - return i, nil + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *PutRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5037,64 +8209,75 @@ func (m *PutRequest) Marshal() (dAtA []byte, err error) { } func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if m.Lease != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Lease)) - } - if m.PrevKv { - dAtA[i] = 0x20 - i++ - if m.PrevKv { + if m.IgnoreLease { + i-- + if m.IgnoreLease { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x30 } if m.IgnoreValue { - dAtA[i] = 0x28 - i++ + i-- if m.IgnoreValue { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x28 } - if m.IgnoreLease { - dAtA[i] = 0x30 - i++ - if m.IgnoreLease { + if m.PrevKv { + i-- + if m.PrevKv { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x20 + } + if m.Lease != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.Lease)) + i-- + dAtA[i] = 0x18 } - return i, nil + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *PutResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5102,37 +8285,50 @@ func (m *PutResponse) Marshal() (dAtA []byte, err error) { } func (m *PutResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n2, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.PrevKv != nil { + { + size, err := m.PrevKv.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.PrevKv.Size())) - n3, err := m.PrevKv.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n3 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *DeleteRangeRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5140,39 +8336,50 @@ func (m *DeleteRangeRequest) Marshal() (dAtA []byte, err error) { } func (m *DeleteRangeRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.RangeEnd) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) - i += copy(dAtA[i:], m.RangeEnd) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.PrevKv { - dAtA[i] = 0x18 - i++ + i-- if m.PrevKv { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x18 } - return i, nil + if len(m.RangeEnd) > 0 { + i -= len(m.RangeEnd) + copy(dAtA[i:], m.RangeEnd) + i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *DeleteRangeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5180,44 +8387,57 @@ func (m *DeleteRangeResponse) Marshal() (dAtA []byte, err error) { } func (m *DeleteRangeResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeleteRangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n4, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.PrevKvs) > 0 { + for iNdEx := len(m.PrevKvs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PrevKvs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } - i += n4 } if m.Deleted != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.Deleted)) + i-- + dAtA[i] = 0x10 } - if len(m.PrevKvs) > 0 { - for _, msg := range m.PrevKvs { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestOp) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5225,80 +8445,115 @@ func (m *RequestOp) Marshal() (dAtA []byte, err error) { } func (m *RequestOp) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Request != nil { - nn5, err := m.Request.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.Request.Size() + i -= size + if _, err := m.Request.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } } - i += nn5 } - return i, nil + return len(dAtA) - i, nil } func (m *RequestOp_RequestRange) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *RequestOp_RequestRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.RequestRange != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.RequestRange.Size())) - n6, err := m.RequestRange.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.RequestRange.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n6 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestOp_RequestPut) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *RequestOp_RequestPut) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.RequestPut != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.RequestPut.Size())) - n7, err := m.RequestPut.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.RequestPut.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n7 + i-- + dAtA[i] = 0x12 } - return i, nil + return len(dAtA) - i, nil } func (m *RequestOp_RequestDeleteRange) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *RequestOp_RequestDeleteRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.RequestDeleteRange != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.RequestDeleteRange.Size())) - n8, err := m.RequestDeleteRange.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.RequestDeleteRange.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n8 + i-- + dAtA[i] = 0x1a } - return i, nil + return len(dAtA) - i, nil } func (m *RequestOp_RequestTxn) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *RequestOp_RequestTxn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.RequestTxn != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.RequestTxn.Size())) - n9, err := m.RequestTxn.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.RequestTxn.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n9 + i-- + dAtA[i] = 0x22 } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseOp) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5306,80 +8561,115 @@ func (m *ResponseOp) Marshal() (dAtA []byte, err error) { } func (m *ResponseOp) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Response != nil { - nn10, err := m.Response.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.Response.Size() + i -= size + if _, err := m.Response.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } } - i += nn10 } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseOp_ResponseRange) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *ResponseOp_ResponseRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.ResponseRange != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.ResponseRange.Size())) - n11, err := m.ResponseRange.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.ResponseRange.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n11 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseOp_ResponsePut) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *ResponseOp_ResponsePut) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.ResponsePut != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.ResponsePut.Size())) - n12, err := m.ResponsePut.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.ResponsePut.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n12 + i-- + dAtA[i] = 0x12 } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseOp_ResponseDeleteRange) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *ResponseOp_ResponseDeleteRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.ResponseDeleteRange != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.ResponseDeleteRange.Size())) - n13, err := m.ResponseDeleteRange.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.ResponseDeleteRange.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n13 + i-- + dAtA[i] = 0x1a } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseOp_ResponseTxn) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *ResponseOp_ResponseTxn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.ResponseTxn != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.ResponseTxn.Size())) - n14, err := m.ResponseTxn.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.ResponseTxn.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n14 + i-- + dAtA[i] = 0x22 } - return i, nil + return len(dAtA) - i, nil } func (m *Compare) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5387,86 +8677,120 @@ func (m *Compare) Marshal() (dAtA []byte, err error) { } func (m *Compare) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Compare) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Result != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Result)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.Target != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Target)) + if len(m.RangeEnd) > 0 { + i -= len(m.RangeEnd) + copy(dAtA[i:], m.RangeEnd) + i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) + i-- + dAtA[i] = 0x4 + i-- + dAtA[i] = 0x82 + } + if m.TargetUnion != nil { + { + size := m.TargetUnion.Size() + i -= size + if _, err := m.TargetUnion.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } } if len(m.Key) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.Key) + copy(dAtA[i:], m.Key) i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + i-- + dAtA[i] = 0x1a } - if m.TargetUnion != nil { - nn15, err := m.TargetUnion.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn15 + if m.Target != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.Target)) + i-- + dAtA[i] = 0x10 } - if len(m.RangeEnd) > 0 { - dAtA[i] = 0x82 - i++ - dAtA[i] = 0x4 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) - i += copy(dAtA[i:], m.RangeEnd) + if m.Result != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.Result)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Compare_Version) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x20 - i++ + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Compare_Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) i = encodeVarintRpc(dAtA, i, uint64(m.Version)) - return i, nil + i-- + dAtA[i] = 0x20 + return len(dAtA) - i, nil } func (m *Compare_CreateRevision) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x28 - i++ + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Compare_CreateRevision) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) i = encodeVarintRpc(dAtA, i, uint64(m.CreateRevision)) - return i, nil + i-- + dAtA[i] = 0x28 + return len(dAtA) - i, nil } func (m *Compare_ModRevision) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x30 - i++ + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Compare_ModRevision) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) i = encodeVarintRpc(dAtA, i, uint64(m.ModRevision)) - return i, nil + i-- + dAtA[i] = 0x30 + return len(dAtA) - i, nil } func (m *Compare_Value) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Compare_Value) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Value != nil { - dAtA[i] = 0x3a - i++ + i -= len(m.Value) + copy(dAtA[i:], m.Value) i = encodeVarintRpc(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + i-- + dAtA[i] = 0x3a } - return i, nil + return len(dAtA) - i, nil } func (m *Compare_Lease) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x40 - i++ + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Compare_Lease) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) i = encodeVarintRpc(dAtA, i, uint64(m.Lease)) - return i, nil + i-- + dAtA[i] = 0x40 + return len(dAtA) - i, nil } func (m *TxnRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5474,53 +8798,68 @@ func (m *TxnRequest) Marshal() (dAtA []byte, err error) { } func (m *TxnRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxnRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Compare) > 0 { - for _, msg := range m.Compare { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Failure) > 0 { + for iNdEx := len(m.Failure) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Failure[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x1a } } if len(m.Success) > 0 { - for _, msg := range m.Success { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Success) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Success[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if len(m.Failure) > 0 { - for _, msg := range m.Failure { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Compare) > 0 { + for iNdEx := len(m.Compare) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Compare[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - return i, nil + return len(dAtA) - i, nil } func (m *TxnResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5528,49 +8867,62 @@ func (m *TxnResponse) Marshal() (dAtA []byte, err error) { } func (m *TxnResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxnResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n16, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Responses) > 0 { + for iNdEx := len(m.Responses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Responses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } - i += n16 } if m.Succeeded { - dAtA[i] = 0x10 - i++ + i-- if m.Succeeded { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x10 } - if len(m.Responses) > 0 { - for _, msg := range m.Responses { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *CompactionRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5578,32 +8930,41 @@ func (m *CompactionRequest) Marshal() (dAtA []byte, err error) { } func (m *CompactionRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompactionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Revision != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Revision)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Physical { - dAtA[i] = 0x10 - i++ + i-- if m.Physical { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x10 } - return i, nil + if m.Revision != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.Revision)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *CompactionResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5611,27 +8972,38 @@ func (m *CompactionResponse) Marshal() (dAtA []byte, err error) { } func (m *CompactionResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompactionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n17, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n17 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *HashRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5639,17 +9011,26 @@ func (m *HashRequest) Marshal() (dAtA []byte, err error) { } func (m *HashRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *HashKVRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5657,22 +9038,31 @@ func (m *HashKVRequest) Marshal() (dAtA []byte, err error) { } func (m *HashKVRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HashKVRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Revision != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.Revision)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *HashKVResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5680,37 +9070,48 @@ func (m *HashKVResponse) Marshal() (dAtA []byte, err error) { } func (m *HashKVResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n18, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n18 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HashKVResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.CompactRevision != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.CompactRevision)) + i-- + dAtA[i] = 0x18 } if m.Hash != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.Hash)) + i-- + dAtA[i] = 0x10 } - if m.CompactRevision != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.CompactRevision)) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *HashResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5718,32 +9119,43 @@ func (m *HashResponse) Marshal() (dAtA []byte, err error) { } func (m *HashResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n19, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n19 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Hash != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.Hash)) + i-- + dAtA[i] = 0x10 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *SnapshotRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5751,17 +9163,26 @@ func (m *SnapshotRequest) Marshal() (dAtA []byte, err error) { } func (m *SnapshotRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SnapshotRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *SnapshotResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5769,38 +9190,50 @@ func (m *SnapshotResponse) Marshal() (dAtA []byte, err error) { } func (m *SnapshotResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SnapshotResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n20, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n20 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Blob) > 0 { + i -= len(m.Blob) + copy(dAtA[i:], m.Blob) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Blob))) + i-- + dAtA[i] = 0x1a } if m.RemainingBytes != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.RemainingBytes)) + i-- + dAtA[i] = 0x10 } - if len(m.Blob) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Blob))) - i += copy(dAtA[i:], m.Blob) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *WatchRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5808,52 +9241,95 @@ func (m *WatchRequest) Marshal() (dAtA []byte, err error) { } func (m *WatchRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WatchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.RequestUnion != nil { - nn21, err := m.RequestUnion.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.RequestUnion.Size() + i -= size + if _, err := m.RequestUnion.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } } - i += nn21 } - return i, nil + return len(dAtA) - i, nil } func (m *WatchRequest_CreateRequest) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *WatchRequest_CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.CreateRequest != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.CreateRequest.Size())) - n22, err := m.CreateRequest.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.CreateRequest.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n22 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *WatchRequest_CancelRequest) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *WatchRequest_CancelRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.CancelRequest != nil { + { + size, err := m.CancelRequest.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.CancelRequest.Size())) - n23, err := m.CancelRequest.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + } + return len(dAtA) - i, nil +} +func (m *WatchRequest_ProgressRequest) MarshalTo(dAtA []byte) (int, error) { + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *WatchRequest_ProgressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.ProgressRequest != nil { + { + size, err := m.ProgressRequest.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n23 + i-- + dAtA[i] = 0x1a } - return i, nil + return len(dAtA) - i, nil } func (m *WatchCreateRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5861,71 +9337,98 @@ func (m *WatchCreateRequest) Marshal() (dAtA []byte, err error) { } func (m *WatchCreateRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WatchCreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.RangeEnd) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) - i += copy(dAtA[i:], m.RangeEnd) + if m.Fragment { + i-- + if m.Fragment { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 } - if m.StartRevision != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.StartRevision)) + if m.WatchId != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.WatchId)) + i-- + dAtA[i] = 0x38 } - if m.ProgressNotify { - dAtA[i] = 0x20 - i++ - if m.ProgressNotify { + if m.PrevKv { + i-- + if m.PrevKv { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x30 } if len(m.Filters) > 0 { - dAtA25 := make([]byte, len(m.Filters)*10) - var j24 int + dAtA22 := make([]byte, len(m.Filters)*10) + var j21 int for _, num := range m.Filters { for num >= 1<<7 { - dAtA25[j24] = uint8(uint64(num)&0x7f | 0x80) + dAtA22[j21] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j24++ + j21++ } - dAtA25[j24] = uint8(num) - j24++ + dAtA22[j21] = uint8(num) + j21++ } + i -= j21 + copy(dAtA[i:], dAtA22[:j21]) + i = encodeVarintRpc(dAtA, i, uint64(j21)) + i-- dAtA[i] = 0x2a - i++ - i = encodeVarintRpc(dAtA, i, uint64(j24)) - i += copy(dAtA[i:], dAtA25[:j24]) } - if m.PrevKv { - dAtA[i] = 0x30 - i++ - if m.PrevKv { + if m.ProgressNotify { + i-- + if m.ProgressNotify { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x20 + } + if m.StartRevision != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.StartRevision)) + i-- + dAtA[i] = 0x18 + } + if len(m.RangeEnd) > 0 { + i -= len(m.RangeEnd) + copy(dAtA[i:], m.RangeEnd) + i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *WatchCancelRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5933,22 +9436,58 @@ func (m *WatchCancelRequest) Marshal() (dAtA []byte, err error) { } func (m *WatchCancelRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WatchCancelRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.WatchId != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.WatchId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *WatchProgressRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WatchProgressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WatchProgressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *WatchResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5956,75 +9495,99 @@ func (m *WatchResponse) Marshal() (dAtA []byte, err error) { } func (m *WatchResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WatchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n26, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n26 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.WatchId != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.WatchId)) + if len(m.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } } - if m.Created { - dAtA[i] = 0x18 - i++ - if m.Created { + if m.Fragment { + i-- + if m.Fragment { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x38 + } + if len(m.CancelReason) > 0 { + i -= len(m.CancelReason) + copy(dAtA[i:], m.CancelReason) + i = encodeVarintRpc(dAtA, i, uint64(len(m.CancelReason))) + i-- + dAtA[i] = 0x32 + } + if m.CompactRevision != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.CompactRevision)) + i-- + dAtA[i] = 0x28 } if m.Canceled { - dAtA[i] = 0x20 - i++ + i-- if m.Canceled { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x20 } - if m.CompactRevision != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.CompactRevision)) + if m.Created { + i-- + if m.Created { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 } - if len(m.CancelReason) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.CancelReason))) - i += copy(dAtA[i:], m.CancelReason) + if m.WatchId != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.WatchId)) + i-- + dAtA[i] = 0x10 } - if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0x5a - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseGrantRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6032,27 +9595,36 @@ func (m *LeaseGrantRequest) Marshal() (dAtA []byte, err error) { } func (m *LeaseGrantRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseGrantRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.TTL != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.TTL)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.ID != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x10 } - return i, nil + if m.TTL != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *LeaseGrantResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6060,43 +9632,55 @@ func (m *LeaseGrantResponse) Marshal() (dAtA []byte, err error) { } func (m *LeaseGrantResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseGrantResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n27, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n27 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.ID != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0x22 } if m.TTL != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x18 } - if len(m.Error) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) + if m.ID != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x10 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseRevokeRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6104,22 +9688,31 @@ func (m *LeaseRevokeRequest) Marshal() (dAtA []byte, err error) { } func (m *LeaseRevokeRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseRevokeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.ID != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseRevokeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6127,27 +9720,38 @@ func (m *LeaseRevokeResponse) Marshal() (dAtA []byte, err error) { } func (m *LeaseRevokeResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseRevokeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n28, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n28 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseKeepAliveRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6155,22 +9759,31 @@ func (m *LeaseKeepAliveRequest) Marshal() (dAtA []byte, err error) { } func (m *LeaseKeepAliveRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseKeepAliveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.ID != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseKeepAliveResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6178,37 +9791,48 @@ func (m *LeaseKeepAliveResponse) Marshal() (dAtA []byte, err error) { } func (m *LeaseKeepAliveResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseKeepAliveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n29, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n29 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TTL != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x18 } if m.ID != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x10 } - if m.TTL != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.TTL)) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseTimeToLiveRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6216,32 +9840,41 @@ func (m *LeaseTimeToLiveRequest) Marshal() (dAtA []byte, err error) { } func (m *LeaseTimeToLiveRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseTimeToLiveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ID != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Keys { - dAtA[i] = 0x10 - i++ + i-- if m.Keys { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x10 + } + if m.ID != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseTimeToLiveResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6249,50 +9882,62 @@ func (m *LeaseTimeToLiveResponse) Marshal() (dAtA []byte, err error) { } func (m *LeaseTimeToLiveResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseTimeToLiveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n30, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Keys) > 0 { + for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Keys[iNdEx]) + copy(dAtA[i:], m.Keys[iNdEx]) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Keys[iNdEx]))) + i-- + dAtA[i] = 0x2a } - i += n30 } - if m.ID != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + if m.GrantedTTL != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.GrantedTTL)) + i-- + dAtA[i] = 0x20 } if m.TTL != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x18 } - if m.GrantedTTL != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.GrantedTTL)) + if m.ID != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x10 } - if len(m.Keys) > 0 { - for _, b := range m.Keys { - dAtA[i] = 0x2a - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseLeasesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6300,17 +9945,26 @@ func (m *LeaseLeasesRequest) Marshal() (dAtA []byte, err error) { } func (m *LeaseLeasesRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseLeasesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *LeaseStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6318,22 +9972,31 @@ func (m *LeaseStatus) Marshal() (dAtA []byte, err error) { } func (m *LeaseStatus) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.ID != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseLeasesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6341,39 +10004,52 @@ func (m *LeaseLeasesResponse) Marshal() (dAtA []byte, err error) { } func (m *LeaseLeasesResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseLeasesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n31, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n31 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Leases) > 0 { - for _, msg := range m.Leases { + for iNdEx := len(m.Leases) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Leases[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Member) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6381,58 +10057,56 @@ func (m *Member) Marshal() (dAtA []byte, err error) { } func (m *Member) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Member) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ID != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Name) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if len(m.ClientURLs) > 0 { + for iNdEx := len(m.ClientURLs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ClientURLs[iNdEx]) + copy(dAtA[i:], m.ClientURLs[iNdEx]) + i = encodeVarintRpc(dAtA, i, uint64(len(m.ClientURLs[iNdEx]))) + i-- + dAtA[i] = 0x22 + } } if len(m.PeerURLs) > 0 { - for _, s := range m.PeerURLs { + for iNdEx := len(m.PeerURLs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PeerURLs[iNdEx]) + copy(dAtA[i:], m.PeerURLs[iNdEx]) + i = encodeVarintRpc(dAtA, i, uint64(len(m.PeerURLs[iNdEx]))) + i-- dAtA[i] = 0x1a - 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) } } - if len(m.ClientURLs) > 0 { - for _, s := range m.ClientURLs { - dAtA[i] = 0x22 - 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) - } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.ID != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *MemberAddRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6440,32 +10114,35 @@ func (m *MemberAddRequest) Marshal() (dAtA []byte, err error) { } func (m *MemberAddRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MemberAddRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.PeerURLs) > 0 { - for _, s := range m.PeerURLs { + for iNdEx := len(m.PeerURLs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PeerURLs[iNdEx]) + copy(dAtA[i:], m.PeerURLs[iNdEx]) + i = encodeVarintRpc(dAtA, i, uint64(len(m.PeerURLs[iNdEx]))) + i-- 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 + return len(dAtA) - i, nil } func (m *MemberAddResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6473,49 +10150,64 @@ func (m *MemberAddResponse) Marshal() (dAtA []byte, err error) { } func (m *MemberAddResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MemberAddResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n32, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Members) > 0 { + for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } - i += n32 } if m.Member != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Member.Size())) - n33, err := m.Member.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Member.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n33 + i-- + dAtA[i] = 0x12 } - if len(m.Members) > 0 { - for _, msg := range m.Members { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *MemberRemoveRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6523,22 +10215,31 @@ func (m *MemberRemoveRequest) Marshal() (dAtA []byte, err error) { } func (m *MemberRemoveRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MemberRemoveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.ID != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *MemberRemoveResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6546,39 +10247,52 @@ func (m *MemberRemoveResponse) Marshal() (dAtA []byte, err error) { } func (m *MemberRemoveResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MemberRemoveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n34, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n34 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Members) > 0 { - for _, msg := range m.Members { + for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *MemberUpdateRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6586,37 +10300,40 @@ func (m *MemberUpdateRequest) Marshal() (dAtA []byte, err error) { } func (m *MemberUpdateRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MemberUpdateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ID != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.PeerURLs) > 0 { - for _, s := range m.PeerURLs { + for iNdEx := len(m.PeerURLs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PeerURLs[iNdEx]) + copy(dAtA[i:], m.PeerURLs[iNdEx]) + i = encodeVarintRpc(dAtA, i, uint64(len(m.PeerURLs[iNdEx]))) + i-- dAtA[i] = 0x12 - 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 + if m.ID != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *MemberUpdateResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6624,39 +10341,52 @@ func (m *MemberUpdateResponse) Marshal() (dAtA []byte, err error) { } func (m *MemberUpdateResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MemberUpdateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n35, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n35 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Members) > 0 { - for _, msg := range m.Members { + for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *MemberListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6664,17 +10394,26 @@ func (m *MemberListRequest) Marshal() (dAtA []byte, err error) { } func (m *MemberListRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MemberListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *MemberListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6682,39 +10421,52 @@ func (m *MemberListResponse) Marshal() (dAtA []byte, err error) { } func (m *MemberListResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MemberListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n36, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n36 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Members) > 0 { - for _, msg := range m.Members { + for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *DefragmentRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6722,17 +10474,26 @@ func (m *DefragmentRequest) Marshal() (dAtA []byte, err error) { } func (m *DefragmentRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DefragmentRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *DefragmentResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6740,27 +10501,38 @@ func (m *DefragmentResponse) Marshal() (dAtA []byte, err error) { } func (m *DefragmentResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DefragmentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n37, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n37 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *MoveLeaderRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6768,22 +10540,31 @@ func (m *MoveLeaderRequest) Marshal() (dAtA []byte, err error) { } func (m *MoveLeaderRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MoveLeaderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.TargetID != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.TargetID)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *MoveLeaderResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6791,27 +10572,38 @@ func (m *MoveLeaderResponse) Marshal() (dAtA []byte, err error) { } func (m *MoveLeaderResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MoveLeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n38, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n38 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AlarmRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6819,32 +10611,41 @@ func (m *AlarmRequest) Marshal() (dAtA []byte, err error) { } func (m *AlarmRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AlarmRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Action != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Action)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Alarm != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.Alarm)) + i-- + dAtA[i] = 0x18 } if m.MemberID != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.MemberID)) + i-- + dAtA[i] = 0x10 } - if m.Alarm != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Alarm)) + if m.Action != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.Action)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *AlarmMember) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6852,27 +10653,36 @@ func (m *AlarmMember) Marshal() (dAtA []byte, err error) { } func (m *AlarmMember) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AlarmMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.MemberID != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.MemberID)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Alarm != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.Alarm)) + i-- + dAtA[i] = 0x10 + } + if m.MemberID != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.MemberID)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *AlarmResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6880,39 +10690,52 @@ func (m *AlarmResponse) Marshal() (dAtA []byte, err error) { } func (m *AlarmResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AlarmResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n39, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n39 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Alarms) > 0 { - for _, msg := range m.Alarms { + for iNdEx := len(m.Alarms) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Alarms[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *StatusRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6920,17 +10743,26 @@ func (m *StatusRequest) Marshal() (dAtA []byte, err error) { } func (m *StatusRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *StatusResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6938,53 +10770,65 @@ func (m *StatusResponse) Marshal() (dAtA []byte, err error) { } func (m *StatusResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n40, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n40 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Version) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Version))) - i += copy(dAtA[i:], m.Version) + if m.RaftTerm != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.RaftTerm)) + i-- + dAtA[i] = 0x30 } - if m.DbSize != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.DbSize)) + if m.RaftIndex != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.RaftIndex)) + i-- + dAtA[i] = 0x28 } if m.Leader != 0 { - dAtA[i] = 0x20 - i++ i = encodeVarintRpc(dAtA, i, uint64(m.Leader)) + i-- + dAtA[i] = 0x20 } - if m.RaftIndex != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.RaftIndex)) + if m.DbSize != 0 { + i = encodeVarintRpc(dAtA, i, uint64(m.DbSize)) + i-- + dAtA[i] = 0x18 } - if m.RaftTerm != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.RaftTerm)) + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x12 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthEnableRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6992,17 +10836,26 @@ func (m *AuthEnableRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthEnableRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthEnableRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *AuthDisableRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7010,17 +10863,26 @@ func (m *AuthDisableRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthDisableRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthDisableRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *AuthenticateRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7028,29 +10890,40 @@ func (m *AuthenticateRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthenticateRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthenticateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Password) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Password) + copy(dAtA[i:], m.Password) i = encodeVarintRpc(dAtA, i, uint64(len(m.Password))) - i += copy(dAtA[i:], m.Password) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserAddRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7058,29 +10931,40 @@ func (m *AuthUserAddRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthUserAddRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserAddRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Password) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Password) + copy(dAtA[i:], m.Password) i = encodeVarintRpc(dAtA, i, uint64(len(m.Password))) - i += copy(dAtA[i:], m.Password) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserGetRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7088,23 +10972,33 @@ func (m *AuthUserGetRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthUserGetRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserGetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Name) + copy(dAtA[i:], m.Name) i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserDeleteRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7112,23 +11006,33 @@ func (m *AuthUserDeleteRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthUserDeleteRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserDeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Name) + copy(dAtA[i:], m.Name) i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserChangePasswordRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7136,29 +11040,40 @@ func (m *AuthUserChangePasswordRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthUserChangePasswordRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserChangePasswordRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Password) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Password) + copy(dAtA[i:], m.Password) i = encodeVarintRpc(dAtA, i, uint64(len(m.Password))) - i += copy(dAtA[i:], m.Password) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserGrantRoleRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7166,29 +11081,40 @@ func (m *AuthUserGrantRoleRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthUserGrantRoleRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserGrantRoleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.User) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.User))) - i += copy(dAtA[i:], m.User) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Role) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Role) + copy(dAtA[i:], m.Role) i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) - i += copy(dAtA[i:], m.Role) + i-- + dAtA[i] = 0x12 + } + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintRpc(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserRevokeRoleRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7196,29 +11122,40 @@ func (m *AuthUserRevokeRoleRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthUserRevokeRoleRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserRevokeRoleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Role) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Role) + copy(dAtA[i:], m.Role) i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) - i += copy(dAtA[i:], m.Role) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthRoleAddRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7226,23 +11163,33 @@ func (m *AuthRoleAddRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleAddRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleAddRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Name) + copy(dAtA[i:], m.Name) i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthRoleGetRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7250,23 +11197,33 @@ func (m *AuthRoleGetRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleGetRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleGetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Role) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Role) + copy(dAtA[i:], m.Role) i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) - i += copy(dAtA[i:], m.Role) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7274,17 +11231,26 @@ func (m *AuthUserListRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthUserListRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *AuthRoleListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7292,17 +11258,26 @@ func (m *AuthRoleListRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleListRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - return i, nil + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil } func (m *AuthRoleDeleteRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7310,23 +11285,33 @@ func (m *AuthRoleDeleteRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleDeleteRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleDeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Role) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Role) + copy(dAtA[i:], m.Role) i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) - i += copy(dAtA[i:], m.Role) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthRoleGrantPermissionRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7334,33 +11319,45 @@ func (m *AuthRoleGrantPermissionRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleGrantPermissionRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleGrantPermissionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Perm != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Perm.Size())) - n41, err := m.Perm.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Perm.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n41 + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthRoleRevokePermissionRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7368,35 +11365,47 @@ func (m *AuthRoleRevokePermissionRequest) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleRevokePermissionRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleRevokePermissionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Role) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) - i += copy(dAtA[i:], m.Role) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.RangeEnd) > 0 { + i -= len(m.RangeEnd) + copy(dAtA[i:], m.RangeEnd) + i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) + i-- + dAtA[i] = 0x1a } if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Key) + copy(dAtA[i:], m.Key) i = encodeVarintRpc(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + i-- + dAtA[i] = 0x12 } - if len(m.RangeEnd) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintRpc(dAtA, i, uint64(len(m.RangeEnd))) - i += copy(dAtA[i:], m.RangeEnd) + if len(m.Role) > 0 { + i -= len(m.Role) + copy(dAtA[i:], m.Role) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Role))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthEnableResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7404,27 +11413,38 @@ func (m *AuthEnableResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthEnableResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthEnableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n42, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n42 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthDisableResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7432,27 +11452,38 @@ func (m *AuthDisableResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthDisableResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthDisableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n43, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n43 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthenticateResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7460,33 +11491,45 @@ func (m *AuthenticateResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthenticateResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthenticateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n44, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n44 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Token) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Token) + copy(dAtA[i:], m.Token) i = encodeVarintRpc(dAtA, i, uint64(len(m.Token))) - i += copy(dAtA[i:], m.Token) + i-- + dAtA[i] = 0x12 + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserAddResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7494,27 +11537,38 @@ func (m *AuthUserAddResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthUserAddResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserAddResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n45, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n45 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserGetResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7522,42 +11576,47 @@ func (m *AuthUserGetResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthUserGetResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserGetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n46, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n46 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Roles) > 0 { - for _, s := range m.Roles { + for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Roles[iNdEx]) + copy(dAtA[i:], m.Roles[iNdEx]) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Roles[iNdEx]))) + i-- dAtA[i] = 0x12 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ + } + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserDeleteResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7565,27 +11624,38 @@ func (m *AuthUserDeleteResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthUserDeleteResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserDeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n47, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n47 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserChangePasswordResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7593,27 +11663,38 @@ func (m *AuthUserChangePasswordResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthUserChangePasswordResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserChangePasswordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n48, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n48 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserGrantRoleResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7621,27 +11702,38 @@ func (m *AuthUserGrantRoleResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthUserGrantRoleResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserGrantRoleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n49, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n49 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserRevokeRoleResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7649,27 +11741,38 @@ func (m *AuthUserRevokeRoleResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthUserRevokeRoleResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserRevokeRoleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n50, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n50 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthRoleAddResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7677,27 +11780,38 @@ func (m *AuthRoleAddResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleAddResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleAddResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n51, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n51 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthRoleGetResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7705,39 +11819,52 @@ func (m *AuthRoleGetResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleGetResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleGetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n52, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n52 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Perm) > 0 { - for _, msg := range m.Perm { + for iNdEx := len(m.Perm) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Perm[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintRpc(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthRoleListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7745,42 +11872,47 @@ func (m *AuthRoleListResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleListResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n53, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n53 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Roles) > 0 { - for _, s := range m.Roles { + for iNdEx := len(m.Roles) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Roles[iNdEx]) + copy(dAtA[i:], m.Roles[iNdEx]) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Roles[iNdEx]))) + i-- dAtA[i] = 0x12 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ + } + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthUserListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7788,42 +11920,47 @@ func (m *AuthUserListResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthUserListResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthUserListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n54, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n54 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Users) > 0 { - for _, s := range m.Users { + for iNdEx := len(m.Users) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Users[iNdEx]) + copy(dAtA[i:], m.Users[iNdEx]) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Users[iNdEx]))) + i-- dAtA[i] = 0x12 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ + } + } + if m.Header != nil { + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthRoleDeleteResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7831,27 +11968,38 @@ func (m *AuthRoleDeleteResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleDeleteResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleDeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n55, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n55 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthRoleGrantPermissionResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7859,27 +12007,38 @@ func (m *AuthRoleGrantPermissionResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleGrantPermissionResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleGrantPermissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n56, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n56 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *AuthRoleRevokePermissionResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7887,33 +12046,49 @@ func (m *AuthRoleRevokePermissionResponse) Marshal() (dAtA []byte, err error) { } func (m *AuthRoleRevokePermissionResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthRoleRevokePermissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRpc(dAtA, i, uint64(m.Header.Size())) - n57, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRpc(dAtA, i, uint64(size)) } - i += n57 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintRpc(dAtA []byte, offset int, v uint64) int { + offset -= sovRpc(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *ResponseHeader) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ClusterId != 0 { @@ -7928,10 +12103,16 @@ func (m *ResponseHeader) Size() (n int) { if m.RaftTerm != 0 { n += 1 + sovRpc(uint64(m.RaftTerm)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *RangeRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Key) @@ -7975,10 +12156,16 @@ func (m *RangeRequest) Size() (n int) { if m.MaxCreateRevision != 0 { n += 1 + sovRpc(uint64(m.MaxCreateRevision)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *RangeResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -7997,10 +12184,16 @@ func (m *RangeResponse) Size() (n int) { if m.Count != 0 { n += 1 + sovRpc(uint64(m.Count)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *PutRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Key) @@ -8023,10 +12216,16 @@ func (m *PutRequest) Size() (n int) { if m.IgnoreLease { n += 2 } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *PutResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8037,10 +12236,16 @@ func (m *PutResponse) Size() (n int) { l = m.PrevKv.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *DeleteRangeRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Key) @@ -8054,10 +12259,16 @@ func (m *DeleteRangeRequest) Size() (n int) { if m.PrevKv { n += 2 } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *DeleteRangeResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8073,19 +12284,31 @@ func (m *DeleteRangeResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *RequestOp) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Request != nil { n += m.Request.Size() } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *RequestOp_RequestRange) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.RequestRange != nil { @@ -8095,6 +12318,9 @@ func (m *RequestOp_RequestRange) Size() (n int) { return n } func (m *RequestOp_RequestPut) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.RequestPut != nil { @@ -8104,6 +12330,9 @@ func (m *RequestOp_RequestPut) Size() (n int) { return n } func (m *RequestOp_RequestDeleteRange) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.RequestDeleteRange != nil { @@ -8113,6 +12342,9 @@ func (m *RequestOp_RequestDeleteRange) Size() (n int) { return n } func (m *RequestOp_RequestTxn) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.RequestTxn != nil { @@ -8122,15 +12354,24 @@ func (m *RequestOp_RequestTxn) Size() (n int) { return n } func (m *ResponseOp) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Response != nil { n += m.Response.Size() } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *ResponseOp_ResponseRange) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ResponseRange != nil { @@ -8140,6 +12381,9 @@ func (m *ResponseOp_ResponseRange) Size() (n int) { return n } func (m *ResponseOp_ResponsePut) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ResponsePut != nil { @@ -8149,6 +12393,9 @@ func (m *ResponseOp_ResponsePut) Size() (n int) { return n } func (m *ResponseOp_ResponseDeleteRange) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ResponseDeleteRange != nil { @@ -8158,6 +12405,9 @@ func (m *ResponseOp_ResponseDeleteRange) Size() (n int) { return n } func (m *ResponseOp_ResponseTxn) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ResponseTxn != nil { @@ -8167,6 +12417,9 @@ func (m *ResponseOp_ResponseTxn) Size() (n int) { return n } func (m *Compare) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Result != 0 { @@ -8186,28 +12439,43 @@ func (m *Compare) Size() (n int) { if l > 0 { n += 2 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *Compare_Version) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovRpc(uint64(m.Version)) return n } func (m *Compare_CreateRevision) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovRpc(uint64(m.CreateRevision)) return n } func (m *Compare_ModRevision) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovRpc(uint64(m.ModRevision)) return n } func (m *Compare_Value) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Value != nil { @@ -8217,12 +12485,18 @@ func (m *Compare_Value) Size() (n int) { return n } func (m *Compare_Lease) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovRpc(uint64(m.Lease)) return n } func (m *TxnRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.Compare) > 0 { @@ -8243,10 +12517,16 @@ func (m *TxnRequest) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *TxnResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8262,10 +12542,16 @@ func (m *TxnResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *CompactionRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Revision != 0 { @@ -8274,35 +12560,59 @@ func (m *CompactionRequest) Size() (n int) { if m.Physical { n += 2 } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *CompactionResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *HashRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *HashKVRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Revision != 0 { n += 1 + sovRpc(uint64(m.Revision)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *HashKVResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8315,10 +12625,16 @@ func (m *HashKVResponse) Size() (n int) { if m.CompactRevision != 0 { n += 1 + sovRpc(uint64(m.CompactRevision)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *HashResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8328,16 +12644,28 @@ func (m *HashResponse) Size() (n int) { if m.Hash != 0 { n += 1 + sovRpc(uint64(m.Hash)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *SnapshotRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *SnapshotResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8351,19 +12679,31 @@ func (m *SnapshotResponse) Size() (n int) { if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *WatchRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.RequestUnion != nil { n += m.RequestUnion.Size() } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *WatchRequest_CreateRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.CreateRequest != nil { @@ -8373,6 +12713,9 @@ func (m *WatchRequest_CreateRequest) Size() (n int) { return n } func (m *WatchRequest_CancelRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.CancelRequest != nil { @@ -8381,7 +12724,22 @@ func (m *WatchRequest_CancelRequest) Size() (n int) { } return n } +func (m *WatchRequest_ProgressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProgressRequest != nil { + l = m.ProgressRequest.Size() + n += 1 + l + sovRpc(uint64(l)) + } + return n +} func (m *WatchCreateRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Key) @@ -8408,19 +12766,49 @@ func (m *WatchCreateRequest) Size() (n int) { if m.PrevKv { n += 2 } + if m.WatchId != 0 { + n += 1 + sovRpc(uint64(m.WatchId)) + } + if m.Fragment { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *WatchCancelRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.WatchId != 0 { n += 1 + sovRpc(uint64(m.WatchId)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *WatchProgressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *WatchResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8443,16 +12831,25 @@ func (m *WatchResponse) Size() (n int) { if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.Fragment { + n += 2 + } if len(m.Events) > 0 { for _, e := range m.Events { l = e.Size() n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseGrantRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.TTL != 0 { @@ -8461,10 +12858,16 @@ func (m *LeaseGrantRequest) Size() (n int) { if m.ID != 0 { n += 1 + sovRpc(uint64(m.ID)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseGrantResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8481,38 +12884,62 @@ func (m *LeaseGrantResponse) Size() (n int) { if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseRevokeRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ID != 0 { n += 1 + sovRpc(uint64(m.ID)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseRevokeResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseKeepAliveRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ID != 0 { n += 1 + sovRpc(uint64(m.ID)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseKeepAliveResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8525,10 +12952,16 @@ func (m *LeaseKeepAliveResponse) Size() (n int) { if m.TTL != 0 { n += 1 + sovRpc(uint64(m.TTL)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseTimeToLiveRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ID != 0 { @@ -8537,10 +12970,16 @@ func (m *LeaseTimeToLiveRequest) Size() (n int) { if m.Keys { n += 2 } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseTimeToLiveResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8562,25 +13001,43 @@ func (m *LeaseTimeToLiveResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseLeasesRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseStatus) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ID != 0 { n += 1 + sovRpc(uint64(m.ID)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseLeasesResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8593,10 +13050,16 @@ func (m *LeaseLeasesResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *Member) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ID != 0 { @@ -8618,10 +13081,16 @@ func (m *Member) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MemberAddRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.PeerURLs) > 0 { @@ -8630,10 +13099,16 @@ func (m *MemberAddRequest) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MemberAddResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8650,19 +13125,31 @@ func (m *MemberAddResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MemberRemoveRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ID != 0 { n += 1 + sovRpc(uint64(m.ID)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MemberRemoveResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8675,10 +13162,16 @@ func (m *MemberRemoveResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MemberUpdateRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ID != 0 { @@ -8690,10 +13183,16 @@ func (m *MemberUpdateRequest) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MemberUpdateResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8706,16 +13205,28 @@ func (m *MemberUpdateResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MemberListRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MemberListResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8728,45 +13239,75 @@ func (m *MemberListResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *DefragmentRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *DefragmentResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MoveLeaderRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.TargetID != 0 { n += 1 + sovRpc(uint64(m.TargetID)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MoveLeaderResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AlarmRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Action != 0 { @@ -8778,10 +13319,16 @@ func (m *AlarmRequest) Size() (n int) { if m.Alarm != 0 { n += 1 + sovRpc(uint64(m.Alarm)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AlarmMember) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.MemberID != 0 { @@ -8790,10 +13337,16 @@ func (m *AlarmMember) Size() (n int) { if m.Alarm != 0 { n += 1 + sovRpc(uint64(m.Alarm)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AlarmResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8806,16 +13359,28 @@ func (m *AlarmResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *StatusRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *StatusResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -8838,22 +13403,40 @@ func (m *StatusResponse) Size() (n int) { if m.RaftTerm != 0 { n += 1 + sovRpc(uint64(m.RaftTerm)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthEnableRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthDisableRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthenticateRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -8864,10 +13447,16 @@ func (m *AuthenticateRequest) Size() (n int) { if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserAddRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -8878,30 +13467,48 @@ func (m *AuthUserAddRequest) Size() (n int) { if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserGetRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserDeleteRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserChangePasswordRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -8912,10 +13519,16 @@ func (m *AuthUserChangePasswordRequest) Size() (n int) { if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserGrantRoleRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.User) @@ -8926,10 +13539,16 @@ func (m *AuthUserGrantRoleRequest) Size() (n int) { if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserRevokeRoleRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -8940,52 +13559,88 @@ func (m *AuthUserRevokeRoleRequest) Size() (n int) { if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleAddRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleGetRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Role) if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserListRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleListRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleDeleteRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Role) if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleGrantPermissionRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Name) @@ -8996,10 +13651,16 @@ func (m *AuthRoleGrantPermissionRequest) Size() (n int) { l = m.Perm.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleRevokePermissionRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Role) @@ -9014,30 +13675,48 @@ func (m *AuthRoleRevokePermissionRequest) Size() (n int) { if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthEnableResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthDisableResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthenticateResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -9048,20 +13727,32 @@ func (m *AuthenticateResponse) Size() (n int) { if l > 0 { n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserAddResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserGetResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -9074,60 +13765,96 @@ func (m *AuthUserGetResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserDeleteResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserChangePasswordResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserGrantRoleResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserRevokeRoleResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleAddResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleGetResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -9140,10 +13867,16 @@ func (m *AuthRoleGetResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleListResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -9156,10 +13889,16 @@ func (m *AuthRoleListResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthUserListResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { @@ -9172,48 +13911,62 @@ func (m *AuthUserListResponse) Size() (n int) { n += 1 + l + sovRpc(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleDeleteResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleGrantPermissionResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *AuthRoleRevokePermissionResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Header != nil { l = m.Header.Size() n += 1 + l + sovRpc(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func sovRpc(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRpc(x uint64) (n int) { return sovRpc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -9233,7 +13986,7 @@ func (m *ResponseHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -9261,7 +14014,7 @@ func (m *ResponseHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ClusterId |= (uint64(b) & 0x7F) << shift + m.ClusterId |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -9280,7 +14033,7 @@ func (m *ResponseHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MemberId |= (uint64(b) & 0x7F) << shift + m.MemberId |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -9299,7 +14052,7 @@ func (m *ResponseHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Revision |= (int64(b) & 0x7F) << shift + m.Revision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -9318,7 +14071,7 @@ func (m *ResponseHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RaftTerm |= (uint64(b) & 0x7F) << shift + m.RaftTerm |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -9332,9 +14085,13 @@ func (m *ResponseHeader) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -9359,7 +14116,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -9387,7 +14144,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9396,6 +14153,9 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9418,7 +14178,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9427,6 +14187,9 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9449,7 +14212,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Limit |= (int64(b) & 0x7F) << shift + m.Limit |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -9468,7 +14231,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Revision |= (int64(b) & 0x7F) << shift + m.Revision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -9487,7 +14250,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SortOrder |= (RangeRequest_SortOrder(b) & 0x7F) << shift + m.SortOrder |= RangeRequest_SortOrder(b&0x7F) << shift if b < 0x80 { break } @@ -9506,7 +14269,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SortTarget |= (RangeRequest_SortTarget(b) & 0x7F) << shift + m.SortTarget |= RangeRequest_SortTarget(b&0x7F) << shift if b < 0x80 { break } @@ -9525,7 +14288,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9545,7 +14308,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9565,7 +14328,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9585,7 +14348,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MinModRevision |= (int64(b) & 0x7F) << shift + m.MinModRevision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -9604,7 +14367,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxModRevision |= (int64(b) & 0x7F) << shift + m.MaxModRevision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -9623,7 +14386,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MinCreateRevision |= (int64(b) & 0x7F) << shift + m.MinCreateRevision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -9642,7 +14405,7 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxCreateRevision |= (int64(b) & 0x7F) << shift + m.MaxCreateRevision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -9656,9 +14419,13 @@ func (m *RangeRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -9683,7 +14450,7 @@ func (m *RangeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -9711,7 +14478,7 @@ func (m *RangeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9720,6 +14487,9 @@ func (m *RangeResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9744,7 +14514,7 @@ func (m *RangeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9753,6 +14523,9 @@ func (m *RangeResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9775,7 +14548,7 @@ func (m *RangeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9795,7 +14568,7 @@ func (m *RangeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Count |= (int64(b) & 0x7F) << shift + m.Count |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -9809,9 +14582,13 @@ func (m *RangeResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -9836,7 +14613,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -9864,7 +14641,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9873,6 +14650,9 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9895,7 +14675,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9904,6 +14684,9 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9926,7 +14709,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Lease |= (int64(b) & 0x7F) << shift + m.Lease |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -9945,7 +14728,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9965,7 +14748,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9985,7 +14768,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10000,9 +14783,13 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -10027,7 +14814,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10055,7 +14842,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10064,6 +14851,9 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10088,7 +14878,7 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10097,6 +14887,9 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10116,9 +14909,13 @@ func (m *PutResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -10143,7 +14940,7 @@ func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10171,7 +14968,7 @@ func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10180,6 +14977,9 @@ func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10202,7 +15002,7 @@ func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10211,6 +15011,9 @@ func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10233,7 +15036,7 @@ func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10248,9 +15051,13 @@ func (m *DeleteRangeRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -10275,7 +15082,7 @@ func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10303,7 +15110,7 @@ func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10312,6 +15119,9 @@ func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10336,7 +15146,7 @@ func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Deleted |= (int64(b) & 0x7F) << shift + m.Deleted |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -10355,7 +15165,7 @@ func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10364,6 +15174,9 @@ func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10381,9 +15194,13 @@ func (m *DeleteRangeResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -10408,7 +15225,7 @@ func (m *RequestOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10436,7 +15253,7 @@ func (m *RequestOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10445,6 +15262,9 @@ func (m *RequestOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10468,7 +15288,7 @@ func (m *RequestOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10477,6 +15297,9 @@ func (m *RequestOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10500,7 +15323,7 @@ func (m *RequestOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10509,6 +15332,9 @@ func (m *RequestOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10532,7 +15358,7 @@ func (m *RequestOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10541,6 +15367,9 @@ func (m *RequestOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10559,9 +15388,13 @@ func (m *RequestOp) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -10586,7 +15419,7 @@ func (m *ResponseOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10614,7 +15447,7 @@ func (m *ResponseOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10623,6 +15456,9 @@ func (m *ResponseOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10646,7 +15482,7 @@ func (m *ResponseOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10655,6 +15491,9 @@ func (m *ResponseOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10678,7 +15517,7 @@ func (m *ResponseOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10687,6 +15526,9 @@ func (m *ResponseOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10710,7 +15552,7 @@ func (m *ResponseOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10719,6 +15561,9 @@ func (m *ResponseOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10737,9 +15582,13 @@ func (m *ResponseOp) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -10764,7 +15613,7 @@ func (m *Compare) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10792,7 +15641,7 @@ func (m *Compare) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Result |= (Compare_CompareResult(b) & 0x7F) << shift + m.Result |= Compare_CompareResult(b&0x7F) << shift if b < 0x80 { break } @@ -10811,7 +15660,7 @@ func (m *Compare) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Target |= (Compare_CompareTarget(b) & 0x7F) << shift + m.Target |= Compare_CompareTarget(b&0x7F) << shift if b < 0x80 { break } @@ -10830,7 +15679,7 @@ func (m *Compare) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10839,6 +15688,9 @@ func (m *Compare) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10861,7 +15713,7 @@ func (m *Compare) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int64(b) & 0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -10881,7 +15733,7 @@ func (m *Compare) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int64(b) & 0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -10901,7 +15753,7 @@ func (m *Compare) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int64(b) & 0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -10921,7 +15773,7 @@ func (m *Compare) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10930,6 +15782,9 @@ func (m *Compare) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10951,7 +15806,7 @@ func (m *Compare) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int64(b) & 0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -10971,7 +15826,7 @@ func (m *Compare) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10980,6 +15835,9 @@ func (m *Compare) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10997,9 +15855,13 @@ func (m *Compare) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11024,7 +15886,7 @@ func (m *TxnRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11052,7 +15914,7 @@ func (m *TxnRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11061,6 +15923,9 @@ func (m *TxnRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11083,7 +15948,7 @@ func (m *TxnRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11092,6 +15957,9 @@ func (m *TxnRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11114,7 +15982,7 @@ func (m *TxnRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11123,6 +15991,9 @@ func (m *TxnRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11140,9 +16011,13 @@ func (m *TxnRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11167,7 +16042,7 @@ func (m *TxnResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11195,7 +16070,7 @@ func (m *TxnResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11204,6 +16079,9 @@ func (m *TxnResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11228,7 +16106,7 @@ func (m *TxnResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11248,7 +16126,7 @@ func (m *TxnResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11257,6 +16135,9 @@ func (m *TxnResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11274,9 +16155,13 @@ func (m *TxnResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11301,7 +16186,7 @@ func (m *CompactionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11329,7 +16214,7 @@ func (m *CompactionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Revision |= (int64(b) & 0x7F) << shift + m.Revision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -11348,7 +16233,7 @@ func (m *CompactionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11363,9 +16248,13 @@ func (m *CompactionRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11390,7 +16279,7 @@ func (m *CompactionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11418,7 +16307,7 @@ func (m *CompactionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11427,6 +16316,9 @@ func (m *CompactionResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11446,9 +16338,13 @@ func (m *CompactionResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11473,7 +16369,7 @@ func (m *HashRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11496,9 +16392,13 @@ func (m *HashRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11523,7 +16423,7 @@ func (m *HashKVRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11551,7 +16451,7 @@ func (m *HashKVRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Revision |= (int64(b) & 0x7F) << shift + m.Revision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -11565,9 +16465,13 @@ func (m *HashKVRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11592,7 +16496,7 @@ func (m *HashKVResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11620,7 +16524,7 @@ func (m *HashKVResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11629,6 +16533,9 @@ func (m *HashKVResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11653,7 +16560,7 @@ func (m *HashKVResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Hash |= (uint32(b) & 0x7F) << shift + m.Hash |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -11672,7 +16579,7 @@ func (m *HashKVResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CompactRevision |= (int64(b) & 0x7F) << shift + m.CompactRevision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -11686,9 +16593,13 @@ func (m *HashKVResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11713,7 +16624,7 @@ func (m *HashResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11741,7 +16652,7 @@ func (m *HashResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11750,6 +16661,9 @@ func (m *HashResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11774,7 +16688,7 @@ func (m *HashResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Hash |= (uint32(b) & 0x7F) << shift + m.Hash |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -11788,9 +16702,13 @@ func (m *HashResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11815,7 +16733,7 @@ func (m *SnapshotRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11838,9 +16756,13 @@ func (m *SnapshotRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11865,7 +16787,7 @@ func (m *SnapshotResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11893,7 +16815,7 @@ func (m *SnapshotResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11902,6 +16824,9 @@ func (m *SnapshotResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11926,7 +16851,7 @@ func (m *SnapshotResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RemainingBytes |= (uint64(b) & 0x7F) << shift + m.RemainingBytes |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11945,7 +16870,7 @@ func (m *SnapshotResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11954,6 +16879,9 @@ func (m *SnapshotResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11971,9 +16899,13 @@ func (m *SnapshotResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -11998,7 +16930,7 @@ func (m *WatchRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12026,7 +16958,7 @@ func (m *WatchRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12035,6 +16967,9 @@ func (m *WatchRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12058,7 +16993,7 @@ func (m *WatchRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12067,6 +17002,9 @@ func (m *WatchRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12076,6 +17014,41 @@ func (m *WatchRequest) Unmarshal(dAtA []byte) error { } m.RequestUnion = &WatchRequest_CancelRequest{v} iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProgressRequest", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRpc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &WatchProgressRequest{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.RequestUnion = &WatchRequest_ProgressRequest{v} + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) @@ -12085,9 +17058,13 @@ func (m *WatchRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -12112,7 +17089,7 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12140,7 +17117,7 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12149,6 +17126,9 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12171,7 +17151,7 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12180,6 +17160,9 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12202,7 +17185,7 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StartRevision |= (int64(b) & 0x7F) << shift + m.StartRevision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12221,7 +17204,7 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12239,7 +17222,7 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (WatchCreateRequest_FilterType(b) & 0x7F) << shift + v |= WatchCreateRequest_FilterType(b&0x7F) << shift if b < 0x80 { break } @@ -12256,7 +17239,7 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - packedLen |= (int(b) & 0x7F) << shift + packedLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12265,9 +17248,16 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } + var elementCount int + if elementCount != 0 && len(m.Filters) == 0 { + m.Filters = make([]WatchCreateRequest_FilterType, 0, elementCount) + } for iNdEx < postIndex { var v WatchCreateRequest_FilterType for shift := uint(0); ; shift += 7 { @@ -12279,7 +17269,7 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (WatchCreateRequest_FilterType(b) & 0x7F) << shift + v |= WatchCreateRequest_FilterType(b&0x7F) << shift if b < 0x80 { break } @@ -12303,12 +17293,51 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } m.PrevKv = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WatchId", wireType) + } + m.WatchId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.WatchId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Fragment", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Fragment = bool(v != 0) default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) @@ -12318,9 +17347,13 @@ func (m *WatchCreateRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -12345,7 +17378,7 @@ func (m *WatchCancelRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12373,7 +17406,7 @@ func (m *WatchCancelRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.WatchId |= (int64(b) & 0x7F) << shift + m.WatchId |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12387,9 +17420,67 @@ func (m *WatchCancelRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } + 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 *WatchProgressRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WatchProgressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WatchProgressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipRpc(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRpc + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -12414,7 +17505,7 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12442,7 +17533,7 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12451,6 +17542,9 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12475,7 +17569,7 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.WatchId |= (int64(b) & 0x7F) << shift + m.WatchId |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12494,7 +17588,7 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12514,7 +17608,7 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12534,7 +17628,7 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CompactRevision |= (int64(b) & 0x7F) << shift + m.CompactRevision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12553,7 +17647,7 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12563,11 +17657,34 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } m.CancelReason = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Fragment", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Fragment = bool(v != 0) case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType) @@ -12582,7 +17699,7 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12591,6 +17708,9 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12608,9 +17728,13 @@ func (m *WatchResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -12635,7 +17759,7 @@ func (m *LeaseGrantRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12663,7 +17787,7 @@ func (m *LeaseGrantRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= (int64(b) & 0x7F) << shift + m.TTL |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12682,7 +17806,7 @@ func (m *LeaseGrantRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (int64(b) & 0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12696,9 +17820,13 @@ func (m *LeaseGrantRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -12723,7 +17851,7 @@ func (m *LeaseGrantResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12751,7 +17879,7 @@ func (m *LeaseGrantResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12760,6 +17888,9 @@ func (m *LeaseGrantResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12784,7 +17915,7 @@ func (m *LeaseGrantResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (int64(b) & 0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12803,7 +17934,7 @@ func (m *LeaseGrantResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= (int64(b) & 0x7F) << shift + m.TTL |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12822,7 +17953,7 @@ func (m *LeaseGrantResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12832,6 +17963,9 @@ func (m *LeaseGrantResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12846,9 +17980,13 @@ func (m *LeaseGrantResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -12873,7 +18011,7 @@ func (m *LeaseRevokeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12901,7 +18039,7 @@ func (m *LeaseRevokeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (int64(b) & 0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12915,9 +18053,13 @@ func (m *LeaseRevokeRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -12942,7 +18084,7 @@ func (m *LeaseRevokeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12970,7 +18112,7 @@ func (m *LeaseRevokeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12979,6 +18121,9 @@ func (m *LeaseRevokeResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12998,9 +18143,13 @@ func (m *LeaseRevokeResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -13025,7 +18174,7 @@ func (m *LeaseKeepAliveRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13053,7 +18202,7 @@ func (m *LeaseKeepAliveRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (int64(b) & 0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13067,9 +18216,13 @@ func (m *LeaseKeepAliveRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -13094,7 +18247,7 @@ func (m *LeaseKeepAliveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13122,7 +18275,7 @@ func (m *LeaseKeepAliveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13131,6 +18284,9 @@ func (m *LeaseKeepAliveResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13155,7 +18311,7 @@ func (m *LeaseKeepAliveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (int64(b) & 0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13174,7 +18330,7 @@ func (m *LeaseKeepAliveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= (int64(b) & 0x7F) << shift + m.TTL |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13188,9 +18344,13 @@ func (m *LeaseKeepAliveResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -13215,7 +18375,7 @@ func (m *LeaseTimeToLiveRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13243,7 +18403,7 @@ func (m *LeaseTimeToLiveRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (int64(b) & 0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13262,7 +18422,7 @@ func (m *LeaseTimeToLiveRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13277,9 +18437,13 @@ func (m *LeaseTimeToLiveRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -13304,7 +18468,7 @@ func (m *LeaseTimeToLiveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13332,7 +18496,7 @@ func (m *LeaseTimeToLiveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13341,6 +18505,9 @@ func (m *LeaseTimeToLiveResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13365,7 +18532,7 @@ func (m *LeaseTimeToLiveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (int64(b) & 0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13384,7 +18551,7 @@ func (m *LeaseTimeToLiveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= (int64(b) & 0x7F) << shift + m.TTL |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13403,7 +18570,7 @@ func (m *LeaseTimeToLiveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GrantedTTL |= (int64(b) & 0x7F) << shift + m.GrantedTTL |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13422,7 +18589,7 @@ func (m *LeaseTimeToLiveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13431,6 +18598,9 @@ func (m *LeaseTimeToLiveResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13446,9 +18616,13 @@ func (m *LeaseTimeToLiveResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -13473,7 +18647,7 @@ func (m *LeaseLeasesRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13496,9 +18670,13 @@ func (m *LeaseLeasesRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -13523,7 +18701,7 @@ func (m *LeaseStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13551,7 +18729,7 @@ func (m *LeaseStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (int64(b) & 0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13565,9 +18743,13 @@ func (m *LeaseStatus) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -13592,7 +18774,7 @@ func (m *LeaseLeasesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13620,7 +18802,7 @@ func (m *LeaseLeasesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13629,6 +18811,9 @@ func (m *LeaseLeasesResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13653,7 +18838,7 @@ func (m *LeaseLeasesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13662,6 +18847,9 @@ func (m *LeaseLeasesResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13679,9 +18867,13 @@ func (m *LeaseLeasesResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -13706,7 +18898,7 @@ func (m *Member) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13734,7 +18926,7 @@ func (m *Member) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (uint64(b) & 0x7F) << shift + m.ID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13753,7 +18945,7 @@ func (m *Member) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13763,6 +18955,9 @@ func (m *Member) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13782,7 +18977,7 @@ func (m *Member) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13792,6 +18987,9 @@ func (m *Member) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13811,7 +19009,7 @@ func (m *Member) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13821,6 +19019,9 @@ func (m *Member) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13835,9 +19036,13 @@ func (m *Member) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -13862,7 +19067,7 @@ func (m *MemberAddRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13890,7 +19095,7 @@ func (m *MemberAddRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13900,6 +19105,9 @@ func (m *MemberAddRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13914,9 +19122,13 @@ func (m *MemberAddRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -13941,7 +19153,7 @@ func (m *MemberAddResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13969,7 +19181,7 @@ func (m *MemberAddResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13978,6 +19190,9 @@ func (m *MemberAddResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14002,7 +19217,7 @@ func (m *MemberAddResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14011,6 +19226,9 @@ func (m *MemberAddResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14035,7 +19253,7 @@ func (m *MemberAddResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14044,6 +19262,9 @@ func (m *MemberAddResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14061,9 +19282,13 @@ func (m *MemberAddResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14088,7 +19313,7 @@ func (m *MemberRemoveRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14116,7 +19341,7 @@ func (m *MemberRemoveRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (uint64(b) & 0x7F) << shift + m.ID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14130,9 +19355,13 @@ func (m *MemberRemoveRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14157,7 +19386,7 @@ func (m *MemberRemoveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14185,7 +19414,7 @@ func (m *MemberRemoveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14194,6 +19423,9 @@ func (m *MemberRemoveResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14218,7 +19450,7 @@ func (m *MemberRemoveResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14227,6 +19459,9 @@ func (m *MemberRemoveResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14244,9 +19479,13 @@ func (m *MemberRemoveResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14271,7 +19510,7 @@ func (m *MemberUpdateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14299,7 +19538,7 @@ func (m *MemberUpdateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (uint64(b) & 0x7F) << shift + m.ID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14318,7 +19557,7 @@ func (m *MemberUpdateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14328,6 +19567,9 @@ func (m *MemberUpdateRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14342,9 +19584,13 @@ func (m *MemberUpdateRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14369,7 +19615,7 @@ func (m *MemberUpdateResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14397,7 +19643,7 @@ func (m *MemberUpdateResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14406,6 +19652,9 @@ func (m *MemberUpdateResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14430,7 +19679,7 @@ func (m *MemberUpdateResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14439,6 +19688,9 @@ func (m *MemberUpdateResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14456,9 +19708,13 @@ func (m *MemberUpdateResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14483,7 +19739,7 @@ func (m *MemberListRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14506,9 +19762,13 @@ func (m *MemberListRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14533,7 +19793,7 @@ func (m *MemberListResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14561,7 +19821,7 @@ func (m *MemberListResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14570,6 +19830,9 @@ func (m *MemberListResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14594,7 +19857,7 @@ func (m *MemberListResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14603,6 +19866,9 @@ func (m *MemberListResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14620,9 +19886,13 @@ func (m *MemberListResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14647,7 +19917,7 @@ func (m *DefragmentRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14670,9 +19940,13 @@ func (m *DefragmentRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14697,7 +19971,7 @@ func (m *DefragmentResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14725,7 +19999,7 @@ func (m *DefragmentResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14734,6 +20008,9 @@ func (m *DefragmentResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14753,9 +20030,13 @@ func (m *DefragmentResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14780,7 +20061,7 @@ func (m *MoveLeaderRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14808,7 +20089,7 @@ func (m *MoveLeaderRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TargetID |= (uint64(b) & 0x7F) << shift + m.TargetID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14822,9 +20103,13 @@ func (m *MoveLeaderRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14849,7 +20134,7 @@ func (m *MoveLeaderResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14877,7 +20162,7 @@ func (m *MoveLeaderResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14886,6 +20171,9 @@ func (m *MoveLeaderResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14905,9 +20193,13 @@ func (m *MoveLeaderResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -14932,7 +20224,7 @@ func (m *AlarmRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14960,7 +20252,7 @@ func (m *AlarmRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Action |= (AlarmRequest_AlarmAction(b) & 0x7F) << shift + m.Action |= AlarmRequest_AlarmAction(b&0x7F) << shift if b < 0x80 { break } @@ -14979,7 +20271,7 @@ func (m *AlarmRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MemberID |= (uint64(b) & 0x7F) << shift + m.MemberID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14998,7 +20290,7 @@ func (m *AlarmRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Alarm |= (AlarmType(b) & 0x7F) << shift + m.Alarm |= AlarmType(b&0x7F) << shift if b < 0x80 { break } @@ -15012,9 +20304,13 @@ func (m *AlarmRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15039,7 +20335,7 @@ func (m *AlarmMember) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15067,7 +20363,7 @@ func (m *AlarmMember) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MemberID |= (uint64(b) & 0x7F) << shift + m.MemberID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15086,7 +20382,7 @@ func (m *AlarmMember) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Alarm |= (AlarmType(b) & 0x7F) << shift + m.Alarm |= AlarmType(b&0x7F) << shift if b < 0x80 { break } @@ -15100,9 +20396,13 @@ func (m *AlarmMember) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15127,7 +20427,7 @@ func (m *AlarmResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15155,7 +20455,7 @@ func (m *AlarmResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15164,6 +20464,9 @@ func (m *AlarmResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15188,7 +20491,7 @@ func (m *AlarmResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15197,6 +20500,9 @@ func (m *AlarmResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15214,9 +20520,13 @@ func (m *AlarmResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15241,7 +20551,7 @@ func (m *StatusRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15264,9 +20574,13 @@ func (m *StatusRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15291,7 +20605,7 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15319,7 +20633,7 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15328,6 +20642,9 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15352,7 +20669,7 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15362,6 +20679,9 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15381,7 +20701,7 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DbSize |= (int64(b) & 0x7F) << shift + m.DbSize |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -15400,7 +20720,7 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Leader |= (uint64(b) & 0x7F) << shift + m.Leader |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15419,7 +20739,7 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RaftIndex |= (uint64(b) & 0x7F) << shift + m.RaftIndex |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15438,7 +20758,7 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RaftTerm |= (uint64(b) & 0x7F) << shift + m.RaftTerm |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15452,9 +20772,13 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15479,7 +20803,7 @@ func (m *AuthEnableRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15502,9 +20826,13 @@ func (m *AuthEnableRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15529,7 +20857,7 @@ func (m *AuthDisableRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15552,9 +20880,13 @@ func (m *AuthDisableRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15579,7 +20911,7 @@ func (m *AuthenticateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15607,7 +20939,7 @@ func (m *AuthenticateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15617,6 +20949,9 @@ func (m *AuthenticateRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15636,7 +20971,7 @@ func (m *AuthenticateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15646,6 +20981,9 @@ func (m *AuthenticateRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15660,9 +20998,13 @@ func (m *AuthenticateRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15687,7 +21029,7 @@ func (m *AuthUserAddRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15715,7 +21057,7 @@ func (m *AuthUserAddRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15725,6 +21067,9 @@ func (m *AuthUserAddRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15744,7 +21089,7 @@ func (m *AuthUserAddRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15754,6 +21099,9 @@ func (m *AuthUserAddRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15768,9 +21116,13 @@ func (m *AuthUserAddRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15795,7 +21147,7 @@ func (m *AuthUserGetRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15823,7 +21175,7 @@ func (m *AuthUserGetRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15833,6 +21185,9 @@ func (m *AuthUserGetRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15847,9 +21202,13 @@ func (m *AuthUserGetRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15874,7 +21233,7 @@ func (m *AuthUserDeleteRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15902,7 +21261,7 @@ func (m *AuthUserDeleteRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15912,6 +21271,9 @@ func (m *AuthUserDeleteRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15926,9 +21288,13 @@ func (m *AuthUserDeleteRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -15953,7 +21319,7 @@ func (m *AuthUserChangePasswordRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15981,7 +21347,7 @@ func (m *AuthUserChangePasswordRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15991,6 +21357,9 @@ func (m *AuthUserChangePasswordRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16010,7 +21379,7 @@ func (m *AuthUserChangePasswordRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16020,6 +21389,9 @@ func (m *AuthUserChangePasswordRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16034,9 +21406,13 @@ func (m *AuthUserChangePasswordRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16061,7 +21437,7 @@ func (m *AuthUserGrantRoleRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16089,7 +21465,7 @@ func (m *AuthUserGrantRoleRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16099,6 +21475,9 @@ func (m *AuthUserGrantRoleRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16118,7 +21497,7 @@ func (m *AuthUserGrantRoleRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16128,6 +21507,9 @@ func (m *AuthUserGrantRoleRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16142,9 +21524,13 @@ func (m *AuthUserGrantRoleRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16169,7 +21555,7 @@ func (m *AuthUserRevokeRoleRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16197,7 +21583,7 @@ func (m *AuthUserRevokeRoleRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16207,6 +21593,9 @@ func (m *AuthUserRevokeRoleRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16226,7 +21615,7 @@ func (m *AuthUserRevokeRoleRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16236,6 +21625,9 @@ func (m *AuthUserRevokeRoleRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16250,9 +21642,13 @@ func (m *AuthUserRevokeRoleRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16277,7 +21673,7 @@ func (m *AuthRoleAddRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16305,7 +21701,7 @@ func (m *AuthRoleAddRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16315,6 +21711,9 @@ func (m *AuthRoleAddRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16329,9 +21728,13 @@ func (m *AuthRoleAddRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16356,7 +21759,7 @@ func (m *AuthRoleGetRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16384,7 +21787,7 @@ func (m *AuthRoleGetRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16394,6 +21797,9 @@ func (m *AuthRoleGetRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16408,9 +21814,13 @@ func (m *AuthRoleGetRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16435,7 +21845,7 @@ func (m *AuthUserListRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16458,9 +21868,13 @@ func (m *AuthUserListRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16485,7 +21899,7 @@ func (m *AuthRoleListRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16508,9 +21922,13 @@ func (m *AuthRoleListRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16535,7 +21953,7 @@ func (m *AuthRoleDeleteRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16563,7 +21981,7 @@ func (m *AuthRoleDeleteRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16573,6 +21991,9 @@ func (m *AuthRoleDeleteRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16587,9 +22008,13 @@ func (m *AuthRoleDeleteRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16614,7 +22039,7 @@ func (m *AuthRoleGrantPermissionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16642,7 +22067,7 @@ func (m *AuthRoleGrantPermissionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16652,6 +22077,9 @@ func (m *AuthRoleGrantPermissionRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16671,7 +22099,7 @@ func (m *AuthRoleGrantPermissionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -16680,6 +22108,9 @@ func (m *AuthRoleGrantPermissionRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16699,9 +22130,13 @@ func (m *AuthRoleGrantPermissionRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16726,7 +22161,7 @@ func (m *AuthRoleRevokePermissionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16754,7 +22189,7 @@ func (m *AuthRoleRevokePermissionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16764,6 +22199,9 @@ func (m *AuthRoleRevokePermissionRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16783,7 +22221,7 @@ func (m *AuthRoleRevokePermissionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16793,6 +22231,9 @@ func (m *AuthRoleRevokePermissionRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16812,7 +22253,7 @@ func (m *AuthRoleRevokePermissionRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16822,6 +22263,9 @@ func (m *AuthRoleRevokePermissionRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16836,9 +22280,13 @@ func (m *AuthRoleRevokePermissionRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16863,7 +22311,7 @@ func (m *AuthEnableResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16891,7 +22339,7 @@ func (m *AuthEnableResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -16900,6 +22348,9 @@ func (m *AuthEnableResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -16919,9 +22370,13 @@ func (m *AuthEnableResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -16946,7 +22401,7 @@ func (m *AuthDisableResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -16974,7 +22429,7 @@ func (m *AuthDisableResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -16983,6 +22438,9 @@ func (m *AuthDisableResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17002,9 +22460,13 @@ func (m *AuthDisableResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17029,7 +22491,7 @@ func (m *AuthenticateResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17057,7 +22519,7 @@ func (m *AuthenticateResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17066,6 +22528,9 @@ func (m *AuthenticateResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17090,7 +22555,7 @@ func (m *AuthenticateResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17100,6 +22565,9 @@ func (m *AuthenticateResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17114,9 +22582,13 @@ func (m *AuthenticateResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17141,7 +22613,7 @@ func (m *AuthUserAddResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17169,7 +22641,7 @@ func (m *AuthUserAddResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17178,6 +22650,9 @@ func (m *AuthUserAddResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17197,9 +22672,13 @@ func (m *AuthUserAddResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17224,7 +22703,7 @@ func (m *AuthUserGetResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17252,7 +22731,7 @@ func (m *AuthUserGetResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17261,6 +22740,9 @@ func (m *AuthUserGetResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17285,7 +22767,7 @@ func (m *AuthUserGetResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17295,6 +22777,9 @@ func (m *AuthUserGetResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17309,9 +22794,13 @@ func (m *AuthUserGetResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17336,7 +22825,7 @@ func (m *AuthUserDeleteResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17364,7 +22853,7 @@ func (m *AuthUserDeleteResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17373,6 +22862,9 @@ func (m *AuthUserDeleteResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17392,9 +22884,13 @@ func (m *AuthUserDeleteResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17419,7 +22915,7 @@ func (m *AuthUserChangePasswordResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17447,7 +22943,7 @@ func (m *AuthUserChangePasswordResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17456,6 +22952,9 @@ func (m *AuthUserChangePasswordResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17475,9 +22974,13 @@ func (m *AuthUserChangePasswordResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17502,7 +23005,7 @@ func (m *AuthUserGrantRoleResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17530,7 +23033,7 @@ func (m *AuthUserGrantRoleResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17539,6 +23042,9 @@ func (m *AuthUserGrantRoleResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17558,9 +23064,13 @@ func (m *AuthUserGrantRoleResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17585,7 +23095,7 @@ func (m *AuthUserRevokeRoleResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17613,7 +23123,7 @@ func (m *AuthUserRevokeRoleResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17622,6 +23132,9 @@ func (m *AuthUserRevokeRoleResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17641,9 +23154,13 @@ func (m *AuthUserRevokeRoleResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17668,7 +23185,7 @@ func (m *AuthRoleAddResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17696,7 +23213,7 @@ func (m *AuthRoleAddResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17705,6 +23222,9 @@ func (m *AuthRoleAddResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17724,9 +23244,13 @@ func (m *AuthRoleAddResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17751,7 +23275,7 @@ func (m *AuthRoleGetResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17779,7 +23303,7 @@ func (m *AuthRoleGetResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17788,6 +23312,9 @@ func (m *AuthRoleGetResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17812,7 +23339,7 @@ func (m *AuthRoleGetResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17821,6 +23348,9 @@ func (m *AuthRoleGetResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17838,9 +23368,13 @@ func (m *AuthRoleGetResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17865,7 +23399,7 @@ func (m *AuthRoleListResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17893,7 +23427,7 @@ func (m *AuthRoleListResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -17902,6 +23436,9 @@ func (m *AuthRoleListResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17926,7 +23463,7 @@ func (m *AuthRoleListResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -17936,6 +23473,9 @@ func (m *AuthRoleListResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -17950,9 +23490,13 @@ func (m *AuthRoleListResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -17977,7 +23521,7 @@ func (m *AuthUserListResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -18005,7 +23549,7 @@ func (m *AuthUserListResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -18014,6 +23558,9 @@ func (m *AuthUserListResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -18038,7 +23585,7 @@ func (m *AuthUserListResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -18048,6 +23595,9 @@ func (m *AuthUserListResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -18062,9 +23612,13 @@ func (m *AuthUserListResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -18089,7 +23643,7 @@ func (m *AuthRoleDeleteResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -18117,7 +23671,7 @@ func (m *AuthRoleDeleteResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -18126,6 +23680,9 @@ func (m *AuthRoleDeleteResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -18145,9 +23702,13 @@ func (m *AuthRoleDeleteResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -18172,7 +23733,7 @@ func (m *AuthRoleGrantPermissionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -18200,7 +23761,7 @@ func (m *AuthRoleGrantPermissionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -18209,6 +23770,9 @@ func (m *AuthRoleGrantPermissionResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -18228,9 +23792,13 @@ func (m *AuthRoleGrantPermissionResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -18255,7 +23823,7 @@ func (m *AuthRoleRevokePermissionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -18283,7 +23851,7 @@ func (m *AuthRoleRevokePermissionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -18292,6 +23860,9 @@ func (m *AuthRoleRevokePermissionResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRpc } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRpc + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -18311,9 +23882,13 @@ func (m *AuthRoleRevokePermissionResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRpc } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRpc + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -18377,10 +23952,13 @@ func skipRpc(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthRpc } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthRpc + } return iNdEx, nil case 3: for { @@ -18409,6 +23987,9 @@ func skipRpc(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthRpc + } } return iNdEx, nil case 4: @@ -18427,239 +24008,3 @@ var ( ErrInvalidLengthRpc = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowRpc = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("rpc.proto", fileDescriptorRpc) } - -var fileDescriptorRpc = []byte{ - // 3669 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x5b, 0x5b, 0x6f, 0x23, 0xc7, - 0x72, 0xd6, 0x90, 0x22, 0x29, 0x16, 0x2f, 0xe2, 0xb6, 0xb4, 0xbb, 0x14, 0x77, 0x57, 0xab, 0xed, - 0xbd, 0x69, 0x2f, 0x16, 0x6d, 0xd9, 0xc9, 0xc3, 0x26, 0x30, 0xac, 0x95, 0xe8, 0x95, 0x2c, 0xad, - 0x24, 0x8f, 0xa8, 0xb5, 0x03, 0x38, 0x11, 0x46, 0x64, 0x4b, 0x62, 0x44, 0xce, 0x30, 0x33, 0x43, - 0xae, 0xb4, 0x31, 0x12, 0xc0, 0x71, 0x82, 0xbc, 0xe4, 0x25, 0x06, 0x82, 0xc4, 0xaf, 0x41, 0x60, - 0xf8, 0x07, 0x04, 0xf9, 0x0b, 0x41, 0x5e, 0x12, 0x20, 0x7f, 0xe0, 0xc0, 0xe7, 0xbc, 0x9c, 0x5f, - 0x70, 0x2e, 0x4f, 0x07, 0x7d, 0x9b, 0xe9, 0xb9, 0x51, 0xb2, 0x69, 0xfb, 0x45, 0x3b, 0x5d, 0x5d, - 0x5d, 0x55, 0x5d, 0xdd, 0x55, 0xd5, 0xfd, 0x35, 0x17, 0xf2, 0x76, 0xbf, 0xb5, 0xd4, 0xb7, 0x2d, - 0xd7, 0x42, 0x45, 0xe2, 0xb6, 0xda, 0x0e, 0xb1, 0x87, 0xc4, 0xee, 0x1f, 0xd6, 0x66, 0x8f, 0xad, - 0x63, 0x8b, 0x75, 0xd4, 0xe9, 0x17, 0xe7, 0xa9, 0xcd, 0x51, 0x9e, 0x7a, 0x6f, 0xd8, 0x6a, 0xb1, - 0x3f, 0xfd, 0xc3, 0xfa, 0xe9, 0x50, 0x74, 0xdd, 0x60, 0x5d, 0xc6, 0xc0, 0x3d, 0x61, 0x7f, 0xfa, - 0x87, 0xec, 0x1f, 0xd1, 0x79, 0xf3, 0xd8, 0xb2, 0x8e, 0xbb, 0xa4, 0x6e, 0xf4, 0x3b, 0x75, 0xc3, - 0x34, 0x2d, 0xd7, 0x70, 0x3b, 0x96, 0xe9, 0xf0, 0x5e, 0xfc, 0xf7, 0x1a, 0x94, 0x75, 0xe2, 0xf4, - 0x2d, 0xd3, 0x21, 0xeb, 0xc4, 0x68, 0x13, 0x1b, 0xdd, 0x02, 0x68, 0x75, 0x07, 0x8e, 0x4b, 0xec, - 0x83, 0x4e, 0xbb, 0xaa, 0x2d, 0x68, 0x8b, 0x93, 0x7a, 0x5e, 0x50, 0x36, 0xda, 0xe8, 0x06, 0xe4, - 0x7b, 0xa4, 0x77, 0xc8, 0x7b, 0x53, 0xac, 0x77, 0x8a, 0x13, 0x36, 0xda, 0xa8, 0x06, 0x53, 0x36, - 0x19, 0x76, 0x9c, 0x8e, 0x65, 0x56, 0xd3, 0x0b, 0xda, 0x62, 0x5a, 0xf7, 0xda, 0x74, 0xa0, 0x6d, - 0x1c, 0xb9, 0x07, 0x2e, 0xb1, 0x7b, 0xd5, 0x49, 0x3e, 0x90, 0x12, 0x9a, 0xc4, 0xee, 0xe1, 0x2f, - 0x33, 0x50, 0xd4, 0x0d, 0xf3, 0x98, 0xe8, 0xe4, 0xaf, 0x06, 0xc4, 0x71, 0x51, 0x05, 0xd2, 0xa7, - 0xe4, 0x9c, 0xa9, 0x2f, 0xea, 0xf4, 0x93, 0x8f, 0x37, 0x8f, 0xc9, 0x01, 0x31, 0xb9, 0xe2, 0x22, - 0x1d, 0x6f, 0x1e, 0x93, 0x86, 0xd9, 0x46, 0xb3, 0x90, 0xe9, 0x76, 0x7a, 0x1d, 0x57, 0x68, 0xe5, - 0x8d, 0x80, 0x39, 0x93, 0x21, 0x73, 0x56, 0x01, 0x1c, 0xcb, 0x76, 0x0f, 0x2c, 0xbb, 0x4d, 0xec, - 0x6a, 0x66, 0x41, 0x5b, 0x2c, 0x2f, 0xdf, 0x5b, 0x52, 0x17, 0x62, 0x49, 0x35, 0x68, 0x69, 0xcf, - 0xb2, 0xdd, 0x1d, 0xca, 0xab, 0xe7, 0x1d, 0xf9, 0x89, 0x3e, 0x84, 0x02, 0x13, 0xe2, 0x1a, 0xf6, - 0x31, 0x71, 0xab, 0x59, 0x26, 0xe5, 0xfe, 0x05, 0x52, 0x9a, 0x8c, 0x59, 0x67, 0xea, 0xf9, 0x37, - 0xc2, 0x50, 0x74, 0x88, 0xdd, 0x31, 0xba, 0x9d, 0x37, 0xc6, 0x61, 0x97, 0x54, 0x73, 0x0b, 0xda, - 0xe2, 0x94, 0x1e, 0xa0, 0xd1, 0xf9, 0x9f, 0x92, 0x73, 0xe7, 0xc0, 0x32, 0xbb, 0xe7, 0xd5, 0x29, - 0xc6, 0x30, 0x45, 0x09, 0x3b, 0x66, 0xf7, 0x9c, 0x2d, 0x9a, 0x35, 0x30, 0x5d, 0xde, 0x9b, 0x67, - 0xbd, 0x79, 0x46, 0x61, 0xdd, 0x8b, 0x50, 0xe9, 0x75, 0xcc, 0x83, 0x9e, 0xd5, 0x3e, 0xf0, 0x1c, - 0x02, 0xcc, 0x21, 0xe5, 0x5e, 0xc7, 0x7c, 0x69, 0xb5, 0x75, 0xe9, 0x16, 0xca, 0x69, 0x9c, 0x05, - 0x39, 0x0b, 0x82, 0xd3, 0x38, 0x53, 0x39, 0x97, 0x60, 0x86, 0xca, 0x6c, 0xd9, 0xc4, 0x70, 0x89, - 0xcf, 0x5c, 0x64, 0xcc, 0x57, 0x7a, 0x1d, 0x73, 0x95, 0xf5, 0x04, 0xf8, 0x8d, 0xb3, 0x08, 0x7f, - 0x49, 0xf0, 0x1b, 0x67, 0x41, 0x7e, 0xbc, 0x04, 0x79, 0xcf, 0xe7, 0x68, 0x0a, 0x26, 0xb7, 0x77, - 0xb6, 0x1b, 0x95, 0x09, 0x04, 0x90, 0x5d, 0xd9, 0x5b, 0x6d, 0x6c, 0xaf, 0x55, 0x34, 0x54, 0x80, - 0xdc, 0x5a, 0x83, 0x37, 0x52, 0xf8, 0x39, 0x80, 0xef, 0x5d, 0x94, 0x83, 0xf4, 0x66, 0xe3, 0xcf, - 0x2a, 0x13, 0x94, 0xe7, 0x55, 0x43, 0xdf, 0xdb, 0xd8, 0xd9, 0xae, 0x68, 0x74, 0xf0, 0xaa, 0xde, - 0x58, 0x69, 0x36, 0x2a, 0x29, 0xca, 0xf1, 0x72, 0x67, 0xad, 0x92, 0x46, 0x79, 0xc8, 0xbc, 0x5a, - 0xd9, 0xda, 0x6f, 0x54, 0x26, 0xf1, 0x57, 0x1a, 0x94, 0xc4, 0x7a, 0xf1, 0x98, 0x40, 0xef, 0x41, - 0xf6, 0x84, 0xc5, 0x05, 0xdb, 0x8a, 0x85, 0xe5, 0x9b, 0xa1, 0xc5, 0x0d, 0xc4, 0x8e, 0x2e, 0x78, - 0x11, 0x86, 0xf4, 0xe9, 0xd0, 0xa9, 0xa6, 0x16, 0xd2, 0x8b, 0x85, 0xe5, 0xca, 0x12, 0x0f, 0xd8, - 0xa5, 0x4d, 0x72, 0xfe, 0xca, 0xe8, 0x0e, 0x88, 0x4e, 0x3b, 0x11, 0x82, 0xc9, 0x9e, 0x65, 0x13, - 0xb6, 0x63, 0xa7, 0x74, 0xf6, 0x4d, 0xb7, 0x31, 0x5b, 0x34, 0xb1, 0x5b, 0x79, 0x03, 0x7f, 0xab, - 0x01, 0xec, 0x0e, 0xdc, 0xe4, 0xd0, 0x98, 0x85, 0xcc, 0x90, 0x0a, 0x16, 0x61, 0xc1, 0x1b, 0x2c, - 0x26, 0x88, 0xe1, 0x10, 0x2f, 0x26, 0x68, 0x03, 0x5d, 0x87, 0x5c, 0xdf, 0x26, 0xc3, 0x83, 0xd3, - 0x21, 0x53, 0x32, 0xa5, 0x67, 0x69, 0x73, 0x73, 0x88, 0xee, 0x40, 0xb1, 0x73, 0x6c, 0x5a, 0x36, - 0x39, 0xe0, 0xb2, 0x32, 0xac, 0xb7, 0xc0, 0x69, 0xcc, 0x6e, 0x85, 0x85, 0x0b, 0xce, 0xaa, 0x2c, - 0x5b, 0x94, 0x84, 0x4d, 0x28, 0x30, 0x53, 0xc7, 0x72, 0xdf, 0x23, 0xdf, 0xc6, 0x14, 0x1b, 0x16, - 0x75, 0xa1, 0xb0, 0x1a, 0x7f, 0x06, 0x68, 0x8d, 0x74, 0x89, 0x4b, 0xc6, 0xc9, 0x1e, 0x8a, 0x4f, - 0xd2, 0xaa, 0x4f, 0xf0, 0x3f, 0x6b, 0x30, 0x13, 0x10, 0x3f, 0xd6, 0xb4, 0xaa, 0x90, 0x6b, 0x33, - 0x61, 0xdc, 0x82, 0xb4, 0x2e, 0x9b, 0xe8, 0x09, 0x4c, 0x09, 0x03, 0x9c, 0x6a, 0x3a, 0x61, 0xd3, - 0xe4, 0xb8, 0x4d, 0x0e, 0xfe, 0x36, 0x05, 0x79, 0x31, 0xd1, 0x9d, 0x3e, 0x5a, 0x81, 0x92, 0xcd, - 0x1b, 0x07, 0x6c, 0x3e, 0xc2, 0xa2, 0x5a, 0x72, 0x12, 0x5a, 0x9f, 0xd0, 0x8b, 0x62, 0x08, 0x23, - 0xa3, 0x3f, 0x81, 0x82, 0x14, 0xd1, 0x1f, 0xb8, 0xc2, 0xe5, 0xd5, 0xa0, 0x00, 0x7f, 0xff, 0xad, - 0x4f, 0xe8, 0x20, 0xd8, 0x77, 0x07, 0x2e, 0x6a, 0xc2, 0xac, 0x1c, 0xcc, 0x67, 0x23, 0xcc, 0x48, - 0x33, 0x29, 0x0b, 0x41, 0x29, 0xd1, 0xa5, 0x5a, 0x9f, 0xd0, 0x91, 0x18, 0xaf, 0x74, 0xaa, 0x26, - 0xb9, 0x67, 0x3c, 0x79, 0x47, 0x4c, 0x6a, 0x9e, 0x99, 0x51, 0x93, 0x9a, 0x67, 0xe6, 0xf3, 0x3c, - 0xe4, 0x44, 0x0b, 0xff, 0x57, 0x0a, 0x40, 0xae, 0xc6, 0x4e, 0x1f, 0xad, 0x41, 0xd9, 0x16, 0xad, - 0x80, 0xb7, 0x6e, 0xc4, 0x7a, 0x4b, 0x2c, 0xe2, 0x84, 0x5e, 0x92, 0x83, 0xb8, 0x71, 0xef, 0x43, - 0xd1, 0x93, 0xe2, 0x3b, 0x6c, 0x2e, 0xc6, 0x61, 0x9e, 0x84, 0x82, 0x1c, 0x40, 0x5d, 0xf6, 0x09, - 0x5c, 0xf5, 0xc6, 0xc7, 0xf8, 0xec, 0xce, 0x08, 0x9f, 0x79, 0x02, 0x67, 0xa4, 0x04, 0xd5, 0x6b, - 0xaa, 0x61, 0xbe, 0xdb, 0xe6, 0x62, 0xdc, 0x16, 0x35, 0x8c, 0x3a, 0x0e, 0x68, 0xbd, 0xe4, 0x4d, - 0xfc, 0xeb, 0x34, 0xe4, 0x56, 0xad, 0x5e, 0xdf, 0xb0, 0xe9, 0x6a, 0x64, 0x6d, 0xe2, 0x0c, 0xba, - 0x2e, 0x73, 0x57, 0x79, 0xf9, 0x6e, 0x50, 0xa2, 0x60, 0x93, 0xff, 0xea, 0x8c, 0x55, 0x17, 0x43, - 0xe8, 0x60, 0x51, 0x1e, 0x53, 0x97, 0x18, 0x2c, 0x8a, 0xa3, 0x18, 0x22, 0x03, 0x39, 0xed, 0x07, - 0x72, 0x0d, 0x72, 0x43, 0x62, 0xfb, 0x25, 0x7d, 0x7d, 0x42, 0x97, 0x04, 0xf4, 0x08, 0xa6, 0xc3, - 0xe5, 0x25, 0x23, 0x78, 0xca, 0xad, 0x60, 0x35, 0xba, 0x0b, 0xc5, 0x40, 0x8d, 0xcb, 0x0a, 0xbe, - 0x42, 0x4f, 0x29, 0x71, 0xd7, 0x64, 0x5e, 0xa5, 0xf5, 0xb8, 0xb8, 0x3e, 0x21, 0x33, 0xeb, 0x35, - 0x99, 0x59, 0xa7, 0xc4, 0x28, 0x91, 0x5b, 0x03, 0x49, 0xe6, 0x83, 0x60, 0x92, 0xc1, 0x1f, 0x40, - 0x29, 0xe0, 0x20, 0x5a, 0x77, 0x1a, 0x1f, 0xef, 0xaf, 0x6c, 0xf1, 0x22, 0xf5, 0x82, 0xd5, 0x25, - 0xbd, 0xa2, 0xd1, 0x5a, 0xb7, 0xd5, 0xd8, 0xdb, 0xab, 0xa4, 0x50, 0x09, 0xf2, 0xdb, 0x3b, 0xcd, - 0x03, 0xce, 0x95, 0xc6, 0x2f, 0x3c, 0x09, 0xa2, 0xc8, 0x29, 0xb5, 0x6d, 0x42, 0xa9, 0x6d, 0x9a, - 0xac, 0x6d, 0x29, 0xbf, 0xb6, 0xb1, 0x32, 0xb7, 0xd5, 0x58, 0xd9, 0x6b, 0x54, 0x26, 0x9f, 0x97, - 0xa1, 0xc8, 0xfd, 0x7b, 0x30, 0x30, 0x69, 0xa9, 0xfd, 0x77, 0x0d, 0xc0, 0x8f, 0x26, 0x54, 0x87, - 0x5c, 0x8b, 0xeb, 0xa9, 0x6a, 0x2c, 0x19, 0x5d, 0x8d, 0x5d, 0x32, 0x5d, 0x72, 0xa1, 0x77, 0x20, - 0xe7, 0x0c, 0x5a, 0x2d, 0xe2, 0xc8, 0x92, 0x77, 0x3d, 0x9c, 0x0f, 0x45, 0xb6, 0xd2, 0x25, 0x1f, - 0x1d, 0x72, 0x64, 0x74, 0xba, 0x03, 0x56, 0x00, 0x47, 0x0f, 0x11, 0x7c, 0xf8, 0xdf, 0x34, 0x28, - 0x28, 0x9b, 0xf7, 0x07, 0x26, 0xe1, 0x9b, 0x90, 0x67, 0x36, 0x90, 0xb6, 0x48, 0xc3, 0x53, 0xba, - 0x4f, 0x40, 0x7f, 0x0c, 0x79, 0x19, 0x01, 0x32, 0x13, 0x57, 0xe3, 0xc5, 0xee, 0xf4, 0x75, 0x9f, - 0x15, 0x6f, 0xc2, 0x15, 0xe6, 0x95, 0x16, 0x3d, 0x5c, 0x4b, 0x3f, 0xaa, 0xc7, 0x4f, 0x2d, 0x74, - 0xfc, 0xac, 0xc1, 0x54, 0xff, 0xe4, 0xdc, 0xe9, 0xb4, 0x8c, 0xae, 0xb0, 0xc2, 0x6b, 0xe3, 0x8f, - 0x00, 0xa9, 0xc2, 0xc6, 0x99, 0x2e, 0x2e, 0x41, 0x61, 0xdd, 0x70, 0x4e, 0x84, 0x49, 0xf8, 0x09, - 0x94, 0x68, 0x73, 0xf3, 0xd5, 0x25, 0x6c, 0x64, 0x97, 0x03, 0xc9, 0x3d, 0x96, 0xcf, 0x11, 0x4c, - 0x9e, 0x18, 0xce, 0x09, 0x9b, 0x68, 0x49, 0x67, 0xdf, 0xe8, 0x11, 0x54, 0x5a, 0x7c, 0x92, 0x07, - 0xa1, 0x2b, 0xc3, 0xb4, 0xa0, 0x7b, 0x27, 0xc1, 0x4f, 0xa1, 0xc8, 0xe7, 0xf0, 0x63, 0x1b, 0x81, - 0xaf, 0xc0, 0xf4, 0x9e, 0x69, 0xf4, 0x9d, 0x13, 0x4b, 0x56, 0x37, 0x3a, 0xe9, 0x8a, 0x4f, 0x1b, - 0x4b, 0xe3, 0x43, 0x98, 0xb6, 0x49, 0xcf, 0xe8, 0x98, 0x1d, 0xf3, 0xf8, 0xe0, 0xf0, 0xdc, 0x25, - 0x8e, 0xb8, 0x30, 0x95, 0x3d, 0xf2, 0x73, 0x4a, 0xa5, 0xa6, 0x1d, 0x76, 0xad, 0x43, 0x91, 0xe6, - 0xd8, 0x37, 0xfe, 0x4f, 0x0d, 0x8a, 0x9f, 0x18, 0x6e, 0x4b, 0x2e, 0x1d, 0xda, 0x80, 0xb2, 0x97, - 0xdc, 0x18, 0x45, 0xd8, 0x12, 0x2a, 0xb1, 0x6c, 0x8c, 0x3c, 0x4a, 0xcb, 0xea, 0x58, 0x6a, 0xa9, - 0x04, 0x26, 0xca, 0x30, 0x5b, 0xa4, 0xeb, 0x89, 0x4a, 0x25, 0x8b, 0x62, 0x8c, 0xaa, 0x28, 0x95, - 0xf0, 0x7c, 0xda, 0x3f, 0x7e, 0xf0, 0x5c, 0xf2, 0x75, 0x0a, 0x50, 0xd4, 0x86, 0xef, 0x7b, 0x22, - 0xbb, 0x0f, 0x65, 0xc7, 0x35, 0xec, 0xc8, 0xde, 0x28, 0x31, 0xaa, 0x97, 0xa0, 0x1f, 0xc2, 0x74, - 0xdf, 0xb6, 0x8e, 0x6d, 0xe2, 0x38, 0x07, 0xa6, 0xe5, 0x76, 0x8e, 0xce, 0xc5, 0xa1, 0xb6, 0x2c, - 0xc9, 0xdb, 0x8c, 0x8a, 0x1a, 0x90, 0x3b, 0xea, 0x74, 0x5d, 0x62, 0x3b, 0xd5, 0xcc, 0x42, 0x7a, - 0xb1, 0xbc, 0xfc, 0xe4, 0x22, 0xaf, 0x2d, 0x7d, 0xc8, 0xf8, 0x9b, 0xe7, 0x7d, 0xa2, 0xcb, 0xb1, - 0xea, 0x41, 0x31, 0x1b, 0x38, 0x28, 0xde, 0x07, 0xf0, 0xf9, 0x69, 0xaa, 0xdd, 0xde, 0xd9, 0xdd, - 0x6f, 0x56, 0x26, 0x50, 0x11, 0xa6, 0xb6, 0x77, 0xd6, 0x1a, 0x5b, 0x0d, 0x9a, 0x97, 0x71, 0x5d, - 0xfa, 0x46, 0xf5, 0x21, 0x9a, 0x83, 0xa9, 0xd7, 0x94, 0x2a, 0xef, 0xdb, 0x69, 0x3d, 0xc7, 0xda, - 0x1b, 0x6d, 0xfc, 0x4f, 0x29, 0x28, 0x89, 0x5d, 0x30, 0xd6, 0x56, 0x54, 0x55, 0xa4, 0x02, 0x2a, - 0xe8, 0xa9, 0x94, 0xef, 0x8e, 0xb6, 0x38, 0xfc, 0xca, 0x26, 0xcd, 0x0d, 0x7c, 0xb1, 0x49, 0x5b, - 0xb8, 0xd5, 0x6b, 0xc7, 0x86, 0x6f, 0x26, 0x36, 0x7c, 0xd1, 0x5d, 0x28, 0x79, 0xbb, 0xcd, 0x70, - 0x44, 0xad, 0xcd, 0xeb, 0x45, 0xb9, 0x91, 0x28, 0x0d, 0xdd, 0x87, 0x2c, 0x19, 0x12, 0xd3, 0x75, - 0xaa, 0x05, 0x96, 0x75, 0x4b, 0xf2, 0xfc, 0xdb, 0xa0, 0x54, 0x5d, 0x74, 0xe2, 0x3f, 0x82, 0x2b, - 0xec, 0x9e, 0xf1, 0xc2, 0x36, 0x4c, 0xf5, 0x42, 0xd4, 0x6c, 0x6e, 0x09, 0xd7, 0xd1, 0x4f, 0x54, - 0x86, 0xd4, 0xc6, 0x9a, 0x98, 0x68, 0x6a, 0x63, 0x0d, 0x7f, 0xa1, 0x01, 0x52, 0xc7, 0x8d, 0xe5, - 0xcb, 0x90, 0x70, 0xa9, 0x3e, 0xed, 0xab, 0x9f, 0x85, 0x0c, 0xb1, 0x6d, 0xcb, 0x66, 0x5e, 0xcb, - 0xeb, 0xbc, 0x81, 0xef, 0x09, 0x1b, 0x74, 0x32, 0xb4, 0x4e, 0xbd, 0xc0, 0xe0, 0xd2, 0x34, 0xcf, - 0xd4, 0x4d, 0x98, 0x09, 0x70, 0x8d, 0x95, 0xfd, 0x1f, 0xc2, 0x55, 0x26, 0x6c, 0x93, 0x90, 0xfe, - 0x4a, 0xb7, 0x33, 0x4c, 0xd4, 0xda, 0x87, 0x6b, 0x61, 0xc6, 0x9f, 0xd6, 0x47, 0xf8, 0x4f, 0x85, - 0xc6, 0x66, 0xa7, 0x47, 0x9a, 0xd6, 0x56, 0xb2, 0x6d, 0x34, 0x3b, 0x9e, 0x92, 0x73, 0x47, 0x94, - 0x49, 0xf6, 0x8d, 0xff, 0x43, 0x83, 0xeb, 0x91, 0xe1, 0x3f, 0xf1, 0xaa, 0xce, 0x03, 0x1c, 0xd3, - 0xed, 0x43, 0xda, 0xb4, 0x83, 0xdf, 0xd0, 0x15, 0x8a, 0x67, 0x27, 0x4d, 0x30, 0x45, 0x61, 0xe7, - 0xac, 0x58, 0x73, 0xf6, 0xc7, 0x91, 0x35, 0xe6, 0x16, 0x14, 0x18, 0x61, 0xcf, 0x35, 0xdc, 0x81, - 0x13, 0x59, 0x8c, 0xbf, 0x11, 0x5b, 0x40, 0x0e, 0x1a, 0x6b, 0x5e, 0xef, 0x40, 0x96, 0x1d, 0x4e, - 0xe5, 0xd1, 0x2c, 0x74, 0x1b, 0x50, 0xec, 0xd0, 0x05, 0x23, 0x3e, 0x81, 0xec, 0x4b, 0x86, 0xe8, - 0x29, 0x96, 0x4d, 0xca, 0xa5, 0x30, 0x8d, 0x1e, 0xc7, 0x19, 0xf2, 0x3a, 0xfb, 0x66, 0x27, 0x19, - 0x42, 0xec, 0x7d, 0x7d, 0x8b, 0x9f, 0x98, 0xf2, 0xba, 0xd7, 0xa6, 0x2e, 0x6b, 0x75, 0x3b, 0xc4, - 0x74, 0x59, 0xef, 0x24, 0xeb, 0x55, 0x28, 0x78, 0x09, 0x2a, 0x5c, 0xd3, 0x4a, 0xbb, 0xad, 0x9c, - 0x48, 0x3c, 0x79, 0x5a, 0x50, 0x1e, 0xfe, 0x46, 0x83, 0x2b, 0xca, 0x80, 0xb1, 0x1c, 0xf3, 0x14, - 0xb2, 0x1c, 0xb7, 0x14, 0xc5, 0x6f, 0x36, 0x38, 0x8a, 0xab, 0xd1, 0x05, 0x0f, 0x5a, 0x82, 0x1c, - 0xff, 0x92, 0xc7, 0xc2, 0x78, 0x76, 0xc9, 0x84, 0xef, 0xc3, 0x8c, 0x20, 0x91, 0x9e, 0x15, 0xb7, - 0xb7, 0x99, 0x43, 0xf1, 0xe7, 0x30, 0x1b, 0x64, 0x1b, 0x6b, 0x4a, 0x8a, 0x91, 0xa9, 0xcb, 0x18, - 0xb9, 0x22, 0x8d, 0xdc, 0xef, 0xb7, 0x95, 0x5a, 0x1d, 0x5e, 0x75, 0x75, 0x45, 0x52, 0xa1, 0x15, - 0xf1, 0x26, 0x20, 0x45, 0xfc, 0xac, 0x13, 0x98, 0x91, 0xdb, 0x61, 0xab, 0xe3, 0x78, 0x27, 0xb8, - 0x37, 0x80, 0x54, 0xe2, 0xcf, 0x6d, 0xd0, 0x1a, 0x39, 0xb2, 0x8d, 0xe3, 0x1e, 0xf1, 0xea, 0x13, - 0x3d, 0xcf, 0xab, 0xc4, 0xb1, 0x32, 0x7a, 0x1d, 0xae, 0xbc, 0xb4, 0x86, 0x34, 0x35, 0x50, 0xaa, - 0x1f, 0x32, 0xfc, 0x3e, 0xe7, 0x2d, 0x9b, 0xd7, 0xa6, 0xca, 0xd5, 0x01, 0x63, 0x29, 0xff, 0x5f, - 0x0d, 0x8a, 0x2b, 0x5d, 0xc3, 0xee, 0x49, 0xc5, 0xef, 0x43, 0x96, 0xdf, 0x52, 0x04, 0x30, 0xf0, - 0x20, 0x28, 0x46, 0xe5, 0xe5, 0x8d, 0x15, 0x7e, 0xa7, 0x11, 0xa3, 0xa8, 0xe1, 0xe2, 0xed, 0x60, - 0x2d, 0xf4, 0x96, 0xb0, 0x86, 0xde, 0x82, 0x8c, 0x41, 0x87, 0xb0, 0x14, 0x5c, 0x0e, 0xdf, 0x0f, - 0x99, 0x34, 0x76, 0x38, 0xe3, 0x5c, 0xf8, 0x3d, 0x28, 0x28, 0x1a, 0xe8, 0x0d, 0xf8, 0x45, 0x43, - 0x1c, 0xc0, 0x56, 0x56, 0x9b, 0x1b, 0xaf, 0xf8, 0xc5, 0xb8, 0x0c, 0xb0, 0xd6, 0xf0, 0xda, 0x29, - 0xfc, 0xa9, 0x18, 0x25, 0xf2, 0x9d, 0x6a, 0x8f, 0x96, 0x64, 0x4f, 0xea, 0x52, 0xf6, 0x9c, 0x41, - 0x49, 0x4c, 0x7f, 0xdc, 0xf4, 0xcd, 0xe4, 0x25, 0xa4, 0x6f, 0xc5, 0x78, 0x5d, 0x30, 0xe2, 0x69, - 0x28, 0x89, 0x84, 0x2e, 0xf6, 0xdf, 0xff, 0x68, 0x50, 0x96, 0x94, 0x71, 0x01, 0x4c, 0x89, 0xbd, - 0xf0, 0x0a, 0xe0, 0x21, 0x2f, 0xd7, 0x20, 0xdb, 0x3e, 0xdc, 0xeb, 0xbc, 0x91, 0x60, 0xb3, 0x68, - 0x51, 0x7a, 0x97, 0xeb, 0xe1, 0x2f, 0x3e, 0xa2, 0x45, 0x6f, 0xe1, 0xb6, 0x71, 0xe4, 0x6e, 0x98, - 0x6d, 0x72, 0xc6, 0xce, 0x8d, 0x93, 0xba, 0x4f, 0x60, 0x97, 0x52, 0xf1, 0x32, 0xc4, 0x0e, 0x8b, - 0xea, 0x4b, 0xd1, 0x0c, 0x5c, 0x59, 0x19, 0xb8, 0x27, 0x0d, 0xd3, 0x38, 0xec, 0xca, 0x8c, 0x45, - 0xcb, 0x2c, 0x25, 0xae, 0x75, 0x1c, 0x95, 0xda, 0x80, 0x19, 0x4a, 0x25, 0xa6, 0xdb, 0x69, 0x29, - 0xe9, 0x4d, 0x16, 0x31, 0x2d, 0x54, 0xc4, 0x0c, 0xc7, 0x79, 0x6d, 0xd9, 0x6d, 0x31, 0x35, 0xaf, - 0x8d, 0xd7, 0xb8, 0xf0, 0x7d, 0x27, 0x50, 0xa6, 0xbe, 0xaf, 0x94, 0x45, 0x5f, 0xca, 0x0b, 0xe2, - 0x8e, 0x90, 0x82, 0x9f, 0xc0, 0x55, 0xc9, 0x29, 0xc0, 0xbd, 0x11, 0xcc, 0x3b, 0x70, 0x4b, 0x32, - 0xaf, 0x9e, 0xd0, 0xdb, 0xd3, 0xae, 0x50, 0xf8, 0x43, 0xed, 0x7c, 0x0e, 0x55, 0xcf, 0x4e, 0x76, - 0x58, 0xb6, 0xba, 0xaa, 0x01, 0x03, 0x47, 0xec, 0x99, 0xbc, 0xce, 0xbe, 0x29, 0xcd, 0xb6, 0xba, - 0xde, 0x91, 0x80, 0x7e, 0xe3, 0x55, 0x98, 0x93, 0x32, 0xc4, 0x31, 0x36, 0x28, 0x24, 0x62, 0x50, - 0x9c, 0x10, 0xe1, 0x30, 0x3a, 0x74, 0xb4, 0xdb, 0x55, 0xce, 0xa0, 0x6b, 0x99, 0x4c, 0x4d, 0x91, - 0x79, 0x95, 0xef, 0x08, 0x6a, 0x98, 0x5a, 0x31, 0x04, 0x99, 0x0a, 0x50, 0xc9, 0x62, 0x21, 0x28, - 0x39, 0xb2, 0x10, 0x11, 0xd1, 0x9f, 0xc1, 0xbc, 0x67, 0x04, 0xf5, 0xdb, 0x2e, 0xb1, 0x7b, 0x1d, - 0xc7, 0x51, 0xe0, 0xa0, 0xb8, 0x89, 0x3f, 0x80, 0xc9, 0x3e, 0x11, 0x39, 0xa5, 0xb0, 0x8c, 0x96, - 0xf8, 0xfb, 0xed, 0x92, 0x32, 0x98, 0xf5, 0xe3, 0x36, 0xdc, 0x96, 0xd2, 0xb9, 0x47, 0x63, 0xc5, - 0x87, 0x8d, 0x92, 0xb7, 0x6e, 0xee, 0xd6, 0xe8, 0xad, 0x3b, 0xcd, 0xd7, 0xde, 0x83, 0x28, 0x3f, - 0xe2, 0x8e, 0x94, 0xb1, 0x35, 0x56, 0xad, 0xd8, 0xe4, 0x3e, 0xf5, 0x42, 0x72, 0x2c, 0x61, 0x87, - 0x30, 0x1b, 0x8c, 0xe4, 0xb1, 0xd2, 0xd8, 0x2c, 0x64, 0x5c, 0xeb, 0x94, 0xc8, 0x24, 0xc6, 0x1b, - 0xd2, 0x60, 0x2f, 0xcc, 0xc7, 0x32, 0xd8, 0xf0, 0x85, 0xb1, 0x2d, 0x39, 0xae, 0xbd, 0x74, 0x35, - 0xe5, 0xe1, 0x8b, 0x37, 0xf0, 0x36, 0x5c, 0x0b, 0xa7, 0x89, 0xb1, 0x4c, 0x7e, 0xc5, 0x37, 0x70, - 0x5c, 0x26, 0x19, 0x4b, 0xee, 0xc7, 0x7e, 0x32, 0x50, 0x12, 0xca, 0x58, 0x22, 0x75, 0xa8, 0xc5, - 0xe5, 0x97, 0x1f, 0x63, 0xbf, 0x7a, 0xe9, 0x66, 0x2c, 0x61, 0x8e, 0x2f, 0x6c, 0xfc, 0xe5, 0xf7, - 0x73, 0x44, 0x7a, 0x64, 0x8e, 0x10, 0x41, 0xe2, 0x67, 0xb1, 0x9f, 0x60, 0xd3, 0x09, 0x1d, 0x7e, - 0x02, 0x1d, 0x57, 0x07, 0xad, 0x21, 0x9e, 0x0e, 0xd6, 0x90, 0x1b, 0x5b, 0x4d, 0xbb, 0x63, 0x2d, - 0xc6, 0x27, 0x7e, 0xee, 0x8c, 0x64, 0xe6, 0xb1, 0x04, 0x7f, 0x0a, 0x0b, 0xc9, 0x49, 0x79, 0x1c, - 0xc9, 0x8f, 0xeb, 0x90, 0xf7, 0x0e, 0x94, 0xca, 0x6f, 0x1f, 0x0a, 0x90, 0xdb, 0xde, 0xd9, 0xdb, - 0x5d, 0x59, 0x6d, 0xf0, 0x1f, 0x3f, 0xac, 0xee, 0xe8, 0xfa, 0xfe, 0x6e, 0xb3, 0x92, 0x5a, 0xfe, - 0x6d, 0x1a, 0x52, 0x9b, 0xaf, 0xd0, 0x9f, 0x43, 0x86, 0xbf, 0x04, 0x8e, 0x78, 0xfe, 0xad, 0x8d, - 0x7a, 0xec, 0xc4, 0x37, 0xbe, 0xf8, 0xff, 0x5f, 0x7d, 0x95, 0xba, 0x8a, 0x2b, 0xf5, 0xe1, 0xbb, - 0x87, 0xc4, 0x35, 0xea, 0xa7, 0xc3, 0x3a, 0xab, 0x0f, 0xcf, 0xb4, 0xc7, 0x68, 0x1f, 0xd2, 0xbb, - 0x03, 0x17, 0x25, 0x3e, 0x0d, 0xd7, 0x92, 0xdf, 0x40, 0xf1, 0x1c, 0x13, 0x3c, 0x83, 0xcb, 0x8a, - 0xe0, 0xfe, 0xc0, 0xa5, 0x62, 0x07, 0x50, 0x50, 0x5f, 0x31, 0x2f, 0x7c, 0x33, 0xae, 0x5d, 0xfc, - 0x42, 0x8a, 0xef, 0x30, 0x75, 0x37, 0xf0, 0x35, 0x45, 0x1d, 0x7f, 0x6b, 0x55, 0x67, 0xd3, 0x3c, - 0x33, 0x51, 0xe2, 0xab, 0x72, 0x2d, 0xf9, 0xe1, 0x34, 0x76, 0x36, 0xee, 0x99, 0x49, 0xc5, 0x9a, - 0xe2, 0xdd, 0xb4, 0xe5, 0xa2, 0xdb, 0x31, 0xef, 0x66, 0xea, 0x0b, 0x51, 0x6d, 0x21, 0x99, 0x41, - 0x28, 0x5a, 0x60, 0x8a, 0x6a, 0xf8, 0xaa, 0xa2, 0xa8, 0xe5, 0xb1, 0x3d, 0xd3, 0x1e, 0x2f, 0x1f, - 0x43, 0x86, 0x21, 0xc4, 0xe8, 0x2f, 0xe4, 0x47, 0x2d, 0x06, 0xdb, 0x4e, 0x58, 0xfc, 0x00, 0xb6, - 0x8c, 0xab, 0x4c, 0x19, 0xc2, 0x25, 0xa9, 0x8c, 0x61, 0xc4, 0xcf, 0xb4, 0xc7, 0x8b, 0xda, 0xdb, - 0xda, 0xf2, 0x6f, 0x26, 0x21, 0xc3, 0xe0, 0x22, 0x64, 0x01, 0xf8, 0x68, 0x6a, 0x78, 0x96, 0x11, - 0x7c, 0x36, 0x3c, 0xcb, 0x28, 0x10, 0x8b, 0xe7, 0x99, 0xe2, 0x2a, 0x9e, 0x91, 0x8a, 0x19, 0x12, - 0x55, 0x67, 0xe0, 0x1a, 0xf5, 0xe9, 0x50, 0x00, 0x66, 0x3c, 0xcc, 0x50, 0x9c, 0xc0, 0x00, 0xaa, - 0x1a, 0xde, 0x21, 0x31, 0x88, 0x2a, 0xc6, 0x4c, 0xe7, 0x4d, 0x7c, 0x5d, 0xf1, 0x2c, 0x57, 0x6b, - 0x33, 0x46, 0xaa, 0xf7, 0xef, 0x34, 0x28, 0x07, 0x71, 0x51, 0x74, 0x37, 0x46, 0x72, 0x18, 0x5e, - 0xad, 0xdd, 0x1b, 0xcd, 0x94, 0x64, 0x01, 0x57, 0x7f, 0x4a, 0x48, 0xdf, 0xa0, 0x8c, 0xc2, 0xf1, - 0xe8, 0x1f, 0x34, 0x98, 0x0e, 0x81, 0x9d, 0x28, 0x4e, 0x43, 0x04, 0x4a, 0xad, 0xdd, 0xbf, 0x80, - 0x4b, 0x18, 0xf2, 0x80, 0x19, 0xb2, 0x80, 0x6f, 0x44, 0x5c, 0xe1, 0x76, 0x7a, 0xc4, 0xb5, 0x84, - 0x31, 0xde, 0x32, 0x70, 0x60, 0x32, 0x76, 0x19, 0x02, 0x40, 0x67, 0xec, 0x32, 0x04, 0x51, 0xcd, - 0x11, 0xcb, 0xc0, 0xd1, 0x48, 0xba, 0xc5, 0x7f, 0x97, 0x86, 0xdc, 0x2a, 0xff, 0x05, 0x22, 0x72, - 0x20, 0xef, 0x21, 0x80, 0x68, 0x3e, 0x0e, 0x8d, 0xf1, 0x6f, 0x0b, 0xb5, 0xdb, 0x89, 0xfd, 0x42, - 0xfb, 0x7d, 0xa6, 0xfd, 0x36, 0xae, 0x49, 0xed, 0xe2, 0x87, 0x8e, 0x75, 0x7e, 0xed, 0xaf, 0x1b, - 0xed, 0x36, 0x9d, 0xf8, 0xdf, 0x42, 0x51, 0x85, 0xe9, 0xd0, 0x9d, 0x58, 0x14, 0x48, 0x45, 0xfa, - 0x6a, 0x78, 0x14, 0x8b, 0xd0, 0xbe, 0xc8, 0xb4, 0x63, 0x7c, 0x2b, 0x41, 0xbb, 0xcd, 0xd8, 0x03, - 0x06, 0x70, 0x98, 0x2d, 0xde, 0x80, 0x00, 0x8a, 0x17, 0x6f, 0x40, 0x10, 0xa5, 0xbb, 0xd0, 0x80, - 0x01, 0x63, 0xa7, 0x06, 0xbc, 0x06, 0xf0, 0x41, 0x35, 0x14, 0xeb, 0x57, 0xe5, 0xea, 0x14, 0x0e, - 0xf9, 0x28, 0x1e, 0x17, 0xdd, 0x73, 0x21, 0xd5, 0xdd, 0x8e, 0x43, 0x43, 0x7f, 0xf9, 0x9b, 0x2c, - 0x14, 0x5e, 0x1a, 0x1d, 0xd3, 0x25, 0xa6, 0x61, 0xb6, 0x08, 0x3a, 0x82, 0x0c, 0x2b, 0x8d, 0xe1, - 0x2c, 0xa7, 0x62, 0x4d, 0xe1, 0x2c, 0x17, 0x00, 0x62, 0xf0, 0x3d, 0xa6, 0x79, 0x1e, 0xcf, 0x49, - 0xcd, 0x3d, 0x5f, 0x7c, 0x9d, 0x61, 0x28, 0x74, 0xc2, 0x7f, 0x09, 0x59, 0x01, 0xcf, 0x87, 0x84, - 0x05, 0xb0, 0x95, 0xda, 0xcd, 0xf8, 0xce, 0xa4, 0xed, 0xa5, 0xaa, 0x72, 0x18, 0x2f, 0xd5, 0xf5, - 0x06, 0xc0, 0x07, 0x08, 0xc3, 0xce, 0x8d, 0xe0, 0x89, 0xb5, 0x85, 0x64, 0x06, 0xa1, 0xf7, 0x11, - 0xd3, 0x7b, 0x17, 0xcf, 0xc7, 0xe9, 0x6d, 0x7b, 0xfc, 0x54, 0xf7, 0x21, 0x4c, 0xae, 0x1b, 0xce, - 0x09, 0x0a, 0x15, 0x3b, 0xe5, 0x47, 0x03, 0xb5, 0x5a, 0x5c, 0x97, 0xd0, 0x74, 0x97, 0x69, 0xba, - 0x85, 0xab, 0x71, 0x9a, 0x4e, 0x0c, 0x87, 0x56, 0x0f, 0x74, 0x02, 0x59, 0xfe, 0x3b, 0x82, 0xb0, - 0x2f, 0x03, 0xbf, 0x45, 0x08, 0xfb, 0x32, 0xf8, 0xd3, 0x83, 0xcb, 0x69, 0x72, 0x61, 0x4a, 0x3e, - 0xde, 0xa3, 0x5b, 0xa1, 0xa5, 0x09, 0x3e, 0xf4, 0xd7, 0xe6, 0x93, 0xba, 0x85, 0xbe, 0x87, 0x4c, - 0xdf, 0x1d, 0x7c, 0x33, 0x76, 0xed, 0x04, 0xf7, 0x33, 0xed, 0xf1, 0xdb, 0x1a, 0x2d, 0x13, 0xe0, - 0x83, 0xac, 0x91, 0xe8, 0x08, 0xe3, 0xb5, 0x91, 0xe8, 0x88, 0xe0, 0xb3, 0x78, 0x99, 0x29, 0x7f, - 0x8a, 0x1f, 0xc6, 0x29, 0x77, 0x6d, 0xc3, 0x74, 0x8e, 0x88, 0xfd, 0x16, 0x07, 0xd3, 0x9c, 0x93, - 0x4e, 0x9f, 0x46, 0xca, 0xef, 0xa7, 0x61, 0x92, 0x9e, 0x47, 0x69, 0x79, 0xf6, 0xaf, 0xf1, 0x61, - 0x6b, 0x22, 0xe0, 0x59, 0xd8, 0x9a, 0x28, 0x02, 0x10, 0x2d, 0xcf, 0xec, 0xb7, 0xe6, 0x84, 0x31, - 0x51, 0xaf, 0x3b, 0x50, 0x50, 0xee, 0xfa, 0x28, 0x46, 0x60, 0x10, 0x99, 0x0b, 0xd7, 0x85, 0x18, - 0xa0, 0x00, 0xdf, 0x66, 0x3a, 0xe7, 0xf0, 0x6c, 0x40, 0x67, 0x9b, 0x73, 0x51, 0xa5, 0x7f, 0x0d, - 0x45, 0x15, 0x13, 0x40, 0x31, 0x32, 0x43, 0xc8, 0x5f, 0x38, 0x25, 0xc6, 0x41, 0x0a, 0xd1, 0xec, - 0xe0, 0xfd, 0xae, 0x5e, 0xb2, 0x52, 0xe5, 0x7d, 0xc8, 0x09, 0xa0, 0x20, 0x6e, 0xb6, 0x41, 0xa8, - 0x30, 0x6e, 0xb6, 0x21, 0x94, 0x21, 0x7a, 0xcc, 0x63, 0x5a, 0xe9, 0x7d, 0x48, 0x96, 0x20, 0xa1, - 0xf1, 0x05, 0x71, 0x93, 0x34, 0xfa, 0xd8, 0x57, 0x92, 0x46, 0xe5, 0x2e, 0x3a, 0x4a, 0xe3, 0x31, - 0x71, 0x45, 0x2c, 0xc9, 0x7b, 0x1e, 0x4a, 0x10, 0xa8, 0xa6, 0x7c, 0x3c, 0x8a, 0x25, 0xe9, 0x54, - 0xee, 0x2b, 0x15, 0xf9, 0x1e, 0x7d, 0x0e, 0xe0, 0x43, 0x1a, 0xe1, 0xd3, 0x56, 0x2c, 0x2e, 0x1a, - 0x3e, 0x6d, 0xc5, 0xa3, 0x22, 0xd1, 0xfc, 0xe1, 0xeb, 0xe6, 0x17, 0x03, 0xaa, 0xfd, 0x5f, 0x34, - 0x40, 0x51, 0x04, 0x04, 0x3d, 0x89, 0xd7, 0x10, 0x8b, 0xb8, 0xd6, 0x9e, 0x5e, 0x8e, 0x39, 0xa9, - 0x44, 0xf8, 0x66, 0xb5, 0xd8, 0x88, 0xfe, 0x6b, 0x6a, 0xd8, 0x97, 0x1a, 0x94, 0x02, 0x10, 0x0a, - 0x7a, 0x90, 0xb0, 0xc6, 0x21, 0xd0, 0xb6, 0xf6, 0xf0, 0x42, 0xbe, 0xa4, 0x93, 0x98, 0xb2, 0x23, - 0xe4, 0x41, 0xfc, 0x1f, 0x35, 0x28, 0x07, 0x61, 0x17, 0x94, 0x20, 0x3f, 0x02, 0xfc, 0xd6, 0x16, - 0x2f, 0x66, 0xbc, 0x78, 0xa9, 0xfc, 0xb3, 0x79, 0x1f, 0x72, 0x02, 0xac, 0x89, 0x0b, 0x88, 0x20, - 0x6c, 0x1c, 0x17, 0x10, 0x21, 0xa4, 0x27, 0x21, 0x20, 0x6c, 0xab, 0x4b, 0x94, 0x10, 0x14, 0x88, - 0x4e, 0x92, 0xc6, 0xd1, 0x21, 0x18, 0x82, 0x83, 0x46, 0x69, 0xf4, 0x43, 0x50, 0xc2, 0x39, 0x28, - 0x41, 0xe0, 0x05, 0x21, 0x18, 0x46, 0x83, 0x12, 0x42, 0x90, 0x29, 0x55, 0x42, 0xd0, 0x07, 0x5f, - 0xe2, 0x42, 0x30, 0x82, 0x88, 0xc7, 0x85, 0x60, 0x14, 0xbf, 0x49, 0x58, 0x57, 0xa6, 0x3b, 0x10, - 0x82, 0x33, 0x31, 0x58, 0x0d, 0x7a, 0x9a, 0xe0, 0xd0, 0x58, 0xb0, 0xbd, 0xf6, 0xd6, 0x25, 0xb9, - 0x47, 0xee, 0x7d, 0xbe, 0x14, 0x72, 0xef, 0x7f, 0xad, 0xc1, 0x6c, 0x1c, 0xd6, 0x83, 0x12, 0x74, - 0x25, 0x00, 0xf5, 0xb5, 0xa5, 0xcb, 0xb2, 0x5f, 0xec, 0x35, 0x2f, 0x1a, 0x9e, 0x57, 0xfe, 0xfb, - 0xbb, 0x79, 0xed, 0xff, 0xbe, 0x9b, 0xd7, 0x7e, 0xf1, 0xdd, 0xbc, 0xf6, 0xaf, 0xbf, 0x9c, 0x9f, - 0x38, 0xcc, 0xb2, 0xff, 0xe1, 0xf5, 0xee, 0x1f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x74, 0x55, 0x61, - 0xe6, 0x68, 0x36, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.proto b/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.proto index e80e6e7d0..d9da43c09 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.proto +++ b/vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.proto @@ -351,6 +351,9 @@ message ResponseHeader { // member_id is the ID of the member which sent the response. uint64 member_id = 2; // revision is the key-value store revision when the request was applied. + // For watch progress responses, the header.revision indicates progress. All future events + // recieved in this stream are guaranteed to have a higher revision number than the + // header.revision number. int64 revision = 3; // raft_term is the raft term when the request was applied. uint64 raft_term = 4; @@ -639,6 +642,7 @@ message WatchRequest { oneof request_union { WatchCreateRequest create_request = 1; WatchCancelRequest cancel_request = 2; + WatchProgressRequest progress_request = 3; } } @@ -671,6 +675,16 @@ message WatchCreateRequest { // If prev_kv is set, created watcher gets the previous KV before the event happens. // If the previous KV is already compacted, nothing will be returned. bool prev_kv = 6; + + // If watch_id is provided and non-zero, it will be assigned to this watcher. + // Since creating a watcher in etcd is not a synchronous operation, + // this can be used ensure that ordering is correct when creating multiple + // watchers on the same stream. Creating a watcher with an ID already in + // use on the stream will cause an error to be returned. + int64 watch_id = 7; + + // fragment enables splitting large revisions into multiple watch responses. + bool fragment = 8; } message WatchCancelRequest { @@ -678,6 +692,11 @@ message WatchCancelRequest { int64 watch_id = 1; } +// Requests the a watch stream progress status be sent in the watch response stream as soon as +// possible. +message WatchProgressRequest { +} + message WatchResponse { ResponseHeader header = 1; // watch_id is the ID of the watcher that corresponds to the response. @@ -703,6 +722,9 @@ message WatchResponse { // cancel_reason indicates the reason for canceling the watcher. string cancel_reason = 6; + // framgment is true if large watch response was split over multiple responses. + bool fragment = 7; + repeated mvccpb.Event events = 11; } diff --git a/vendor/github.com/coreos/etcd/etcdserver/metrics.go b/vendor/github.com/coreos/etcd/etcdserver/metrics.go index 10f8a475f..2fb07a554 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/metrics.go +++ b/vendor/github.com/coreos/etcd/etcdserver/metrics.go @@ -54,6 +54,12 @@ var ( Name: "slow_apply_total", Help: "The total number of slow apply requests (likely overloaded from slow disk).", }) + applySnapshotInProgress = prometheus.NewGauge(prometheus.GaugeOpts{ + Namespace: "etcd", + Subsystem: "server", + Name: "snapshot_apply_in_progress_total", + Help: "1 if the server is applying the incoming snapshot. 0 if none.", + }) proposalsCommitted = prometheus.NewGauge(prometheus.GaugeOpts{ Namespace: "etcd", Subsystem: "server", @@ -131,6 +137,7 @@ func init() { prometheus.MustRegister(leaderChanges) prometheus.MustRegister(heartbeatSendFailures) prometheus.MustRegister(slowApplies) + prometheus.MustRegister(applySnapshotInProgress) prometheus.MustRegister(proposalsCommitted) prometheus.MustRegister(proposalsApplied) prometheus.MustRegister(proposalsPending) diff --git a/vendor/github.com/coreos/etcd/etcdserver/raft.go b/vendor/github.com/coreos/etcd/etcdserver/raft.go index 1080633b1..f73df6c7d 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/raft.go +++ b/vendor/github.com/coreos/etcd/etcdserver/raft.go @@ -344,7 +344,7 @@ func (r *raftNode) processMessages(ms []raftpb.Message) []raftpb.Message { ok, exceed := r.td.Observe(ms[i].To) if !ok { // TODO: limit request rate. - plog.Warningf("failed to send out heartbeat on time (exceeded the %v timeout for %v)", r.heartbeat, exceed) + plog.Warningf("failed to send out heartbeat on time (exceeded the %v timeout for %v, to %x)", r.heartbeat, exceed, ms[i].To) plog.Warningf("server is likely overloaded") heartbeatSendFailures.Inc() } @@ -403,7 +403,7 @@ func startNode(cfg ServerConfig, cl *membership.RaftCluster, ids []types.ID) (id }, ) if w, err = wal.Create(cfg.WALDir(), metadata); err != nil { - plog.Fatalf("create wal error: %v", err) + plog.Panicf("create wal error: %v", err) } peers := make([]raft.Peer, len(ids)) for i, id := range ids { diff --git a/vendor/github.com/coreos/etcd/etcdserver/server.go b/vendor/github.com/coreos/etcd/etcdserver/server.go index 71e2bcf4b..f46e91d34 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/server.go +++ b/vendor/github.com/coreos/etcd/etcdserver/server.go @@ -198,7 +198,9 @@ type EtcdServer struct { // stopping is closed by run goroutine on shutdown. stopping chan struct{} // done is closed when all goroutines from start() complete. - done chan struct{} + done chan struct{} + leaderChanged chan struct{} + leaderChangedMu sync.RWMutex errorc chan error id types.ID @@ -597,6 +599,7 @@ func (s *EtcdServer) start() { s.ctx, s.cancel = context.WithCancel(context.Background()) s.readwaitc = make(chan struct{}, 1) s.readNotifier = newNotifier() + s.leaderChanged = make(chan struct{}) if s.ClusterVersion() != nil { plog.Infof("starting server... [version: %v, cluster version: %v]", version.Version, version.Cluster(s.ClusterVersion().String())) } else { @@ -733,6 +736,17 @@ func (s *EtcdServer) run() { s.compactor.Resume() } } + if newLeader { + select { + case s.leaderChanged <- struct{}{}: + default: + } + s.leaderChangedMu.Lock() + lc := s.leaderChanged + s.leaderChanged = make(chan struct{}) + s.leaderChangedMu.Unlock() + close(lc) + } // TODO: remove the nil checking // current test utility does not provide the stats @@ -841,6 +855,12 @@ func (s *EtcdServer) run() { } } +func (s *EtcdServer) leaderChangedNotify() <-chan struct{} { + s.leaderChangedMu.RLock() + defer s.leaderChangedMu.RUnlock() + return s.leaderChanged +} + func (s *EtcdServer) applyAll(ep *etcdProgress, apply *apply) { s.applySnapshot(ep, apply) s.applyEntries(ep, apply) @@ -866,9 +886,12 @@ func (s *EtcdServer) applySnapshot(ep *etcdProgress, apply *apply) { if raft.IsEmptySnap(apply.snapshot) { return } - + applySnapshotInProgress.Inc() plog.Infof("applying snapshot at index %d...", ep.snapi) - defer plog.Infof("finished applying incoming snapshot at index %d", ep.snapi) + defer func() { + plog.Infof("finished applying incoming snapshot at index %d", ep.snapi) + applySnapshotInProgress.Dec() + }() if apply.snapshot.Metadata.Index <= ep.appliedi { plog.Panicf("snapshot index [%d] should > appliedi[%d] + 1", diff --git a/vendor/github.com/coreos/etcd/etcdserver/v3_server.go b/vendor/github.com/coreos/etcd/etcdserver/v3_server.go index f214a1926..9d429e329 100644 --- a/vendor/github.com/coreos/etcd/etcdserver/v3_server.go +++ b/vendor/github.com/coreos/etcd/etcdserver/v3_server.go @@ -614,7 +614,10 @@ func (s *EtcdServer) linearizableReadLoop() { id1 := s.reqIDGen.Next() binary.BigEndian.PutUint64(ctxToSend, id1) + leaderChangedNotifier := s.leaderChangedNotify() select { + case <-leaderChangedNotifier: + continue case <-s.readwaitc: case <-s.stopping: return @@ -659,6 +662,12 @@ func (s *EtcdServer) linearizableReadLoop() { slowReadIndex.Inc() } + case <-leaderChangedNotifier: + timeout = true + readIndexFailed.Inc() + // return a retryable error. + nr.notify(ErrLeaderChanged) + case <-time.After(s.Cfg.ReqTimeout()): plog.Warningf("timed out waiting for read index response (local node might have slow network)") nr.notify(ErrTimeout) diff --git a/vendor/github.com/coreos/etcd/functional.yaml b/vendor/github.com/coreos/etcd/functional.yaml old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/Dockerfile b/vendor/github.com/coreos/etcd/functional/Dockerfile old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/Procfile-proxy b/vendor/github.com/coreos/etcd/functional/Procfile-proxy old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/README.md b/vendor/github.com/coreos/etcd/functional/README.md old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/agent/doc.go b/vendor/github.com/coreos/etcd/functional/agent/doc.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/agent/handler.go b/vendor/github.com/coreos/etcd/functional/agent/handler.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/agent/server.go b/vendor/github.com/coreos/etcd/functional/agent/server.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/agent/utils.go b/vendor/github.com/coreos/etcd/functional/agent/utils.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/agent/utils_test.go b/vendor/github.com/coreos/etcd/functional/agent/utils_test.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/build b/vendor/github.com/coreos/etcd/functional/build index 84018aa5f..fd121eaf4 100755 --- a/vendor/github.com/coreos/etcd/functional/build +++ b/vendor/github.com/coreos/etcd/functional/build @@ -5,7 +5,7 @@ if ! [[ "$0" =~ "functional/build" ]]; then exit 255 fi -CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o ./bin/etcd-agent ./cmd/functional/cmd/etcd-agent -CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o ./bin/etcd-proxy ./cmd/functional/cmd/etcd-proxy -CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o ./bin/etcd-runner ./cmd/functional/cmd/etcd-runner -CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o ./bin/etcd-tester ./cmd/functional/cmd/etcd-tester +CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o ./bin/etcd-agent ./functional/cmd/etcd-agent +CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o ./bin/etcd-proxy ./functional/cmd/etcd-proxy +CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o ./bin/etcd-runner ./functional/cmd/etcd-runner +CGO_ENABLED=0 go build -v -installsuffix cgo -ldflags "-s" -o ./bin/etcd-tester ./functional/cmd/etcd-tester diff --git a/vendor/github.com/coreos/etcd/functional/cmd/etcd-agent/main.go b/vendor/github.com/coreos/etcd/functional/cmd/etcd-agent/main.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/cmd/etcd-proxy/main.go b/vendor/github.com/coreos/etcd/functional/cmd/etcd-proxy/main.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/cmd/etcd-runner/main.go b/vendor/github.com/coreos/etcd/functional/cmd/etcd-runner/main.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/cmd/etcd-tester/main.go b/vendor/github.com/coreos/etcd/functional/cmd/etcd-tester/main.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/rpcpb/etcd_config.go b/vendor/github.com/coreos/etcd/functional/rpcpb/etcd_config.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/rpcpb/etcd_config_test.go b/vendor/github.com/coreos/etcd/functional/rpcpb/etcd_config_test.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/rpcpb/member.go b/vendor/github.com/coreos/etcd/functional/rpcpb/member.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/rpcpb/rpc.pb.go b/vendor/github.com/coreos/etcd/functional/rpcpb/rpc.pb.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/rpcpb/rpc.proto b/vendor/github.com/coreos/etcd/functional/rpcpb/rpc.proto old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/runner/election_command.go b/vendor/github.com/coreos/etcd/functional/runner/election_command.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/runner/error.go b/vendor/github.com/coreos/etcd/functional/runner/error.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/runner/global.go b/vendor/github.com/coreos/etcd/functional/runner/global.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/runner/help.go b/vendor/github.com/coreos/etcd/functional/runner/help.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/runner/lease_renewer_command.go b/vendor/github.com/coreos/etcd/functional/runner/lease_renewer_command.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/runner/lock_racer_command.go b/vendor/github.com/coreos/etcd/functional/runner/lock_racer_command.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/runner/root.go b/vendor/github.com/coreos/etcd/functional/runner/root.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/runner/watch_command.go b/vendor/github.com/coreos/etcd/functional/runner/watch_command.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/case.go b/vendor/github.com/coreos/etcd/functional/tester/case.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/case_delay.go b/vendor/github.com/coreos/etcd/functional/tester/case_delay.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/case_external.go b/vendor/github.com/coreos/etcd/functional/tester/case_external.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/case_failpoints.go b/vendor/github.com/coreos/etcd/functional/tester/case_failpoints.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/case_network_blackhole.go b/vendor/github.com/coreos/etcd/functional/tester/case_network_blackhole.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/case_network_delay.go b/vendor/github.com/coreos/etcd/functional/tester/case_network_delay.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/case_no_fail.go b/vendor/github.com/coreos/etcd/functional/tester/case_no_fail.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/case_sigquit_remove.go b/vendor/github.com/coreos/etcd/functional/tester/case_sigquit_remove.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/case_sigquit_remove_quorum.go b/vendor/github.com/coreos/etcd/functional/tester/case_sigquit_remove_quorum.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/case_sigterm.go b/vendor/github.com/coreos/etcd/functional/tester/case_sigterm.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/checker.go b/vendor/github.com/coreos/etcd/functional/tester/checker.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/checker_kv_hash.go b/vendor/github.com/coreos/etcd/functional/tester/checker_kv_hash.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/checker_lease_expire.go b/vendor/github.com/coreos/etcd/functional/tester/checker_lease_expire.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/checker_no_check.go b/vendor/github.com/coreos/etcd/functional/tester/checker_no_check.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/checker_runner.go b/vendor/github.com/coreos/etcd/functional/tester/checker_runner.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/cluster.go b/vendor/github.com/coreos/etcd/functional/tester/cluster.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/cluster_read_config.go b/vendor/github.com/coreos/etcd/functional/tester/cluster_read_config.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/cluster_run.go b/vendor/github.com/coreos/etcd/functional/tester/cluster_run.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/cluster_shuffle.go b/vendor/github.com/coreos/etcd/functional/tester/cluster_shuffle.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/doc.go b/vendor/github.com/coreos/etcd/functional/tester/doc.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/metrics_report.go b/vendor/github.com/coreos/etcd/functional/tester/metrics_report.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/stresser.go b/vendor/github.com/coreos/etcd/functional/tester/stresser.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/stresser_composite.go b/vendor/github.com/coreos/etcd/functional/tester/stresser_composite.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/stresser_key.go b/vendor/github.com/coreos/etcd/functional/tester/stresser_key.go old mode 100644 new mode 100755 index 2fc1bf2b0..e5bbe3b09 --- a/vendor/github.com/coreos/etcd/functional/tester/stresser_key.go +++ b/vendor/github.com/coreos/etcd/functional/tester/stresser_key.go @@ -31,7 +31,6 @@ import ( "go.uber.org/zap" "golang.org/x/time/rate" "google.golang.org/grpc" - "google.golang.org/grpc/transport" ) type keyStresser struct { @@ -145,8 +144,8 @@ func (s *keyStresser) run() { // to the new leader. case etcdserver.ErrStopped.Error(): // one of the etcd nodes stopped from failure injection - case transport.ErrConnClosing.Desc: - // server closed the transport (failure injected node) + // case transport.ErrConnClosing.Desc: + // // server closed the transport (failure injected node) case rpctypes.ErrNotCapable.Error(): // capability check has not been done (in the beginning) case rpctypes.ErrTooManyRequests.Error(): diff --git a/vendor/github.com/coreos/etcd/functional/tester/stresser_lease.go b/vendor/github.com/coreos/etcd/functional/tester/stresser_lease.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/stresser_runner.go b/vendor/github.com/coreos/etcd/functional/tester/stresser_runner.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/functional/tester/utils.go b/vendor/github.com/coreos/etcd/functional/tester/utils.go old mode 100644 new mode 100755 diff --git a/vendor/github.com/coreos/etcd/glide.lock b/vendor/github.com/coreos/etcd/glide.lock index 4554c845d..68cd3dae2 100644 --- a/vendor/github.com/coreos/etcd/glide.lock +++ b/vendor/github.com/coreos/etcd/glide.lock @@ -1,8 +1,8 @@ -hash: f0697416d74e4c0fb9d6471c39c3e005ecdeccc8a864c1b0b65e0087b3242027 -updated: 2018-04-10T23:45:04.40596807-07:00 +hash: 6dcd52f0c5d9b95aac8d2a07aea9f72746ac0432afa4192334ad141e3da2afcf +updated: 2019-08-19T10:57:53.265557-07:00 imports: - name: github.com/beorn7/perks - version: 3a771d992973f24aa725d07868b467d1ddfceafb + version: 37c8de3658fcb183f997c4e13e8337516ab753e6 subpackages: - quantile - name: github.com/bgentry/speakeasy @@ -14,13 +14,13 @@ imports: subpackages: - semver - name: github.com/coreos/go-systemd - version: d2196463941895ee908e13531a23a39feb9e1243 + version: e64a0ec8b42a61e2a9801dc1d0abe539dea79197 subpackages: - daemon - journal - util - name: github.com/coreos/pkg - version: 3ac0863d7acf3bc44daf49afef8919af12f704ef + version: 97fdf19511ea361ae1c100dd393cc47f8dcfa1e1 subpackages: - capnslog - dlopen @@ -31,33 +31,38 @@ imports: - name: github.com/dgrijalva/jwt-go version: d2709f9f1f31ebcda9651b03077758c1f3a0018c - name: github.com/dustin/go-humanize - version: bb3d318650d48840a39aa21a027c6630e198e626 + version: 9f541cc9db5d55bce703bd99987c9d5cb8eea45e - name: github.com/ghodss/yaml version: 0ca9ea5df5451ffdf184b4428c902747c2c11cd7 - name: github.com/gogo/protobuf - version: 342cbe0a04158f6dcb03ca0079991a51a4248c02 + version: ba06b47c162d49f2af050fb4c75bcbc86a159d5c subpackages: - gogoproto - proto - protoc-gen-gogo/descriptor - name: github.com/golang/groupcache - version: 02826c3e79038b59d737d3b1c0a1d937f71a4433 + version: 869f871628b6baa9cfbc11732cdf6546b17c1298 subpackages: - lru - name: github.com/golang/protobuf - version: 1e59b77b52bf8e4b449a57e6f79f21226d571845 + version: 6c65a5562fc06764971b7c5d05c76c75e84bdbf7 subpackages: - jsonpb - proto + - protoc-gen-go/descriptor - ptypes - ptypes/any - ptypes/duration - ptypes/struct - ptypes/timestamp - name: github.com/google/btree - version: 925471ac9e2131377a91e1595defec898166fe49 + version: 4030bb1f1f0c35b30ca7009e9ebd06849dd45306 +- name: github.com/google/uuid + version: d460ce9f8df2e77fb1ba55ca87fafed96c607494 - name: github.com/gorilla/websocket version: 4201258b820c74ac8e6922fc9e6b52f71fe46f8d +- name: github.com/grpc-ecosystem/go-grpc-middleware + version: c250d6563d4d4c20252cd865923440e829844f4e - name: github.com/grpc-ecosystem/go-grpc-prometheus version: 0dafe0d496ea71181bf2dd039e7e3f44b6bd11a7 - name: github.com/grpc-ecosystem/grpc-gateway @@ -70,6 +75,8 @@ imports: version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 - name: github.com/jonboulle/clockwork version: 2eee05ed794112d45db504eb05aa693efd2b8b09 +- name: github.com/json-iterator/go + version: 27518f6661eba504be5a7a9a9f6d9460d892ade3 - name: github.com/kr/pty version: 2c10821df3c3cf905230d078702dfbe9404c9b23 - name: github.com/mattn/go-runewidth @@ -77,9 +84,13 @@ imports: subpackages: - runewidth.go - name: github.com/matttproud/golang_protobuf_extensions - version: c12348ce28de40eed0136aa2b644d0ee0650e56c + version: c182affec369e30f25d3eb8cd8a478dee585ae7d subpackages: - pbutil +- name: github.com/modern-go/concurrent + version: bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 +- name: github.com/modern-go/reflect2 + version: 94122c33edd36123c84d5368cfb2b69df93a0ec8 - name: github.com/olekukonko/tablewriter version: a0225b3f23b5ce0cbec6d7a66a968f8a59eca9c4 - name: github.com/prometheus/client_golang @@ -106,7 +117,7 @@ imports: - name: github.com/sirupsen/logrus version: f006c2ac4710855cf0f916dd6b77acf6b048dc6e - name: github.com/soheilhy/cmux - version: bb79a83465015a27a175925ebd155e660f55e9f1 + version: e09e9389d85d8492d313d73d1469c029e710623f - name: github.com/spf13/cobra version: 1c44ec8d3f1552cac48999f9306da23c4d8a288b - name: github.com/spf13/pflag @@ -124,11 +135,11 @@ imports: - name: github.com/xiang90/probing version: 07dd2e8dfe18522e9c447ba95f2fe95262f63bb2 - name: go.uber.org/atomic - version: 8474b86a5a6f79c443ce4b2992817ff32cf208b8 + version: df976f2515e274675050de7b3f42545de80594fd - name: go.uber.org/multierr version: 3c4937480c32f4c13a875a1829af76c98ca3d40a - name: go.uber.org/zap - version: 35aad584952c3e7020db7b839f6b102de6271f89 + version: 27376062155ad36be76b0f12cf1572a221d3a48c subpackages: - buffer - internal/bufferpool @@ -136,23 +147,23 @@ imports: - internal/exit - zapcore - name: golang.org/x/crypto - version: 9419663f5a44be8b34ca85f08abc5fe1be11f8a3 + version: c2843e01d9a2bc60bb26ad24e09734fdc2d9ec58 subpackages: - bcrypt - blowfish - ssh/terminal - name: golang.org/x/net - version: 66aacef3dd8a676686c7ae3716979581e8b03c47 + version: 74dc4d7220e7acc4e100824340f3e66577424772 subpackages: - context + - http/httpguts - http2 - http2/hpack - idna - internal/timeseries - - lex/httplex - trace - name: golang.org/x/sys - version: ebfc5b4631820b793c9010c87fd8fef0f39eb082 + version: fde4db37ae7ad8191b03d30d27f258b5291ae4e3 subpackages: - unix - windows @@ -170,24 +181,42 @@ imports: - name: google.golang.org/genproto version: 09f6ed296fc66555a25fe4ce95173148778dfa85 subpackages: + - googleapis/api/annotations - googleapis/rpc/status - name: google.golang.org/grpc - version: 5b3c4e850e90a4cf6a20ebd46c8b32a0a3afcb9e + version: 6eaf6f47437a6b4e2153a190160ef39a92c7eceb subpackages: - balancer + - balancer/base + - balancer/roundrobin + - binarylog/grpc_binarylog_v1 - codes - connectivity - credentials - - grpclb/grpc_lb_v1/messages + - credentials/internal + - encoding + - encoding/proto - grpclog - health - health/grpc_health_v1 - internal + - internal/backoff + - internal/balancerload + - internal/binarylog + - internal/channelz + - internal/envconfig + - internal/grpcrand + - internal/grpcsync + - internal/syscall + - internal/transport - keepalive - metadata - naming - peer - resolver + - resolver/dns + - resolver/passthrough + - serviceconfig - stats - status - tap @@ -195,5 +224,7 @@ imports: - name: gopkg.in/cheggaaa/pb.v1 version: 226d21d43a305fac52b3a104ef83e721b15275e0 - name: gopkg.in/yaml.v2 - version: cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b + version: 51d6538a90f86fe93ac480b35f37b2be17fef232 +- name: sigs.k8s.io/yaml + version: fd68e9863619f6ec2fdd8625fe1f02e7c877e480 testImports: [] diff --git a/vendor/github.com/coreos/etcd/glide.yaml b/vendor/github.com/coreos/etcd/glide.yaml index cc83a8516..500dcdc48 100644 --- a/vendor/github.com/coreos/etcd/glide.yaml +++ b/vendor/github.com/coreos/etcd/glide.yaml @@ -11,41 +11,43 @@ import: subpackages: - semver - package: github.com/coreos/go-systemd - version: v15 + version: v20 subpackages: - daemon - journal - util - package: go.uber.org/zap - version: v1.7.1 + version: v1.10.0 - package: github.com/coreos/pkg - version: v3 + version: v4 subpackages: - capnslog - package: github.com/cpuguy83/go-md2man version: 23709d0847197db6021a51fdb193e66e9222d4e7 - package: github.com/dustin/go-humanize - version: bb3d318650d48840a39aa21a027c6630e198e626 + version: v1.0.0 - package: github.com/ghodss/yaml version: v1.0.0 - package: github.com/gogo/protobuf - version: v0.5 + version: v1.2.1 subpackages: - proto - gogoproto - package: github.com/gorilla/websocket version: 4201258b820c74ac8e6922fc9e6b52f71fe46f8d - package: github.com/golang/groupcache - version: 02826c3e79038b59d737d3b1c0a1d937f71a4433 + version: 869f871628b6baa9cfbc11732cdf6546b17c1298 subpackages: - lru - package: github.com/golang/protobuf - version: 1e59b77b52bf8e4b449a57e6f79f21226d571845 + version: v1.3.2 subpackages: - jsonpb - proto - package: github.com/google/btree - version: 925471ac9e2131377a91e1595defec898166fe49 + version: v1.0.0 +- package: github.com/google/uuid + version: v1.0.0 - package: github.com/grpc-ecosystem/grpc-gateway version: v1.3.0 subpackages: @@ -77,6 +79,8 @@ import: version: a6e9df898b1336106c743392c48ee0b71f5c4efa subpackages: - xfs +- package: github.com/grpc-ecosystem/go-grpc-middleware + version: v1.0.0 - package: github.com/grpc-ecosystem/go-grpc-prometheus version: 0dafe0d496ea71181bf2dd039e7e3f44b6bd11a7 - package: github.com/spf13/cobra @@ -87,17 +91,21 @@ import: version: bdcc60b419d136a85cdf2e7cbcac34b3f1cd6e57 subpackages: - codec +- package: github.com/json-iterator/go + version: v1.1.7 +- package: github.com/modern-go/reflect2 + version: v1.0.1 - package: github.com/urfave/cli version: v1.18.0 - package: github.com/xiang90/probing version: 0.0.1 - package: golang.org/x/crypto - version: 9419663f5a44be8b34ca85f08abc5fe1be11f8a3 + version: c2843e01d9a2bc60bb26ad24e09734fdc2d9ec58 subpackages: - bcrypt - blowfish - package: golang.org/x/net - version: 66aacef3dd8a676686c7ae3716979581e8b03c47 + version: 74dc4d7220e7acc4e100824340f3e66577424772 subpackages: - context - http2 @@ -105,28 +113,40 @@ import: - internal/timeseries - trace - package: golang.org/x/sys - version: ebfc5b4631820b793c9010c87fd8fef0f39eb082 + version: fde4db37ae7ad8191b03d30d27f258b5291ae4e3 + subpackages: + - unix + - windows - package: golang.org/x/time version: c06e80d9300e4443158a03817b8a8cb37d230320 subpackages: - rate - package: google.golang.org/grpc - version: v1.7.5 + version: v1.23.0 subpackages: + - balancer - codes + - connectivity - credentials - grpclog - internal + - keepalive + - status - metadata - naming - peer - transport - health - health/grpc_health_v1 + - resolver + - resolver/dns + - resolver/passthrough - package: gopkg.in/cheggaaa/pb.v1 version: v1.0.2 - package: gopkg.in/yaml.v2 - version: cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b + version: v2.2.2 +- package: sigs.k8s.io/yaml + version: v1.1.0 - package: github.com/dgrijalva/jwt-go version: v3.0.0 - package: google.golang.org/genproto @@ -134,7 +154,7 @@ import: subpackages: - googleapis/rpc/status - package: golang.org/x/text - version: b19bf474d317b857955b12035d2c5acb57ce8b01 + version: 342b2e1fbaa52c93f31447ad2c6abc048c63e475 subpackages: - secure/bidirule - transform @@ -145,7 +165,7 @@ import: - package: github.com/sirupsen/logrus version: v1.0.3 - package: github.com/soheilhy/cmux - version: v0.1.3 + version: v0.1.4 - package: github.com/tmc/grpc-websocket-proxy version: 89b8d40f7ca833297db804fcb3be53a76d01c238 subpackages: diff --git a/vendor/github.com/coreos/etcd/integration/cluster.go b/vendor/github.com/coreos/etcd/integration/cluster.go index 923e20afa..d426e2770 100644 --- a/vendor/github.com/coreos/etcd/integration/cluster.go +++ b/vendor/github.com/coreos/etcd/integration/cluster.go @@ -647,6 +647,7 @@ func NewClientV3(m *member) (*clientv3.Client, error) { cfg := clientv3.Config{ Endpoints: []string{m.grpcAddr}, DialTimeout: 5 * time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, MaxCallSendMsgSize: m.clientMaxCallSendMsgSize, MaxCallRecvMsgSize: m.clientMaxCallRecvMsgSize, } diff --git a/vendor/github.com/coreos/etcd/integration/v3_grpc_inflight_test.go b/vendor/github.com/coreos/etcd/integration/v3_grpc_inflight_test.go index dd0d180cc..0fb796cd4 100644 --- a/vendor/github.com/coreos/etcd/integration/v3_grpc_inflight_test.go +++ b/vendor/github.com/coreos/etcd/integration/v3_grpc_inflight_test.go @@ -25,6 +25,8 @@ import ( "github.com/coreos/etcd/pkg/testutil" "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // TestV3MaintenanceDefragmentInflightRange ensures inflight range requests @@ -58,7 +60,7 @@ func TestV3MaintenanceDefragmentInflightRange(t *testing.T) { // TestV3KVInflightRangeRequests ensures that inflight requests // (sent before server shutdown) are gracefully handled by server-side. // They are either finished or canceled, but never crash the backend. -// See https://github.com/coreos/etcd/issues/7322 for more detail. +// See https://github.com/etcd-io/etcd/issues/7322 for more detail. func TestV3KVInflightRangeRequests(t *testing.T) { defer testutil.AfterTest(t) clus := NewClusterV3(t, &ClusterConfig{Size: 1}) @@ -81,8 +83,10 @@ func TestV3KVInflightRangeRequests(t *testing.T) { defer wg.Done() _, err := kvc.Range(ctx, &pb.RangeRequest{Key: []byte("foo"), Serializable: true}, grpc.FailFast(false)) if err != nil { - if err != nil && rpctypes.ErrorDesc(err) != context.Canceled.Error() { - t.Fatalf("inflight request should be canceld with %v, got %v", context.Canceled, err) + errCode := status.Convert(err).Code() + errDesc := rpctypes.ErrorDesc(err) + if err != nil && !(errDesc == context.Canceled.Error() || errCode == codes.Canceled || errCode == codes.Unavailable) { + t.Errorf("inflight request should be canceled with '%v' or code Canceled or Unavailable, got '%v' with code '%s'", context.Canceled.Error(), errDesc, errCode) } } }() diff --git a/vendor/github.com/coreos/etcd/integration/v3_grpc_test.go b/vendor/github.com/coreos/etcd/integration/v3_grpc_test.go index c6e4a3d16..50f656ca7 100644 --- a/vendor/github.com/coreos/etcd/integration/v3_grpc_test.go +++ b/vendor/github.com/coreos/etcd/integration/v3_grpc_test.go @@ -32,7 +32,9 @@ import ( "github.com/coreos/etcd/pkg/transport" "google.golang.org/grpc" + "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" ) // TestV3PutOverwrite puts a key with the v3 api to a random cluster member, @@ -166,7 +168,7 @@ func TestV3HashKV(t *testing.T) { } rev := resp.Header.Revision - hresp, err := mvc.HashKV(context.Background(), &pb.HashKVRequest{0}) + hresp, err := mvc.HashKV(context.Background(), &pb.HashKVRequest{}) if err != nil { t.Fatal(err) } @@ -177,7 +179,7 @@ func TestV3HashKV(t *testing.T) { prevHash := hresp.Hash prevCompactRev := hresp.CompactRevision for i := 0; i < 10; i++ { - hresp, err := mvc.HashKV(context.Background(), &pb.HashKVRequest{0}) + hresp, err := mvc.HashKV(context.Background(), &pb.HashKVRequest{}) if err != nil { t.Fatal(err) } @@ -1714,6 +1716,7 @@ func testTLSReload(t *testing.T, cloneFunc func() transport.TLSInfo, replaceFunc cli, cerr := clientv3.New(clientv3.Config{ Endpoints: []string{clus.Members[0].GRPCAddr()}, DialTimeout: time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, TLS: cc, }) if cerr != nil { @@ -1748,6 +1751,7 @@ func testTLSReload(t *testing.T, cloneFunc func() transport.TLSInfo, replaceFunc cl, cerr := clientv3.New(clientv3.Config{ Endpoints: []string{clus.Members[0].GRPCAddr()}, DialTimeout: 5 * time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, TLS: tls, }) if cerr != nil { @@ -1892,7 +1896,18 @@ func eqErrGRPC(err1 error, err2 error) bool { // FailFast=false works with Put. func waitForRestart(t *testing.T, kvc pb.KVClient) { req := &pb.RangeRequest{Key: []byte("_"), Serializable: true} - if _, err := kvc.Range(context.TODO(), req, grpc.FailFast(false)); err != nil { - t.Fatal(err) + // TODO: Remove retry loop once the new grpc load balancer provides retry. + var err error + for i := 0; i < 10; i++ { + if _, err = kvc.Range(context.TODO(), req, grpc.FailFast(false)); err != nil { + if status, ok := status.FromError(err); ok && status.Code() == codes.Unavailable { + time.Sleep(time.Millisecond * 250) + } else { + t.Fatal(err) + } + } + } + if err != nil { + t.Fatalf("timed out waiting for restart: %v", err) } } diff --git a/vendor/github.com/coreos/etcd/integration/v3_lease_test.go b/vendor/github.com/coreos/etcd/integration/v3_lease_test.go index 7ec2d3c76..c1e1cacee 100644 --- a/vendor/github.com/coreos/etcd/integration/v3_lease_test.go +++ b/vendor/github.com/coreos/etcd/integration/v3_lease_test.go @@ -511,12 +511,14 @@ func TestV3LeaseFailover(t *testing.T) { md := metadata.Pairs(rpctypes.MetadataRequireLeaderKey, rpctypes.MetadataHasLeader) mctx := metadata.NewOutgoingContext(context.Background(), md) ctx, cancel := context.WithCancel(mctx) - defer cancel() lac, err := lc.LeaseKeepAlive(ctx) if err != nil { t.Fatal(err) } - defer lac.CloseSend() + defer func() { + lac.CloseSend() + cancel() + }() // send keep alive to old leader until the old leader starts // to drop lease request. diff --git a/vendor/github.com/coreos/etcd/integration/v3_tls_test.go b/vendor/github.com/coreos/etcd/integration/v3_tls_test.go index 5ebe7ad35..280aa7d9f 100644 --- a/vendor/github.com/coreos/etcd/integration/v3_tls_test.go +++ b/vendor/github.com/coreos/etcd/integration/v3_tls_test.go @@ -22,6 +22,7 @@ import ( "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/pkg/testutil" + "google.golang.org/grpc" ) func TestTLSClientCipherSuitesValid(t *testing.T) { testTLSCipherSuites(t, true) } @@ -57,6 +58,7 @@ func testTLSCipherSuites(t *testing.T, valid bool) { cli, cerr := clientv3.New(clientv3.Config{ Endpoints: []string{clus.Members[0].GRPCAddr()}, DialTimeout: time.Second, + DialOptions: []grpc.DialOption{grpc.WithBlock()}, TLS: cc, }) if cli != nil { diff --git a/vendor/github.com/coreos/etcd/lease/leasepb/lease.pb.go b/vendor/github.com/coreos/etcd/lease/leasepb/lease.pb.go index 4ab937672..433f0aad1 100644 --- a/vendor/github.com/coreos/etcd/lease/leasepb/lease.pb.go +++ b/vendor/github.com/coreos/etcd/lease/leasepb/lease.pb.go @@ -1,31 +1,17 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: lease.proto -/* - Package leasepb is a generated protocol buffer package. - - It is generated from these files: - lease.proto - - It has these top-level messages: - Lease - LeaseInternalRequest - LeaseInternalResponse -*/ package leasepb import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - + fmt "fmt" + io "io" math "math" - - _ "github.com/gogo/protobuf/gogoproto" + math_bits "math/bits" etcdserverpb "github.com/coreos/etcd/etcdserver/etcdserverpb" - - io "io" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -40,42 +26,157 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type Lease struct { - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - TTL int64 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + TTL int64 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Lease) Reset() { *m = Lease{} } -func (m *Lease) String() string { return proto.CompactTextString(m) } -func (*Lease) ProtoMessage() {} -func (*Lease) Descriptor() ([]byte, []int) { return fileDescriptorLease, []int{0} } +func (m *Lease) Reset() { *m = Lease{} } +func (m *Lease) String() string { return proto.CompactTextString(m) } +func (*Lease) ProtoMessage() {} +func (*Lease) Descriptor() ([]byte, []int) { + return fileDescriptor_3dd57e402472b33a, []int{0} +} +func (m *Lease) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Lease) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Lease.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Lease) XXX_Merge(src proto.Message) { + xxx_messageInfo_Lease.Merge(m, src) +} +func (m *Lease) XXX_Size() int { + return m.Size() +} +func (m *Lease) XXX_DiscardUnknown() { + xxx_messageInfo_Lease.DiscardUnknown(m) +} + +var xxx_messageInfo_Lease proto.InternalMessageInfo type LeaseInternalRequest struct { - LeaseTimeToLiveRequest *etcdserverpb.LeaseTimeToLiveRequest `protobuf:"bytes,1,opt,name=LeaseTimeToLiveRequest" json:"LeaseTimeToLiveRequest,omitempty"` + LeaseTimeToLiveRequest *etcdserverpb.LeaseTimeToLiveRequest `protobuf:"bytes,1,opt,name=LeaseTimeToLiveRequest,proto3" json:"LeaseTimeToLiveRequest,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *LeaseInternalRequest) Reset() { *m = LeaseInternalRequest{} } -func (m *LeaseInternalRequest) String() string { return proto.CompactTextString(m) } -func (*LeaseInternalRequest) ProtoMessage() {} -func (*LeaseInternalRequest) Descriptor() ([]byte, []int) { return fileDescriptorLease, []int{1} } +func (m *LeaseInternalRequest) Reset() { *m = LeaseInternalRequest{} } +func (m *LeaseInternalRequest) String() string { return proto.CompactTextString(m) } +func (*LeaseInternalRequest) ProtoMessage() {} +func (*LeaseInternalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3dd57e402472b33a, []int{1} +} +func (m *LeaseInternalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseInternalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseInternalRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseInternalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseInternalRequest.Merge(m, src) +} +func (m *LeaseInternalRequest) XXX_Size() int { + return m.Size() +} +func (m *LeaseInternalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseInternalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_LeaseInternalRequest proto.InternalMessageInfo type LeaseInternalResponse struct { - LeaseTimeToLiveResponse *etcdserverpb.LeaseTimeToLiveResponse `protobuf:"bytes,1,opt,name=LeaseTimeToLiveResponse" json:"LeaseTimeToLiveResponse,omitempty"` + LeaseTimeToLiveResponse *etcdserverpb.LeaseTimeToLiveResponse `protobuf:"bytes,1,opt,name=LeaseTimeToLiveResponse,proto3" json:"LeaseTimeToLiveResponse,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *LeaseInternalResponse) Reset() { *m = LeaseInternalResponse{} } -func (m *LeaseInternalResponse) String() string { return proto.CompactTextString(m) } -func (*LeaseInternalResponse) ProtoMessage() {} -func (*LeaseInternalResponse) Descriptor() ([]byte, []int) { return fileDescriptorLease, []int{2} } +func (m *LeaseInternalResponse) Reset() { *m = LeaseInternalResponse{} } +func (m *LeaseInternalResponse) String() string { return proto.CompactTextString(m) } +func (*LeaseInternalResponse) ProtoMessage() {} +func (*LeaseInternalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3dd57e402472b33a, []int{2} +} +func (m *LeaseInternalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseInternalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseInternalResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseInternalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseInternalResponse.Merge(m, src) +} +func (m *LeaseInternalResponse) XXX_Size() int { + return m.Size() +} +func (m *LeaseInternalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseInternalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_LeaseInternalResponse proto.InternalMessageInfo func init() { proto.RegisterType((*Lease)(nil), "leasepb.Lease") proto.RegisterType((*LeaseInternalRequest)(nil), "leasepb.LeaseInternalRequest") proto.RegisterType((*LeaseInternalResponse)(nil), "leasepb.LeaseInternalResponse") } + +func init() { proto.RegisterFile("lease.proto", fileDescriptor_3dd57e402472b33a) } + +var fileDescriptor_3dd57e402472b33a = []byte{ + // 233 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xce, 0x49, 0x4d, 0x2c, + 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x07, 0x73, 0x0a, 0x92, 0xa4, 0x44, 0xd2, + 0xf3, 0xd3, 0xf3, 0xc1, 0x62, 0xfa, 0x20, 0x16, 0x44, 0x5a, 0x4a, 0x2d, 0xb5, 0x24, 0x39, 0x45, + 0x1f, 0x44, 0x14, 0xa7, 0x16, 0x95, 0xa5, 0x16, 0x21, 0x31, 0x0b, 0x92, 0xf4, 0x8b, 0x0a, 0x92, + 0x21, 0xea, 0x94, 0x34, 0xb9, 0x58, 0x7d, 0x40, 0x06, 0x09, 0xf1, 0x71, 0x31, 0x79, 0xba, 0x48, + 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0x31, 0x79, 0xba, 0x08, 0x09, 0x70, 0x31, 0x87, 0x84, 0xf8, + 0x48, 0x30, 0x81, 0x05, 0x40, 0x4c, 0xa5, 0x12, 0x2e, 0x11, 0xb0, 0x52, 0xcf, 0xbc, 0x92, 0xd4, + 0xa2, 0xbc, 0xc4, 0x9c, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, 0xa1, 0x18, 0x2e, 0x31, 0xb0, + 0x78, 0x48, 0x66, 0x6e, 0x6a, 0x48, 0xbe, 0x4f, 0x66, 0x59, 0x2a, 0x54, 0x06, 0x6c, 0x1a, 0xb7, + 0x91, 0x8a, 0x1e, 0xb2, 0xdd, 0x7a, 0xd8, 0xd5, 0x06, 0xe1, 0x30, 0x43, 0xa9, 0x82, 0x4b, 0x14, + 0xcd, 0xd6, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa1, 0x78, 0x2e, 0x71, 0x0c, 0x2d, 0x10, 0x29, + 0xa8, 0xbd, 0xaa, 0x04, 0xec, 0x85, 0x28, 0x0e, 0xc2, 0x65, 0x8a, 0x93, 0xc4, 0x89, 0x87, 0x72, + 0x0c, 0x17, 0x1e, 0xca, 0x31, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, + 0x72, 0x8c, 0x33, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0xc3, 0xce, 0x18, 0x10, 0x00, 0x00, 0xff, + 0xff, 0x9f, 0xf2, 0x42, 0xe0, 0x91, 0x01, 0x00, 0x00, +} + func (m *Lease) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -83,27 +184,36 @@ func (m *Lease) Marshal() (dAtA []byte, err error) { } func (m *Lease) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Lease) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ID != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintLease(dAtA, i, uint64(m.ID)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.TTL != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintLease(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x10 + } + if m.ID != 0 { + i = encodeVarintLease(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseInternalRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -111,27 +221,38 @@ func (m *LeaseInternalRequest) Marshal() (dAtA []byte, err error) { } func (m *LeaseInternalRequest) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseInternalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.LeaseTimeToLiveRequest != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintLease(dAtA, i, uint64(m.LeaseTimeToLiveRequest.Size())) - n1, err := m.LeaseTimeToLiveRequest.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.LeaseTimeToLiveRequest.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLease(dAtA, i, uint64(size)) } - i += n1 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *LeaseInternalResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -139,33 +260,49 @@ func (m *LeaseInternalResponse) Marshal() (dAtA []byte, err error) { } func (m *LeaseInternalResponse) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseInternalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.LeaseTimeToLiveResponse != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintLease(dAtA, i, uint64(m.LeaseTimeToLiveResponse.Size())) - n2, err := m.LeaseTimeToLiveResponse.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.LeaseTimeToLiveResponse.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLease(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintLease(dAtA []byte, offset int, v uint64) int { + offset -= sovLease(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Lease) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.ID != 0 { @@ -174,38 +311,46 @@ func (m *Lease) Size() (n int) { if m.TTL != 0 { n += 1 + sovLease(uint64(m.TTL)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseInternalRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.LeaseTimeToLiveRequest != nil { l = m.LeaseTimeToLiveRequest.Size() n += 1 + l + sovLease(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *LeaseInternalResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.LeaseTimeToLiveResponse != nil { l = m.LeaseTimeToLiveResponse.Size() n += 1 + l + sovLease(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func sovLease(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozLease(x uint64) (n int) { return sovLease(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -225,7 +370,7 @@ func (m *Lease) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -253,7 +398,7 @@ func (m *Lease) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (int64(b) & 0x7F) << shift + m.ID |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -272,7 +417,7 @@ func (m *Lease) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= (int64(b) & 0x7F) << shift + m.TTL |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -286,9 +431,13 @@ func (m *Lease) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthLease } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthLease + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -313,7 +462,7 @@ func (m *LeaseInternalRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -341,7 +490,7 @@ func (m *LeaseInternalRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -350,6 +499,9 @@ func (m *LeaseInternalRequest) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLease } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLease + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -369,9 +521,13 @@ func (m *LeaseInternalRequest) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthLease } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthLease + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -396,7 +552,7 @@ func (m *LeaseInternalResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -424,7 +580,7 @@ func (m *LeaseInternalResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -433,6 +589,9 @@ func (m *LeaseInternalResponse) Unmarshal(dAtA []byte) error { return ErrInvalidLengthLease } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLease + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -452,9 +611,13 @@ func (m *LeaseInternalResponse) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthLease } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthLease + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -518,10 +681,13 @@ func skipLease(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthLease } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthLease + } return iNdEx, nil case 3: for { @@ -550,6 +716,9 @@ func skipLease(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthLease + } } return iNdEx, nil case 4: @@ -568,24 +737,3 @@ var ( ErrInvalidLengthLease = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowLease = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("lease.proto", fileDescriptorLease) } - -var fileDescriptorLease = []byte{ - // 233 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xce, 0x49, 0x4d, 0x2c, - 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x07, 0x73, 0x0a, 0x92, 0xa4, 0x44, 0xd2, - 0xf3, 0xd3, 0xf3, 0xc1, 0x62, 0xfa, 0x20, 0x16, 0x44, 0x5a, 0x4a, 0x2d, 0xb5, 0x24, 0x39, 0x45, - 0x1f, 0x44, 0x14, 0xa7, 0x16, 0x95, 0xa5, 0x16, 0x21, 0x31, 0x0b, 0x92, 0xf4, 0x8b, 0x0a, 0x92, - 0x21, 0xea, 0x94, 0x34, 0xb9, 0x58, 0x7d, 0x40, 0x06, 0x09, 0xf1, 0x71, 0x31, 0x79, 0xba, 0x48, - 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0x31, 0x79, 0xba, 0x08, 0x09, 0x70, 0x31, 0x87, 0x84, 0xf8, - 0x48, 0x30, 0x81, 0x05, 0x40, 0x4c, 0xa5, 0x12, 0x2e, 0x11, 0xb0, 0x52, 0xcf, 0xbc, 0x92, 0xd4, - 0xa2, 0xbc, 0xc4, 0x9c, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, 0xa1, 0x18, 0x2e, 0x31, 0xb0, - 0x78, 0x48, 0x66, 0x6e, 0x6a, 0x48, 0xbe, 0x4f, 0x66, 0x59, 0x2a, 0x54, 0x06, 0x6c, 0x1a, 0xb7, - 0x91, 0x8a, 0x1e, 0xb2, 0xdd, 0x7a, 0xd8, 0xd5, 0x06, 0xe1, 0x30, 0x43, 0xa9, 0x82, 0x4b, 0x14, - 0xcd, 0xd6, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0xa1, 0x78, 0x2e, 0x71, 0x0c, 0x2d, 0x10, 0x29, - 0xa8, 0xbd, 0xaa, 0x04, 0xec, 0x85, 0x28, 0x0e, 0xc2, 0x65, 0x8a, 0x93, 0xc4, 0x89, 0x87, 0x72, - 0x0c, 0x17, 0x1e, 0xca, 0x31, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, - 0x72, 0x8c, 0x33, 0x1e, 0xcb, 0x31, 0x24, 0xb1, 0x81, 0xc3, 0xce, 0x18, 0x10, 0x00, 0x00, 0xff, - 0xff, 0x9f, 0xf2, 0x42, 0xe0, 0x91, 0x01, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/etcd/mvcc/kvstore_compaction.go b/vendor/github.com/coreos/etcd/mvcc/kvstore_compaction.go index 1726490c1..082a33f0e 100644 --- a/vendor/github.com/coreos/etcd/mvcc/kvstore_compaction.go +++ b/vendor/github.com/coreos/etcd/mvcc/kvstore_compaction.go @@ -21,7 +21,7 @@ import ( func (s *store) scheduleCompaction(compactMainRev int64, keep map[revision]struct{}) bool { totalStart := time.Now() - defer dbCompactionTotalDurations.Observe(float64(time.Since(totalStart) / time.Millisecond)) + defer func() { dbCompactionTotalDurations.Observe(float64(time.Since(totalStart) / time.Millisecond)) }() keyCompactions := 0 defer func() { dbCompactionKeysCounter.Add(float64(keyCompactions)) }() diff --git a/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.pb.go b/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.pb.go index 23fe337a5..4679da505 100644 --- a/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.pb.go +++ b/vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.pb.go @@ -1,28 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: kv.proto -/* - Package mvccpb is a generated protocol buffer package. - - It is generated from these files: - kv.proto - - It has these top-level messages: - KeyValue - Event -*/ package mvccpb import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - + fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" - - io "io" + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -47,6 +35,7 @@ var Event_EventType_name = map[int32]string{ 0: "PUT", 1: "DELETE", } + var Event_EventType_value = map[string]int32{ "PUT": 0, "DELETE": 1, @@ -55,7 +44,10 @@ var Event_EventType_value = map[string]int32{ func (x Event_EventType) String() string { return proto.EnumName(Event_EventType_name, int32(x)) } -func (Event_EventType) EnumDescriptor() ([]byte, []int) { return fileDescriptorKv, []int{1, 0} } + +func (Event_EventType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_2216fe83c9c12408, []int{1, 0} +} type KeyValue struct { // key is the key in bytes. An empty key is not allowed. @@ -73,13 +65,44 @@ type KeyValue struct { // lease is the ID of the lease that attached to key. // When the attached lease expires, the key will be deleted. // If lease is 0, then no lease is attached to the key. - Lease int64 `protobuf:"varint,6,opt,name=lease,proto3" json:"lease,omitempty"` + Lease int64 `protobuf:"varint,6,opt,name=lease,proto3" json:"lease,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *KeyValue) Reset() { *m = KeyValue{} } +func (m *KeyValue) String() string { return proto.CompactTextString(m) } +func (*KeyValue) ProtoMessage() {} +func (*KeyValue) Descriptor() ([]byte, []int) { + return fileDescriptor_2216fe83c9c12408, []int{0} +} +func (m *KeyValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *KeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_KeyValue.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *KeyValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_KeyValue.Merge(m, src) +} +func (m *KeyValue) XXX_Size() int { + return m.Size() +} +func (m *KeyValue) XXX_DiscardUnknown() { + xxx_messageInfo_KeyValue.DiscardUnknown(m) } -func (m *KeyValue) Reset() { *m = KeyValue{} } -func (m *KeyValue) String() string { return proto.CompactTextString(m) } -func (*KeyValue) ProtoMessage() {} -func (*KeyValue) Descriptor() ([]byte, []int) { return fileDescriptorKv, []int{0} } +var xxx_messageInfo_KeyValue proto.InternalMessageInfo type Event struct { // type is the kind of event. If type is a PUT, it indicates @@ -91,25 +114,82 @@ type Event struct { // A PUT event with kv.Version=1 indicates the creation of a key. // A DELETE/EXPIRE event contains the deleted key with // its modification revision set to the revision of deletion. - Kv *KeyValue `protobuf:"bytes,2,opt,name=kv" json:"kv,omitempty"` + Kv *KeyValue `protobuf:"bytes,2,opt,name=kv,proto3" json:"kv,omitempty"` // prev_kv holds the key-value pair before the event happens. - PrevKv *KeyValue `protobuf:"bytes,3,opt,name=prev_kv,json=prevKv" json:"prev_kv,omitempty"` + PrevKv *KeyValue `protobuf:"bytes,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Event) Reset() { *m = Event{} } +func (m *Event) String() string { return proto.CompactTextString(m) } +func (*Event) ProtoMessage() {} +func (*Event) Descriptor() ([]byte, []int) { + return fileDescriptor_2216fe83c9c12408, []int{1} +} +func (m *Event) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Event.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Event) XXX_Merge(src proto.Message) { + xxx_messageInfo_Event.Merge(m, src) +} +func (m *Event) XXX_Size() int { + return m.Size() +} +func (m *Event) XXX_DiscardUnknown() { + xxx_messageInfo_Event.DiscardUnknown(m) } -func (m *Event) Reset() { *m = Event{} } -func (m *Event) String() string { return proto.CompactTextString(m) } -func (*Event) ProtoMessage() {} -func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorKv, []int{1} } +var xxx_messageInfo_Event proto.InternalMessageInfo func init() { + proto.RegisterEnum("mvccpb.Event_EventType", Event_EventType_name, Event_EventType_value) proto.RegisterType((*KeyValue)(nil), "mvccpb.KeyValue") proto.RegisterType((*Event)(nil), "mvccpb.Event") - proto.RegisterEnum("mvccpb.Event_EventType", Event_EventType_name, Event_EventType_value) } + +func init() { proto.RegisterFile("kv.proto", fileDescriptor_2216fe83c9c12408) } + +var fileDescriptor_2216fe83c9c12408 = []byte{ + // 303 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x41, 0x4e, 0xc2, 0x40, + 0x14, 0x86, 0x3b, 0x14, 0x0a, 0x3e, 0x08, 0x36, 0x13, 0x12, 0x27, 0x2e, 0x26, 0x95, 0x8d, 0x18, + 0x13, 0x4c, 0xf0, 0x06, 0xc6, 0xae, 0x70, 0x61, 0x1a, 0x74, 0x4b, 0x4a, 0x79, 0x21, 0xa4, 0x94, + 0x69, 0x4a, 0x9d, 0xa4, 0x37, 0x71, 0xef, 0xde, 0x73, 0xb0, 0xe4, 0x08, 0x52, 0x2f, 0x62, 0xfa, + 0xc6, 0xe2, 0xc6, 0xcd, 0xe4, 0xfd, 0xff, 0xff, 0x65, 0xe6, 0x7f, 0x03, 0x9d, 0x58, 0x8f, 0xd3, + 0x4c, 0xe5, 0x8a, 0x3b, 0x89, 0x8e, 0xa2, 0x74, 0x71, 0x39, 0x58, 0xa9, 0x95, 0x22, 0xeb, 0xae, + 0x9a, 0x4c, 0x3a, 0xfc, 0x64, 0xd0, 0x99, 0x62, 0xf1, 0x1a, 0x6e, 0xde, 0x90, 0xbb, 0x60, 0xc7, + 0x58, 0x08, 0xe6, 0xb1, 0x51, 0x2f, 0xa8, 0x46, 0x7e, 0x0d, 0xe7, 0x51, 0x86, 0x61, 0x8e, 0xf3, + 0x0c, 0xf5, 0x7a, 0xb7, 0x56, 0x5b, 0xd1, 0xf0, 0xd8, 0xc8, 0x0e, 0xfa, 0xc6, 0x0e, 0x7e, 0x5d, + 0x7e, 0x05, 0xbd, 0x44, 0x2d, 0xff, 0x28, 0x9b, 0xa8, 0x6e, 0xa2, 0x96, 0x27, 0x44, 0x40, 0x5b, + 0x63, 0x46, 0x69, 0x93, 0xd2, 0x5a, 0xf2, 0x01, 0xb4, 0x74, 0x55, 0x40, 0xb4, 0xe8, 0x65, 0x23, + 0x2a, 0x77, 0x83, 0xe1, 0x0e, 0x85, 0x43, 0xb4, 0x11, 0xc3, 0x0f, 0x06, 0x2d, 0x5f, 0xe3, 0x36, + 0xe7, 0xb7, 0xd0, 0xcc, 0x8b, 0x14, 0xa9, 0x6e, 0x7f, 0x72, 0x31, 0x36, 0x7b, 0x8e, 0x29, 0x34, + 0xe7, 0xac, 0x48, 0x31, 0x20, 0x88, 0x7b, 0xd0, 0x88, 0x35, 0x75, 0xef, 0x4e, 0xdc, 0x1a, 0xad, + 0x17, 0x0f, 0x1a, 0xb1, 0xe6, 0x37, 0xd0, 0x4e, 0x33, 0xd4, 0xf3, 0x58, 0x53, 0xf9, 0xff, 0x30, + 0xa7, 0x02, 0xa6, 0x7a, 0xe8, 0xc1, 0xd9, 0xe9, 0x7e, 0xde, 0x06, 0xfb, 0xf9, 0x65, 0xe6, 0x5a, + 0x1c, 0xc0, 0x79, 0xf4, 0x9f, 0xfc, 0x99, 0xef, 0xb2, 0x07, 0xb1, 0x3f, 0x4a, 0xeb, 0x70, 0x94, + 0xd6, 0xbe, 0x94, 0xec, 0x50, 0x4a, 0xf6, 0x55, 0x4a, 0xf6, 0xfe, 0x2d, 0xad, 0x85, 0x43, 0xff, + 0x7e, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x45, 0x92, 0x5d, 0xa1, 0x01, 0x00, 0x00, +} + func (m *KeyValue) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -117,49 +197,60 @@ func (m *KeyValue) Marshal() (dAtA []byte, err error) { } func (m *KeyValue) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KeyValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintKv(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.CreateRevision != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintKv(dAtA, i, uint64(m.CreateRevision)) + if m.Lease != 0 { + i = encodeVarintKv(dAtA, i, uint64(m.Lease)) + i-- + dAtA[i] = 0x30 } - if m.ModRevision != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintKv(dAtA, i, uint64(m.ModRevision)) + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintKv(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x2a } if m.Version != 0 { - dAtA[i] = 0x20 - i++ i = encodeVarintKv(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x20 } - if len(m.Value) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintKv(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + if m.ModRevision != 0 { + i = encodeVarintKv(dAtA, i, uint64(m.ModRevision)) + i-- + dAtA[i] = 0x18 } - if m.Lease != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintKv(dAtA, i, uint64(m.Lease)) + if m.CreateRevision != 0 { + i = encodeVarintKv(dAtA, i, uint64(m.CreateRevision)) + i-- + dAtA[i] = 0x10 } - return i, nil + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintKv(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Event) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -167,48 +258,66 @@ func (m *Event) Marshal() (dAtA []byte, err error) { } func (m *Event) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Type != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintKv(dAtA, i, uint64(m.Type)) - } - if m.Kv != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintKv(dAtA, i, uint64(m.Kv.Size())) - n1, err := m.Kv.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.PrevKv != nil { + { + size, err := m.PrevKv.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintKv(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x1a - i++ - i = encodeVarintKv(dAtA, i, uint64(m.PrevKv.Size())) - n2, err := m.PrevKv.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + } + if m.Kv != nil { + { + size, err := m.Kv.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintKv(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0x12 } - return i, nil + if m.Type != 0 { + i = encodeVarintKv(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func encodeVarintKv(dAtA []byte, offset int, v uint64) int { + offset -= sovKv(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *KeyValue) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Key) @@ -231,10 +340,16 @@ func (m *KeyValue) Size() (n int) { if m.Lease != 0 { n += 1 + sovKv(uint64(m.Lease)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *Event) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Type != 0 { @@ -248,18 +363,14 @@ func (m *Event) Size() (n int) { l = m.PrevKv.Size() n += 1 + l + sovKv(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func sovKv(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozKv(x uint64) (n int) { return sovKv(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -279,7 +390,7 @@ func (m *KeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -307,7 +418,7 @@ func (m *KeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -316,6 +427,9 @@ func (m *KeyValue) Unmarshal(dAtA []byte) error { return ErrInvalidLengthKv } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKv + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -338,7 +452,7 @@ func (m *KeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CreateRevision |= (int64(b) & 0x7F) << shift + m.CreateRevision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -357,7 +471,7 @@ func (m *KeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ModRevision |= (int64(b) & 0x7F) << shift + m.ModRevision |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -376,7 +490,7 @@ func (m *KeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Version |= (int64(b) & 0x7F) << shift + m.Version |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -395,7 +509,7 @@ func (m *KeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -404,6 +518,9 @@ func (m *KeyValue) Unmarshal(dAtA []byte) error { return ErrInvalidLengthKv } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthKv + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -426,7 +543,7 @@ func (m *KeyValue) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Lease |= (int64(b) & 0x7F) << shift + m.Lease |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -440,9 +557,13 @@ func (m *KeyValue) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthKv } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthKv + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -467,7 +588,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -495,7 +616,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= (Event_EventType(b) & 0x7F) << shift + m.Type |= Event_EventType(b&0x7F) << shift if b < 0x80 { break } @@ -514,7 +635,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -523,6 +644,9 @@ func (m *Event) Unmarshal(dAtA []byte) error { return ErrInvalidLengthKv } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthKv + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -547,7 +671,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -556,6 +680,9 @@ func (m *Event) Unmarshal(dAtA []byte) error { return ErrInvalidLengthKv } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthKv + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -575,9 +702,13 @@ func (m *Event) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthKv } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthKv + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -641,10 +772,13 @@ func skipKv(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthKv } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthKv + } return iNdEx, nil case 3: for { @@ -673,6 +807,9 @@ func skipKv(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthKv + } } return iNdEx, nil case 4: @@ -691,28 +828,3 @@ var ( ErrInvalidLengthKv = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowKv = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("kv.proto", fileDescriptorKv) } - -var fileDescriptorKv = []byte{ - // 303 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x41, 0x4e, 0xc2, 0x40, - 0x14, 0x86, 0x3b, 0x14, 0x0a, 0x3e, 0x08, 0x36, 0x13, 0x12, 0x27, 0x2e, 0x26, 0x95, 0x8d, 0x18, - 0x13, 0x4c, 0xf0, 0x06, 0xc6, 0xae, 0x70, 0x61, 0x1a, 0x74, 0x4b, 0x4a, 0x79, 0x21, 0xa4, 0x94, - 0x69, 0x4a, 0x9d, 0xa4, 0x37, 0x71, 0xef, 0xde, 0x73, 0xb0, 0xe4, 0x08, 0x52, 0x2f, 0x62, 0xfa, - 0xc6, 0xe2, 0xc6, 0xcd, 0xe4, 0xfd, 0xff, 0xff, 0x65, 0xe6, 0x7f, 0x03, 0x9d, 0x58, 0x8f, 0xd3, - 0x4c, 0xe5, 0x8a, 0x3b, 0x89, 0x8e, 0xa2, 0x74, 0x71, 0x39, 0x58, 0xa9, 0x95, 0x22, 0xeb, 0xae, - 0x9a, 0x4c, 0x3a, 0xfc, 0x64, 0xd0, 0x99, 0x62, 0xf1, 0x1a, 0x6e, 0xde, 0x90, 0xbb, 0x60, 0xc7, - 0x58, 0x08, 0xe6, 0xb1, 0x51, 0x2f, 0xa8, 0x46, 0x7e, 0x0d, 0xe7, 0x51, 0x86, 0x61, 0x8e, 0xf3, - 0x0c, 0xf5, 0x7a, 0xb7, 0x56, 0x5b, 0xd1, 0xf0, 0xd8, 0xc8, 0x0e, 0xfa, 0xc6, 0x0e, 0x7e, 0x5d, - 0x7e, 0x05, 0xbd, 0x44, 0x2d, 0xff, 0x28, 0x9b, 0xa8, 0x6e, 0xa2, 0x96, 0x27, 0x44, 0x40, 0x5b, - 0x63, 0x46, 0x69, 0x93, 0xd2, 0x5a, 0xf2, 0x01, 0xb4, 0x74, 0x55, 0x40, 0xb4, 0xe8, 0x65, 0x23, - 0x2a, 0x77, 0x83, 0xe1, 0x0e, 0x85, 0x43, 0xb4, 0x11, 0xc3, 0x0f, 0x06, 0x2d, 0x5f, 0xe3, 0x36, - 0xe7, 0xb7, 0xd0, 0xcc, 0x8b, 0x14, 0xa9, 0x6e, 0x7f, 0x72, 0x31, 0x36, 0x7b, 0x8e, 0x29, 0x34, - 0xe7, 0xac, 0x48, 0x31, 0x20, 0x88, 0x7b, 0xd0, 0x88, 0x35, 0x75, 0xef, 0x4e, 0xdc, 0x1a, 0xad, - 0x17, 0x0f, 0x1a, 0xb1, 0xe6, 0x37, 0xd0, 0x4e, 0x33, 0xd4, 0xf3, 0x58, 0x53, 0xf9, 0xff, 0x30, - 0xa7, 0x02, 0xa6, 0x7a, 0xe8, 0xc1, 0xd9, 0xe9, 0x7e, 0xde, 0x06, 0xfb, 0xf9, 0x65, 0xe6, 0x5a, - 0x1c, 0xc0, 0x79, 0xf4, 0x9f, 0xfc, 0x99, 0xef, 0xb2, 0x07, 0xb1, 0x3f, 0x4a, 0xeb, 0x70, 0x94, - 0xd6, 0xbe, 0x94, 0xec, 0x50, 0x4a, 0xf6, 0x55, 0x4a, 0xf6, 0xfe, 0x2d, 0xad, 0x85, 0x43, 0xff, - 0x7e, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x45, 0x92, 0x5d, 0xa1, 0x01, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/etcd/mvcc/watcher_group.go b/vendor/github.com/coreos/etcd/mvcc/watcher_group.go index b65c7bc5e..b569d04b3 100644 --- a/vendor/github.com/coreos/etcd/mvcc/watcher_group.go +++ b/vendor/github.com/coreos/etcd/mvcc/watcher_group.go @@ -156,6 +156,7 @@ type watcherGroup struct { func newWatcherGroup() watcherGroup { return watcherGroup{ keyWatchers: make(watcherSetByKey), + ranges: adt.NewIntervalTree(), watchers: make(watcherSet), } } diff --git a/vendor/github.com/coreos/etcd/pkg/adt/README.md b/vendor/github.com/coreos/etcd/pkg/adt/README.md new file mode 100644 index 000000000..a2089cd4b --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/adt/README.md @@ -0,0 +1,48 @@ + +## Red-Black Tree + +*"Introduction to Algorithms" (Cormen et al, 3rd ed.), Chapter 13* + +1. Every node is either red or black. +2. The root is black. +3. Every leaf (NIL) is black. +4. If a node is red, then both its children are black. +5. For each node, all simple paths from the node to descendant leaves contain the +same number of black nodes. + +For example, + +```go +import ( + "fmt" + + "go.etcd.io/etcd/pkg/adt" +) + +func main() { + ivt := adt.NewIntervalTree() + ivt.Insert(NewInt64Interval(510, 511), 0) + ivt.Insert(NewInt64Interval(82, 83), 0) + ivt.Insert(NewInt64Interval(830, 831), 0) + ... +``` + +After inserting the values `510`, `82`, `830`, `11`, `383`, `647`, `899`, `261`, `410`, `514`, `815`, `888`, `972`, `238`, `292`, `953`. + +![red-black-tree-01-insertion.png](img/red-black-tree-01-insertion.png) + +Deleting the node `514` should not trigger any rebalancing: + +![red-black-tree-02-delete-514.png](img/red-black-tree-02-delete-514.png) + +Deleting the node `11` triggers multiple rotates for rebalancing: + +![red-black-tree-03-delete-11.png](img/red-black-tree-03-delete-11.png) +![red-black-tree-04-delete-11.png](img/red-black-tree-04-delete-11.png) +![red-black-tree-05-delete-11.png](img/red-black-tree-05-delete-11.png) +![red-black-tree-06-delete-11.png](img/red-black-tree-06-delete-11.png) +![red-black-tree-07-delete-11.png](img/red-black-tree-07-delete-11.png) +![red-black-tree-08-delete-11.png](img/red-black-tree-08-delete-11.png) +![red-black-tree-09-delete-11.png](img/red-black-tree-09-delete-11.png) + +Try yourself at https://www.cs.usfca.edu/~galles/visualization/RedBlack.html. diff --git a/vendor/github.com/coreos/etcd/pkg/adt/example_test.go b/vendor/github.com/coreos/etcd/pkg/adt/example_test.go index caa5317cd..4a67e4176 100644 --- a/vendor/github.com/coreos/etcd/pkg/adt/example_test.go +++ b/vendor/github.com/coreos/etcd/pkg/adt/example_test.go @@ -21,8 +21,7 @@ import ( ) func Example() { - ivt := &adt.IntervalTree{} - + ivt := adt.NewIntervalTree() ivt.Insert(adt.NewInt64Interval(1, 3), 123) ivt.Insert(adt.NewInt64Interval(9, 13), 456) ivt.Insert(adt.NewInt64Interval(7, 20), 789) diff --git a/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-01-insertion.png b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-01-insertion.png new file mode 100644 index 000000000..42fcf5bf6 Binary files /dev/null and b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-01-insertion.png differ diff --git a/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-02-delete-514.png b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-02-delete-514.png new file mode 100644 index 000000000..6377b8b41 Binary files /dev/null and b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-02-delete-514.png differ diff --git a/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-03-delete-11.png b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-03-delete-11.png new file mode 100644 index 000000000..f6f44aea0 Binary files /dev/null and b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-03-delete-11.png differ diff --git a/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-04-delete-11.png b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-04-delete-11.png new file mode 100644 index 000000000..e005fcf6d Binary files /dev/null and b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-04-delete-11.png differ diff --git a/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-05-delete-11.png b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-05-delete-11.png new file mode 100644 index 000000000..143f79721 Binary files /dev/null and b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-05-delete-11.png differ diff --git a/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-06-delete-11.png b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-06-delete-11.png new file mode 100644 index 000000000..dc43ec9ed Binary files /dev/null and b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-06-delete-11.png differ diff --git a/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-07-delete-11.png b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-07-delete-11.png new file mode 100644 index 000000000..b6606d425 Binary files /dev/null and b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-07-delete-11.png differ diff --git a/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-08-delete-11.png b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-08-delete-11.png new file mode 100644 index 000000000..a144159ca Binary files /dev/null and b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-08-delete-11.png differ diff --git a/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-09-delete-11.png b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-09-delete-11.png new file mode 100644 index 000000000..bc1c284a1 Binary files /dev/null and b/vendor/github.com/coreos/etcd/pkg/adt/img/red-black-tree-09-delete-11.png differ diff --git a/vendor/github.com/coreos/etcd/pkg/adt/interval_tree.go b/vendor/github.com/coreos/etcd/pkg/adt/interval_tree.go index ec302e4a7..2e5b2ddb8 100644 --- a/vendor/github.com/coreos/etcd/pkg/adt/interval_tree.go +++ b/vendor/github.com/coreos/etcd/pkg/adt/interval_tree.go @@ -16,7 +16,9 @@ package adt import ( "bytes" + "fmt" "math" + "strings" ) // Comparable is an interface for trichotomic comparisons. @@ -35,6 +37,17 @@ const ( red ) +func (c rbcolor) String() string { + switch c { + case black: + return "black" + case red: + return "black" + default: + panic(fmt.Errorf("unknown color %d", c)) + } +} + // Interval implements a Comparable interval [begin, end) // TODO: support different sorts of intervals: (a,b), [a,b], (a, b] type Interval struct { @@ -74,39 +87,39 @@ type intervalNode struct { c rbcolor } -func (x *intervalNode) color() rbcolor { - if x == nil { +func (x *intervalNode) color(sentinel *intervalNode) rbcolor { + if x == sentinel { return black } return x.c } -func (n *intervalNode) height() int { - if n == nil { +func (x *intervalNode) height(sentinel *intervalNode) int { + if x == sentinel { return 0 } - ld := n.left.height() - rd := n.right.height() + ld := x.left.height(sentinel) + rd := x.right.height(sentinel) if ld < rd { return rd + 1 } return ld + 1 } -func (x *intervalNode) min() *intervalNode { - for x.left != nil { +func (x *intervalNode) min(sentinel *intervalNode) *intervalNode { + for x.left != sentinel { x = x.left } return x } // successor is the next in-order node in the tree -func (x *intervalNode) successor() *intervalNode { - if x.right != nil { - return x.right.min() +func (x *intervalNode) successor(sentinel *intervalNode) *intervalNode { + if x.right != sentinel { + return x.right.min(sentinel) } y := x.parent - for y != nil && x == y.right { + for y != sentinel && x == y.right { x = y y = y.parent } @@ -114,14 +127,14 @@ func (x *intervalNode) successor() *intervalNode { } // updateMax updates the maximum values for a node and its ancestors -func (x *intervalNode) updateMax() { - for x != nil { +func (x *intervalNode) updateMax(sentinel *intervalNode) { + for x != sentinel { oldmax := x.max max := x.iv.Ivl.End - if x.left != nil && x.left.max.Compare(max) > 0 { + if x.left != sentinel && x.left.max.Compare(max) > 0 { max = x.left.max } - if x.right != nil && x.right.max.Compare(max) > 0 { + if x.right != sentinel && x.right.max.Compare(max) > 0 { max = x.right.max } if oldmax.Compare(max) == 0 { @@ -135,66 +148,151 @@ func (x *intervalNode) updateMax() { type nodeVisitor func(n *intervalNode) bool // visit will call a node visitor on each node that overlaps the given interval -func (x *intervalNode) visit(iv *Interval, nv nodeVisitor) bool { - if x == nil { +func (x *intervalNode) visit(iv *Interval, sentinel *intervalNode, nv nodeVisitor) bool { + if x == sentinel { return true } v := iv.Compare(&x.iv.Ivl) switch { case v < 0: - if !x.left.visit(iv, nv) { + if !x.left.visit(iv, sentinel, nv) { return false } case v > 0: maxiv := Interval{x.iv.Ivl.Begin, x.max} if maxiv.Compare(iv) == 0 { - if !x.left.visit(iv, nv) || !x.right.visit(iv, nv) { + if !x.left.visit(iv, sentinel, nv) || !x.right.visit(iv, sentinel, nv) { return false } } default: - if !x.left.visit(iv, nv) || !nv(x) || !x.right.visit(iv, nv) { + if !x.left.visit(iv, sentinel, nv) || !nv(x) || !x.right.visit(iv, sentinel, nv) { return false } } return true } +// IntervalValue represents a range tree node that contains a range and a value. type IntervalValue struct { Ivl Interval Val interface{} } // IntervalTree represents a (mostly) textbook implementation of the -// "Introduction to Algorithms" (Cormen et al, 2nd ed.) chapter 13 red-black tree +// "Introduction to Algorithms" (Cormen et al, 3rd ed.) chapter 13 red-black tree // and chapter 14.3 interval tree with search supporting "stabbing queries". -type IntervalTree struct { +type IntervalTree interface { + // Insert adds a node with the given interval into the tree. + Insert(ivl Interval, val interface{}) + // Delete removes the node with the given interval from the tree, returning + // true if a node is in fact removed. + Delete(ivl Interval) bool + // Len gives the number of elements in the tree. + Len() int + // Height is the number of levels in the tree; one node has height 1. + Height() int + // MaxHeight is the expected maximum tree height given the number of nodes. + MaxHeight() int + // Visit calls a visitor function on every tree node intersecting the given interval. + // It will visit each interval [x, y) in ascending order sorted on x. + Visit(ivl Interval, ivv IntervalVisitor) + // Find gets the IntervalValue for the node matching the given interval + Find(ivl Interval) *IntervalValue + // Intersects returns true if there is some tree node intersecting the given interval. + Intersects(iv Interval) bool + // Contains returns true if the interval tree's keys cover the entire given interval. + Contains(ivl Interval) bool + // Stab returns a slice with all elements in the tree intersecting the interval. + Stab(iv Interval) []*IntervalValue + // Union merges a given interval tree into the receiver. + Union(inIvt IntervalTree, ivl Interval) +} + +// NewIntervalTree returns a new interval tree. +func NewIntervalTree() IntervalTree { + sentinel := &intervalNode{ + iv: IntervalValue{}, + max: nil, + left: nil, + right: nil, + parent: nil, + c: black, + } + return &intervalTree{ + root: sentinel, + count: 0, + sentinel: sentinel, + } +} + +type intervalTree struct { root *intervalNode count int + + // red-black NIL node + // use 'sentinel' as a dummy object to simplify boundary conditions + // use the sentinel to treat a nil child of a node x as an ordinary node whose parent is x + // use one shared sentinel to represent all nil leaves and the root's parent + sentinel *intervalNode } +// TODO: make this consistent with textbook implementation +// +// "Introduction to Algorithms" (Cormen et al, 3rd ed.), chapter 13.4, p324 +// +// 0. RB-DELETE(T, z) +// 1. +// 2. y = z +// 3. y-original-color = y.color +// 4. +// 5. if z.left == T.nil +// 6. x = z.right +// 7. RB-TRANSPLANT(T, z, z.right) +// 8. else if z.right == T.nil +// 9. x = z.left +// 10. RB-TRANSPLANT(T, z, z.left) +// 11. else +// 12. y = TREE-MINIMUM(z.right) +// 13. y-original-color = y.color +// 14. x = y.right +// 15. if y.p == z +// 16. x.p = y +// 17. else +// 18. RB-TRANSPLANT(T, y, y.right) +// 19. y.right = z.right +// 20. y.right.p = y +// 21. RB-TRANSPLANT(T, z, y) +// 22. y.left = z.left +// 23. y.left.p = y +// 24. y.color = z.color +// 25. +// 26. if y-original-color == BLACK +// 27. RB-DELETE-FIXUP(T, x) + // Delete removes the node with the given interval from the tree, returning // true if a node is in fact removed. -func (ivt *IntervalTree) Delete(ivl Interval) bool { +func (ivt *intervalTree) Delete(ivl Interval) bool { z := ivt.find(ivl) - if z == nil { + if z == ivt.sentinel { return false } y := z - if z.left != nil && z.right != nil { - y = z.successor() + if z.left != ivt.sentinel && z.right != ivt.sentinel { + y = z.successor(ivt.sentinel) } - x := y.left - if x == nil { + x := ivt.sentinel + if y.left != ivt.sentinel { + x = y.left + } else if y.right != ivt.sentinel { x = y.right } - if x != nil { - x.parent = y.parent - } - if y.parent == nil { + x.parent = y.parent + + if y.parent == ivt.sentinel { ivt.root = x } else { if y == y.parent.left { @@ -202,14 +300,14 @@ func (ivt *IntervalTree) Delete(ivl Interval) bool { } else { y.parent.right = x } - y.parent.updateMax() + y.parent.updateMax(ivt.sentinel) } if y != z { z.iv = y.iv - z.updateMax() + z.updateMax(ivt.sentinel) } - if y.color() == black && x != nil { + if y.color(ivt.sentinel) == black { ivt.deleteFixup(x) } @@ -217,11 +315,55 @@ func (ivt *IntervalTree) Delete(ivl Interval) bool { return true } -func (ivt *IntervalTree) deleteFixup(x *intervalNode) { - for x != ivt.root && x.color() == black && x.parent != nil { - if x == x.parent.left { +// "Introduction to Algorithms" (Cormen et al, 3rd ed.), chapter 13.4, p326 +// +// 0. RB-DELETE-FIXUP(T, z) +// 1. +// 2. while x ≠ T.root and x.color == BLACK +// 3. if x == x.p.left +// 4. w = x.p.right +// 5. if w.color == RED +// 6. w.color = BLACK +// 7. x.p.color = RED +// 8. LEFT-ROTATE(T, x, p) +// 9. if w.left.color == BLACK and w.right.color == BLACK +// 10. w.color = RED +// 11. x = x.p +// 12. else if w.right.color == BLACK +// 13. w.left.color = BLACK +// 14. w.color = RED +// 15. RIGHT-ROTATE(T, w) +// 16. w = w.p.right +// 17. w.color = x.p.color +// 18. x.p.color = BLACK +// 19. LEFT-ROTATE(T, w.p) +// 20. x = T.root +// 21. else +// 22. w = x.p.left +// 23. if w.color == RED +// 24. w.color = BLACK +// 25. x.p.color = RED +// 26. RIGHT-ROTATE(T, x, p) +// 27. if w.right.color == BLACK and w.left.color == BLACK +// 28. w.color = RED +// 29. x = x.p +// 30. else if w.left.color == BLACK +// 31. w.right.color = BLACK +// 32. w.color = RED +// 33. LEFT-ROTATE(T, w) +// 34. w = w.p.left +// 35. w.color = x.p.color +// 36. x.p.color = BLACK +// 37. RIGHT-ROTATE(T, w.p) +// 38. x = T.root +// 39. +// 40. x.color = BLACK +// +func (ivt *intervalTree) deleteFixup(x *intervalNode) { + for x != ivt.root && x.color(ivt.sentinel) == black { + if x == x.parent.left { // line 3-20 w := x.parent.right - if w.color() == red { + if w.color(ivt.sentinel) == red { w.c = black x.parent.c = red ivt.rotateLeft(x.parent) @@ -230,26 +372,26 @@ func (ivt *IntervalTree) deleteFixup(x *intervalNode) { if w == nil { break } - if w.left.color() == black && w.right.color() == black { + if w.left.color(ivt.sentinel) == black && w.right.color(ivt.sentinel) == black { w.c = red x = x.parent } else { - if w.right.color() == black { + if w.right.color(ivt.sentinel) == black { w.left.c = black w.c = red ivt.rotateRight(w) w = x.parent.right } - w.c = x.parent.color() + w.c = x.parent.color(ivt.sentinel) x.parent.c = black w.right.c = black ivt.rotateLeft(x.parent) x = ivt.root } - } else { + } else { // line 22-38 // same as above but with left and right exchanged w := x.parent.left - if w.color() == red { + if w.color(ivt.sentinel) == red { w.c = black x.parent.c = red ivt.rotateRight(x.parent) @@ -258,17 +400,17 @@ func (ivt *IntervalTree) deleteFixup(x *intervalNode) { if w == nil { break } - if w.left.color() == black && w.right.color() == black { + if w.left.color(ivt.sentinel) == black && w.right.color(ivt.sentinel) == black { w.c = red x = x.parent } else { - if w.left.color() == black { + if w.left.color(ivt.sentinel) == black { w.right.c = black w.c = red ivt.rotateLeft(w) w = x.parent.left } - w.c = x.parent.color() + w.c = x.parent.color(ivt.sentinel) x.parent.c = black w.left.c = black ivt.rotateRight(x.parent) @@ -276,17 +418,60 @@ func (ivt *IntervalTree) deleteFixup(x *intervalNode) { } } } + if x != nil { x.c = black } } +func (ivt *intervalTree) createIntervalNode(ivl Interval, val interface{}) *intervalNode { + return &intervalNode{ + iv: IntervalValue{ivl, val}, + max: ivl.End, + c: red, + left: ivt.sentinel, + right: ivt.sentinel, + parent: ivt.sentinel, + } +} + +// TODO: make this consistent with textbook implementation +// +// "Introduction to Algorithms" (Cormen et al, 3rd ed.), chapter 13.3, p315 +// +// 0. RB-INSERT(T, z) +// 1. +// 2. y = T.nil +// 3. x = T.root +// 4. +// 5. while x ≠ T.nil +// 6. y = x +// 7. if z.key < x.key +// 8. x = x.left +// 9. else +// 10. x = x.right +// 11. +// 12. z.p = y +// 13. +// 14. if y == T.nil +// 15. T.root = z +// 16. else if z.key < y.key +// 17. y.left = z +// 18. else +// 19. y.right = z +// 20. +// 21. z.left = T.nil +// 22. z.right = T.nil +// 23. z.color = RED +// 24. +// 25. RB-INSERT-FIXUP(T, z) + // Insert adds a node with the given interval into the tree. -func (ivt *IntervalTree) Insert(ivl Interval, val interface{}) { - var y *intervalNode - z := &intervalNode{iv: IntervalValue{ivl, val}, max: ivl.End, c: red} +func (ivt *intervalTree) Insert(ivl Interval, val interface{}) { + y := ivt.sentinel + z := ivt.createIntervalNode(ivl, val) x := ivt.root - for x != nil { + for x != ivt.sentinel { y = x if z.iv.Ivl.Begin.Compare(x.iv.Ivl.Begin) < 0 { x = x.left @@ -296,7 +481,7 @@ func (ivt *IntervalTree) Insert(ivl Interval, val interface{}) { } z.parent = y - if y == nil { + if y == ivt.sentinel { ivt.root = z } else { if z.iv.Ivl.Begin.Compare(y.iv.Ivl.Begin) < 0 { @@ -304,18 +489,54 @@ func (ivt *IntervalTree) Insert(ivl Interval, val interface{}) { } else { y.right = z } - y.updateMax() + y.updateMax(ivt.sentinel) } z.c = red + ivt.insertFixup(z) ivt.count++ } -func (ivt *IntervalTree) insertFixup(z *intervalNode) { - for z.parent != nil && z.parent.parent != nil && z.parent.color() == red { - if z.parent == z.parent.parent.left { +// "Introduction to Algorithms" (Cormen et al, 3rd ed.), chapter 13.3, p316 +// +// 0. RB-INSERT-FIXUP(T, z) +// 1. +// 2. while z.p.color == RED +// 3. if z.p == z.p.p.left +// 4. y = z.p.p.right +// 5. if y.color == RED +// 6. z.p.color = BLACK +// 7. y.color = BLACK +// 8. z.p.p.color = RED +// 9. z = z.p.p +// 10. else if z == z.p.right +// 11. z = z.p +// 12. LEFT-ROTATE(T, z) +// 13. z.p.color = BLACK +// 14. z.p.p.color = RED +// 15. RIGHT-ROTATE(T, z.p.p) +// 16. else +// 17. y = z.p.p.left +// 18. if y.color == RED +// 19. z.p.color = BLACK +// 20. y.color = BLACK +// 21. z.p.p.color = RED +// 22. z = z.p.p +// 23. else if z == z.p.right +// 24. z = z.p +// 25. RIGHT-ROTATE(T, z) +// 26. z.p.color = BLACK +// 27. z.p.p.color = RED +// 28. LEFT-ROTATE(T, z.p.p) +// 29. +// 30. T.root.color = BLACK +// +func (ivt *intervalTree) insertFixup(z *intervalNode) { + for z.parent.color(ivt.sentinel) == red { + if z.parent == z.parent.parent.left { // line 3-15 + y := z.parent.parent.right - if y.color() == red { + if y.color(ivt.sentinel) == red { y.c = black z.parent.c = black z.parent.parent.c = red @@ -329,10 +550,10 @@ func (ivt *IntervalTree) insertFixup(z *intervalNode) { z.parent.parent.c = red ivt.rotateRight(z.parent.parent) } - } else { + } else { // line 16-28 // same as then with left/right exchanged y := z.parent.parent.left - if y.color() == red { + if y.color(ivt.sentinel) == red { y.c = black z.parent.c = black z.parent.parent.c = red @@ -348,42 +569,109 @@ func (ivt *IntervalTree) insertFixup(z *intervalNode) { } } } + + // line 30 ivt.root.c = black } // rotateLeft moves x so it is left of its right child -func (ivt *IntervalTree) rotateLeft(x *intervalNode) { +// +// "Introduction to Algorithms" (Cormen et al, 3rd ed.), chapter 13.2, p313 +// +// 0. LEFT-ROTATE(T, x) +// 1. +// 2. y = x.right +// 3. x.right = y.left +// 4. +// 5. if y.left ≠ T.nil +// 6. y.left.p = x +// 7. +// 8. y.p = x.p +// 9. +// 10. if x.p == T.nil +// 11. T.root = y +// 12. else if x == x.p.left +// 13. x.p.left = y +// 14. else +// 15. x.p.right = y +// 16. +// 17. y.left = x +// 18. x.p = y +// +func (ivt *intervalTree) rotateLeft(x *intervalNode) { + // rotateLeft x must have right child + if x.right == ivt.sentinel { + return + } + + // line 2-3 y := x.right x.right = y.left - if y.left != nil { + + // line 5-6 + if y.left != ivt.sentinel { y.left.parent = x } - x.updateMax() + x.updateMax(ivt.sentinel) + + // line 10-15, 18 ivt.replaceParent(x, y) + + // line 17 y.left = x - y.updateMax() + y.updateMax(ivt.sentinel) } -// rotateLeft moves x so it is right of its left child -func (ivt *IntervalTree) rotateRight(x *intervalNode) { - if x == nil { +// rotateRight moves x so it is right of its left child +// +// 0. RIGHT-ROTATE(T, x) +// 1. +// 2. y = x.left +// 3. x.left = y.right +// 4. +// 5. if y.right ≠ T.nil +// 6. y.right.p = x +// 7. +// 8. y.p = x.p +// 9. +// 10. if x.p == T.nil +// 11. T.root = y +// 12. else if x == x.p.right +// 13. x.p.right = y +// 14. else +// 15. x.p.left = y +// 16. +// 17. y.right = x +// 18. x.p = y +// +func (ivt *intervalTree) rotateRight(x *intervalNode) { + // rotateRight x must have left child + if x.left == ivt.sentinel { return } + + // line 2-3 y := x.left x.left = y.right - if y.right != nil { + + // line 5-6 + if y.right != ivt.sentinel { y.right.parent = x } - x.updateMax() + x.updateMax(ivt.sentinel) + + // line 10-15, 18 ivt.replaceParent(x, y) + + // line 17 y.right = x - y.updateMax() + y.updateMax(ivt.sentinel) } // replaceParent replaces x's parent with y -func (ivt *IntervalTree) replaceParent(x *intervalNode, y *intervalNode) { +func (ivt *intervalTree) replaceParent(x *intervalNode, y *intervalNode) { y.parent = x.parent - if x.parent == nil { + if x.parent == ivt.sentinel { ivt.root = y } else { if x == x.parent.left { @@ -391,19 +679,19 @@ func (ivt *IntervalTree) replaceParent(x *intervalNode, y *intervalNode) { } else { x.parent.right = y } - x.parent.updateMax() + x.parent.updateMax(ivt.sentinel) } x.parent = y } // Len gives the number of elements in the tree -func (ivt *IntervalTree) Len() int { return ivt.count } +func (ivt *intervalTree) Len() int { return ivt.count } // Height is the number of levels in the tree; one node has height 1. -func (ivt *IntervalTree) Height() int { return ivt.root.height() } +func (ivt *intervalTree) Height() int { return ivt.root.height(ivt.sentinel) } // MaxHeight is the expected maximum tree height given the number of nodes -func (ivt *IntervalTree) MaxHeight() int { +func (ivt *intervalTree) MaxHeight() int { return int((2 * math.Log2(float64(ivt.Len()+1))) + 0.5) } @@ -412,12 +700,13 @@ type IntervalVisitor func(n *IntervalValue) bool // Visit calls a visitor function on every tree node intersecting the given interval. // It will visit each interval [x, y) in ascending order sorted on x. -func (ivt *IntervalTree) Visit(ivl Interval, ivv IntervalVisitor) { - ivt.root.visit(&ivl, func(n *intervalNode) bool { return ivv(&n.iv) }) +func (ivt *intervalTree) Visit(ivl Interval, ivv IntervalVisitor) { + ivt.root.visit(&ivl, ivt.sentinel, func(n *intervalNode) bool { return ivv(&n.iv) }) } // find the exact node for a given interval -func (ivt *IntervalTree) find(ivl Interval) (ret *intervalNode) { +func (ivt *intervalTree) find(ivl Interval) *intervalNode { + ret := ivt.sentinel f := func(n *intervalNode) bool { if n.iv.Ivl != ivl { return true @@ -425,34 +714,34 @@ func (ivt *IntervalTree) find(ivl Interval) (ret *intervalNode) { ret = n return false } - ivt.root.visit(&ivl, f) + ivt.root.visit(&ivl, ivt.sentinel, f) return ret } // Find gets the IntervalValue for the node matching the given interval -func (ivt *IntervalTree) Find(ivl Interval) (ret *IntervalValue) { +func (ivt *intervalTree) Find(ivl Interval) (ret *IntervalValue) { n := ivt.find(ivl) - if n == nil { + if n == ivt.sentinel { return nil } return &n.iv } // Intersects returns true if there is some tree node intersecting the given interval. -func (ivt *IntervalTree) Intersects(iv Interval) bool { +func (ivt *intervalTree) Intersects(iv Interval) bool { x := ivt.root - for x != nil && iv.Compare(&x.iv.Ivl) != 0 { - if x.left != nil && x.left.max.Compare(iv.Begin) > 0 { + for x != ivt.sentinel && iv.Compare(&x.iv.Ivl) != 0 { + if x.left != ivt.sentinel && x.left.max.Compare(iv.Begin) > 0 { x = x.left } else { x = x.right } } - return x != nil + return x != ivt.sentinel } // Contains returns true if the interval tree's keys cover the entire given interval. -func (ivt *IntervalTree) Contains(ivl Interval) bool { +func (ivt *intervalTree) Contains(ivl Interval) bool { var maxEnd, minBegin Comparable isContiguous := true @@ -476,7 +765,7 @@ func (ivt *IntervalTree) Contains(ivl Interval) bool { } // Stab returns a slice with all elements in the tree intersecting the interval. -func (ivt *IntervalTree) Stab(iv Interval) (ivs []*IntervalValue) { +func (ivt *intervalTree) Stab(iv Interval) (ivs []*IntervalValue) { if ivt.count == 0 { return nil } @@ -486,7 +775,7 @@ func (ivt *IntervalTree) Stab(iv Interval) (ivs []*IntervalValue) { } // Union merges a given interval tree into the receiver. -func (ivt *IntervalTree) Union(inIvt IntervalTree, ivl Interval) { +func (ivt *intervalTree) Union(inIvt IntervalTree, ivl Interval) { f := func(n *IntervalValue) bool { ivt.Insert(n.Ivl, n.Val) return true @@ -494,6 +783,63 @@ func (ivt *IntervalTree) Union(inIvt IntervalTree, ivl Interval) { inIvt.Visit(ivl, f) } +type visitedInterval struct { + root Interval + left Interval + right Interval + color rbcolor + depth int +} + +func (vi visitedInterval) String() string { + bd := new(strings.Builder) + bd.WriteString(fmt.Sprintf("root [%v,%v,%v], left [%v,%v], right [%v,%v], depth %d", + vi.root.Begin, vi.root.End, vi.color, + vi.left.Begin, vi.left.End, + vi.right.Begin, vi.right.End, + vi.depth, + )) + return bd.String() +} + +// visitLevel traverses tree in level order. +// used for testing +func (ivt *intervalTree) visitLevel() []visitedInterval { + if ivt.root == ivt.sentinel { + return nil + } + + rs := make([]visitedInterval, 0, ivt.Len()) + + type pair struct { + node *intervalNode + depth int + } + queue := []pair{{ivt.root, 0}} + for len(queue) > 0 { + f := queue[0] + queue = queue[1:] + + vi := visitedInterval{ + root: f.node.iv.Ivl, + color: f.node.color(ivt.sentinel), + depth: f.depth, + } + if f.node.left != ivt.sentinel { + vi.left = f.node.left.iv.Ivl + queue = append(queue, pair{f.node.left, f.depth + 1}) + } + if f.node.right != ivt.sentinel { + vi.right = f.node.right.iv.Ivl + queue = append(queue, pair{f.node.right, f.depth + 1}) + } + + rs = append(rs, vi) + } + + return rs +} + type StringComparable string func (s StringComparable) Compare(c Comparable) int { @@ -543,6 +889,7 @@ func (s StringAffineComparable) Compare(c Comparable) int { func NewStringAffineInterval(begin, end string) Interval { return Interval{StringAffineComparable(begin), StringAffineComparable(end)} } + func NewStringAffinePoint(s string) Interval { return NewStringAffineInterval(s, s+"\x00") } @@ -551,6 +898,10 @@ func NewInt64Interval(a int64, b int64) Interval { return Interval{Int64Comparable(a), Int64Comparable(b)} } +func newInt64EmptyInterval() Interval { + return Interval{Begin: nil, End: nil} +} + func NewInt64Point(a int64) Interval { return Interval{Int64Comparable(a), Int64Comparable(a + 1)} } @@ -591,6 +942,7 @@ func (b BytesAffineComparable) Compare(c Comparable) int { func NewBytesAffineInterval(begin, end []byte) Interval { return Interval{BytesAffineComparable(begin), BytesAffineComparable(end)} } + func NewBytesAffinePoint(b []byte) Interval { be := make([]byte, len(b)+1) copy(be, b) diff --git a/vendor/github.com/coreos/etcd/pkg/adt/interval_tree_test.go b/vendor/github.com/coreos/etcd/pkg/adt/interval_tree_test.go index 493c11fa0..608841f92 100644 --- a/vendor/github.com/coreos/etcd/pkg/adt/interval_tree_test.go +++ b/vendor/github.com/coreos/etcd/pkg/adt/interval_tree_test.go @@ -16,12 +16,276 @@ package adt import ( "math/rand" + "reflect" "testing" "time" ) +// TestIntervalTreeInsert tests interval tree insertion. +func TestIntervalTreeInsert(t *testing.T) { + // "Introduction to Algorithms" (Cormen et al, 3rd ed.) chapter 14, Figure 14.4 + ivt := NewIntervalTree() + ivt.Insert(NewInt64Interval(16, 21), 30) + ivt.Insert(NewInt64Interval(8, 9), 23) + ivt.Insert(NewInt64Interval(0, 3), 3) + ivt.Insert(NewInt64Interval(5, 8), 10) + ivt.Insert(NewInt64Interval(6, 10), 10) + ivt.Insert(NewInt64Interval(15, 23), 23) + ivt.Insert(NewInt64Interval(17, 19), 20) + ivt.Insert(NewInt64Interval(25, 30), 30) + ivt.Insert(NewInt64Interval(26, 26), 26) + ivt.Insert(NewInt64Interval(19, 20), 20) + + expected := []visitedInterval{ + {root: NewInt64Interval(16, 21), color: black, left: NewInt64Interval(8, 9), right: NewInt64Interval(25, 30), depth: 0}, + + {root: NewInt64Interval(8, 9), color: red, left: NewInt64Interval(5, 8), right: NewInt64Interval(15, 23), depth: 1}, + {root: NewInt64Interval(25, 30), color: red, left: NewInt64Interval(17, 19), right: NewInt64Interval(26, 26), depth: 1}, + + {root: NewInt64Interval(5, 8), color: black, left: NewInt64Interval(0, 3), right: NewInt64Interval(6, 10), depth: 2}, + {root: NewInt64Interval(15, 23), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 2}, + {root: NewInt64Interval(17, 19), color: black, left: newInt64EmptyInterval(), right: NewInt64Interval(19, 20), depth: 2}, + {root: NewInt64Interval(26, 26), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 2}, + + {root: NewInt64Interval(0, 3), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(6, 10), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(19, 20), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + } + + tr := ivt.(*intervalTree) + visits := tr.visitLevel() + if !reflect.DeepEqual(expected, visits) { + t.Fatalf("level order expected %v, got %v", expected, visits) + } +} + +// TestIntervalTreeSelfBalanced ensures range tree is self-balanced after inserting ranges to the tree. +// Use https://www.cs.usfca.edu/~galles/visualization/RedBlack.html for test case creation. +// +// Regular Binary Search Tree +// [0,1] +// \ +// [1,2] +// \ +// [3,4] +// \ +// [5,6] +// \ +// [7,8] +// \ +// [8,9] +// +// Self-Balancing Binary Search Tree +// [1,2] +// / \ +// [0,1] [5,6] +// / \ +// [3,4] [7,8] +// \ +// [8,9] +// +func TestIntervalTreeSelfBalanced(t *testing.T) { + ivt := NewIntervalTree() + ivt.Insert(NewInt64Interval(0, 1), 0) + ivt.Insert(NewInt64Interval(1, 2), 0) + ivt.Insert(NewInt64Interval(3, 4), 0) + ivt.Insert(NewInt64Interval(5, 6), 0) + ivt.Insert(NewInt64Interval(7, 8), 0) + ivt.Insert(NewInt64Interval(8, 9), 0) + + expected := []visitedInterval{ + {root: NewInt64Interval(1, 2), color: black, left: NewInt64Interval(0, 1), right: NewInt64Interval(5, 6), depth: 0}, + + {root: NewInt64Interval(0, 1), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 1}, + {root: NewInt64Interval(5, 6), color: red, left: NewInt64Interval(3, 4), right: NewInt64Interval(7, 8), depth: 1}, + + {root: NewInt64Interval(3, 4), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 2}, + {root: NewInt64Interval(7, 8), color: black, left: newInt64EmptyInterval(), right: NewInt64Interval(8, 9), depth: 2}, + + {root: NewInt64Interval(8, 9), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + } + + tr := ivt.(*intervalTree) + visits := tr.visitLevel() + if !reflect.DeepEqual(expected, visits) { + t.Fatalf("level order expected %v, got %v", expected, visits) + } + + if visits[len(visits)-1].depth != 3 { + t.Fatalf("expected self-balanced tree with last level 3, but last level got %d", visits[len(visits)-1].depth) + } +} + +// TestIntervalTreeDelete ensures delete operation maintains red-black tree properties. +// Use https://www.cs.usfca.edu/~galles/visualization/RedBlack.html for test case creation. +// See https://github.com/etcd-io/etcd/issues/10877 for more detail. +// +// +// After insertion: +// [510,511] +// / \ +// ---------- ----------------------- +// / \ +// [82,83] [830,831] +// / \ / \ +// / \ / \ +// [11,12] [383,384](red) [647,648] [899,900](red) +// / \ / \ / \ +// / \ / \ / \ +// [261,262] [410,411] [514,515](red) [815,816](red) [888,889] [972,973] +// / \ / +// / \ / +// [238,239](red) [292,293](red) [953,954](red) +// +// +// After deleting 514 (no rebalance): +// [510,511] +// / \ +// ---------- ----------------------- +// / \ +// [82,83] [830,831] +// / \ / \ +// / \ / \ +// [11,12] [383,384](red) [647,648] [899,900](red) +// / \ \ / \ +// / \ \ / \ +// [261,262] [410,411] [815,816](red) [888,889] [972,973] +// / \ / +// / \ / +// [238,239](red) [292,293](red) [953,954](red) +// +// +// After deleting 11 (requires rebalancing): +// [510,511] +// / \ +// ---------- -------------------------- +// / \ +// [383,384] [830,831] +// / \ / \ +// / \ / \ +// [261,262](red) [410,411] [647,648] [899,900](red) +// / \ \ / \ +// / \ \ / \ +// [82,83] [292,293] [815,816](red) [888,889] [972,973] +// \ / +// \ / +// [238,239](red) [953,954](red) +// +// +func TestIntervalTreeDelete(t *testing.T) { + ivt := NewIntervalTree() + ivt.Insert(NewInt64Interval(510, 511), 0) + ivt.Insert(NewInt64Interval(82, 83), 0) + ivt.Insert(NewInt64Interval(830, 831), 0) + ivt.Insert(NewInt64Interval(11, 12), 0) + ivt.Insert(NewInt64Interval(383, 384), 0) + ivt.Insert(NewInt64Interval(647, 648), 0) + ivt.Insert(NewInt64Interval(899, 900), 0) + ivt.Insert(NewInt64Interval(261, 262), 0) + ivt.Insert(NewInt64Interval(410, 411), 0) + ivt.Insert(NewInt64Interval(514, 515), 0) + ivt.Insert(NewInt64Interval(815, 816), 0) + ivt.Insert(NewInt64Interval(888, 889), 0) + ivt.Insert(NewInt64Interval(972, 973), 0) + ivt.Insert(NewInt64Interval(238, 239), 0) + ivt.Insert(NewInt64Interval(292, 293), 0) + ivt.Insert(NewInt64Interval(953, 954), 0) + + tr := ivt.(*intervalTree) + + expectedBeforeDelete := []visitedInterval{ + {root: NewInt64Interval(510, 511), color: black, left: NewInt64Interval(82, 83), right: NewInt64Interval(830, 831), depth: 0}, + + {root: NewInt64Interval(82, 83), color: black, left: NewInt64Interval(11, 12), right: NewInt64Interval(383, 384), depth: 1}, + {root: NewInt64Interval(830, 831), color: black, left: NewInt64Interval(647, 648), right: NewInt64Interval(899, 900), depth: 1}, + + {root: NewInt64Interval(11, 12), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 2}, + {root: NewInt64Interval(383, 384), color: red, left: NewInt64Interval(261, 262), right: NewInt64Interval(410, 411), depth: 2}, + {root: NewInt64Interval(647, 648), color: black, left: NewInt64Interval(514, 515), right: NewInt64Interval(815, 816), depth: 2}, + {root: NewInt64Interval(899, 900), color: red, left: NewInt64Interval(888, 889), right: NewInt64Interval(972, 973), depth: 2}, + + {root: NewInt64Interval(261, 262), color: black, left: NewInt64Interval(238, 239), right: NewInt64Interval(292, 293), depth: 3}, + {root: NewInt64Interval(410, 411), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(514, 515), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(815, 816), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(888, 889), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(972, 973), color: black, left: NewInt64Interval(953, 954), right: newInt64EmptyInterval(), depth: 3}, + + {root: NewInt64Interval(238, 239), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 4}, + {root: NewInt64Interval(292, 293), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 4}, + {root: NewInt64Interval(953, 954), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 4}, + } + visitsBeforeDelete := tr.visitLevel() + if !reflect.DeepEqual(expectedBeforeDelete, visitsBeforeDelete) { + t.Fatalf("level order after insertion expected %v, got %v", expectedBeforeDelete, visitsBeforeDelete) + } + + // delete the node "514" + range514 := NewInt64Interval(514, 515) + if deleted := tr.Delete(NewInt64Interval(514, 515)); !deleted { + t.Fatalf("range %v not deleted", range514) + } + + expectedAfterDelete514 := []visitedInterval{ + {root: NewInt64Interval(510, 511), color: black, left: NewInt64Interval(82, 83), right: NewInt64Interval(830, 831), depth: 0}, + + {root: NewInt64Interval(82, 83), color: black, left: NewInt64Interval(11, 12), right: NewInt64Interval(383, 384), depth: 1}, + {root: NewInt64Interval(830, 831), color: black, left: NewInt64Interval(647, 648), right: NewInt64Interval(899, 900), depth: 1}, + + {root: NewInt64Interval(11, 12), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 2}, + {root: NewInt64Interval(383, 384), color: red, left: NewInt64Interval(261, 262), right: NewInt64Interval(410, 411), depth: 2}, + {root: NewInt64Interval(647, 648), color: black, left: newInt64EmptyInterval(), right: NewInt64Interval(815, 816), depth: 2}, + {root: NewInt64Interval(899, 900), color: red, left: NewInt64Interval(888, 889), right: NewInt64Interval(972, 973), depth: 2}, + + {root: NewInt64Interval(261, 262), color: black, left: NewInt64Interval(238, 239), right: NewInt64Interval(292, 293), depth: 3}, + {root: NewInt64Interval(410, 411), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(815, 816), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(888, 889), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(972, 973), color: black, left: NewInt64Interval(953, 954), right: newInt64EmptyInterval(), depth: 3}, + + {root: NewInt64Interval(238, 239), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 4}, + {root: NewInt64Interval(292, 293), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 4}, + {root: NewInt64Interval(953, 954), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 4}, + } + visitsAfterDelete514 := tr.visitLevel() + if !reflect.DeepEqual(expectedAfterDelete514, visitsAfterDelete514) { + t.Fatalf("level order after deleting '514' expected %v, got %v", expectedAfterDelete514, visitsAfterDelete514) + } + + // delete the node "11" + range11 := NewInt64Interval(11, 12) + if deleted := tr.Delete(NewInt64Interval(11, 12)); !deleted { + t.Fatalf("range %v not deleted", range11) + } + + expectedAfterDelete11 := []visitedInterval{ + {root: NewInt64Interval(510, 511), color: black, left: NewInt64Interval(383, 384), right: NewInt64Interval(830, 831), depth: 0}, + + {root: NewInt64Interval(383, 384), color: black, left: NewInt64Interval(261, 262), right: NewInt64Interval(410, 411), depth: 1}, + {root: NewInt64Interval(830, 831), color: black, left: NewInt64Interval(647, 648), right: NewInt64Interval(899, 900), depth: 1}, + + {root: NewInt64Interval(261, 262), color: red, left: NewInt64Interval(82, 83), right: NewInt64Interval(292, 293), depth: 2}, + {root: NewInt64Interval(410, 411), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 2}, + {root: NewInt64Interval(647, 648), color: black, left: newInt64EmptyInterval(), right: NewInt64Interval(815, 816), depth: 2}, + {root: NewInt64Interval(899, 900), color: red, left: NewInt64Interval(888, 889), right: NewInt64Interval(972, 973), depth: 2}, + + {root: NewInt64Interval(82, 83), color: black, left: newInt64EmptyInterval(), right: NewInt64Interval(238, 239), depth: 3}, + {root: NewInt64Interval(292, 293), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(815, 816), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(888, 889), color: black, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 3}, + {root: NewInt64Interval(972, 973), color: black, left: NewInt64Interval(953, 954), right: newInt64EmptyInterval(), depth: 3}, + + {root: NewInt64Interval(238, 239), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 4}, + {root: NewInt64Interval(953, 954), color: red, left: newInt64EmptyInterval(), right: newInt64EmptyInterval(), depth: 4}, + } + visitsAfterDelete11 := tr.visitLevel() + if !reflect.DeepEqual(expectedAfterDelete11, visitsAfterDelete11) { + t.Fatalf("level order after deleting '11' expected %v, got %v", expectedAfterDelete11, visitsAfterDelete11) + } +} + func TestIntervalTreeIntersects(t *testing.T) { - ivt := &IntervalTree{} + ivt := NewIntervalTree() ivt.Insert(NewStringInterval("1", "3"), 123) if ivt.Intersects(NewStringPoint("0")) { @@ -42,7 +306,7 @@ func TestIntervalTreeIntersects(t *testing.T) { } func TestIntervalTreeStringAffine(t *testing.T) { - ivt := &IntervalTree{} + ivt := NewIntervalTree() ivt.Insert(NewStringAffineInterval("8", ""), 123) if !ivt.Intersects(NewStringAffinePoint("9")) { t.Errorf("missing 9") @@ -53,15 +317,16 @@ func TestIntervalTreeStringAffine(t *testing.T) { } func TestIntervalTreeStab(t *testing.T) { - ivt := &IntervalTree{} + ivt := NewIntervalTree() ivt.Insert(NewStringInterval("0", "1"), 123) ivt.Insert(NewStringInterval("0", "2"), 456) ivt.Insert(NewStringInterval("5", "6"), 789) ivt.Insert(NewStringInterval("6", "8"), 999) ivt.Insert(NewStringInterval("0", "3"), 0) - if ivt.root.max.Compare(StringComparable("8")) != 0 { - t.Fatalf("wrong root max got %v, expected 8", ivt.root.max) + tr := ivt.(*intervalTree) + if tr.root.max.Compare(StringComparable("8")) != 0 { + t.Fatalf("wrong root max got %v, expected 8", tr.root.max) } if x := len(ivt.Stab(NewStringPoint("0"))); x != 3 { t.Errorf("got %d, expected 3", x) @@ -94,7 +359,7 @@ type xy struct { func TestIntervalTreeRandom(t *testing.T) { // generate unique intervals ivs := make(map[xy]struct{}) - ivt := &IntervalTree{} + ivt := NewIntervalTree() maxv := 128 rand.Seed(time.Now().UnixNano()) @@ -168,7 +433,7 @@ func TestIntervalTreeSortedVisit(t *testing.T) { }, } for i, tt := range tests { - ivt := &IntervalTree{} + ivt := NewIntervalTree() for _, ivl := range tt.ivls { ivt.Insert(ivl, struct{}{}) } @@ -217,7 +482,7 @@ func TestIntervalTreeVisitExit(t *testing.T) { } for i, tt := range tests { - ivt := &IntervalTree{} + ivt := NewIntervalTree() for _, ivl := range ivls { ivt.Insert(ivl, struct{}{}) } @@ -284,7 +549,7 @@ func TestIntervalTreeContains(t *testing.T) { }, } for i, tt := range tests { - ivt := &IntervalTree{} + ivt := NewIntervalTree() for _, ivl := range tt.ivls { ivt.Insert(ivl, struct{}{}) } diff --git a/vendor/github.com/coreos/etcd/pkg/cpuutil/endian.go b/vendor/github.com/coreos/etcd/pkg/cpuutil/endian.go index 6ab898d4b..06c06cd4a 100644 --- a/vendor/github.com/coreos/etcd/pkg/cpuutil/endian.go +++ b/vendor/github.com/coreos/etcd/pkg/cpuutil/endian.go @@ -27,7 +27,7 @@ var byteOrder binary.ByteOrder func ByteOrder() binary.ByteOrder { return byteOrder } func init() { - var i int = 0x1 + i := int(0x1) if v := (*[intWidth]byte)(unsafe.Pointer(&i)); v[0] == 0 { byteOrder = binary.BigEndian } else { diff --git a/vendor/github.com/coreos/etcd/pkg/flags/flag_test.go b/vendor/github.com/coreos/etcd/pkg/flags/flag_test.go index db157c9be..248d5f973 100644 --- a/vendor/github.com/coreos/etcd/pkg/flags/flag_test.go +++ b/vendor/github.com/coreos/etcd/pkg/flags/flag_test.go @@ -87,7 +87,7 @@ func TestSetFlagsFromEnvParsingError(t *testing.T) { } defer os.Unsetenv("ETCD_HEARTBEAT_INTERVAL") - if serr := SetFlagsFromEnv("ETCD", fs); serr.Error() != `invalid value "100 # ms" for ETCD_HEARTBEAT_INTERVAL: strconv.ParseUint: parsing "100 # ms": invalid syntax` { + if serr := SetFlagsFromEnv("ETCD", fs); serr.Error() != `invalid value "100 # ms" for ETCD_HEARTBEAT_INTERVAL: parse error` { t.Fatalf("expected parsing error, got %v", serr) } } diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/discard_logger.go b/vendor/github.com/coreos/etcd/pkg/logutil/discard_logger.go new file mode 100644 index 000000000..81b0a9d03 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/discard_logger.go @@ -0,0 +1,46 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import ( + "log" + + "google.golang.org/grpc/grpclog" +) + +// assert that "discardLogger" satisfy "Logger" interface +var _ Logger = &discardLogger{} + +// NewDiscardLogger returns a new Logger that discards everything except "fatal". +func NewDiscardLogger() Logger { return &discardLogger{} } + +type discardLogger struct{} + +func (l *discardLogger) Info(args ...interface{}) {} +func (l *discardLogger) Infoln(args ...interface{}) {} +func (l *discardLogger) Infof(format string, args ...interface{}) {} +func (l *discardLogger) Warning(args ...interface{}) {} +func (l *discardLogger) Warningln(args ...interface{}) {} +func (l *discardLogger) Warningf(format string, args ...interface{}) {} +func (l *discardLogger) Error(args ...interface{}) {} +func (l *discardLogger) Errorln(args ...interface{}) {} +func (l *discardLogger) Errorf(format string, args ...interface{}) {} +func (l *discardLogger) Fatal(args ...interface{}) { log.Fatal(args...) } +func (l *discardLogger) Fatalln(args ...interface{}) { log.Fatalln(args...) } +func (l *discardLogger) Fatalf(format string, args ...interface{}) { log.Fatalf(format, args...) } +func (l *discardLogger) V(lvl int) bool { + return false +} +func (l *discardLogger) Lvl(lvl int) grpclog.LoggerV2 { return l } diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/doc.go b/vendor/github.com/coreos/etcd/pkg/logutil/doc.go new file mode 100644 index 000000000..e919f2499 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/doc.go @@ -0,0 +1,16 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package logutil includes utilities to facilitate logging. +package logutil diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/log_level.go b/vendor/github.com/coreos/etcd/pkg/logutil/log_level.go new file mode 100644 index 000000000..d57e17394 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/log_level.go @@ -0,0 +1,70 @@ +// Copyright 2019 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import ( + "fmt" + + "github.com/coreos/pkg/capnslog" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +var DefaultLogLevel = "info" + +// ConvertToZapLevel converts log level string to zapcore.Level. +func ConvertToZapLevel(lvl string) zapcore.Level { + switch lvl { + case "debug": + return zap.DebugLevel + case "info": + return zap.InfoLevel + case "warn": + return zap.WarnLevel + case "error": + return zap.ErrorLevel + case "dpanic": + return zap.DPanicLevel + case "panic": + return zap.PanicLevel + case "fatal": + return zap.FatalLevel + default: + panic(fmt.Sprintf("unknown level %q", lvl)) + } +} + +// ConvertToCapnslogLogLevel convert log level string to capnslog.LogLevel. +// TODO: deprecate this in 3.5 +func ConvertToCapnslogLogLevel(lvl string) capnslog.LogLevel { + switch lvl { + case "debug": + return capnslog.DEBUG + case "info": + return capnslog.INFO + case "warn": + return capnslog.WARNING + case "error": + return capnslog.ERROR + case "dpanic": + return capnslog.CRITICAL + case "panic": + return capnslog.CRITICAL + case "fatal": + return capnslog.CRITICAL + default: + panic(fmt.Sprintf("unknown level %q", lvl)) + } +} diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/logger.go b/vendor/github.com/coreos/etcd/pkg/logutil/logger.go new file mode 100644 index 000000000..e7da80eff --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/logger.go @@ -0,0 +1,64 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import "google.golang.org/grpc/grpclog" + +// Logger defines logging interface. +// TODO: deprecate in v3.5. +type Logger interface { + grpclog.LoggerV2 + + // Lvl returns logger if logger's verbosity level >= "lvl". + // Otherwise, logger that discards everything. + Lvl(lvl int) grpclog.LoggerV2 +} + +// assert that "defaultLogger" satisfy "Logger" interface +var _ Logger = &defaultLogger{} + +// NewLogger wraps "grpclog.LoggerV2" that implements "Logger" interface. +// +// For example: +// +// var defaultLogger Logger +// g := grpclog.NewLoggerV2WithVerbosity(os.Stderr, os.Stderr, os.Stderr, 4) +// defaultLogger = NewLogger(g) +// +func NewLogger(g grpclog.LoggerV2) Logger { return &defaultLogger{g: g} } + +type defaultLogger struct { + g grpclog.LoggerV2 +} + +func (l *defaultLogger) Info(args ...interface{}) { l.g.Info(args...) } +func (l *defaultLogger) Infoln(args ...interface{}) { l.g.Info(args...) } +func (l *defaultLogger) Infof(format string, args ...interface{}) { l.g.Infof(format, args...) } +func (l *defaultLogger) Warning(args ...interface{}) { l.g.Warning(args...) } +func (l *defaultLogger) Warningln(args ...interface{}) { l.g.Warning(args...) } +func (l *defaultLogger) Warningf(format string, args ...interface{}) { l.g.Warningf(format, args...) } +func (l *defaultLogger) Error(args ...interface{}) { l.g.Error(args...) } +func (l *defaultLogger) Errorln(args ...interface{}) { l.g.Error(args...) } +func (l *defaultLogger) Errorf(format string, args ...interface{}) { l.g.Errorf(format, args...) } +func (l *defaultLogger) Fatal(args ...interface{}) { l.g.Fatal(args...) } +func (l *defaultLogger) Fatalln(args ...interface{}) { l.g.Fatal(args...) } +func (l *defaultLogger) Fatalf(format string, args ...interface{}) { l.g.Fatalf(format, args...) } +func (l *defaultLogger) V(lvl int) bool { return l.g.V(lvl) } +func (l *defaultLogger) Lvl(lvl int) grpclog.LoggerV2 { + if l.g.V(lvl) { + return l + } + return &discardLogger{} +} diff --git a/vendor/github.com/coreos/etcd/clientv3/logger_test.go b/vendor/github.com/coreos/etcd/pkg/logutil/logger_test.go similarity index 84% rename from vendor/github.com/coreos/etcd/clientv3/logger_test.go rename to vendor/github.com/coreos/etcd/pkg/logutil/logger_test.go index e54d48a1b..1f2ef9b68 100644 --- a/vendor/github.com/coreos/etcd/clientv3/logger_test.go +++ b/vendor/github.com/coreos/etcd/pkg/logutil/logger_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package clientv3 +package logutil_test import ( "bytes" @@ -20,13 +20,15 @@ import ( "strings" "testing" + "github.com/coreos/etcd/pkg/logutil" + "google.golang.org/grpc/grpclog" ) func TestLogger(t *testing.T) { buf := new(bytes.Buffer) - l := NewLogger(grpclog.NewLoggerV2WithVerbosity(buf, buf, buf, 10)) + l := logutil.NewLogger(grpclog.NewLoggerV2WithVerbosity(buf, buf, buf, 10)) l.Infof("hello world!") if !strings.Contains(buf.String(), "hello world!") { t.Fatalf("expected 'hello world!', got %q", buf.String()) @@ -43,7 +45,7 @@ func TestLogger(t *testing.T) { } buf.Reset() - l = NewLogger(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard)) + l = logutil.NewLogger(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard)) l.Infof("ignore this") if len(buf.Bytes()) > 0 { t.Fatalf("unexpected logs %q", buf.String()) diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/merge_logger.go b/vendor/github.com/coreos/etcd/pkg/logutil/merge_logger.go index cc750f4d3..866b6f7a8 100644 --- a/vendor/github.com/coreos/etcd/pkg/logutil/merge_logger.go +++ b/vendor/github.com/coreos/etcd/pkg/logutil/merge_logger.go @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package logutil includes utilities to facilitate logging. package logutil import ( diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/merge_logger_test.go b/vendor/github.com/coreos/etcd/pkg/logutil/merge_logger_test.go index 99e422d9d..10d0e4372 100644 --- a/vendor/github.com/coreos/etcd/pkg/logutil/merge_logger_test.go +++ b/vendor/github.com/coreos/etcd/pkg/logutil/merge_logger_test.go @@ -23,16 +23,12 @@ import ( "github.com/coreos/pkg/capnslog" ) -var ( - testLogger = capnslog.NewPackageLogger("github.com/coreos/etcd", "pkg/logutil") -) - func TestMergeLogger(t *testing.T) { var ( txt = "hello" repeatN = 6 duration = 2049843762 * time.Nanosecond - mg = NewMergeLogger(testLogger) + mg = NewMergeLogger(capnslog.NewPackageLogger("github.com/coreos/etcd", "pkg/logutil")) ) // overwrite this for testing defaultMergePeriod = time.Minute diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/package_logger.go b/vendor/github.com/coreos/etcd/pkg/logutil/package_logger.go new file mode 100644 index 000000000..378bee0e3 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/package_logger.go @@ -0,0 +1,60 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import ( + "github.com/coreos/pkg/capnslog" + "google.golang.org/grpc/grpclog" +) + +// assert that "packageLogger" satisfy "Logger" interface +var _ Logger = &packageLogger{} + +// NewPackageLogger wraps "*capnslog.PackageLogger" that implements "Logger" interface. +// +// For example: +// +// var defaultLogger Logger +// defaultLogger = NewPackageLogger("github.com/coreos/etcd", "snapshot") +// +func NewPackageLogger(repo, pkg string) Logger { + return &packageLogger{p: capnslog.NewPackageLogger(repo, pkg)} +} + +type packageLogger struct { + p *capnslog.PackageLogger +} + +func (l *packageLogger) Info(args ...interface{}) { l.p.Info(args...) } +func (l *packageLogger) Infoln(args ...interface{}) { l.p.Info(args...) } +func (l *packageLogger) Infof(format string, args ...interface{}) { l.p.Infof(format, args...) } +func (l *packageLogger) Warning(args ...interface{}) { l.p.Warning(args...) } +func (l *packageLogger) Warningln(args ...interface{}) { l.p.Warning(args...) } +func (l *packageLogger) Warningf(format string, args ...interface{}) { l.p.Warningf(format, args...) } +func (l *packageLogger) Error(args ...interface{}) { l.p.Error(args...) } +func (l *packageLogger) Errorln(args ...interface{}) { l.p.Error(args...) } +func (l *packageLogger) Errorf(format string, args ...interface{}) { l.p.Errorf(format, args...) } +func (l *packageLogger) Fatal(args ...interface{}) { l.p.Fatal(args...) } +func (l *packageLogger) Fatalln(args ...interface{}) { l.p.Fatal(args...) } +func (l *packageLogger) Fatalf(format string, args ...interface{}) { l.p.Fatalf(format, args...) } +func (l *packageLogger) V(lvl int) bool { + return l.p.LevelAt(capnslog.LogLevel(lvl)) +} +func (l *packageLogger) Lvl(lvl int) grpclog.LoggerV2 { + if l.p.LevelAt(capnslog.LogLevel(lvl)) { + return l + } + return &discardLogger{} +} diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/package_logger_test.go b/vendor/github.com/coreos/etcd/pkg/logutil/package_logger_test.go new file mode 100644 index 000000000..b6ab0052b --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/package_logger_test.go @@ -0,0 +1,59 @@ +// Copyright 2017 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil_test + +import ( + "bytes" + "io/ioutil" + "strings" + "testing" + + "github.com/coreos/etcd/pkg/logutil" + + "github.com/coreos/pkg/capnslog" +) + +func TestPackageLogger(t *testing.T) { + buf := new(bytes.Buffer) + capnslog.SetFormatter(capnslog.NewDefaultFormatter(buf)) + + l := logutil.NewPackageLogger("github.com/coreos/etcd", "logger") + + r := capnslog.MustRepoLogger("github.com/coreos/etcd") + r.SetLogLevel(map[string]capnslog.LogLevel{"logger": capnslog.INFO}) + + l.Infof("hello world!") + if !strings.Contains(buf.String(), "hello world!") { + t.Fatalf("expected 'hello world!', got %q", buf.String()) + } + buf.Reset() + + // capnslog.INFO is 3 + l.Lvl(2).Infof("Level 2") + l.Lvl(5).Infof("Level 5") + if !strings.Contains(buf.String(), "Level 2") { + t.Fatalf("expected 'Level 2', got %q", buf.String()) + } + if strings.Contains(buf.String(), "Level 5") { + t.Fatalf("unexpected 'Level 5', got %q", buf.String()) + } + buf.Reset() + + capnslog.SetFormatter(capnslog.NewDefaultFormatter(ioutil.Discard)) + l.Infof("ignore this") + if len(buf.Bytes()) > 0 { + t.Fatalf("unexpected logs %q", buf.String()) + } +} diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/zap.go b/vendor/github.com/coreos/etcd/pkg/logutil/zap.go new file mode 100644 index 000000000..2f692233a --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/zap.go @@ -0,0 +1,97 @@ +// Copyright 2019 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import ( + "sort" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +// DefaultZapLoggerConfig defines default zap logger configuration. +var DefaultZapLoggerConfig = zap.Config{ + Level: zap.NewAtomicLevelAt(ConvertToZapLevel(DefaultLogLevel)), + + Development: false, + Sampling: &zap.SamplingConfig{ + Initial: 100, + Thereafter: 100, + }, + + Encoding: "json", + + // copied from "zap.NewProductionEncoderConfig" with some updates + EncoderConfig: zapcore.EncoderConfig{ + TimeKey: "ts", + LevelKey: "level", + NameKey: "logger", + CallerKey: "caller", + MessageKey: "msg", + StacktraceKey: "stacktrace", + LineEnding: zapcore.DefaultLineEnding, + EncodeLevel: zapcore.LowercaseLevelEncoder, + EncodeTime: zapcore.ISO8601TimeEncoder, + EncodeDuration: zapcore.StringDurationEncoder, + EncodeCaller: zapcore.ShortCallerEncoder, + }, + + // Use "/dev/null" to discard all + OutputPaths: []string{"stderr"}, + ErrorOutputPaths: []string{"stderr"}, +} + +// AddOutputPaths adds output paths to the existing output paths, resolving conflicts. +func AddOutputPaths(cfg zap.Config, outputPaths, errorOutputPaths []string) zap.Config { + outputs := make(map[string]struct{}) + for _, v := range cfg.OutputPaths { + outputs[v] = struct{}{} + } + for _, v := range outputPaths { + outputs[v] = struct{}{} + } + outputSlice := make([]string, 0) + if _, ok := outputs["/dev/null"]; ok { + // "/dev/null" to discard all + outputSlice = []string{"/dev/null"} + } else { + for k := range outputs { + outputSlice = append(outputSlice, k) + } + } + cfg.OutputPaths = outputSlice + sort.Strings(cfg.OutputPaths) + + errOutputs := make(map[string]struct{}) + for _, v := range cfg.ErrorOutputPaths { + errOutputs[v] = struct{}{} + } + for _, v := range errorOutputPaths { + errOutputs[v] = struct{}{} + } + errOutputSlice := make([]string, 0) + if _, ok := errOutputs["/dev/null"]; ok { + // "/dev/null" to discard all + errOutputSlice = []string{"/dev/null"} + } else { + for k := range errOutputs { + errOutputSlice = append(errOutputSlice, k) + } + } + cfg.ErrorOutputPaths = errOutputSlice + sort.Strings(cfg.ErrorOutputPaths) + + return cfg +} diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/zap_grpc.go b/vendor/github.com/coreos/etcd/pkg/logutil/zap_grpc.go new file mode 100644 index 000000000..3f48d813d --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/zap_grpc.go @@ -0,0 +1,111 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import ( + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "google.golang.org/grpc/grpclog" +) + +// NewGRPCLoggerV2 converts "*zap.Logger" to "grpclog.LoggerV2". +// It discards all INFO level logging in gRPC, if debug level +// is not enabled in "*zap.Logger". +func NewGRPCLoggerV2(lcfg zap.Config) (grpclog.LoggerV2, error) { + lg, err := lcfg.Build(zap.AddCallerSkip(1)) // to annotate caller outside of "logutil" + if err != nil { + return nil, err + } + return &zapGRPCLogger{lg: lg, sugar: lg.Sugar()}, nil +} + +// NewGRPCLoggerV2FromZapCore creates "grpclog.LoggerV2" from "zap.Core" +// and "zapcore.WriteSyncer". It discards all INFO level logging in gRPC, +// if debug level is not enabled in "*zap.Logger". +func NewGRPCLoggerV2FromZapCore(cr zapcore.Core, syncer zapcore.WriteSyncer) grpclog.LoggerV2 { + // "AddCallerSkip" to annotate caller outside of "logutil" + lg := zap.New(cr, zap.AddCaller(), zap.AddCallerSkip(1), zap.ErrorOutput(syncer)) + return &zapGRPCLogger{lg: lg, sugar: lg.Sugar()} +} + +type zapGRPCLogger struct { + lg *zap.Logger + sugar *zap.SugaredLogger +} + +func (zl *zapGRPCLogger) Info(args ...interface{}) { + if !zl.lg.Core().Enabled(zapcore.DebugLevel) { + return + } + zl.sugar.Info(args...) +} + +func (zl *zapGRPCLogger) Infoln(args ...interface{}) { + if !zl.lg.Core().Enabled(zapcore.DebugLevel) { + return + } + zl.sugar.Info(args...) +} + +func (zl *zapGRPCLogger) Infof(format string, args ...interface{}) { + if !zl.lg.Core().Enabled(zapcore.DebugLevel) { + return + } + zl.sugar.Infof(format, args...) +} + +func (zl *zapGRPCLogger) Warning(args ...interface{}) { + zl.sugar.Warn(args...) +} + +func (zl *zapGRPCLogger) Warningln(args ...interface{}) { + zl.sugar.Warn(args...) +} + +func (zl *zapGRPCLogger) Warningf(format string, args ...interface{}) { + zl.sugar.Warnf(format, args...) +} + +func (zl *zapGRPCLogger) Error(args ...interface{}) { + zl.sugar.Error(args...) +} + +func (zl *zapGRPCLogger) Errorln(args ...interface{}) { + zl.sugar.Error(args...) +} + +func (zl *zapGRPCLogger) Errorf(format string, args ...interface{}) { + zl.sugar.Errorf(format, args...) +} + +func (zl *zapGRPCLogger) Fatal(args ...interface{}) { + zl.sugar.Fatal(args...) +} + +func (zl *zapGRPCLogger) Fatalln(args ...interface{}) { + zl.sugar.Fatal(args...) +} + +func (zl *zapGRPCLogger) Fatalf(format string, args ...interface{}) { + zl.sugar.Fatalf(format, args...) +} + +func (zl *zapGRPCLogger) V(l int) bool { + // infoLog == 0 + if l <= 0 { // debug level, then we ignore info level in gRPC + return !zl.lg.Core().Enabled(zapcore.DebugLevel) + } + return true +} diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/zap_grpc_test.go b/vendor/github.com/coreos/etcd/pkg/logutil/zap_grpc_test.go new file mode 100644 index 000000000..9e028cac8 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/zap_grpc_test.go @@ -0,0 +1,91 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strings" + "testing" + "time" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +func TestNewGRPCLoggerV2(t *testing.T) { + logPath := filepath.Join(os.TempDir(), fmt.Sprintf("test-log-%d", time.Now().UnixNano())) + defer os.RemoveAll(logPath) + + lcfg := zap.Config{ + Level: zap.NewAtomicLevelAt(zap.InfoLevel), + Development: false, + Sampling: &zap.SamplingConfig{ + Initial: 100, + Thereafter: 100, + }, + Encoding: "json", + EncoderConfig: DefaultZapLoggerConfig.EncoderConfig, + OutputPaths: []string{logPath}, + ErrorOutputPaths: []string{logPath}, + } + gl, err := NewGRPCLoggerV2(lcfg) + if err != nil { + t.Fatal(err) + } + + // debug level is not enabled, + // so info level gRPC-side logging is discarded + gl.Info("etcd-logutil-1") + data, err := ioutil.ReadFile(logPath) + if err != nil { + t.Fatal(err) + } + if bytes.Contains(data, []byte("etcd-logutil-1")) { + t.Fatalf("unexpected line %q", string(data)) + } + + gl.Warning("etcd-logutil-2") + data, err = ioutil.ReadFile(logPath) + if err != nil { + t.Fatal(err) + } + if !bytes.Contains(data, []byte("etcd-logutil-2")) { + t.Fatalf("can't find data in log %q", string(data)) + } + if !bytes.Contains(data, []byte("logutil/zap_grpc_test.go:")) { + t.Fatalf("unexpected caller; %q", string(data)) + } +} + +func TestNewGRPCLoggerV2FromZapCore(t *testing.T) { + buf := bytes.NewBuffer(nil) + syncer := zapcore.AddSync(buf) + cr := zapcore.NewCore( + zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()), + syncer, + zap.NewAtomicLevelAt(zap.InfoLevel), + ) + + lg := NewGRPCLoggerV2FromZapCore(cr, syncer) + lg.Warning("TestNewGRPCLoggerV2FromZapCore") + txt := buf.String() + if !strings.Contains(txt, "TestNewGRPCLoggerV2FromZapCore") { + t.Fatalf("unexpected log %q", txt) + } +} diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/zap_journal.go b/vendor/github.com/coreos/etcd/pkg/logutil/zap_journal.go new file mode 100644 index 000000000..b1788bc83 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/zap_journal.go @@ -0,0 +1,92 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !windows + +package logutil + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "os" + "path/filepath" + + "github.com/coreos/etcd/pkg/systemd" + + "github.com/coreos/go-systemd/journal" + "go.uber.org/zap/zapcore" +) + +// NewJournalWriter wraps "io.Writer" to redirect log output +// to the local systemd journal. If journald send fails, it fails +// back to writing to the original writer. +// The decode overhead is only <30µs per write. +// Reference: https://github.com/coreos/pkg/blob/master/capnslog/journald_formatter.go +func NewJournalWriter(wr io.Writer) (io.Writer, error) { + return &journalWriter{Writer: wr}, systemd.DialJournal() +} + +type journalWriter struct { + io.Writer +} + +// WARN: assume that etcd uses default field names in zap encoder config +// make sure to keep this up-to-date! +type logLine struct { + Level string `json:"level"` + Caller string `json:"caller"` +} + +func (w *journalWriter) Write(p []byte) (int, error) { + line := &logLine{} + if err := json.NewDecoder(bytes.NewReader(p)).Decode(line); err != nil { + return 0, err + } + + var pri journal.Priority + switch line.Level { + case zapcore.DebugLevel.String(): + pri = journal.PriDebug + case zapcore.InfoLevel.String(): + pri = journal.PriInfo + + case zapcore.WarnLevel.String(): + pri = journal.PriWarning + case zapcore.ErrorLevel.String(): + pri = journal.PriErr + + case zapcore.DPanicLevel.String(): + pri = journal.PriCrit + case zapcore.PanicLevel.String(): + pri = journal.PriCrit + case zapcore.FatalLevel.String(): + pri = journal.PriCrit + + default: + panic(fmt.Errorf("unknown log level: %q", line.Level)) + } + + err := journal.Send(string(p), pri, map[string]string{ + "PACKAGE": filepath.Dir(line.Caller), + "SYSLOG_IDENTIFIER": filepath.Base(os.Args[0]), + }) + if err != nil { + // "journal" also falls back to stderr + // "fmt.Fprintln(os.Stderr, s)" + return w.Writer.Write(p) + } + return 0, nil +} diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/zap_journal_test.go b/vendor/github.com/coreos/etcd/pkg/logutil/zap_journal_test.go new file mode 100644 index 000000000..09e39cb6d --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/zap_journal_test.go @@ -0,0 +1,50 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !windows + +package logutil + +import ( + "bytes" + "testing" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +func TestNewJournalWriter(t *testing.T) { + buf := bytes.NewBuffer(nil) + jw, err := NewJournalWriter(buf) + if err != nil { + t.Skip(err) + } + + syncer := zapcore.AddSync(jw) + + cr := zapcore.NewCore( + zapcore.NewJSONEncoder(DefaultZapLoggerConfig.EncoderConfig), + syncer, + zap.NewAtomicLevelAt(zap.InfoLevel), + ) + + lg := zap.New(cr, zap.AddCaller(), zap.ErrorOutput(syncer)) + defer lg.Sync() + + lg.Info("TestNewJournalWriter") + if buf.String() == "" { + // check with "journalctl -f" + t.Log("sent logs successfully to journald") + } +} diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/zap_raft.go b/vendor/github.com/coreos/etcd/pkg/logutil/zap_raft.go new file mode 100644 index 000000000..012d688d2 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/zap_raft.go @@ -0,0 +1,102 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import ( + "errors" + + "github.com/coreos/etcd/raft" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +// NewRaftLogger builds "raft.Logger" from "*zap.Config". +func NewRaftLogger(lcfg *zap.Config) (raft.Logger, error) { + if lcfg == nil { + return nil, errors.New("nil zap.Config") + } + lg, err := lcfg.Build(zap.AddCallerSkip(1)) // to annotate caller outside of "logutil" + if err != nil { + return nil, err + } + return &zapRaftLogger{lg: lg, sugar: lg.Sugar()}, nil +} + +// NewRaftLoggerZap converts "*zap.Logger" to "raft.Logger". +func NewRaftLoggerZap(lg *zap.Logger) raft.Logger { + return &zapRaftLogger{lg: lg, sugar: lg.Sugar()} +} + +// NewRaftLoggerFromZapCore creates "raft.Logger" from "zap.Core" +// and "zapcore.WriteSyncer". +func NewRaftLoggerFromZapCore(cr zapcore.Core, syncer zapcore.WriteSyncer) raft.Logger { + // "AddCallerSkip" to annotate caller outside of "logutil" + lg := zap.New(cr, zap.AddCaller(), zap.AddCallerSkip(1), zap.ErrorOutput(syncer)) + return &zapRaftLogger{lg: lg, sugar: lg.Sugar()} +} + +type zapRaftLogger struct { + lg *zap.Logger + sugar *zap.SugaredLogger +} + +func (zl *zapRaftLogger) Debug(args ...interface{}) { + zl.sugar.Debug(args...) +} + +func (zl *zapRaftLogger) Debugf(format string, args ...interface{}) { + zl.sugar.Debugf(format, args...) +} + +func (zl *zapRaftLogger) Error(args ...interface{}) { + zl.sugar.Error(args...) +} + +func (zl *zapRaftLogger) Errorf(format string, args ...interface{}) { + zl.sugar.Errorf(format, args...) +} + +func (zl *zapRaftLogger) Info(args ...interface{}) { + zl.sugar.Info(args...) +} + +func (zl *zapRaftLogger) Infof(format string, args ...interface{}) { + zl.sugar.Infof(format, args...) +} + +func (zl *zapRaftLogger) Warning(args ...interface{}) { + zl.sugar.Warn(args...) +} + +func (zl *zapRaftLogger) Warningf(format string, args ...interface{}) { + zl.sugar.Warnf(format, args...) +} + +func (zl *zapRaftLogger) Fatal(args ...interface{}) { + zl.sugar.Fatal(args...) +} + +func (zl *zapRaftLogger) Fatalf(format string, args ...interface{}) { + zl.sugar.Fatalf(format, args...) +} + +func (zl *zapRaftLogger) Panic(args ...interface{}) { + zl.sugar.Panic(args...) +} + +func (zl *zapRaftLogger) Panicf(format string, args ...interface{}) { + zl.sugar.Panicf(format, args...) +} diff --git a/vendor/github.com/coreos/etcd/pkg/logutil/zap_raft_test.go b/vendor/github.com/coreos/etcd/pkg/logutil/zap_raft_test.go new file mode 100644 index 000000000..5724f1916 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/logutil/zap_raft_test.go @@ -0,0 +1,89 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logutil + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strings" + "testing" + "time" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +func TestNewRaftLogger(t *testing.T) { + logPath := filepath.Join(os.TempDir(), fmt.Sprintf("test-log-%d", time.Now().UnixNano())) + defer os.RemoveAll(logPath) + + lcfg := &zap.Config{ + Level: zap.NewAtomicLevelAt(zap.DebugLevel), + Development: false, + Sampling: &zap.SamplingConfig{ + Initial: 100, + Thereafter: 100, + }, + Encoding: "json", + EncoderConfig: DefaultZapLoggerConfig.EncoderConfig, + OutputPaths: []string{logPath}, + ErrorOutputPaths: []string{logPath}, + } + gl, err := NewRaftLogger(lcfg) + if err != nil { + t.Fatal(err) + } + + gl.Info("etcd-logutil-1") + data, err := ioutil.ReadFile(logPath) + if err != nil { + t.Fatal(err) + } + if !bytes.Contains(data, []byte("etcd-logutil-1")) { + t.Fatalf("can't find data in log %q", string(data)) + } + + gl.Warning("etcd-logutil-2") + data, err = ioutil.ReadFile(logPath) + if err != nil { + t.Fatal(err) + } + if !bytes.Contains(data, []byte("etcd-logutil-2")) { + t.Fatalf("can't find data in log %q", string(data)) + } + if !bytes.Contains(data, []byte("logutil/zap_raft_test.go:")) { + t.Fatalf("unexpected caller; %q", string(data)) + } +} + +func TestNewRaftLoggerFromZapCore(t *testing.T) { + buf := bytes.NewBuffer(nil) + syncer := zapcore.AddSync(buf) + cr := zapcore.NewCore( + zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()), + syncer, + zap.NewAtomicLevelAt(zap.InfoLevel), + ) + + lg := NewRaftLoggerFromZapCore(cr, syncer) + lg.Info("TestNewRaftLoggerFromZapCore") + txt := buf.String() + if !strings.Contains(txt, "TestNewRaftLoggerFromZapCore") { + t.Fatalf("unexpected log %q", txt) + } +} diff --git a/vendor/github.com/coreos/etcd/pkg/mock/mockserver/doc.go b/vendor/github.com/coreos/etcd/pkg/mock/mockserver/doc.go new file mode 100644 index 000000000..030b3b2ff --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/mock/mockserver/doc.go @@ -0,0 +1,16 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package mockserver provides mock implementations for etcdserver's server interface. +package mockserver diff --git a/vendor/github.com/coreos/etcd/pkg/mock/mockserver/mockserver.go b/vendor/github.com/coreos/etcd/pkg/mock/mockserver/mockserver.go new file mode 100644 index 000000000..d72b40b45 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/mock/mockserver/mockserver.go @@ -0,0 +1,188 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mockserver + +import ( + "context" + "fmt" + "io/ioutil" + "net" + "os" + "sync" + + pb "github.com/coreos/etcd/etcdserver/etcdserverpb" + + "google.golang.org/grpc" + "google.golang.org/grpc/resolver" +) + +// MockServer provides a mocked out grpc server of the etcdserver interface. +type MockServer struct { + ln net.Listener + Network string + Address string + GrpcServer *grpc.Server +} + +func (ms *MockServer) ResolverAddress() resolver.Address { + switch ms.Network { + case "unix": + return resolver.Address{Addr: fmt.Sprintf("unix://%s", ms.Address)} + case "tcp": + return resolver.Address{Addr: ms.Address} + default: + panic("illegal network type: " + ms.Network) + } +} + +// MockServers provides a cluster of mocket out gprc servers of the etcdserver interface. +type MockServers struct { + mu sync.RWMutex + Servers []*MockServer + wg sync.WaitGroup +} + +// StartMockServers creates the desired count of mock servers +// and starts them. +func StartMockServers(count int) (ms *MockServers, err error) { + return StartMockServersOnNetwork(count, "tcp") +} + +// StartMockServersOnNetwork creates mock servers on either 'tcp' or 'unix' sockets. +func StartMockServersOnNetwork(count int, network string) (ms *MockServers, err error) { + switch network { + case "tcp": + return startMockServersTcp(count) + case "unix": + return startMockServersUnix(count) + default: + return nil, fmt.Errorf("unsupported network type: %s", network) + } +} + +func startMockServersTcp(count int) (ms *MockServers, err error) { + addrs := make([]string, 0, count) + for i := 0; i < count; i++ { + addrs = append(addrs, "localhost:0") + } + return startMockServers("tcp", addrs) +} + +func startMockServersUnix(count int) (ms *MockServers, err error) { + dir := os.TempDir() + addrs := make([]string, 0, count) + for i := 0; i < count; i++ { + f, err := ioutil.TempFile(dir, "etcd-unix-so-") + if err != nil { + return nil, fmt.Errorf("failed to allocate temp file for unix socket: %v", err) + } + fn := f.Name() + err = os.Remove(fn) + if err != nil { + return nil, fmt.Errorf("failed to remove temp file before creating unix socket: %v", err) + } + addrs = append(addrs, fn) + } + return startMockServers("unix", addrs) +} + +func startMockServers(network string, addrs []string) (ms *MockServers, err error) { + ms = &MockServers{ + Servers: make([]*MockServer, len(addrs)), + wg: sync.WaitGroup{}, + } + defer func() { + if err != nil { + ms.Stop() + } + }() + for idx, addr := range addrs { + ln, err := net.Listen(network, addr) + if err != nil { + return nil, fmt.Errorf("failed to listen %v", err) + } + ms.Servers[idx] = &MockServer{ln: ln, Network: network, Address: ln.Addr().String()} + ms.StartAt(idx) + } + return ms, nil +} + +// StartAt restarts mock server at given index. +func (ms *MockServers) StartAt(idx int) (err error) { + ms.mu.Lock() + defer ms.mu.Unlock() + + if ms.Servers[idx].ln == nil { + ms.Servers[idx].ln, err = net.Listen(ms.Servers[idx].Network, ms.Servers[idx].Address) + if err != nil { + return fmt.Errorf("failed to listen %v", err) + } + } + + svr := grpc.NewServer() + pb.RegisterKVServer(svr, &mockKVServer{}) + ms.Servers[idx].GrpcServer = svr + + ms.wg.Add(1) + go func(svr *grpc.Server, l net.Listener) { + svr.Serve(l) + }(ms.Servers[idx].GrpcServer, ms.Servers[idx].ln) + return nil +} + +// StopAt stops mock server at given index. +func (ms *MockServers) StopAt(idx int) { + ms.mu.Lock() + defer ms.mu.Unlock() + + if ms.Servers[idx].ln == nil { + return + } + + ms.Servers[idx].GrpcServer.Stop() + ms.Servers[idx].GrpcServer = nil + ms.Servers[idx].ln = nil + ms.wg.Done() +} + +// Stop stops the mock server, immediately closing all open connections and listeners. +func (ms *MockServers) Stop() { + for idx := range ms.Servers { + ms.StopAt(idx) + } + ms.wg.Wait() +} + +type mockKVServer struct{} + +func (m *mockKVServer) Range(context.Context, *pb.RangeRequest) (*pb.RangeResponse, error) { + return &pb.RangeResponse{}, nil +} + +func (m *mockKVServer) Put(context.Context, *pb.PutRequest) (*pb.PutResponse, error) { + return &pb.PutResponse{}, nil +} + +func (m *mockKVServer) DeleteRange(context.Context, *pb.DeleteRangeRequest) (*pb.DeleteRangeResponse, error) { + return &pb.DeleteRangeResponse{}, nil +} + +func (m *mockKVServer) Txn(context.Context, *pb.TxnRequest) (*pb.TxnResponse, error) { + return &pb.TxnResponse{}, nil +} + +func (m *mockKVServer) Compact(context.Context, *pb.CompactionRequest) (*pb.CompactionResponse, error) { + return &pb.CompactionResponse{}, nil +} diff --git a/vendor/github.com/coreos/etcd/pkg/systemd/doc.go b/vendor/github.com/coreos/etcd/pkg/systemd/doc.go new file mode 100644 index 000000000..30e77ce04 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/systemd/doc.go @@ -0,0 +1,16 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package systemd provides utility functions for systemd. +package systemd diff --git a/vendor/github.com/coreos/etcd/pkg/systemd/journal.go b/vendor/github.com/coreos/etcd/pkg/systemd/journal.go new file mode 100644 index 000000000..b861c6942 --- /dev/null +++ b/vendor/github.com/coreos/etcd/pkg/systemd/journal.go @@ -0,0 +1,29 @@ +// Copyright 2018 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package systemd + +import "net" + +// DialJournal returns no error if the process can dial journal socket. +// Returns an error if dial failed, whichi indicates journald is not available +// (e.g. run embedded etcd as docker daemon). +// Reference: https://github.com/coreos/go-systemd/blob/master/journal/journal.go. +func DialJournal() error { + conn, err := net.Dial("unixgram", "/run/systemd/journal/socket") + if conn != nil { + defer conn.Close() + } + return err +} diff --git a/vendor/github.com/coreos/etcd/e2e/v2v3_test.go b/vendor/github.com/coreos/etcd/pkg/testutil/var.go similarity index 77% rename from vendor/github.com/coreos/etcd/e2e/v2v3_test.go rename to vendor/github.com/coreos/etcd/pkg/testutil/var.go index b9c69466a..0c4c9fc6e 100644 --- a/vendor/github.com/coreos/etcd/e2e/v2v3_test.go +++ b/vendor/github.com/coreos/etcd/pkg/testutil/var.go @@ -1,4 +1,4 @@ -// Copyright 2017 The etcd Authors +// Copyright 2018 The etcd Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// +build v2v3 +package testutil -package e2e +import "time" -func addV2Args(args []string) []string { - return append(args, "--experimental-enable-v2v3", "v2/") -} +var ( + ApplyTimeout = time.Second + RequestTimeout = 3 * time.Second +) diff --git a/vendor/github.com/coreos/etcd/proxy/grpcproxy/cache/store.go b/vendor/github.com/coreos/etcd/proxy/grpcproxy/cache/store.go index 70715e499..89d808adb 100644 --- a/vendor/github.com/coreos/etcd/proxy/grpcproxy/cache/store.go +++ b/vendor/github.com/coreos/etcd/proxy/grpcproxy/cache/store.go @@ -53,6 +53,7 @@ func keyFunc(req *pb.RangeRequest) string { func NewCache(maxCacheEntries int) Cache { return &cache{ lru: lru.New(maxCacheEntries), + cachedRanges: adt.NewIntervalTree(), compactedRev: -1, } } @@ -99,9 +100,12 @@ func (c *cache) Add(req *pb.RangeRequest, resp *pb.RangeResponse) { iv = c.cachedRanges.Find(ivl) if iv == nil { - c.cachedRanges.Insert(ivl, []string{key}) + val := map[string]struct{}{key: {}} + c.cachedRanges.Insert(ivl, val) } else { - iv.Val = append(iv.Val.([]string), key) + val := iv.Val.(map[string]struct{}) + val[key] = struct{}{} + iv.Val = val } } @@ -141,8 +145,8 @@ func (c *cache) Invalidate(key, endkey []byte) { ivs = c.cachedRanges.Stab(ivl) for _, iv := range ivs { - keys := iv.Val.([]string) - for _, key := range keys { + keys := iv.Val.(map[string]struct{}) + for key := range keys { c.lru.Remove(key) } } diff --git a/vendor/github.com/coreos/etcd/proxy/grpcproxy/metrics.go b/vendor/github.com/coreos/etcd/proxy/grpcproxy/metrics.go index 864fa1609..ebb82bb72 100644 --- a/vendor/github.com/coreos/etcd/proxy/grpcproxy/metrics.go +++ b/vendor/github.com/coreos/etcd/proxy/grpcproxy/metrics.go @@ -14,7 +14,17 @@ package grpcproxy -import "github.com/prometheus/client_golang/prometheus" +import ( + "fmt" + "io/ioutil" + "math/rand" + "net/http" + "strings" + "time" + + "github.com/coreos/etcd/etcdserver/api/etcdhttp" + "github.com/prometheus/client_golang/prometheus" +) var ( watchersCoalescing = prometheus.NewGauge(prometheus.GaugeOpts{ @@ -56,3 +66,49 @@ func init() { prometheus.MustRegister(cacheHits) prometheus.MustRegister(cachedMisses) } + +// HandleMetrics performs a GET request against etcd endpoint and returns '/metrics'. +func HandleMetrics(mux *http.ServeMux, c *http.Client, eps []string) { + // random shuffle endpoints + r := rand.New(rand.NewSource(int64(time.Now().Nanosecond()))) + if len(eps) > 1 { + eps = shuffleEndpoints(r, eps) + } + + pathMetrics := etcdhttp.PathMetrics + mux.HandleFunc(pathMetrics, func(w http.ResponseWriter, r *http.Request) { + target := fmt.Sprintf("%s%s", eps[0], pathMetrics) + if !strings.HasPrefix(target, "http") { + scheme := "http" + if r.TLS != nil { + scheme = "https" + } + target = fmt.Sprintf("%s://%s", scheme, target) + } + + resp, err := c.Get(target) + if err != nil { + http.Error(w, "Internal server error", http.StatusInternalServerError) + } + defer resp.Body.Close() + w.Header().Set("Content-Type", "text/plain; version=0.0.4") + body, _ := ioutil.ReadAll(resp.Body) + fmt.Fprintf(w, "%s", body) + }) +} + +func shuffleEndpoints(r *rand.Rand, eps []string) []string { + // copied from Go 1.9<= rand.Rand.Perm + n := len(eps) + p := make([]int, n) + for i := 0; i < n; i++ { + j := r.Intn(i + 1) + p[i] = p[j] + p[j] = i + } + neps := make([]string, n) + for i, k := range p { + neps[i] = eps[k] + } + return neps +} diff --git a/vendor/github.com/coreos/etcd/raft/logger.go b/vendor/github.com/coreos/etcd/raft/logger.go index 92e55b373..426a77d34 100644 --- a/vendor/github.com/coreos/etcd/raft/logger.go +++ b/vendor/github.com/coreos/etcd/raft/logger.go @@ -114,7 +114,7 @@ func (l *DefaultLogger) Fatalf(format string, v ...interface{}) { } func (l *DefaultLogger) Panic(v ...interface{}) { - l.Logger.Panic(v) + l.Logger.Panic(v...) } func (l *DefaultLogger) Panicf(format string, v ...interface{}) { diff --git a/vendor/github.com/coreos/etcd/raft/raft.go b/vendor/github.com/coreos/etcd/raft/raft.go index b4c0f0248..22ff138e9 100644 --- a/vendor/github.com/coreos/etcd/raft/raft.go +++ b/vendor/github.com/coreos/etcd/raft/raft.go @@ -663,6 +663,7 @@ func (r *raft) becomePreCandidate() { r.step = stepCandidate r.votes = make(map[uint64]bool) r.tick = r.tickElection + r.lead = None r.state = StatePreCandidate r.logger.Infof("%x became pre-candidate at term %d", r.id, r.Term) } diff --git a/vendor/github.com/coreos/etcd/raft/raft_test.go b/vendor/github.com/coreos/etcd/raft/raft_test.go index c1cf7cc55..e29bace20 100644 --- a/vendor/github.com/coreos/etcd/raft/raft_test.go +++ b/vendor/github.com/coreos/etcd/raft/raft_test.go @@ -3562,6 +3562,55 @@ func TestPreVoteWithSplitVote(t *testing.T) { } } +// TestPreVoteWithCheckQuorum ensures that after a node become pre-candidate, +// it will checkQuorum correctly. +func TestPreVoteWithCheckQuorum(t *testing.T) { + n1 := newTestRaft(1, []uint64{1, 2, 3}, 10, 1, NewMemoryStorage()) + n2 := newTestRaft(2, []uint64{1, 2, 3}, 10, 1, NewMemoryStorage()) + n3 := newTestRaft(3, []uint64{1, 2, 3}, 10, 1, NewMemoryStorage()) + + n1.becomeFollower(1, None) + n2.becomeFollower(1, None) + n3.becomeFollower(1, None) + + n1.preVote = true + n2.preVote = true + n3.preVote = true + + n1.checkQuorum = true + n2.checkQuorum = true + n3.checkQuorum = true + + nt := newNetwork(n1, n2, n3) + nt.send(pb.Message{From: 1, To: 1, Type: pb.MsgHup}) + + // isolate node 1. node 2 and node 3 have leader info + nt.isolate(1) + + // check state + sm := nt.peers[1].(*raft) + if sm.state != StateLeader { + t.Fatalf("peer 1 state: %s, want %s", sm.state, StateLeader) + } + sm = nt.peers[2].(*raft) + if sm.state != StateFollower { + t.Fatalf("peer 2 state: %s, want %s", sm.state, StateFollower) + } + sm = nt.peers[3].(*raft) + if sm.state != StateFollower { + t.Fatalf("peer 3 state: %s, want %s", sm.state, StateFollower) + } + + // node 2 will ignore node 3's PreVote + nt.send(pb.Message{From: 3, To: 3, Type: pb.MsgHup}) + nt.send(pb.Message{From: 2, To: 2, Type: pb.MsgHup}) + + // Do we have a leader? + if n2.state != StateLeader && n3.state != StateFollower { + t.Errorf("no leader") + } +} + func entsWithConfig(configFunc func(*Config), terms ...uint64) *raft { storage := NewMemoryStorage() for i, term := range terms { diff --git a/vendor/github.com/coreos/etcd/raft/raftpb/raft.pb.go b/vendor/github.com/coreos/etcd/raft/raftpb/raft.pb.go index fd9ee3729..753bd84ac 100644 --- a/vendor/github.com/coreos/etcd/raft/raftpb/raft.pb.go +++ b/vendor/github.com/coreos/etcd/raft/raftpb/raft.pb.go @@ -1,33 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: raft.proto -/* - Package raftpb is a generated protocol buffer package. - - It is generated from these files: - raft.proto - - It has these top-level messages: - Entry - SnapshotMetadata - Snapshot - Message - HardState - ConfState - ConfChange -*/ package raftpb import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - + fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" - - io "io" + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -52,6 +35,7 @@ var EntryType_name = map[int32]string{ 0: "EntryNormal", 1: "EntryConfChange", } + var EntryType_value = map[string]int32{ "EntryNormal": 0, "EntryConfChange": 1, @@ -62,9 +46,11 @@ func (x EntryType) Enum() *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 { @@ -73,7 +59,10 @@ func (x *EntryType) UnmarshalJSON(data []byte) error { *x = EntryType(value) return nil } -func (EntryType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaft, []int{0} } + +func (EntryType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b042552c306ae59b, []int{0} +} type MessageType int32 @@ -120,6 +109,7 @@ var MessageType_name = map[int32]string{ 17: "MsgPreVote", 18: "MsgPreVoteResp", } + var MessageType_value = map[string]int32{ "MsgHup": 0, "MsgBeat": 1, @@ -147,9 +137,11 @@ func (x MessageType) Enum() *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 { @@ -158,7 +150,10 @@ func (x *MessageType) UnmarshalJSON(data []byte) error { *x = MessageType(value) return nil } -func (MessageType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaft, []int{1} } + +func (MessageType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b042552c306ae59b, []int{1} +} type ConfChangeType int32 @@ -175,6 +170,7 @@ var ConfChangeType_name = map[int32]string{ 2: "ConfChangeUpdateNode", 3: "ConfChangeAddLearnerNode", } + var ConfChangeType_value = map[string]int32{ "ConfChangeAddNode": 0, "ConfChangeRemoveNode": 1, @@ -187,9 +183,11 @@ func (x ConfChangeType) Enum() *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 { @@ -198,102 +196,318 @@ func (x *ConfChangeType) UnmarshalJSON(data []byte) error { *x = ConfChangeType(value) return nil } -func (ConfChangeType) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaft, []int{2} } + +func (ConfChangeType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b042552c306ae59b, []int{2} +} type Entry struct { - Term uint64 `protobuf:"varint,2,opt,name=Term" json:"Term"` - Index uint64 `protobuf:"varint,3,opt,name=Index" json:"Index"` - Type EntryType `protobuf:"varint,1,opt,name=Type,enum=raftpb.EntryType" json:"Type"` - Data []byte `protobuf:"bytes,4,opt,name=Data" json:"Data,omitempty"` - XXX_unrecognized []byte `json:"-"` + Term uint64 `protobuf:"varint,2,opt,name=Term" json:"Term"` + Index uint64 `protobuf:"varint,3,opt,name=Index" json:"Index"` + Type EntryType `protobuf:"varint,1,opt,name=Type,enum=raftpb.EntryType" json:"Type"` + Data []byte `protobuf:"bytes,4,opt,name=Data" json:"Data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptorRaft, []int{0} } +func (m *Entry) Reset() { *m = Entry{} } +func (m *Entry) String() string { return proto.CompactTextString(m) } +func (*Entry) ProtoMessage() {} +func (*Entry) Descriptor() ([]byte, []int) { + return fileDescriptor_b042552c306ae59b, []int{0} +} +func (m *Entry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Entry.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Entry) XXX_Merge(src proto.Message) { + xxx_messageInfo_Entry.Merge(m, src) +} +func (m *Entry) XXX_Size() int { + return m.Size() +} +func (m *Entry) XXX_DiscardUnknown() { + xxx_messageInfo_Entry.DiscardUnknown(m) +} + +var xxx_messageInfo_Entry proto.InternalMessageInfo type SnapshotMetadata struct { - ConfState ConfState `protobuf:"bytes,1,opt,name=conf_state,json=confState" json:"conf_state"` - Index uint64 `protobuf:"varint,2,opt,name=index" json:"index"` - Term uint64 `protobuf:"varint,3,opt,name=term" json:"term"` - XXX_unrecognized []byte `json:"-"` + ConfState ConfState `protobuf:"bytes,1,opt,name=conf_state,json=confState" json:"conf_state"` + Index uint64 `protobuf:"varint,2,opt,name=index" json:"index"` + Term uint64 `protobuf:"varint,3,opt,name=term" json:"term"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptorRaft, []int{1} } +func (m *SnapshotMetadata) Reset() { *m = SnapshotMetadata{} } +func (m *SnapshotMetadata) String() string { return proto.CompactTextString(m) } +func (*SnapshotMetadata) ProtoMessage() {} +func (*SnapshotMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_b042552c306ae59b, []int{1} +} +func (m *SnapshotMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SnapshotMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SnapshotMetadata.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SnapshotMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_SnapshotMetadata.Merge(m, src) +} +func (m *SnapshotMetadata) XXX_Size() int { + return m.Size() +} +func (m *SnapshotMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_SnapshotMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_SnapshotMetadata proto.InternalMessageInfo type Snapshot struct { - Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` - Metadata SnapshotMetadata `protobuf:"bytes,2,opt,name=metadata" json:"metadata"` - XXX_unrecognized []byte `json:"-"` + Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` + Metadata SnapshotMetadata `protobuf:"bytes,2,opt,name=metadata" json:"metadata"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptorRaft, []int{2} } +func (m *Snapshot) Reset() { *m = Snapshot{} } +func (m *Snapshot) String() string { return proto.CompactTextString(m) } +func (*Snapshot) ProtoMessage() {} +func (*Snapshot) Descriptor() ([]byte, []int) { + return fileDescriptor_b042552c306ae59b, []int{2} +} +func (m *Snapshot) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Snapshot.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Snapshot) XXX_Merge(src proto.Message) { + xxx_messageInfo_Snapshot.Merge(m, src) +} +func (m *Snapshot) XXX_Size() int { + return m.Size() +} +func (m *Snapshot) XXX_DiscardUnknown() { + xxx_messageInfo_Snapshot.DiscardUnknown(m) +} + +var xxx_messageInfo_Snapshot proto.InternalMessageInfo type Message struct { - Type MessageType `protobuf:"varint,1,opt,name=type,enum=raftpb.MessageType" json:"type"` - To uint64 `protobuf:"varint,2,opt,name=to" json:"to"` - From uint64 `protobuf:"varint,3,opt,name=from" json:"from"` - Term uint64 `protobuf:"varint,4,opt,name=term" json:"term"` - LogTerm uint64 `protobuf:"varint,5,opt,name=logTerm" json:"logTerm"` - Index uint64 `protobuf:"varint,6,opt,name=index" json:"index"` - Entries []Entry `protobuf:"bytes,7,rep,name=entries" json:"entries"` - Commit uint64 `protobuf:"varint,8,opt,name=commit" json:"commit"` - Snapshot Snapshot `protobuf:"bytes,9,opt,name=snapshot" json:"snapshot"` - Reject bool `protobuf:"varint,10,opt,name=reject" json:"reject"` - RejectHint uint64 `protobuf:"varint,11,opt,name=rejectHint" json:"rejectHint"` - 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 fileDescriptorRaft, []int{3} } + Type MessageType `protobuf:"varint,1,opt,name=type,enum=raftpb.MessageType" json:"type"` + To uint64 `protobuf:"varint,2,opt,name=to" json:"to"` + From uint64 `protobuf:"varint,3,opt,name=from" json:"from"` + Term uint64 `protobuf:"varint,4,opt,name=term" json:"term"` + LogTerm uint64 `protobuf:"varint,5,opt,name=logTerm" json:"logTerm"` + Index uint64 `protobuf:"varint,6,opt,name=index" json:"index"` + Entries []Entry `protobuf:"bytes,7,rep,name=entries" json:"entries"` + Commit uint64 `protobuf:"varint,8,opt,name=commit" json:"commit"` + Snapshot Snapshot `protobuf:"bytes,9,opt,name=snapshot" json:"snapshot"` + Reject bool `protobuf:"varint,10,opt,name=reject" json:"reject"` + RejectHint uint64 `protobuf:"varint,11,opt,name=rejectHint" json:"rejectHint"` + Context []byte `protobuf:"bytes,12,opt,name=context" json:"context,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptor_b042552c306ae59b, []int{3} +} +func (m *Message) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Message.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_Message.Merge(m, src) +} +func (m *Message) XXX_Size() int { + return m.Size() +} +func (m *Message) XXX_DiscardUnknown() { + xxx_messageInfo_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_Message proto.InternalMessageInfo type HardState struct { - Term uint64 `protobuf:"varint,1,opt,name=term" json:"term"` - Vote uint64 `protobuf:"varint,2,opt,name=vote" json:"vote"` - Commit uint64 `protobuf:"varint,3,opt,name=commit" json:"commit"` - XXX_unrecognized []byte `json:"-"` + Term uint64 `protobuf:"varint,1,opt,name=term" json:"term"` + Vote uint64 `protobuf:"varint,2,opt,name=vote" json:"vote"` + Commit uint64 `protobuf:"varint,3,opt,name=commit" json:"commit"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptorRaft, []int{4} } +func (m *HardState) Reset() { *m = HardState{} } +func (m *HardState) String() string { return proto.CompactTextString(m) } +func (*HardState) ProtoMessage() {} +func (*HardState) Descriptor() ([]byte, []int) { + return fileDescriptor_b042552c306ae59b, []int{4} +} +func (m *HardState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HardState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HardState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HardState) XXX_Merge(src proto.Message) { + xxx_messageInfo_HardState.Merge(m, src) +} +func (m *HardState) XXX_Size() int { + return m.Size() +} +func (m *HardState) XXX_DiscardUnknown() { + xxx_messageInfo_HardState.DiscardUnknown(m) +} + +var xxx_messageInfo_HardState proto.InternalMessageInfo type ConfState struct { - Nodes []uint64 `protobuf:"varint,1,rep,name=nodes" json:"nodes,omitempty"` - Learners []uint64 `protobuf:"varint,2,rep,name=learners" json:"learners,omitempty"` - XXX_unrecognized []byte `json:"-"` + Nodes []uint64 `protobuf:"varint,1,rep,name=nodes" json:"nodes,omitempty"` + Learners []uint64 `protobuf:"varint,2,rep,name=learners" json:"learners,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptorRaft, []int{5} } +func (m *ConfState) Reset() { *m = ConfState{} } +func (m *ConfState) String() string { return proto.CompactTextString(m) } +func (*ConfState) ProtoMessage() {} +func (*ConfState) Descriptor() ([]byte, []int) { + return fileDescriptor_b042552c306ae59b, []int{5} +} +func (m *ConfState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConfState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConfState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConfState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfState.Merge(m, src) +} +func (m *ConfState) XXX_Size() int { + return m.Size() +} +func (m *ConfState) XXX_DiscardUnknown() { + xxx_messageInfo_ConfState.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfState proto.InternalMessageInfo type ConfChange struct { - ID uint64 `protobuf:"varint,1,opt,name=ID" json:"ID"` - Type ConfChangeType `protobuf:"varint,2,opt,name=Type,enum=raftpb.ConfChangeType" json:"Type"` - NodeID uint64 `protobuf:"varint,3,opt,name=NodeID" json:"NodeID"` - Context []byte `protobuf:"bytes,4,opt,name=Context" json:"Context,omitempty"` - XXX_unrecognized []byte `json:"-"` + ID uint64 `protobuf:"varint,1,opt,name=ID" json:"ID"` + Type ConfChangeType `protobuf:"varint,2,opt,name=Type,enum=raftpb.ConfChangeType" json:"Type"` + NodeID uint64 `protobuf:"varint,3,opt,name=NodeID" json:"NodeID"` + Context []byte `protobuf:"bytes,4,opt,name=Context" json:"Context,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptor_b042552c306ae59b, []int{6} +} +func (m *ConfChange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConfChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConfChange.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConfChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfChange.Merge(m, src) +} +func (m *ConfChange) XXX_Size() int { + return m.Size() +} +func (m *ConfChange) XXX_DiscardUnknown() { + xxx_messageInfo_ConfChange.DiscardUnknown(m) } -func (m *ConfChange) Reset() { *m = ConfChange{} } -func (m *ConfChange) String() string { return proto.CompactTextString(m) } -func (*ConfChange) ProtoMessage() {} -func (*ConfChange) Descriptor() ([]byte, []int) { return fileDescriptorRaft, []int{6} } +var xxx_messageInfo_ConfChange proto.InternalMessageInfo func init() { + proto.RegisterEnum("raftpb.EntryType", EntryType_name, EntryType_value) + proto.RegisterEnum("raftpb.MessageType", MessageType_name, MessageType_value) + proto.RegisterEnum("raftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value) proto.RegisterType((*Entry)(nil), "raftpb.Entry") proto.RegisterType((*SnapshotMetadata)(nil), "raftpb.SnapshotMetadata") proto.RegisterType((*Snapshot)(nil), "raftpb.Snapshot") @@ -301,14 +515,69 @@ func init() { proto.RegisterType((*HardState)(nil), "raftpb.HardState") proto.RegisterType((*ConfState)(nil), "raftpb.ConfState") proto.RegisterType((*ConfChange)(nil), "raftpb.ConfChange") - proto.RegisterEnum("raftpb.EntryType", EntryType_name, EntryType_value) - proto.RegisterEnum("raftpb.MessageType", MessageType_name, MessageType_value) - proto.RegisterEnum("raftpb.ConfChangeType", ConfChangeType_name, ConfChangeType_value) } + +func init() { proto.RegisterFile("raft.proto", fileDescriptor_b042552c306ae59b) } + +var fileDescriptor_b042552c306ae59b = []byte{ + // 816 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x54, 0xcd, 0x6e, 0x23, 0x45, + 0x10, 0xf6, 0x8c, 0xc7, 0x7f, 0x35, 0x8e, 0xd3, 0xa9, 0x35, 0xa8, 0x15, 0x45, 0xc6, 0xb2, 0x38, + 0x58, 0x41, 0x1b, 0x20, 0x07, 0x0e, 0x48, 0x1c, 0x36, 0x09, 0x52, 0x22, 0xad, 0xa3, 0xc5, 0x9b, + 0xe5, 0x80, 0x84, 0x50, 0xc7, 0x53, 0x9e, 0x18, 0x32, 0xd3, 0xa3, 0x9e, 0xf6, 0xb2, 0xb9, 0x20, + 0x1e, 0x80, 0x07, 0xe0, 0xc2, 0xfb, 0xe4, 0xb8, 0x12, 0x77, 0xc4, 0x86, 0x17, 0x41, 0xdd, 0xd3, + 0x63, 0xcf, 0x24, 0xb7, 0xae, 0xaf, 0x6a, 0xbe, 0xfa, 0xbe, 0xea, 0xea, 0x01, 0x50, 0x62, 0xa9, + 0x8f, 0x32, 0x25, 0xb5, 0xc4, 0xb6, 0x39, 0x67, 0xd7, 0xfb, 0xc3, 0x58, 0xc6, 0xd2, 0x42, 0x9f, + 0x9b, 0x53, 0x91, 0x9d, 0xfc, 0x06, 0xad, 0x6f, 0x53, 0xad, 0xee, 0x90, 0x43, 0x70, 0x45, 0x2a, + 0xe1, 0xfe, 0xd8, 0x9b, 0x06, 0x27, 0xc1, 0xfd, 0x3f, 0x9f, 0x34, 0xe6, 0x16, 0xc1, 0x7d, 0x68, + 0x5d, 0xa4, 0x11, 0xbd, 0xe3, 0xcd, 0x4a, 0xaa, 0x80, 0xf0, 0x33, 0x08, 0xae, 0xee, 0x32, 0xe2, + 0xde, 0xd8, 0x9b, 0x0e, 0x8e, 0xf7, 0x8e, 0x8a, 0x5e, 0x47, 0x96, 0xd2, 0x24, 0x36, 0x44, 0x77, + 0x19, 0x21, 0x42, 0x70, 0x26, 0xb4, 0xe0, 0xc1, 0xd8, 0x9b, 0xf6, 0xe7, 0xf6, 0x3c, 0xf9, 0xdd, + 0x03, 0xf6, 0x3a, 0x15, 0x59, 0x7e, 0x23, 0xf5, 0x8c, 0xb4, 0x88, 0x84, 0x16, 0xf8, 0x15, 0xc0, + 0x42, 0xa6, 0xcb, 0x9f, 0x72, 0x2d, 0x74, 0xc1, 0x1d, 0x6e, 0xb9, 0x4f, 0x65, 0xba, 0x7c, 0x6d, + 0x12, 0x8e, 0xbb, 0xb7, 0x28, 0x01, 0xa3, 0x74, 0x65, 0x95, 0x56, 0x4d, 0x14, 0x90, 0xf1, 0xa7, + 0x8d, 0xbf, 0xaa, 0x09, 0x8b, 0x4c, 0x7e, 0x80, 0x6e, 0xa9, 0xc0, 0x48, 0x34, 0x0a, 0x6c, 0xcf, + 0xfe, 0xdc, 0x9e, 0xf1, 0x6b, 0xe8, 0x26, 0x4e, 0x99, 0x25, 0x0e, 0x8f, 0x79, 0xa9, 0xe5, 0xb1, + 0x72, 0xc7, 0xbb, 0xa9, 0x9f, 0xfc, 0xd5, 0x84, 0xce, 0x8c, 0xf2, 0x5c, 0xc4, 0x84, 0xcf, 0x21, + 0xd0, 0xdb, 0x59, 0x3d, 0x2b, 0x39, 0x5c, 0xba, 0x3a, 0x2d, 0x53, 0x86, 0x43, 0xf0, 0xb5, 0xac, + 0x39, 0xf1, 0xb5, 0x34, 0x36, 0x96, 0x4a, 0x3e, 0xb2, 0x61, 0x90, 0x8d, 0xc1, 0xe0, 0xb1, 0x41, + 0x1c, 0x41, 0xe7, 0x56, 0xc6, 0xf6, 0x76, 0x5b, 0x95, 0x64, 0x09, 0x6e, 0xc7, 0xd6, 0x7e, 0x3a, + 0xb6, 0xe7, 0xd0, 0xa1, 0x54, 0xab, 0x15, 0xe5, 0xbc, 0x33, 0x6e, 0x4e, 0xc3, 0xe3, 0x9d, 0xda, + 0x1d, 0x97, 0x54, 0xae, 0x06, 0x0f, 0xa0, 0xbd, 0x90, 0x49, 0xb2, 0xd2, 0xbc, 0x5b, 0xe1, 0x72, + 0x18, 0x1e, 0x43, 0x37, 0x77, 0x13, 0xe3, 0x3d, 0x3b, 0x49, 0xf6, 0x78, 0x92, 0xe5, 0x04, 0xcb, + 0x3a, 0xc3, 0xa8, 0xe8, 0x67, 0x5a, 0x68, 0x0e, 0x63, 0x6f, 0xda, 0x2d, 0x19, 0x0b, 0x0c, 0x3f, + 0x05, 0x28, 0x4e, 0xe7, 0xab, 0x54, 0xf3, 0xb0, 0xd2, 0xb3, 0x82, 0x23, 0x87, 0xce, 0x42, 0xa6, + 0x9a, 0xde, 0x69, 0xde, 0xb7, 0x17, 0x5b, 0x86, 0x93, 0x1f, 0xa1, 0x77, 0x2e, 0x54, 0x54, 0xac, + 0x4f, 0x39, 0x41, 0xef, 0xc9, 0x04, 0x39, 0x04, 0x6f, 0xa5, 0xa6, 0xfa, 0xe3, 0x30, 0x48, 0xc5, + 0x70, 0xf3, 0xa9, 0xe1, 0xc9, 0x37, 0xd0, 0xdb, 0xac, 0x2b, 0x0e, 0xa1, 0x95, 0xca, 0x88, 0x72, + 0xee, 0x8d, 0x9b, 0xd3, 0x60, 0x5e, 0x04, 0xb8, 0x0f, 0xdd, 0x5b, 0x12, 0x2a, 0x25, 0x95, 0x73, + 0xdf, 0x26, 0x36, 0xf1, 0xe4, 0x0f, 0x0f, 0xc0, 0x7c, 0x7f, 0x7a, 0x23, 0xd2, 0xd8, 0x6e, 0xc4, + 0xc5, 0x59, 0x4d, 0x9d, 0x7f, 0x71, 0x86, 0x5f, 0xb8, 0x27, 0xe8, 0xdb, 0xb5, 0xfa, 0xb8, 0xfa, + 0x4c, 0x8a, 0xef, 0x9e, 0xbc, 0xc3, 0x03, 0x68, 0x5f, 0xca, 0x88, 0x2e, 0xce, 0xea, 0x9a, 0x0b, + 0xcc, 0x0c, 0xeb, 0xd4, 0x0d, 0xab, 0x78, 0xa8, 0x65, 0x78, 0xf8, 0x25, 0xf4, 0x36, 0x0f, 0x1b, + 0x77, 0x21, 0xb4, 0xc1, 0xa5, 0x54, 0x89, 0xb8, 0x65, 0x0d, 0x7c, 0x06, 0xbb, 0x16, 0xd8, 0x36, + 0x66, 0xde, 0xe1, 0xdf, 0x3e, 0x84, 0x95, 0x05, 0x47, 0x80, 0xf6, 0x2c, 0x8f, 0xcf, 0xd7, 0x19, + 0x6b, 0x60, 0x08, 0x9d, 0x59, 0x1e, 0x9f, 0x90, 0xd0, 0xcc, 0x73, 0xc1, 0x2b, 0x25, 0x33, 0xe6, + 0xbb, 0xaa, 0x17, 0x59, 0xc6, 0x9a, 0x38, 0x00, 0x28, 0xce, 0x73, 0xca, 0x33, 0x16, 0xb8, 0xc2, + 0xef, 0xa5, 0x26, 0xd6, 0x32, 0x22, 0x5c, 0x60, 0xb3, 0x6d, 0x97, 0x35, 0xcb, 0xc4, 0x3a, 0xc8, + 0xa0, 0x6f, 0x9a, 0x91, 0x50, 0xfa, 0xda, 0x74, 0xe9, 0xe2, 0x10, 0x58, 0x15, 0xb1, 0x1f, 0xf5, + 0x10, 0x61, 0x30, 0xcb, 0xe3, 0x37, 0xa9, 0x22, 0xb1, 0xb8, 0x11, 0xd7, 0xb7, 0xc4, 0x00, 0xf7, + 0x60, 0xc7, 0x11, 0x99, 0xcb, 0x5b, 0xe7, 0x2c, 0x74, 0x65, 0xa7, 0x37, 0xb4, 0xf8, 0xe5, 0xbb, + 0xb5, 0x54, 0xeb, 0x84, 0xf5, 0xf1, 0x23, 0xd8, 0x9b, 0xe5, 0xf1, 0x95, 0x12, 0x69, 0xbe, 0x24, + 0xf5, 0x92, 0x44, 0x44, 0x8a, 0xed, 0xb8, 0xaf, 0xaf, 0x56, 0x09, 0xc9, 0xb5, 0xbe, 0x94, 0xbf, + 0xb2, 0x81, 0x13, 0x33, 0x27, 0x11, 0xd9, 0x3f, 0x27, 0xdb, 0x75, 0x62, 0x36, 0x88, 0x15, 0xc3, + 0x9c, 0xdf, 0x57, 0x8a, 0xac, 0xc5, 0x3d, 0xd7, 0xd5, 0xc5, 0xb6, 0x06, 0x0f, 0xef, 0x60, 0x50, + 0xbf, 0x5e, 0xa3, 0x63, 0x8b, 0xbc, 0x88, 0x22, 0x73, 0x97, 0xac, 0x81, 0x1c, 0x86, 0x5b, 0x78, + 0x4e, 0x89, 0x7c, 0x4b, 0x36, 0xe3, 0xd5, 0x33, 0x6f, 0xb2, 0x48, 0xe8, 0x22, 0xe3, 0xe3, 0x01, + 0xf0, 0x1a, 0xd5, 0xcb, 0x62, 0x1b, 0x6d, 0xb6, 0x79, 0xc2, 0xef, 0x3f, 0x8c, 0x1a, 0xef, 0x3f, + 0x8c, 0x1a, 0xf7, 0x0f, 0x23, 0xef, 0xfd, 0xc3, 0xc8, 0xfb, 0xf7, 0x61, 0xe4, 0xfd, 0xf9, 0xdf, + 0xa8, 0xf1, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x30, 0xe1, 0x02, 0x69, 0x74, 0x06, 0x00, 0x00, +} + func (m *Entry) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -316,35 +585,42 @@ func (m *Entry) Marshal() (dAtA []byte, err error) { } func (m *Entry) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Type)) - dAtA[i] = 0x10 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Term)) - dAtA[i] = 0x18 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Index)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Data != nil { - dAtA[i] = 0x22 - i++ + i -= len(m.Data) + copy(dAtA[i:], m.Data) i = encodeVarintRaft(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x22 } - return i, nil + i = encodeVarintRaft(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x18 + i = encodeVarintRaft(dAtA, i, uint64(m.Term)) + i-- + dAtA[i] = 0x10 + i = encodeVarintRaft(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil } func (m *SnapshotMetadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -352,34 +628,42 @@ func (m *SnapshotMetadata) Marshal() (dAtA []byte, err error) { } func (m *SnapshotMetadata) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SnapshotMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.ConfState.Size())) - n1, err := m.ConfState.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - i += n1 - dAtA[i] = 0x10 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Index)) - dAtA[i] = 0x18 - i++ i = encodeVarintRaft(dAtA, i, uint64(m.Term)) - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x18 + i = encodeVarintRaft(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x10 + { + size, err := m.ConfState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaft(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *Snapshot) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -387,34 +671,43 @@ func (m *Snapshot) Marshal() (dAtA []byte, err error) { } func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Data != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRaft(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - dAtA[i] = 0x12 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Metadata.Size())) - n2, err := m.Metadata.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaft(dAtA, i, uint64(size)) } - i += n2 - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 + if m.Data != nil { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintRaft(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Message) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -422,78 +715,89 @@ func (m *Message) Marshal() (dAtA []byte, err error) { } func (m *Message) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Type)) - dAtA[i] = 0x10 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.To)) - dAtA[i] = 0x18 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.From)) - dAtA[i] = 0x20 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Term)) - dAtA[i] = 0x28 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.LogTerm)) - dAtA[i] = 0x30 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Index)) - if len(m.Entries) > 0 { - for _, msg := range m.Entries { - dAtA[i] = 0x3a - i++ - i = encodeVarintRaft(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 -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - dAtA[i] = 0x40 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Commit)) - dAtA[i] = 0x4a - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Snapshot.Size())) - n3, err := m.Snapshot.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Context != nil { + i -= len(m.Context) + copy(dAtA[i:], m.Context) + i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) + i-- + dAtA[i] = 0x62 } - i += n3 - dAtA[i] = 0x50 - i++ + i = encodeVarintRaft(dAtA, i, uint64(m.RejectHint)) + i-- + dAtA[i] = 0x58 + i-- if m.Reject { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ - dAtA[i] = 0x58 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.RejectHint)) - if m.Context != nil { - dAtA[i] = 0x62 - i++ - i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) - i += copy(dAtA[i:], m.Context) + i-- + dAtA[i] = 0x50 + { + size, err := m.Snapshot.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaft(dAtA, i, uint64(size)) } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x4a + i = encodeVarintRaft(dAtA, i, uint64(m.Commit)) + i-- + dAtA[i] = 0x40 + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRaft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } } - return i, nil + i = encodeVarintRaft(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x30 + i = encodeVarintRaft(dAtA, i, uint64(m.LogTerm)) + i-- + dAtA[i] = 0x28 + i = encodeVarintRaft(dAtA, i, uint64(m.Term)) + i-- + dAtA[i] = 0x20 + i = encodeVarintRaft(dAtA, i, uint64(m.From)) + i-- + dAtA[i] = 0x18 + i = encodeVarintRaft(dAtA, i, uint64(m.To)) + i-- + dAtA[i] = 0x10 + i = encodeVarintRaft(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil } func (m *HardState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -501,29 +805,35 @@ func (m *HardState) Marshal() (dAtA []byte, err error) { } func (m *HardState) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HardState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Term)) - dAtA[i] = 0x10 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Vote)) - dAtA[i] = 0x18 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Commit)) if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + i = encodeVarintRaft(dAtA, i, uint64(m.Commit)) + i-- + dAtA[i] = 0x18 + i = encodeVarintRaft(dAtA, i, uint64(m.Vote)) + i-- + dAtA[i] = 0x10 + i = encodeVarintRaft(dAtA, i, uint64(m.Term)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil } func (m *ConfState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -531,34 +841,40 @@ func (m *ConfState) Marshal() (dAtA []byte, err error) { } func (m *ConfState) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConfState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Nodes) > 0 { - for _, num := range m.Nodes { - dAtA[i] = 0x8 - i++ - i = encodeVarintRaft(dAtA, i, uint64(num)) - } + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Learners) > 0 { - for _, num := range m.Learners { + for iNdEx := len(m.Learners) - 1; iNdEx >= 0; iNdEx-- { + i = encodeVarintRaft(dAtA, i, uint64(m.Learners[iNdEx])) + i-- dAtA[i] = 0x10 - i++ - i = encodeVarintRaft(dAtA, i, uint64(num)) } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Nodes) > 0 { + for iNdEx := len(m.Nodes) - 1; iNdEx >= 0; iNdEx-- { + i = encodeVarintRaft(dAtA, i, uint64(m.Nodes[iNdEx])) + i-- + dAtA[i] = 0x8 + } } - return i, nil + return len(dAtA) - i, nil } func (m *ConfChange) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -566,41 +882,53 @@ func (m *ConfChange) Marshal() (dAtA []byte, err error) { } func (m *ConfChange) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConfChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.ID)) - dAtA[i] = 0x10 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.Type)) - dAtA[i] = 0x18 - i++ - i = encodeVarintRaft(dAtA, i, uint64(m.NodeID)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Context != nil { - dAtA[i] = 0x22 - i++ + i -= len(m.Context) + copy(dAtA[i:], m.Context) i = encodeVarintRaft(dAtA, i, uint64(len(m.Context))) - i += copy(dAtA[i:], m.Context) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x22 } - return i, nil + i = encodeVarintRaft(dAtA, i, uint64(m.NodeID)) + i-- + dAtA[i] = 0x18 + i = encodeVarintRaft(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x10 + i = encodeVarintRaft(dAtA, i, uint64(m.ID)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil } func encodeVarintRaft(dAtA []byte, offset int, v uint64) int { + offset -= sovRaft(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Entry) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovRaft(uint64(m.Type)) @@ -617,6 +945,9 @@ func (m *Entry) Size() (n int) { } func (m *SnapshotMetadata) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = m.ConfState.Size() @@ -630,6 +961,9 @@ func (m *SnapshotMetadata) Size() (n int) { } func (m *Snapshot) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Data != nil { @@ -645,6 +979,9 @@ func (m *Snapshot) Size() (n int) { } func (m *Message) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovRaft(uint64(m.Type)) @@ -675,6 +1012,9 @@ func (m *Message) Size() (n int) { } func (m *HardState) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovRaft(uint64(m.Term)) @@ -687,6 +1027,9 @@ func (m *HardState) Size() (n int) { } func (m *ConfState) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if len(m.Nodes) > 0 { @@ -706,6 +1049,9 @@ func (m *ConfState) Size() (n int) { } func (m *ConfChange) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovRaft(uint64(m.ID)) @@ -722,14 +1068,7 @@ func (m *ConfChange) Size() (n int) { } func sovRaft(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRaft(x uint64) (n int) { return sovRaft(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -749,7 +1088,7 @@ func (m *Entry) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -777,7 +1116,7 @@ func (m *Entry) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= (EntryType(b) & 0x7F) << shift + m.Type |= EntryType(b&0x7F) << shift if b < 0x80 { break } @@ -796,7 +1135,7 @@ func (m *Entry) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Term |= (uint64(b) & 0x7F) << shift + m.Term |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -815,7 +1154,7 @@ func (m *Entry) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Index |= (uint64(b) & 0x7F) << shift + m.Index |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -834,7 +1173,7 @@ func (m *Entry) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -843,6 +1182,9 @@ func (m *Entry) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaft } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRaft + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -860,6 +1202,9 @@ func (m *Entry) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaft } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaft + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -888,7 +1233,7 @@ func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -916,7 +1261,7 @@ func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -925,6 +1270,9 @@ func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaft } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaft + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -946,7 +1294,7 @@ func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Index |= (uint64(b) & 0x7F) << shift + m.Index |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -965,7 +1313,7 @@ func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Term |= (uint64(b) & 0x7F) << shift + m.Term |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -979,6 +1327,9 @@ func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaft } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaft + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1007,7 +1358,7 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1035,7 +1386,7 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1044,6 +1395,9 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaft } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRaft + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1066,7 +1420,7 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1075,6 +1429,9 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaft } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaft + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1091,6 +1448,9 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaft } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaft + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1119,7 +1479,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1147,7 +1507,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= (MessageType(b) & 0x7F) << shift + m.Type |= MessageType(b&0x7F) << shift if b < 0x80 { break } @@ -1166,7 +1526,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.To |= (uint64(b) & 0x7F) << shift + m.To |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1185,7 +1545,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.From |= (uint64(b) & 0x7F) << shift + m.From |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1204,7 +1564,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Term |= (uint64(b) & 0x7F) << shift + m.Term |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1223,7 +1583,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LogTerm |= (uint64(b) & 0x7F) << shift + m.LogTerm |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1242,7 +1602,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Index |= (uint64(b) & 0x7F) << shift + m.Index |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1261,7 +1621,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1270,6 +1630,9 @@ func (m *Message) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaft } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaft + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1292,7 +1655,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Commit |= (uint64(b) & 0x7F) << shift + m.Commit |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1311,7 +1674,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1320,6 +1683,9 @@ func (m *Message) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaft } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRaft + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1341,7 +1707,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1361,7 +1727,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RejectHint |= (uint64(b) & 0x7F) << shift + m.RejectHint |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1380,7 +1746,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1389,6 +1755,9 @@ func (m *Message) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaft } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRaft + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1406,6 +1775,9 @@ func (m *Message) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaft } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaft + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1434,7 +1806,7 @@ func (m *HardState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1462,7 +1834,7 @@ func (m *HardState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Term |= (uint64(b) & 0x7F) << shift + m.Term |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1481,7 +1853,7 @@ func (m *HardState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Vote |= (uint64(b) & 0x7F) << shift + m.Vote |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1500,7 +1872,7 @@ func (m *HardState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Commit |= (uint64(b) & 0x7F) << shift + m.Commit |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1514,6 +1886,9 @@ func (m *HardState) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaft } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaft + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1542,7 +1917,7 @@ func (m *ConfState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1568,7 +1943,7 @@ func (m *ConfState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (uint64(b) & 0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1585,7 +1960,7 @@ func (m *ConfState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - packedLen |= (int(b) & 0x7F) << shift + packedLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1594,9 +1969,23 @@ func (m *ConfState) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaft } postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthRaft + } if postIndex > l { return io.ErrUnexpectedEOF } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Nodes) == 0 { + m.Nodes = make([]uint64, 0, elementCount) + } for iNdEx < postIndex { var v uint64 for shift := uint(0); ; shift += 7 { @@ -1608,7 +1997,7 @@ func (m *ConfState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (uint64(b) & 0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1630,7 +2019,7 @@ func (m *ConfState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (uint64(b) & 0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1647,7 +2036,7 @@ func (m *ConfState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - packedLen |= (int(b) & 0x7F) << shift + packedLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1656,9 +2045,23 @@ func (m *ConfState) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaft } postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthRaft + } if postIndex > l { return io.ErrUnexpectedEOF } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Learners) == 0 { + m.Learners = make([]uint64, 0, elementCount) + } for iNdEx < postIndex { var v uint64 for shift := uint(0); ; shift += 7 { @@ -1670,7 +2073,7 @@ func (m *ConfState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (uint64(b) & 0x7F) << shift + v |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1689,6 +2092,9 @@ func (m *ConfState) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaft } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaft + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1717,7 +2123,7 @@ func (m *ConfChange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1745,7 +2151,7 @@ func (m *ConfChange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ID |= (uint64(b) & 0x7F) << shift + m.ID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1764,7 +2170,7 @@ func (m *ConfChange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= (ConfChangeType(b) & 0x7F) << shift + m.Type |= ConfChangeType(b&0x7F) << shift if b < 0x80 { break } @@ -1783,7 +2189,7 @@ func (m *ConfChange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NodeID |= (uint64(b) & 0x7F) << shift + m.NodeID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1802,7 +2208,7 @@ func (m *ConfChange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1811,6 +2217,9 @@ func (m *ConfChange) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRaft } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRaft + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1828,6 +2237,9 @@ func (m *ConfChange) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRaft } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRaft + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1895,10 +2307,13 @@ func skipRaft(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthRaft } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthRaft + } return iNdEx, nil case 3: for { @@ -1927,6 +2342,9 @@ func skipRaft(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthRaft + } } return iNdEx, nil case 4: @@ -1945,60 +2363,3 @@ var ( ErrInvalidLengthRaft = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowRaft = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("raft.proto", fileDescriptorRaft) } - -var fileDescriptorRaft = []byte{ - // 815 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x54, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0xf6, 0x8c, 0xc7, 0x7f, 0x35, 0x8e, 0xd3, 0xa9, 0x35, 0xa8, 0x15, 0x45, 0xc6, 0xb2, 0x38, - 0x58, 0x41, 0x1b, 0x20, 0x07, 0x0e, 0x48, 0x1c, 0x36, 0x09, 0x52, 0x22, 0xad, 0xa3, 0xc5, 0x9b, - 0xe5, 0x80, 0x84, 0x50, 0xc7, 0x53, 0x9e, 0x18, 0x32, 0xd3, 0xa3, 0x9e, 0xf6, 0xb2, 0xb9, 0x20, - 0x1e, 0x80, 0x07, 0xe0, 0xc2, 0xfb, 0xe4, 0xb8, 0x12, 0x77, 0xc4, 0x86, 0x17, 0x41, 0xdd, 0xd3, - 0x63, 0xcf, 0x24, 0xb7, 0xae, 0xef, 0xab, 0xae, 0xfa, 0xea, 0xeb, 0x9a, 0x01, 0x50, 0x62, 0xa9, - 0x8f, 0x32, 0x25, 0xb5, 0xc4, 0xb6, 0x39, 0x67, 0xd7, 0xfb, 0xc3, 0x58, 0xc6, 0xd2, 0x42, 0x9f, - 0x9b, 0x53, 0xc1, 0x4e, 0x7e, 0x83, 0xd6, 0xb7, 0xa9, 0x56, 0x77, 0xf8, 0x19, 0x04, 0x57, 0x77, - 0x19, 0x71, 0x6f, 0xec, 0x4d, 0x07, 0xc7, 0x7b, 0x47, 0xc5, 0xad, 0x23, 0x4b, 0x1a, 0xe2, 0x24, - 0xb8, 0xff, 0xe7, 0x93, 0xc6, 0xdc, 0x26, 0x21, 0x87, 0xe0, 0x8a, 0x54, 0xc2, 0xfd, 0xb1, 0x37, - 0x0d, 0x36, 0x0c, 0xa9, 0x04, 0xf7, 0xa1, 0x75, 0x91, 0x46, 0xf4, 0x8e, 0x37, 0x2b, 0x54, 0x01, - 0x21, 0x42, 0x70, 0x26, 0xb4, 0xe0, 0xc1, 0xd8, 0x9b, 0xf6, 0xe7, 0xf6, 0x3c, 0xf9, 0xdd, 0x03, - 0xf6, 0x3a, 0x15, 0x59, 0x7e, 0x23, 0xf5, 0x8c, 0xb4, 0x88, 0x84, 0x16, 0xf8, 0x15, 0xc0, 0x42, - 0xa6, 0xcb, 0x9f, 0x72, 0x2d, 0x74, 0xa1, 0x28, 0xdc, 0x2a, 0x3a, 0x95, 0xe9, 0xf2, 0xb5, 0x21, - 0x5c, 0xf1, 0xde, 0xa2, 0x04, 0x4c, 0xf3, 0x95, 0x6d, 0x5e, 0xd5, 0x55, 0x40, 0x46, 0xb2, 0x36, - 0x92, 0xab, 0xba, 0x2c, 0x32, 0xf9, 0x01, 0xba, 0xa5, 0x02, 0x23, 0xd1, 0x28, 0xb0, 0x3d, 0xfb, - 0x73, 0x7b, 0xc6, 0xaf, 0xa1, 0x9b, 0x38, 0x65, 0xb6, 0x70, 0x78, 0xcc, 0x4b, 0x2d, 0x8f, 0x95, - 0xbb, 0xba, 0x9b, 0xfc, 0xc9, 0x5f, 0x4d, 0xe8, 0xcc, 0x28, 0xcf, 0x45, 0x4c, 0xf8, 0x1c, 0x02, - 0xbd, 0x75, 0xf8, 0x59, 0x59, 0xc3, 0xd1, 0x55, 0x8f, 0x4d, 0x1a, 0x0e, 0xc1, 0xd7, 0xb2, 0x36, - 0x89, 0xaf, 0xa5, 0x19, 0x63, 0xa9, 0xe4, 0xa3, 0x31, 0x0c, 0xb2, 0x19, 0x30, 0x78, 0x3c, 0x20, - 0x8e, 0xa0, 0x73, 0x2b, 0x63, 0xfb, 0x60, 0xad, 0x0a, 0x59, 0x82, 0x5b, 0xdb, 0xda, 0x4f, 0x6d, - 0x7b, 0x0e, 0x1d, 0x4a, 0xb5, 0x5a, 0x51, 0xce, 0x3b, 0xe3, 0xe6, 0x34, 0x3c, 0xde, 0xa9, 0x6d, - 0x46, 0x59, 0xca, 0xe5, 0xe0, 0x01, 0xb4, 0x17, 0x32, 0x49, 0x56, 0x9a, 0x77, 0x2b, 0xb5, 0x1c, - 0x86, 0xc7, 0xd0, 0xcd, 0x9d, 0x63, 0xbc, 0x67, 0x9d, 0x64, 0x8f, 0x9d, 0x2c, 0x1d, 0x2c, 0xf3, - 0x4c, 0x45, 0x45, 0x3f, 0xd3, 0x42, 0x73, 0x18, 0x7b, 0xd3, 0x6e, 0x59, 0xb1, 0xc0, 0xf0, 0x53, - 0x80, 0xe2, 0x74, 0xbe, 0x4a, 0x35, 0x0f, 0x2b, 0x3d, 0x2b, 0x38, 0x72, 0xe8, 0x2c, 0x64, 0xaa, - 0xe9, 0x9d, 0xe6, 0x7d, 0xfb, 0xb0, 0x65, 0x38, 0xf9, 0x11, 0x7a, 0xe7, 0x42, 0x45, 0xc5, 0xfa, - 0x94, 0x0e, 0x7a, 0x4f, 0x1c, 0xe4, 0x10, 0xbc, 0x95, 0x9a, 0xea, 0xfb, 0x6e, 0x90, 0xca, 0xc0, - 0xcd, 0xa7, 0x03, 0x4f, 0xbe, 0x81, 0xde, 0x66, 0x5d, 0x71, 0x08, 0xad, 0x54, 0x46, 0x94, 0x73, - 0x6f, 0xdc, 0x9c, 0x06, 0xf3, 0x22, 0xc0, 0x7d, 0xe8, 0xde, 0x92, 0x50, 0x29, 0xa9, 0x9c, 0xfb, - 0x96, 0xd8, 0xc4, 0x93, 0x3f, 0x3c, 0x00, 0x73, 0xff, 0xf4, 0x46, 0xa4, 0xb1, 0xdd, 0x88, 0x8b, - 0xb3, 0x9a, 0x3a, 0xff, 0xe2, 0x0c, 0xbf, 0x70, 0x1f, 0xae, 0x6f, 0xd7, 0xea, 0xe3, 0xea, 0x67, - 0x52, 0xdc, 0x7b, 0xf2, 0xf5, 0x1e, 0x40, 0xfb, 0x52, 0x46, 0x74, 0x71, 0x56, 0xd7, 0x5c, 0x60, - 0xc6, 0xac, 0x53, 0x67, 0x56, 0xf1, 0xa1, 0x96, 0xe1, 0xe1, 0x97, 0xd0, 0xdb, 0xfc, 0x0e, 0x70, - 0x17, 0x42, 0x1b, 0x5c, 0x4a, 0x95, 0x88, 0x5b, 0xd6, 0xc0, 0x67, 0xb0, 0x6b, 0x81, 0x6d, 0x63, - 0xe6, 0x1d, 0xfe, 0xed, 0x43, 0x58, 0x59, 0x70, 0x04, 0x68, 0xcf, 0xf2, 0xf8, 0x7c, 0x9d, 0xb1, - 0x06, 0x86, 0xd0, 0x99, 0xe5, 0xf1, 0x09, 0x09, 0xcd, 0x3c, 0x17, 0xbc, 0x52, 0x32, 0x63, 0xbe, - 0xcb, 0x7a, 0x91, 0x65, 0xac, 0x89, 0x03, 0x80, 0xe2, 0x3c, 0xa7, 0x3c, 0x63, 0x81, 0x4b, 0xfc, - 0x5e, 0x6a, 0x62, 0x2d, 0x23, 0xc2, 0x05, 0x96, 0x6d, 0x3b, 0xd6, 0x2c, 0x13, 0xeb, 0x20, 0x83, - 0xbe, 0x69, 0x46, 0x42, 0xe9, 0x6b, 0xd3, 0xa5, 0x8b, 0x43, 0x60, 0x55, 0xc4, 0x5e, 0xea, 0x21, - 0xc2, 0x60, 0x96, 0xc7, 0x6f, 0x52, 0x45, 0x62, 0x71, 0x23, 0xae, 0x6f, 0x89, 0x01, 0xee, 0xc1, - 0x8e, 0x2b, 0x64, 0x1e, 0x6f, 0x9d, 0xb3, 0xd0, 0xa5, 0x9d, 0xde, 0xd0, 0xe2, 0x97, 0xef, 0xd6, - 0x52, 0xad, 0x13, 0xd6, 0xc7, 0x8f, 0x60, 0x6f, 0x96, 0xc7, 0x57, 0x4a, 0xa4, 0xf9, 0x92, 0xd4, - 0x4b, 0x12, 0x11, 0x29, 0xb6, 0xe3, 0x6e, 0x5f, 0xad, 0x12, 0x92, 0x6b, 0x7d, 0x29, 0x7f, 0x65, - 0x03, 0x27, 0x66, 0x4e, 0x22, 0xb2, 0x3f, 0x43, 0xb6, 0xeb, 0xc4, 0x6c, 0x10, 0x2b, 0x86, 0xb9, - 0x79, 0x5f, 0x29, 0xb2, 0x23, 0xee, 0xb9, 0xae, 0x2e, 0xb6, 0x39, 0x78, 0x78, 0x07, 0x83, 0xfa, - 0xf3, 0x1a, 0x1d, 0x5b, 0xe4, 0x45, 0x14, 0x99, 0xb7, 0x64, 0x0d, 0xe4, 0x30, 0xdc, 0xc2, 0x73, - 0x4a, 0xe4, 0x5b, 0xb2, 0x8c, 0x57, 0x67, 0xde, 0x64, 0x91, 0xd0, 0x05, 0xe3, 0xe3, 0x01, 0xf0, - 0x5a, 0xa9, 0x97, 0xc5, 0x36, 0x5a, 0xb6, 0x79, 0xc2, 0xef, 0x3f, 0x8c, 0x1a, 0xef, 0x3f, 0x8c, - 0x1a, 0xf7, 0x0f, 0x23, 0xef, 0xfd, 0xc3, 0xc8, 0xfb, 0xf7, 0x61, 0xe4, 0xfd, 0xf9, 0xdf, 0xa8, - 0xf1, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x86, 0x52, 0x5b, 0xe0, 0x74, 0x06, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/etcd/rafthttp/http.go b/vendor/github.com/coreos/etcd/rafthttp/http.go index 223a5deb9..817d6c64b 100644 --- a/vendor/github.com/coreos/etcd/rafthttp/http.go +++ b/vendor/github.com/coreos/etcd/rafthttp/http.go @@ -203,6 +203,10 @@ func (h *snapshotHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } + snapshotReceiveInflights.WithLabelValues(from).Inc() + defer func() { + snapshotReceiveInflights.WithLabelValues(from).Dec() + }() plog.Infof("receiving database snapshot [index:%d, from %s] ...", m.Snapshot.Metadata.Index, types.ID(m.From)) // save incoming database snapshot. n, err := h.snapshotter.SaveDBFrom(r.Body, m.Snapshot.Metadata.Index) diff --git a/vendor/github.com/coreos/etcd/rafthttp/metrics.go b/vendor/github.com/coreos/etcd/rafthttp/metrics.go index 2066663c6..a5e49178a 100644 --- a/vendor/github.com/coreos/etcd/rafthttp/metrics.go +++ b/vendor/github.com/coreos/etcd/rafthttp/metrics.go @@ -62,6 +62,15 @@ var ( []string{"To"}, ) + snapshotSendInflights = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "etcd", + Subsystem: "network", + Name: "snapshot_send_inflights_total", + Help: "Total number of inflight snapshot sends", + }, + []string{"To"}, + ) + snapshotSendFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: "etcd", Subsystem: "network", @@ -93,6 +102,15 @@ var ( []string{"From"}, ) + snapshotReceiveInflights = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "etcd", + Subsystem: "network", + Name: "snapshot_receive_inflights_total", + Help: "Total number of inflight snapshot receives", + }, + []string{"From"}, + ) + snapshotReceiveFailures = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: "etcd", Subsystem: "network", @@ -133,9 +151,11 @@ func init() { prometheus.MustRegister(recvFailures) prometheus.MustRegister(snapshotSend) + prometheus.MustRegister(snapshotSendInflights) prometheus.MustRegister(snapshotSendFailures) prometheus.MustRegister(snapshotSendSeconds) prometheus.MustRegister(snapshotReceive) + prometheus.MustRegister(snapshotReceiveInflights) prometheus.MustRegister(snapshotReceiveFailures) prometheus.MustRegister(snapshotReceiveSeconds) diff --git a/vendor/github.com/coreos/etcd/rafthttp/snapshot_sender.go b/vendor/github.com/coreos/etcd/rafthttp/snapshot_sender.go index 24eb53553..a97c6f345 100644 --- a/vendor/github.com/coreos/etcd/rafthttp/snapshot_sender.go +++ b/vendor/github.com/coreos/etcd/rafthttp/snapshot_sender.go @@ -76,6 +76,10 @@ func (s *snapshotSender) send(merged snap.Message) { req := createPostRequest(u, RaftSnapshotPrefix, body, "application/octet-stream", s.tr.URLs, s.from, s.cid) plog.Infof("start to send database snapshot [index: %d, to %s]...", m.Snapshot.Metadata.Index, types.ID(m.To)) + snapshotSendInflights.WithLabelValues(to).Inc() + defer func() { + snapshotSendInflights.WithLabelValues(to).Dec() + }() err := s.post(req) defer merged.CloseWithError(err) diff --git a/vendor/github.com/coreos/etcd/rafthttp/transport.go b/vendor/github.com/coreos/etcd/rafthttp/transport.go index 16e854c8a..9ec765086 100644 --- a/vendor/github.com/coreos/etcd/rafthttp/transport.go +++ b/vendor/github.com/coreos/etcd/rafthttp/transport.go @@ -372,12 +372,16 @@ type Pausable interface { } func (t *Transport) Pause() { + t.mu.RLock() + defer t.mu.RUnlock() for _, p := range t.peers { p.(Pausable).Pause() } } func (t *Transport) Resume() { + t.mu.RLock() + defer t.mu.RUnlock() for _, p := range t.peers { p.(Pausable).Resume() } diff --git a/vendor/github.com/coreos/etcd/scripts/build-aci b/vendor/github.com/coreos/etcd/scripts/build-aci deleted file mode 100755 index 60f7c4cb3..000000000 --- a/vendor/github.com/coreos/etcd/scripts/build-aci +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash - -set -e - -BINARYDIR=${BINARYDIR:-bin} -BUILDDIR=${BUILDDIR:-bin} - -# A non-installed acbuild can be used, for example: -# ACBUILD=../../appc/acbuild/bin/acbuild -ACBUILD=${ACBUILD:-acbuild} - -VERSION=$1 - -go2aci() { - case "${1}" in - "arm64") echo "aarch64";; - *) echo "${1}";; - esac -} - -if ! command -v "${ACBUILD}" >/dev/null; then - echo "acbuild ($ACBUILD) is not executable" - exit 1 -fi - -if [ ! -x "${BINARYDIR}"/etcd ] ; then - echo "$BINARYDIR/etcd not found. Is it compiled?" - exit 1 -fi - -if [ -z "$VERSION" ] ; then - echo "Usage: scripts/build-aci VERSION" - exit 1 -fi - -acbuild --debug begin - -TMPHOSTS="$(mktemp)" -ACI_ARCH=$(go2aci "${GOARCH}") - -acbuildEnd() { - rm "$TMPHOSTS" - export EXIT=$? - acbuild --debug end && exit $EXIT -} -trap acbuildEnd EXIT - -cat < "$TMPHOSTS" -127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 -DF - -acbuild --debug set-name coreos.com/etcd -acbuild --debug annotation add appc.io/executor/supports-systemd-notify true - -acbuild --debug copy "${BINARYDIR}"/etcd /usr/local/bin/etcd -acbuild --debug copy "${BINARYDIR}"/etcdctl /usr/local/bin/etcdctl - -acbuild --debug copy README.md README.md -acbuild --debug copy etcdctl/README.md README-etcdctl.md -acbuild --debug copy etcdctl/READMEv2.md READMEv2-etcdctl.md -acbuild --debug copy-to-dir Documentation . - -acbuild --debug environment add ETCD_DATA_DIR /var/lib/etcd -acbuild --debug mount add data-dir /var/lib/etcd - -acbuild --debug label add version "$VERSION" - -acbuild --debug set-exec -- /usr/local/bin/etcd - -acbuild --debug port add client tcp 2379 -acbuild --debug port add peer tcp 2380 - -acbuild --debug copy "$TMPHOSTS" /etc/hosts - -acbuild --debug label add arch "${ACI_ARCH}" - -# mkdir default data-dir -mkdir -p .acbuild/currentaci/rootfs/var/lib/etcd - -# symlinks for backward-compatibility -ln -s ./usr/local/bin/etcd .acbuild/currentaci/rootfs/etcd -ln -s ./usr/local/bin/etcdctl .acbuild/currentaci/rootfs/etcdctl - -acbuild --debug write --overwrite "${BUILDDIR}/etcd-${1}-linux-${ACI_ARCH}.aci" diff --git a/vendor/github.com/coreos/etcd/scripts/build-release.sh b/vendor/github.com/coreos/etcd/scripts/build-release.sh index 0310586a0..8c2eee050 100755 --- a/vendor/github.com/coreos/etcd/scripts/build-release.sh +++ b/vendor/github.com/coreos/etcd/scripts/build-release.sh @@ -11,11 +11,6 @@ if [ -z "${VERSION}" ]; then exit 255 fi -if ! command -v acbuild >/dev/null; then - echo "cannot find acbuild" - exit 1 -fi - if ! command -v docker >/dev/null; then echo "cannot find docker" exit 1 @@ -27,14 +22,8 @@ pushd "${ETCD_ROOT}" >/dev/null echo Building etcd binary... ./scripts/build-binary "${VERSION}" - # ppc64le not yet supported by acbuild. - for TARGET_ARCH in "amd64" "arm64"; do - echo Building ${TARGET_ARCH} aci image... - GOARCH=${TARGET_ARCH} BINARYDIR=release/etcd-${VERSION}-linux-${TARGET_ARCH} BUILDDIR=release ./scripts/build-aci "${VERSION}" - done - for TARGET_ARCH in "amd64" "arm64" "ppc64le"; do echo Building ${TARGET_ARCH} docker image... - GOARCH=${TARGET_ARCH} BINARYDIR=release/etcd-${VERSION}-linux-${TARGET_ARCH} BUILDDIR=release ./scripts/build-docker "${VERSION}" + GOOS=linux GOARCH=${TARGET_ARCH} BINARYDIR=release/etcd-${VERSION}-linux-${TARGET_ARCH} BUILDDIR=release ./scripts/build-docker "${VERSION}" done popd >/dev/null diff --git a/vendor/github.com/coreos/etcd/scripts/genproto.sh b/vendor/github.com/coreos/etcd/scripts/genproto.sh index fd6c05543..028f2192d 100755 --- a/vendor/github.com/coreos/etcd/scripts/genproto.sh +++ b/vendor/github.com/coreos/etcd/scripts/genproto.sh @@ -10,17 +10,20 @@ if ! [[ "$0" =~ scripts/genproto.sh ]]; then exit 255 fi -if [[ $(protoc --version | cut -f2 -d' ') != "3.5.0" ]]; then - echo "could not find protoc 3.5.0, is it installed + in PATH?" +if [[ $(protoc --version | cut -f2 -d' ') != "3.7.1" ]]; then + echo "could not find protoc 3.7.1, is it installed + in PATH?" exit 255 fi # directories containing protos to be built DIRS="./wal/walpb ./etcdserver/etcdserverpb ./snap/snappb ./raft/raftpb ./mvcc/mvccpb ./lease/leasepb ./auth/authpb ./etcdserver/api/v3lock/v3lockpb ./etcdserver/api/v3election/v3electionpb" +# disable go mod +export GO111MODULE=off + # exact version of packages to build -GOGO_PROTO_SHA="41168f6614b7bb144818ec8967b8c702705df564" -GRPC_GATEWAY_SHA="a92d37fb6339375fa4bb7d9c364f92373fe199c3" +GOGO_PROTO_SHA="1adfc126b41513cc696b209667c8656ea7aac67c" +GRPC_GATEWAY_SHA="92583770e3f01b09a0d3e9bdf64321d8bebd48f2" SCHWAG_SHA="b7d0fc9aadaaae3d61aaadfc12e4a2f945514912" # set up self-contained GOPATH for building @@ -28,39 +31,57 @@ export GOPATH=${PWD}/gopath.proto export GOBIN=${PWD}/bin export PATH="${GOBIN}:${PATH}" -COREOS_ROOT="${GOPATH}/src/github.com/coreos" -ETCD_ROOT="${COREOS_ROOT}/etcd" +ETCD_IO_ROOT="${GOPATH}/src/github.com/coreos/etcd" +ETCD_ROOT="${ETCD_IO_ROOT}/etcd" GOGOPROTO_ROOT="${GOPATH}/src/github.com/gogo/protobuf" SCHWAG_ROOT="${GOPATH}/src/github.com/hexfusion/schwag" GOGOPROTO_PATH="${GOGOPROTO_ROOT}:${GOGOPROTO_ROOT}/protobuf" GRPC_GATEWAY_ROOT="${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway" -rm -f "${ETCD_ROOT}" -mkdir -p "${COREOS_ROOT}" +function cleanup { + # Remove the whole fake GOPATH which can really confuse go mod. + rm -rf "${PWD}/gopath.proto" +} + +cleanup +trap cleanup EXIT + +mkdir -p "${ETCD_IO_ROOT}" ln -s "${PWD}" "${ETCD_ROOT}" -# Ensure we have the right version of protoc-gen-gogo by building it every time. -# TODO(jonboulle): vendor this instead of `go get`ting it. -go get -u github.com/gogo/protobuf/{proto,protoc-gen-gogo,gogoproto} -go get -u golang.org/x/tools/cmd/goimports +echo "Installing gogo/protobuf..." +GOGOPROTO_ROOT="$GOPATH/src/github.com/gogo/protobuf" +# rm -rf $GOGOPROTO_ROOT +mkdir -p $GOPATH/src/github.com/gogo +pushd $GOPATH/src/github.com/gogo + git clone https://github.com/gogo/protobuf.git +popd pushd "${GOGOPROTO_ROOT}" - git reset --hard "${GOGO_PROTO_SHA}" - make install + git reset --hard HEAD + make install popd -# generate gateway code -go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway -go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +echo "Installing grpc-ecosystem/grpc-gateway..." +GRPC_GATEWAY_ROOT="$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway" +# rm -rf $GRPC_GATEWAY_ROOT +mkdir -p $GOPATH/src/github.com/grpc-ecosystem +go get -v -d github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway +go get -v -d github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +pushd $GOPATH/src/github.com/grpc-ecosystem + rm -rf ./grpc-gateway + git clone https://github.com/grpc-ecosystem/grpc-gateway.git +popd pushd "${GRPC_GATEWAY_ROOT}" git reset --hard "${GRPC_GATEWAY_SHA}" - go install ./protoc-gen-grpc-gateway + go install -v ./protoc-gen-grpc-gateway + go install -v ./protoc-gen-swagger popd for dir in ${DIRS}; do pushd "${dir}" - protoc --gofast_out=plugins=grpc,import_prefix=github.com/coreos/:. -I=".:${GOGOPROTO_PATH}:${COREOS_ROOT}:${GRPC_GATEWAY_ROOT}/third_party/googleapis" ./*.proto + protoc --gofast_out=plugins=grpc,import_prefix=github.com/coreos/:. -I=".:${GOGOPROTO_PATH}:${ETCD_IO_ROOT}:${GRPC_GATEWAY_ROOT}/third_party/googleapis" ./*.proto sed -i.bak -E "s/github\.com\/coreos\/(gogoproto|github\.com|golang\.org|google\.golang\.org)/\1/g" ./*.pb.go - sed -i.bak -E 's/github\.com\/coreos\/(errors|fmt|io)/\1/g' ./*.pb.go + sed -i.bak -E 's/github\.com\/coreos\/(errors|fmt|io|context|math\/bits)/\1/g' ./*.pb.go 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 _ \"github\.com\/coreos\/google\/api\"//g' ./*.pb.go @@ -69,77 +90,3 @@ for dir in ${DIRS}; do goimports -w ./*.pb.go popd done - -# remove old swagger files so it's obvious whether the files fail to generate -rm -rf Documentation/dev-guide/apispec/swagger/*json -for pb in etcdserverpb/rpc api/v3lock/v3lockpb/v3lock api/v3election/v3electionpb/v3election; do - protobase="etcdserver/${pb}" - protoc -I. \ - -I"${GRPC_GATEWAY_ROOT}"/third_party/googleapis \ - -I"${GOGOPROTO_PATH}" \ - -I"${COREOS_ROOT}" \ - --grpc-gateway_out=logtostderr=true:. \ - --swagger_out=logtostderr=true:./Documentation/dev-guide/apispec/swagger/. \ - ${protobase}.proto - # hack to move gw files around so client won't include them - pkgpath=$(dirname "${protobase}") - pkg=$(basename "${pkgpath}") - gwfile="${protobase}.pb.gw.go" - sed -i.bak -E "s/package $pkg/package gw/g" ${gwfile} - sed -i.bak -E "s/protoReq /&$pkg\./g" ${gwfile} - sed -i.bak -E "s/, client /, client $pkg./g" ${gwfile} - sed -i.bak -E "s/Client /, client $pkg./g" ${gwfile} - sed -i.bak -E "s/[^(]*Client, runtime/${pkg}.&/" ${gwfile} - sed -i.bak -E "s/New[A-Za-z]*Client/${pkg}.&/" ${gwfile} - # darwin doesn't like newlines in sed... - sed -i.bak -E "s|import \(|& \"github.com/coreos/etcd/${pkgpath}\"|" ${gwfile} - mkdir -p "${pkgpath}"/gw/ - go fmt ${gwfile} - mv ${gwfile} "${pkgpath}/gw/" - rm -f ./etcdserver/${pb}*.bak - swaggerName=$(basename ${pb}) - mv Documentation/dev-guide/apispec/swagger/etcdserver/${pb}.swagger.json \ - Documentation/dev-guide/apispec/swagger/"${swaggerName}".swagger.json -done -rm -rf Documentation/dev-guide/apispec/swagger/etcdserver/ - -# append security to swagger spec -go get -u "github.com/hexfusion/schwag" -pushd "${SCHWAG_ROOT}" - git reset --hard "${SCHWAG_SHA}" - go install . -popd -schwag -input=Documentation/dev-guide/apispec/swagger/rpc.swagger.json - -# install protodoc -# go get -v -u github.com/coreos/protodoc -# -# by default, do not run this option. -# only run when './scripts/genproto.sh -g' -# -if [ "$1" = "-g" ]; then - echo "protodoc is auto-generating grpc API reference documentation..." - go get -v -u github.com/coreos/protodoc - SHA_PROTODOC="4372ee725035a208404e2d5465ba921469decc32" - PROTODOC_PATH="${GOPATH}/src/github.com/coreos/protodoc" - pushd "${PROTODOC_PATH}" - git reset --hard "${SHA_PROTODOC}" - go install - echo "protodoc is updated" - popd - - protodoc --directories="etcdserver/etcdserverpb=service_message,mvcc/mvccpb=service_message,lease/leasepb=service_message,auth/authpb=service_message" \ - --title="etcd API Reference" \ - --output="Documentation/dev-guide/api_reference_v3.md" \ - --message-only-from-this-file="etcdserver/etcdserverpb/rpc.proto" \ - --disclaimer="This is a generated documentation. Please read the proto files for more." - - protodoc --directories="etcdserver/api/v3lock/v3lockpb=service_message,etcdserver/api/v3election/v3electionpb=service_message,mvcc/mvccpb=service_message" \ - --title="etcd concurrency API Reference" \ - --output="Documentation/dev-guide/api_concurrency_reference_v3.md" \ - --disclaimer="This is a generated documentation. Please read the proto files for more." - - echo "protodoc is finished..." -else - echo "skipping grpc API reference document auto-generation..." -fi diff --git a/vendor/github.com/coreos/etcd/scripts/release b/vendor/github.com/coreos/etcd/scripts/release index c71ca398e..b69871bc1 100755 --- a/vendor/github.com/coreos/etcd/scripts/release +++ b/vendor/github.com/coreos/etcd/scripts/release @@ -32,11 +32,6 @@ main() { MINOR_VERSION=$(echo "${VERSION}" | cut -d. -f 1-2) BRANCH="release-${MINOR_VERSION}" - if ! command -v acbuild >/dev/null; then - echo "cannot find acbuild" - exit 1 - fi - if ! command -v docker >/dev/null; then echo "cannot find docker" exit 1 @@ -56,7 +51,7 @@ main() { if [ ! -d "${reldir}/etcd" ]; then mkdir -p "${reldir}" cd "${reldir}" - git clone git@github.com:coreos/etcd.git --branch "${BRANCH}" + git clone git@github.com:etcd-io/etcd.git --branch "${BRANCH}" fi cd "${reldir}/etcd" @@ -68,7 +63,8 @@ main() { fi # Check go version. - local go_version="go$(yq -r ".go[0]" .travis.yml)" + # download "yq" from https://github.com/mikefarah/yq + local go_version="go$(yq read .travis.yml "go[0]")" local current_go_version=$(go version | awk '{ print $3 }') if [[ "${current_go_version}" != "${go_version}" ]]; then echo "Current go version is ${current_go_version}, but etcd ${RELEASE_VERSION} requires ${go_version} (see .travis.yml)." @@ -87,10 +83,10 @@ main() { fi echo "Updating version from ${source_version} to ${VERSION} in version/version.go" sed -i "s/${source_version}/${VERSION}/g" version/version.go - echo "Building etcd with updated version" - ./build fi + echo "Building etcd and checking --version output" + ./build local etcd_version=$(bin/etcd --version | grep "etcd Version" | awk '{ print $3 }') if [[ "${etcd_version}" != "${VERSION}" ]]; then echo "Wrong etcd version in version/version.go. Expected ${etcd_version} but got ${VERSION}. Aborting." @@ -106,7 +102,7 @@ main() { # Push the version change if it's not already been pushed. if [ $(git rev-list --count "origin/${BRANCH}..${BRANCH}") -gt 0 ]; then - read -p "Push version bump up to ${VERSION} to github.com/coreos/etcd [y/N]? " confirm + read -p "Push version bump up to ${VERSION} to github.com/etcd-io/etcd [y/N]? " confirm [[ "${confirm,,}" == "y" ]] || exit 1 git push fi @@ -141,8 +137,8 @@ main() { fi # Sanity checks. - ./release/etcd-${RELEASE_VERSION}-linux-amd64/etcd --version | grep -q "etcd Version: ${VERSION}" - ETCDCTL_API=3 ./release/etcd-${RELEASE_VERSION}-linux-amd64/etcdctl version | grep -q "etcdctl version: ${VERSION}" + ./release/etcd-${RELEASE_VERSION}-$(go env GOOS)-amd64/etcd --version | grep -q "etcd Version: ${VERSION}" || true + ./release/etcd-${RELEASE_VERSION}-$(go env GOOS)-amd64/etcdctl version | grep -q "etcdctl version: ${VERSION}" || true # Upload artifacts. if [ "${NO_UPLOAD}" == 1 ]; then @@ -152,14 +148,13 @@ main() { [[ "${confirm,,}" == "y" ]] || exit 1 gsutil -m cp ./release/*.zip gs://etcd/${RELEASE_VERSION}/ gsutil -m cp ./release/*.tar.gz gs://etcd/${RELEASE_VERSION}/ - gsutil -m cp ./release/*.aci gs://etcd/${RELEASE_VERSION}/ gsutil -m acl ch -u allUsers:R -r gs://etcd/${RELEASE_VERSION}/ fi - + # Push images. if [ "${NO_DOCKER_PUSH}" == 1 ]; then echo "Skipping docker push. --no-docker-push flat is set." - else + else read -p "Publish etcd ${RELEASE_VERSION} docker images to quay.io [y/N]? " confirm [[ "${confirm,,}" == "y" ]] || exit 1 for i in {1..5}; do @@ -168,45 +163,24 @@ main() { done gcloud docker -- login -u _json_key -p "$(cat /etc/gcp-key-etcd-development.json)" https://gcr.io + echo "Pushing container images to quay.io" ${RELEASE_VERSION} docker push quay.io/coreos/etcd:${RELEASE_VERSION} + + echo "Pushing container images to gcr.io" ${RELEASE_VERSION} gcloud docker -- push gcr.io/etcd-development/etcd:${RELEASE_VERSION} - if [ "${MINOR_VERSION}" != "3.1" ]; then - for TARGET_ARCH in "-arm64" "-ppc64le"; do - docker push quay.io/coreos/etcd:${RELEASE_VERSION}${TARGET_ARCH} - gcloud docker -- push gcr.io/etcd-development/etcd:${RELEASE_VERSION}${TARGET_ARCH} - done - fi - gsutil -m acl ch -u allUsers:R -r gs://artifacts.etcd-development.appspot.com - docker tag quay.io/coreos/etcd:${RELEASE_VERSION} quay.io/coreos/etcd:v${MINOR_VERSION} - docker push quay.io/coreos/etcd:v${MINOR_VERSION} - - gcloud docker -- tag gcr.io/etcd-development/etcd:${RELEASE_VERSION} gcr.io/etcd-development/etcd:v${MINOR_VERSION} - gcloud docker -- push gcr.io/etcd-development/etcd:v${MINOR_VERSION} - fi + for TARGET_ARCH in "-arm64" "-ppc64le"; do + echo "Pushing container images to quay.io" ${RELEASE_VERSION}${TARGET_ARCH} + docker push quay.io/coreos/etcd:${RELEASE_VERSION}${TARGET_ARCH} - # TODO: test - # docker run --rm --name etcd-gcr-${RELEASE_VERSION} gcr.io/etcd-development/etcd:${RELEASE_VERSION}; - # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "/usr/local/bin/etcd --version" - # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "ETCDCTL_API=3 /usr/local/bin/etcdctl version" - # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "ETCDCTL_API=3 /usr/local/bin/etcdctl put foo bar" - # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "ETCDCTL_API=3 /usr/local/bin/etcdctl get foo" - - # Bump version to next development version. - git checkout -q "${BRANCH}" # Since we might be on a checkout of the remote version tag. - local source_version=$(egrep "\s+Version\s*=" version/version.go | sed -e "s/.*\"\(.*\)\".*/\1/g") - if [[ "${source_version}" != "${VERSION}+git" ]]; then - echo "Updating version from ${source_version} to ${VERSION}+git in version/version.go" - sed -i "s/${source_version}/${VERSION}+git/g" version/version.go - echo "Building etcd with ${VERSION}+git in version/version.go" - git add version/version.go - git commit -m "version: bump up to ${VERSION}+git" - git diff --staged - read -p "Push version bump up to ${VERSION}+git to github.com/coreos/etcd [y/N]? " confirm - [[ "${confirm,,}" == "y" ]] || exit 1 - git push + echo "Pushing container images to gcr.io" ${RELEASE_VERSION}${TARGET_ARCH} + gcloud docker -- push gcr.io/etcd-development/etcd:${RELEASE_VERSION}${TARGET_ARCH} + done + + echo "Setting permissions using gsutil..." + gsutil -m acl ch -u allUsers:R -r gs://artifacts.etcd-development.appspot.com fi - + # TODO: signing process echo "" echo "WARNING: The release has not been signed and published to github. This must be done manually." diff --git a/vendor/github.com/coreos/etcd/scripts/updatedep.sh b/vendor/github.com/coreos/etcd/scripts/updatedep.sh index 9fb9ee841..8d5d41bd6 100755 --- a/vendor/github.com/coreos/etcd/scripts/updatedep.sh +++ b/vendor/github.com/coreos/etcd/scripts/updatedep.sh @@ -1,69 +1,33 @@ #!/usr/bin/env bash - -# A script for updating godep dependencies for the vendored directory /cmd/ -# without pulling in etcd itself as a dependency. -# -# update depedency -# 1. edit glide.yaml with version, git SHA -# 2. run ./scripts/updatedep.sh -# 3. it automatically detects new git SHA, and vendors updates to cmd/vendor directory -# -# add depedency -# 1. run ./scripts/updatedep.sh github.com/USER/PROJECT#^1.0.0 -# OR -# ./scripts/updatedep.sh github.com/USER/PROJECT#9b772b54b3bf0be1eec083c9669766a56332559a -# 2. make sure glide.yaml and glide.lock are updated +set -e if ! [[ "$0" =~ scripts/updatedep.sh ]]; then - echo "must be run from repository root" - exit 255 + echo "must be run from repository root" + exit 255 fi -rm -rf vendor -mv cmd/vendor vendor - -# TODO: glide doesn't play well with symlink -echo "manually deleting etcd-repo symlink in vendor" -rm -f vendor/github.com/coreos/etcd +# NOTE: just run +rm -rf ./vendor +glide install --strip-vendor --skip-test . +glide vc --only-code --no-tests -GLIDE_ROOT="$GOPATH/src/github.com/Masterminds/glide" -GLIDE_SHA=21ff6d397ccca910873d8eaabab6a941c364cc70 -go get -d -u github.com/Masterminds/glide -pushd "${GLIDE_ROOT}" - git reset --hard ${GLIDE_SHA} - go install -popd +# ref. https://github.com/kubernetes/kubernetes/pull/81434 +exit 0 -GLIDE_VC_ROOT="$GOPATH/src/github.com/sgotti/glide-vc" -GLIDE_VC_SHA=d96375d23c85287e80296cdf48f9d21c227fa40a -go get -d -u github.com/sgotti/glide-vc -pushd "${GLIDE_VC_ROOT}" - git reset --hard ${GLIDE_VC_SHA} - go install -popd -if [ -n "$1" ]; then - echo "glide get on $1" - matches=$(grep "name: $1" glide.lock) - if [ ! -z "$matches" ]; then - echo "glide update on $1" - glide update --strip-vendor "$1" - else - echo "glide get on $1" - glide get --strip-vendor "$1" - fi -else - echo "glide update on *" - glide update --strip-vendor -fi; -echo "removing test files" -glide vc --only-code --no-tests -mv vendor cmd/ - -echo "recreating symlink to etcd" -ln -s ../../../../ cmd/vendor/github.com/coreos/etcd +if [ -d "gopath.proto" ]; then + # gopath.proto is created by genproto.sh and it thoroughly messes + # with go mod. + echo "Remove gopath.proto before running this script" + exit 255 +fi -echo "done" +if [[ $(go version) != "go version go1.12"* ]]; then + echo "expect Go 1.12+, got:" "$(go version)" + exit 255 +fi +GO111MODULE=on go mod tidy -v +GO111MODULE=on go mod vendor -v diff --git a/vendor/github.com/coreos/etcd/snap/snappb/snap.pb.go b/vendor/github.com/coreos/etcd/snap/snappb/snap.pb.go index e72b577f5..46897b45e 100644 --- a/vendor/github.com/coreos/etcd/snap/snappb/snap.pb.go +++ b/vendor/github.com/coreos/etcd/snap/snappb/snap.pb.go @@ -1,27 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: snap.proto -/* - Package snappb is a generated protocol buffer package. - - It is generated from these files: - snap.proto - - It has these top-level messages: - Snapshot -*/ package snappb import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - + fmt "fmt" + io "io" math "math" + math_bits "math/bits" _ "github.com/gogo/protobuf/gogoproto" - - io "io" + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -36,23 +25,68 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type Snapshot struct { - Crc uint32 `protobuf:"varint,1,opt,name=crc" json:"crc"` - Data []byte `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` - XXX_unrecognized []byte `json:"-"` + Crc uint32 `protobuf:"varint,1,opt,name=crc" json:"crc"` + Data []byte `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `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 fileDescriptor_f2e3c045ebf84d00, []int{0} +} +func (m *Snapshot) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Snapshot.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Snapshot) XXX_Merge(src proto.Message) { + xxx_messageInfo_Snapshot.Merge(m, src) +} +func (m *Snapshot) XXX_Size() int { + return m.Size() +} +func (m *Snapshot) XXX_DiscardUnknown() { + xxx_messageInfo_Snapshot.DiscardUnknown(m) } -func (m *Snapshot) Reset() { *m = Snapshot{} } -func (m *Snapshot) String() string { return proto.CompactTextString(m) } -func (*Snapshot) ProtoMessage() {} -func (*Snapshot) Descriptor() ([]byte, []int) { return fileDescriptorSnap, []int{0} } +var xxx_messageInfo_Snapshot proto.InternalMessageInfo func init() { proto.RegisterType((*Snapshot)(nil), "snappb.snapshot") } + +func init() { proto.RegisterFile("snap.proto", fileDescriptor_f2e3c045ebf84d00) } + +var fileDescriptor_f2e3c045ebf84d00 = []byte{ + // 126 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xce, 0x4b, 0x2c, + 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0xb1, 0x0b, 0x92, 0xa4, 0x44, 0xd2, 0xf3, + 0xd3, 0xf3, 0xc1, 0x42, 0xfa, 0x20, 0x16, 0x44, 0x56, 0xc9, 0x8c, 0x8b, 0x03, 0x24, 0x5f, 0x9c, + 0x91, 0x5f, 0x22, 0x24, 0xc6, 0xc5, 0x9c, 0x5c, 0x94, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xeb, + 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x48, 0x40, 0x48, 0x88, 0x8b, 0x25, 0x25, 0xb1, 0x24, + 0x51, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xcc, 0x76, 0x12, 0x39, 0xf1, 0x50, 0x8e, 0xe1, + 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, + 0x01, 0x10, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x0f, 0x32, 0xb2, 0x78, 0x00, 0x00, 0x00, +} + func (m *Snapshot) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -60,35 +94,47 @@ func (m *Snapshot) Marshal() (dAtA []byte, err error) { } func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintSnap(dAtA, i, uint64(m.Crc)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Data != nil { - dAtA[i] = 0x12 - i++ + i -= len(m.Data) + copy(dAtA[i:], m.Data) i = encodeVarintSnap(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 } - return i, nil + i = encodeVarintSnap(dAtA, i, uint64(m.Crc)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil } func encodeVarintSnap(dAtA []byte, offset int, v uint64) int { + offset -= sovSnap(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Snapshot) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovSnap(uint64(m.Crc)) @@ -103,14 +149,7 @@ func (m *Snapshot) Size() (n int) { } func sovSnap(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozSnap(x uint64) (n int) { return sovSnap(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -130,7 +169,7 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -158,7 +197,7 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Crc |= (uint32(b) & 0x7F) << shift + m.Crc |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -177,7 +216,7 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -186,6 +225,9 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { return ErrInvalidLengthSnap } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthSnap + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -203,6 +245,9 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthSnap } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSnap + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -270,10 +315,13 @@ func skipSnap(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthSnap } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthSnap + } return iNdEx, nil case 3: for { @@ -302,6 +350,9 @@ func skipSnap(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthSnap + } } return iNdEx, nil case 4: @@ -320,17 +371,3 @@ var ( ErrInvalidLengthSnap = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowSnap = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("snap.proto", fileDescriptorSnap) } - -var fileDescriptorSnap = []byte{ - // 126 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xce, 0x4b, 0x2c, - 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x03, 0xb1, 0x0b, 0x92, 0xa4, 0x44, 0xd2, 0xf3, - 0xd3, 0xf3, 0xc1, 0x42, 0xfa, 0x20, 0x16, 0x44, 0x56, 0xc9, 0x8c, 0x8b, 0x03, 0x24, 0x5f, 0x9c, - 0x91, 0x5f, 0x22, 0x24, 0xc6, 0xc5, 0x9c, 0x5c, 0x94, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xeb, - 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x48, 0x40, 0x48, 0x88, 0x8b, 0x25, 0x25, 0xb1, 0x24, - 0x51, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xcc, 0x76, 0x12, 0x39, 0xf1, 0x50, 0x8e, 0xe1, - 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, - 0x01, 0x10, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x0f, 0x32, 0xb2, 0x78, 0x00, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/etcd/test b/vendor/github.com/coreos/etcd/test index da356f592..718380f19 100755 --- a/vendor/github.com/coreos/etcd/test +++ b/vendor/github.com/coreos/etcd/test @@ -40,9 +40,6 @@ if [[ "${PASSES}" == *"functional"* ]]; then ./functional/build fi -# build tests with vendored dependencies -etcd_setup_gopath - if [ -z "$PASSES" ]; then PASSES="fmt bom dep build unit" fi @@ -53,12 +50,12 @@ USERPKG=${PKG:-} COVER=${COVER:-"-cover"} # Hack: gofmt ./ will recursively check the .git directory. So use *.go for gofmt. -IGNORE_PKGS="(cmd/|etcdserverpb|rafttest|gopath.proto|v3lockpb|v3electionpb)" -INTEGRATION_PKGS="(integration|e2e|contrib|functional)" +IGNORE_PKGS="(vendor/|etcdserverpb|rafttest|gopath.proto|v3lockpb|v3electionpb)" +INTEGRATION_PKGS="(integration|tests/e2e|contrib|functional)" -# all github.com/coreos/etcd/whatever pkgs that are not auto-generated / tools +# all github.com/etcd-io/etcd/whatever pkgs that are not auto-generated / tools # shellcheck disable=SC1117 -PKGS=$(find . -name \*.go | while read -r a; do dirname "$a"; done | sort | uniq | grep -vE "$IGNORE_PKGS" | grep -vE "(tools/|contrib/|e2e|pb)" | sed "s|\.|${REPO_PATH}|g" | xargs echo) +PKGS=$(find . -name \*.go | while read -r a; do dirname "$a"; done | sort | uniq | grep -vE "$IGNORE_PKGS" | grep -vE "(tools/|contrib/|tests/e2e|pb)" | sed "s|\.|${REPO_PATH}|g" | xargs echo) # pkg1,pkg2,pkg3 PKGS_COMMA=${PKGS// /,} @@ -85,6 +82,10 @@ fi # shellcheck disable=SC2206 FMT=($FMT) +if [ "${VERBOSE}" == "1" ]; then + # shellcheck disable=SC2128 + echo "Running with FMT:" "${FMT[@]}" +fi # prepend REPO_PATH to each local package split=$TEST @@ -93,24 +94,38 @@ for a in $split; do TEST="$TEST ${REPO_PATH}/${a}"; done # shellcheck disable=SC2206 TEST=($TEST) +if [ "${VERBOSE}" == "1" ]; then + # shellcheck disable=SC2128 + echo "Running with TEST:" "${TEST[@]}" +fi -# TODO: 'client' pkg fails with gosimple from generated files # TODO: 'rafttest' is failing with unused -STATIC_ANALYSIS_PATHS=$(find . -name \*.go | while read -r a; do dirname "$a"; done | sort | uniq | grep -vE "$IGNORE_PKGS" | grep -v 'client') +STATIC_ANALYSIS_PATHS=$(find . -name \*.go ! -path './vendor/*' ! -path './gopath.proto/*' ! -path '*pb/*' | while read -r a; do dirname "$a"; done | sort | uniq | grep -vE "$IGNORE_PKGS") # shellcheck disable=SC2206 STATIC_ANALYSIS_PATHS=($STATIC_ANALYSIS_PATHS) +if [ "${VERBOSE}" == "1" ]; then + # shellcheck disable=SC2128 + echo "Running with STATIC_ANALYSIS_PATHS:" "${STATIC_ANALYSIS_PATHS[@]}" +fi if [ -z "$GOARCH" ]; then GOARCH=$(go env GOARCH); fi +# determine the number of CPUs to use for Go tests +TEST_CPUS="1,2,4" +if [ -n "${CPU}" ]; then + TEST_CPUS="${CPU}" +fi +echo "Running with TEST_CPUS:" "${TEST_CPUS}" + # determine whether target supports race detection if [ "$GOARCH" == "amd64" ]; then RACE="--race" fi RUN_ARG="" -if [ ! -z "${TESTCASE}" ]; then +if [ -n "${TESTCASE}" ]; then RUN_ARG="-run=${TESTCASE}" fi @@ -133,11 +148,11 @@ function unit_pass { # expectation could be different USERTIMEOUT="" if [ -z "${TIMEOUT}" ]; then - USERTIMEOUT="3m" + USERTIMEOUT="30m" else USERTIMEOUT="${TIMEOUT}" fi - go test ${GO_TEST_FLAG} -timeout "${USERTIMEOUT}" "${COVER}" ${RACE} -cpu 4 ${RUN_ARG} "$@" "${TEST[@]}" + go test ${GO_TEST_FLAG} -timeout "${USERTIMEOUT}" "${COVER}" ${RACE} -cpu "${TEST_CPUS}" ${RUN_ARG} "$@" "${TEST[@]}" } function integration_pass { @@ -147,7 +162,7 @@ function integration_pass { # expectation could be different USERTIMEOUT="" if [ -z "${TIMEOUT}" ]; then - USERTIMEOUT="20m" + USERTIMEOUT="30m" else USERTIMEOUT="${TIMEOUT}" fi @@ -157,7 +172,7 @@ function integration_pass { # if TESTCASE not set, PKG set, run all test cases in specified package # if TESTCASE not set, PKG not set, run all tests in all integration and integration_extra packages if [ -z "${TESTCASE}" ] && [ -z "${USERPKG}" ]; then - go test -timeout "${USERTIMEOUT}" -v -cpu 4 "$@" "${REPO_PATH}/integration" + go test -timeout "${USERTIMEOUT}" -v -cpu "${TEST_CPUS}" "$@" "${REPO_PATH}/integration" integration_extra "$@" else if [ -z "${USERPKG}" ]; then @@ -168,13 +183,13 @@ function integration_pass { else INTEGTESTPKG=("${TEST[@]}") fi - go test -timeout "${USERTIMEOUT}" -v -cpu 4 "${RUN_ARG}" "$@" "${INTEGTESTPKG[@]}" + go test -timeout "${USERTIMEOUT}" -v -cpu "${TEST_CPUS}" "${RUN_ARG}" "$@" "${INTEGTESTPKG[@]}" fi } function integration_extra { - go test -timeout 1m -v ${RACE} -cpu 4 "$@" "${REPO_PATH}/client/integration" - go test -timeout 25m -v ${RACE} -cpu 4 "$@" "${REPO_PATH}/clientv3/integration" + go test -timeout 25m -v ${RACE} -cpu "${TEST_CPUS}" "$@" "${REPO_PATH}/clientv3/integration" + go test -timeout 1m -v ${RACE} -cpu "${TEST_CPUS}" -run=Example "$@" "${TEST[@]}" } function functional_pass { @@ -204,6 +219,18 @@ function functional_pass { kill -s TERM "${agent_pids[@]}" || true if [[ "${ETCD_TESTER_EXIT_CODE}" -ne "0" ]]; then + printf "\n" + echo "FAILED! 'tail -1000 /tmp/etcd-functional-1/etcd.log'" + tail -1000 /tmp/etcd-functional-1/etcd.log + + printf "\n" + echo "FAILED! 'tail -1000 /tmp/etcd-functional-2/etcd.log'" + tail -1000 /tmp/etcd-functional-2/etcd.log + + printf "\n" + echo "FAILED! 'tail -1000 /tmp/etcd-functional-3/etcd.log'" + tail -1000 /tmp/etcd-functional-3/etcd.log + echo "--- FAIL: exit code" ${ETCD_TESTER_EXIT_CODE} exit ${ETCD_TESTER_EXIT_CODE} fi @@ -214,7 +241,7 @@ function cov_pass { echo "Running code coverage..." # install gocovmerge before running code coverage from github.com/wadey/gocovmerge # gocovmerge merges coverage files - if ! which gocovmerge >/dev/null; then + if ! command -v gocovmerge >/dev/null; then echo "gocovmerge not installed" exit 255 fi @@ -232,11 +259,11 @@ function cov_pass { mkdir -p "$COVERDIR" # run code coverage for unit and integration tests - GOCOVFLAGS="-covermode=set -coverpkg ${PKGS_COMMA} -v -timeout 20m" + GOCOVFLAGS="-covermode=set -coverpkg ${PKGS_COMMA} -v -timeout 30m" # shellcheck disable=SC2206 GOCOVFLAGS=($GOCOVFLAGS) failed="" - for t in $(echo "${TEST_PKGS}" | grep -vE "(e2e|functional)"); do + for t in $(echo "${TEST_PKGS}" | grep -vE "(tests/e2e|functional)"); do tf=$(echo "$t" | tr / _) # cache package compilation data for faster repeated builds go test "${GOCOVFLAGS[@]}" -i "${REPO_PATH}/$t" || true @@ -255,10 +282,10 @@ function cov_pass { # use 30m timeout because e2e coverage takes longer # due to many tests cause etcd process to wait # on leadership transfer timeout during gracefully shutdown - echo Testing e2e without proxy... - go test -tags cov -timeout 30m -v "${REPO_PATH}/e2e" || failed="$failed e2e" - echo Testing e2e with proxy... - go test -tags "cov cluster_proxy" -timeout 30m -v "${REPO_PATH}/e2e" || failed="$failed e2e-proxy" + echo Testing tests/e2e without proxy... + go test -tags cov -timeout 30m -v "${REPO_PATH}/tests/e2e" || failed="$failed tests/e2e" + echo Testing tests/e2e with proxy... + go test -tags "cov cluster_proxy" -timeout 30m -v "${REPO_PATH}/tests/e2e" || failed="$failed tests/e2e-proxy" # incrementally merge to get coverage data even if some coverage files are corrupted # optimistically assume etcdserver package's coverage file is OK since gocovmerge @@ -290,20 +317,20 @@ function e2e_pass { # expectation could be different USERTIMEOUT="" if [ -z "${TIMEOUT}" ]; then - USERTIMEOUT="20m" + USERTIMEOUT="30m" else USERTIMEOUT="${TIMEOUT}" fi - go test -timeout "${USERTIMEOUT}" -v -cpu 4 "${RUN_ARG}" "$@" "${REPO_PATH}/e2e" + go test -timeout "${USERTIMEOUT}" -v -cpu "${TEST_CPUS}" "${RUN_ARG}" "$@" "${REPO_PATH}/tests/e2e" } function integration_e2e_pass { echo "Running integration and e2e tests..." - go test -timeout 20m -v -cpu 4 "$@" "${REPO_PATH}/e2e" & + go test -timeout 30m -v -cpu "${TEST_CPUS}" "$@" "${REPO_PATH}/tests/e2e" & e2epid="$!" - go test -timeout 20m -v -cpu 4 "$@" "${REPO_PATH}/integration" & + go test -timeout 30m -v -cpu "${TEST_CPUS}" "$@" "${REPO_PATH}/integration" & intpid="$!" wait $e2epid wait $intpid @@ -311,9 +338,9 @@ function integration_e2e_pass { } function grpcproxy_pass { - go test -timeout 20m -v ${RACE} -tags cluster_proxy -cpu 4 "$@" "${REPO_PATH}/integration" - go test -timeout 20m -v ${RACE} -tags cluster_proxy -cpu 4 "$@" "${REPO_PATH}/clientv3/integration" - go test -timeout 20m -v -tags cluster_proxy "$@" "${REPO_PATH}/e2e" + go test -timeout 30m -v ${RACE} -tags cluster_proxy -cpu "${TEST_CPUS}" "$@" "${REPO_PATH}/integration" + go test -timeout 30m -v ${RACE} -tags cluster_proxy -cpu "${TEST_CPUS}" "$@" "${REPO_PATH}/clientv3/integration" + go test -timeout 30m -v -tags cluster_proxy "$@" "${REPO_PATH}/tests/e2e" } function release_pass { @@ -333,7 +360,7 @@ function release_pass { echo "Downloading $file" set +e - curl --fail -L "https://github.com/coreos/etcd/releases/download/$UPGRADE_VER/$file" -o "/tmp/$file" + curl --fail -L "https://github.com/etcd-io/etcd/releases/download/$UPGRADE_VER/$file" -o "/tmp/$file" local result=$? set -e case $result in @@ -349,7 +376,7 @@ function release_pass { } function shellcheck_pass { - if which shellcheck >/dev/null; then + if command -v shellcheck >/dev/null; then shellcheckResult=$(shellcheck -fgcc build test scripts/*.sh 2>&1 || true) if [ -n "${shellcheckResult}" ]; then echo -e "shellcheck checking failed:\\n${shellcheckResult}" @@ -360,8 +387,8 @@ function shellcheck_pass { function markdown_you_pass { # eschew you - yous=$(find . -name \*.md -exec grep -E --color "[Yy]ou[r]?[ '.,;]" {} + | grep -v /v2/ || true) - if [ ! -z "$yous" ]; then + yous=$(find . -name \*.md ! -path './vendor/*' ! -path './Documentation/v2/*' ! -path './gopath.proto/*' -exec grep -E --color "[Yy]ou[r]?[ '.,;]" {} + || true) + if [ -n "$yous" ]; then echo -e "found 'you' in documentation:\\n${yous}" exit 255 fi @@ -369,7 +396,7 @@ function markdown_you_pass { function markdown_marker_pass { # TODO: check other markdown files when marker handles headers with '[]' - if which marker >/dev/null; then + if command -v marker >/dev/null; then markerResult=$(marker --skip-http --root ./Documentation 2>&1 || true) if [ -n "${markerResult}" ]; then echo -e "marker checking failed:\\n${markerResult}" @@ -381,7 +408,7 @@ function markdown_marker_pass { } function goword_pass { - if which goword >/dev/null; then + if command -v goword >/dev/null; then # get all go files to process gofiles=$(find "${FMT[@]}" -iname '*.go' 2>/dev/null) # shellcheck disable=SC2206 @@ -393,13 +420,13 @@ function goword_pass { gofiles=($gofiles) # only check for broken exported godocs gowordRes=$(goword -use-spell=false "${gofiles[@]}" | grep godoc-export | sort) - if [ ! -z "$gowordRes" ]; then + if [ -n "$gowordRes" ]; then echo -e "goword checking failed:\\n${gowordRes}" exit 255 fi # check some spelling gowordRes=$(goword -ignore-file=.words clientv3/{*,*/*}.go 2>&1 | grep spell | sort) - if [ ! -z "$gowordRes" ]; then + if [ -n "$gowordRes" ]; then echo -e "goword checking failed:\\n${gowordRes}" exit 255 fi @@ -428,44 +455,36 @@ function govet_shadow_pass { fmtpkgs=$(for a in "${FMT[@]}"; do dirname "$a"; done | sort | uniq | grep -v "\\.") # shellcheck disable=SC2206 fmtpkgs=($fmtpkgs) - vetRes=$(go tool vet -all -shadow "${fmtpkgs[@]}" 2>&1 | grep -v '/gw/' || true) + # Golang 1.12 onwards the experimental -shadow option is no longer available with go vet + go get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow + export PATH=${GOPATH}/bin:${PATH} + shadow_tool=$(which shadow) + vetRes=$(go vet -all -vettool="${shadow_tool}" "${TEST[@]}") if [ -n "${vetRes}" ]; then echo -e "govet -all -shadow checking failed:\\n${vetRes}" exit 255 fi } -function gosimple_pass { - if which gosimple >/dev/null; then - gosimpleResult=$(gosimple "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) - if [ -n "${gosimpleResult}" ]; then - echo -e "gosimple checking failed:\\n${gosimpleResult}" - exit 255 - fi - else - echo "Skipping gosimple..." - fi -} - -function unused_pass { - if which unused >/dev/null; then - unusedResult=$(unused "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) - if [ -n "${unusedResult}" ]; then - echo -e "unused checking failed:\\n${unusedResult}" +function unparam_pass { + if command -v unparam >/dev/null; then + unparamResult=$(unparam "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) + if [ -n "${unparamResult}" ]; then + echo -e "unparam checking failed:\\n${unparamResult}" exit 255 fi else - echo "Skipping unused..." + echo "Skipping unparam..." fi } function staticcheck_pass { - if which staticcheck >/dev/null; then + if command -v staticcheck >/dev/null; then staticcheckResult=$(staticcheck "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) if [ -n "${staticcheckResult}" ]; then # TODO: resolve these after go1.8 migration # See https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck - STATIC_CHECK_MASK="SA(1012|1019|2002)" + STATIC_CHECK_MASK="S(A|T)(1002|1005|1006|1008|1012|1019|1032|2002|4003|4006)" if echo "${staticcheckResult}" | grep -vE "$STATIC_CHECK_MASK"; then echo -e "staticcheck checking failed:\\n${staticcheckResult}" exit 255 @@ -479,8 +498,32 @@ function staticcheck_pass { fi } +function revive_pass { + if command -v revive >/dev/null; then + reviveResult=$(revive -config ./tests/revive.toml -exclude "vendor/..." ./... 2>&1 || true) + if [ -n "${reviveResult}" ]; then + echo -e "revive checking failed:\\n${reviveResult}" + exit 255 + fi + else + echo "Skipping revive..." + fi +} + +function unconvert_pass { + if command -v unconvert >/dev/null; then + unconvertResult=$(unconvert -v "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) + if [ -n "${unconvertResult}" ]; then + echo -e "unconvert checking failed:\\n${unconvertResult}" + exit 255 + fi + else + echo "Skipping unconvert..." + fi +} + function ineffassign_pass { - if which ineffassign >/dev/null; then + if command -v ineffassign >/dev/null; then ineffassignResult=$(ineffassign "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) if [ -n "${ineffassignResult}" ]; then echo -e "ineffassign checking failed:\\n${ineffassignResult}" @@ -492,7 +535,7 @@ function ineffassign_pass { } function nakedret_pass { - if which nakedret >/dev/null; then + if command -v nakedret >/dev/null; then nakedretResult=$(nakedret "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) if [ -n "${nakedretResult}" ]; then echo -e "nakedret checking failed:\\n${nakedretResult}" @@ -505,7 +548,7 @@ function nakedret_pass { function license_header_pass { licRes="" - files=$(find . -type f -iname '*.go' ! -path './cmd/*' ! -path './gopath.proto/*') + files=$(find . -type f -iname '*.go' ! -path './vendor/*' ! -path './gopath.proto/*') for file in $files; do if ! head -n3 "${file}" | grep -Eq "(Copyright|generated|GENERATED)" ; then licRes="${licRes}"$(echo -e " ${file}") @@ -557,9 +600,13 @@ function commit_title_pass { done } +# tools gosimple,unused,staticheck,unconvert,ineffasign,nakedret +# are not module-aware. See https://github.com/golang/go/issues/24661 +# The module-aware versions need to be used when they become available function fmt_pass { toggle_failpoints disable + # TODO: add "unparam" for p in shellcheck \ markdown_you \ markdown_marker \ @@ -567,11 +614,7 @@ function fmt_pass { gofmt \ govet \ govet_shadow \ - gosimple \ - unused \ - staticcheck \ - ineffassign \ - nakedret \ + revive \ license_header \ receiver_name \ commit_title \ @@ -583,7 +626,13 @@ function fmt_pass { } function bom_pass { - if ! which license-bill-of-materials >/dev/null; then + if ! command -v license-bill-of-materials >/dev/null; then + return + fi + if [ "${GO111MODULE}" == "on" ]; then + # license-bill-off-materials calls "go list std cmd" which cannot handle modules + # Please see https://github.com/golang/go/issues/26924 + echo "Skipping license-bill-of-materials with go modules..." return fi echo "Checking bill of materials..." @@ -604,7 +653,7 @@ function dep_pass { badpkg="(etcdserver$|mvcc$|backend$|grpc-gateway)" deps=$(go list -f '{{ .Deps }}' | sed 's/ /\n/g' | grep -E "${badpkg}" || echo "") popd >/dev/null - if [ ! -z "$deps" ]; then + if [ -n "$deps" ]; then echo -e "clientv3 has masked dependencies:\\n${deps}" exit 255 fi @@ -621,6 +670,7 @@ function build_cov_pass { function build_pass { echo "Checking build..." GO_BUILD_FLAGS="-v" etcd_build + GO_BUILD_FLAGS="-v" tools_build } for pass in $PASSES; do @@ -630,3 +680,4 @@ for pass in $PASSES; do done echo "Success" + diff --git a/vendor/github.com/coreos/etcd/tests/Dockerfile b/vendor/github.com/coreos/etcd/tests/Dockerfile index 624ca4aac..070f63405 100644 --- a/vendor/github.com/coreos/etcd/tests/Dockerfile +++ b/vendor/github.com/coreos/etcd/tests/Dockerfile @@ -32,7 +32,7 @@ RUN apt-get -y update \ ENV GOROOT /usr/local/go ENV GOPATH /go ENV PATH ${GOPATH}/bin:${GOROOT}/bin:${PATH} -ENV GO_VERSION 1.10.3 +ENV GO_VERSION REPLACE_ME_GO_VERSION ENV GO_DOWNLOAD_URL https://storage.googleapis.com/golang RUN rm -rf ${GOROOT} \ && curl -s ${GO_DOWNLOAD_URL}/go${GO_VERSION}.linux-amd64.tar.gz | tar -v -C /usr/local/ -xz \ @@ -41,21 +41,3 @@ RUN rm -rf ${GOROOT} \ RUN mkdir -p ${GOPATH}/src/github.com/coreos/etcd WORKDIR ${GOPATH}/src/github.com/coreos/etcd - -ADD ./scripts/install-marker.sh /tmp/install-marker.sh - -RUN go get -v -u -tags spell github.com/chzchzchz/goword \ - && go get -v -u github.com/coreos/license-bill-of-materials \ - && go get -v -u github.com/mgechev/revive \ - && go get -v -u github.com/mdempsky/unconvert \ - && go get -v -u mvdan.cc/unparam \ - && go get -v -u honnef.co/go/tools/cmd/gosimple \ - && go get -v -u honnef.co/go/tools/cmd/unused \ - && go get -v -u honnef.co/go/tools/cmd/staticcheck \ - && go get -v -u github.com/gyuho/gocovmerge \ - && go get -v -u github.com/gordonklaus/ineffassign \ - && go get -v -u github.com/alexkohler/nakedret \ - && /tmp/install-marker.sh amd64 \ - && rm -f /tmp/install-marker.sh \ - && curl -s https://codecov.io/bash >/codecov \ - && chmod 700 /codecov diff --git a/vendor/github.com/coreos/etcd/e2e/cluster_direct_test.go b/vendor/github.com/coreos/etcd/tests/e2e/cluster_direct_test.go similarity index 100% rename from vendor/github.com/coreos/etcd/e2e/cluster_direct_test.go rename to vendor/github.com/coreos/etcd/tests/e2e/cluster_direct_test.go diff --git a/vendor/github.com/coreos/etcd/e2e/cluster_test.go b/vendor/github.com/coreos/etcd/tests/e2e/cluster_test.go similarity index 90% rename from vendor/github.com/coreos/etcd/e2e/cluster_test.go rename to vendor/github.com/coreos/etcd/tests/e2e/cluster_test.go index cfdb8c80a..fb9814d9e 100644 --- a/vendor/github.com/coreos/etcd/e2e/cluster_test.go +++ b/vendor/github.com/coreos/etcd/tests/e2e/cluster_test.go @@ -20,8 +20,6 @@ import ( "net/url" "os" "strings" - - "github.com/coreos/etcd/etcdserver" ) const etcdProcessBasePort = 20000 @@ -78,6 +76,18 @@ var ( initialToken: "new", clientCertAuthEnabled: true, } + configClientTLSCertAuthWithNoCN = etcdProcessClusterConfig{ + clusterSize: 1, + clientTLS: clientTLS, + initialToken: "new", + clientCertAuthEnabled: true, + noCN: true, + } + configJWT = etcdProcessClusterConfig{ + clusterSize: 1, + initialToken: "new", + authTokenOpts: "jwt,pub-key=../../integration/fixtures/server.crt,priv-key=../../integration/fixtures/server.key.insecure,sign-method=RS256,ttl=1s", + } ) func configStandalone(cfg etcdProcessClusterConfig) *etcdProcessClusterConfig { @@ -103,7 +113,7 @@ type etcdProcessClusterConfig struct { metricsURLScheme string - snapCount int // default is 10000 + snapshotCount int // default is 10000 clientTLS clientConnType clientCertAuthEnabled bool @@ -111,6 +121,7 @@ type etcdProcessClusterConfig struct { isPeerAutoTLS bool isClientAutoTLS bool isClientCRL bool + noCN bool cipherSuites []string @@ -118,7 +129,9 @@ type etcdProcessClusterConfig struct { initialToken string quotaBackendBytes int64 noStrictReconfig bool + enableV2 bool initialCorruptCheck bool + authTokenOpts string } // newEtcdProcessCluster launches a new cluster from etcd processes, returning @@ -171,8 +184,8 @@ func (cfg *etcdProcessClusterConfig) etcdServerProcessConfigs() []*etcdServerPro if cfg.execPath == "" { cfg.execPath = binPath } - if cfg.snapCount == 0 { - cfg.snapCount = etcdserver.DefaultSnapCount + if cfg.snapshotCount == 0 { + cfg.snapshotCount = 10000 } etcdCfgs := make([]*etcdServerProcessConfig, cfg.clusterSize) @@ -213,7 +226,7 @@ func (cfg *etcdProcessClusterConfig) etcdServerProcessConfigs() []*etcdServerPro "--initial-advertise-peer-urls", purl.String(), "--initial-cluster-token", cfg.initialToken, "--data-dir", dataDirPath, - "--snapshot-count", fmt.Sprintf("%d", cfg.snapCount), + "--snapshot-count", fmt.Sprintf("%d", cfg.snapshotCount), } args = addV2Args(args) if cfg.forceNewCluster { @@ -227,6 +240,9 @@ func (cfg *etcdProcessClusterConfig) etcdServerProcessConfigs() []*etcdServerPro if cfg.noStrictReconfig { args = append(args, "--strict-reconfig-check=false") } + if cfg.enableV2 { + args = append(args, "--enable-v2") + } if cfg.initialCorruptCheck { args = append(args, "--experimental-initial-corrupt-check") } @@ -240,6 +256,11 @@ func (cfg *etcdProcessClusterConfig) etcdServerProcessConfigs() []*etcdServerPro } args = append(args, cfg.tlsArgs()...) + + if cfg.authTokenOpts != "" { + args = append(args, "--auth-token", cfg.authTokenOpts) + } + etcdCfgs[i] = &etcdServerProcessConfig{ execPath: cfg.execPath, args: args, @@ -271,7 +292,7 @@ func (cfg *etcdProcessClusterConfig) tlsArgs() (args []string) { tlsClientArgs := []string{ "--cert-file", certPath, "--key-file", privateKeyPath, - "--ca-file", caPath, + "--trusted-ca-file", caPath, } args = append(args, tlsClientArgs...) @@ -288,7 +309,7 @@ func (cfg *etcdProcessClusterConfig) tlsArgs() (args []string) { tlsPeerArgs := []string{ "--peer-cert-file", certPath, "--peer-key-file", privateKeyPath, - "--peer-ca-file", caPath, + "--peer-trusted-ca-file", caPath, } args = append(args, tlsPeerArgs...) } diff --git a/vendor/github.com/coreos/etcd/tests/e2e/ctl_v2_test.go b/vendor/github.com/coreos/etcd/tests/e2e/ctl_v2_test.go new file mode 100644 index 000000000..cc7319793 --- /dev/null +++ b/vendor/github.com/coreos/etcd/tests/e2e/ctl_v2_test.go @@ -0,0 +1,183 @@ +// Copyright 2016 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package e2e + +import ( + "os" + "strings" + "testing" + + "github.com/coreos/etcd/pkg/fileutil" + "github.com/coreos/etcd/pkg/testutil" +) + +func testCtlV2Set(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) { + os.Setenv("ETCDCTL_API", "2") + defer os.Unsetenv("ETCDCTL_API") + defer testutil.AfterTest(t) + + cfg.enableV2 = true + epc := setupEtcdctlTest(t, cfg, quorum) + defer func() { + if errC := epc.Close(); errC != nil { + t.Fatalf("error closing etcd processes (%v)", errC) + } + }() + + key, value := "foo", "bar" + + if err := etcdctlSet(epc, key, value); err != nil { + t.Fatalf("failed set (%v)", err) + } + + if err := etcdctlGet(epc, key, value, quorum); err != nil { + t.Fatalf("failed get (%v)", err) + } +} + +func etcdctlPrefixArgs(clus *etcdProcessCluster) []string { + endpoints := strings.Join(clus.EndpointsV2(), ",") + cmdArgs := []string{ctlBinPath, "--endpoints", endpoints} + if clus.cfg.clientTLS == clientTLS { + cmdArgs = append(cmdArgs, "--ca-file", caPath, "--cert-file", certPath, "--key-file", privateKeyPath) + } + return cmdArgs +} + +func etcdctlClusterHealth(clus *etcdProcessCluster, val string) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "cluster-health") + return spawnWithExpect(cmdArgs, val) +} + +func etcdctlSet(clus *etcdProcessCluster, key, value string) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "set", key, value) + return spawnWithExpect(cmdArgs, value) +} + +func etcdctlMk(clus *etcdProcessCluster, key, value string, first bool) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "mk", key, value) + if first { + return spawnWithExpect(cmdArgs, value) + } + return spawnWithExpect(cmdArgs, "Error: 105: Key already exists") +} + +func etcdctlGet(clus *etcdProcessCluster, key, value string, quorum bool) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "get", key) + if quorum { + cmdArgs = append(cmdArgs, "--quorum") + } + return spawnWithExpect(cmdArgs, value) +} + +func etcdctlRm(clus *etcdProcessCluster, key, value string, first bool) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "rm", key) + if first { + return spawnWithExpect(cmdArgs, "PrevNode.Value: "+value) + } + return spawnWithExpect(cmdArgs, "Error: 100: Key not found") +} + +func etcdctlLs(clus *etcdProcessCluster, key string, quorum bool) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "ls") + if quorum { + cmdArgs = append(cmdArgs, "--quorum") + } + return spawnWithExpect(cmdArgs, key) +} + +func etcdctlWatch(clus *etcdProcessCluster, key, value string, noSync bool) <-chan error { + cmdArgs := append(etcdctlPrefixArgs(clus), "watch", "--after-index=1", key) + if noSync { + cmdArgs = append(cmdArgs, "--no-sync") + } + errc := make(chan error, 1) + go func() { + errc <- spawnWithExpect(cmdArgs, value) + }() + return errc +} + +func etcdctlRoleAdd(clus *etcdProcessCluster, role string) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "role", "add", role) + return spawnWithExpect(cmdArgs, role) +} + +func etcdctlRoleGrant(clus *etcdProcessCluster, role string, perms ...string) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "role", "grant") + cmdArgs = append(cmdArgs, perms...) + cmdArgs = append(cmdArgs, role) + return spawnWithExpect(cmdArgs, role) +} + +func etcdctlRoleList(clus *etcdProcessCluster, expectedRole string) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "role", "list") + return spawnWithExpect(cmdArgs, expectedRole) +} + +func etcdctlUserAdd(clus *etcdProcessCluster, user, pass string) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "user", "add", user+":"+pass) + return spawnWithExpect(cmdArgs, "User "+user+" created") +} + +func etcdctlUserGrant(clus *etcdProcessCluster, user, role string) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "user", "grant", "--roles", role, user) + return spawnWithExpect(cmdArgs, "User "+user+" updated") +} + +func etcdctlUserGet(clus *etcdProcessCluster, user string) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "user", "get", user) + return spawnWithExpect(cmdArgs, "User: "+user) +} + +func etcdctlUserList(clus *etcdProcessCluster, expectedUser string) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "user", "list") + return spawnWithExpect(cmdArgs, expectedUser) +} + +func etcdctlAuthEnable(clus *etcdProcessCluster) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "auth", "enable") + return spawnWithExpect(cmdArgs, "Authentication Enabled") +} + +func etcdctlBackup(clus *etcdProcessCluster, dataDir, backupDir string, v3 bool) error { + cmdArgs := append(etcdctlPrefixArgs(clus), "backup", "--data-dir", dataDir, "--backup-dir", backupDir) + if v3 { + cmdArgs = append(cmdArgs, "--with-v3") + } + proc, err := spawnCmd(cmdArgs) + if err != nil { + return err + } + return proc.Close() +} + +func mustEtcdctl(t *testing.T) { + if !fileutil.Exist(binDir + "/etcdctl") { + t.Fatalf("could not find etcdctl binary") + } +} + +func setupEtcdctlTest(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) *etcdProcessCluster { + mustEtcdctl(t) + if !quorum { + cfg = configStandalone(*cfg) + } + epc, err := newEtcdProcessCluster(cfg) + if err != nil { + t.Fatalf("could not start etcd process cluster (%v)", err) + } + return epc +} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_member_test.go b/vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_member_test.go similarity index 56% rename from vendor/github.com/coreos/etcd/e2e/ctl_v3_member_test.go rename to vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_member_test.go index dfd3f799a..0c22a3c57 100644 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_member_test.go +++ b/vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_member_test.go @@ -24,12 +24,51 @@ import ( "github.com/coreos/etcd/etcdserver/etcdserverpb" ) -func TestCtlV3MemberList(t *testing.T) { testCtl(t, memberListTest) } +func TestCtlV3MemberList(t *testing.T) { testCtl(t, memberListTest) } +func TestCtlV3MemberListNoTLS(t *testing.T) { testCtl(t, memberListTest, withCfg(configNoTLS)) } +func TestCtlV3MemberListClientTLS(t *testing.T) { testCtl(t, memberListTest, withCfg(configClientTLS)) } +func TestCtlV3MemberListClientAutoTLS(t *testing.T) { + testCtl(t, memberListTest, withCfg(configClientAutoTLS)) +} +func TestCtlV3MemberListPeerTLS(t *testing.T) { testCtl(t, memberListTest, withCfg(configPeerTLS)) } func TestCtlV3MemberRemove(t *testing.T) { testCtl(t, memberRemoveTest, withQuorum(), withNoStrictReconfig()) } -func TestCtlV3MemberAdd(t *testing.T) { testCtl(t, memberAddTest) } -func TestCtlV3MemberUpdate(t *testing.T) { testCtl(t, memberUpdateTest) } +func TestCtlV3MemberRemoveNoTLS(t *testing.T) { + testCtl(t, memberRemoveTest, withQuorum(), withNoStrictReconfig(), withCfg(configNoTLS)) +} +func TestCtlV3MemberRemoveClientTLS(t *testing.T) { + testCtl(t, memberRemoveTest, withQuorum(), withNoStrictReconfig(), withCfg(configClientTLS)) +} +func TestCtlV3MemberRemoveClientAutoTLS(t *testing.T) { + testCtl(t, memberRemoveTest, withQuorum(), withNoStrictReconfig(), withCfg( + // default clusterSize is 1 + etcdProcessClusterConfig{ + clusterSize: 3, + isClientAutoTLS: true, + clientTLS: clientTLS, + initialToken: "new", + })) +} +func TestCtlV3MemberRemovePeerTLS(t *testing.T) { + testCtl(t, memberRemoveTest, withQuorum(), withNoStrictReconfig(), withCfg(configPeerTLS)) +} +func TestCtlV3MemberAdd(t *testing.T) { testCtl(t, memberAddTest) } +func TestCtlV3MemberAddNoTLS(t *testing.T) { testCtl(t, memberAddTest, withCfg(configNoTLS)) } +func TestCtlV3MemberAddClientTLS(t *testing.T) { testCtl(t, memberAddTest, withCfg(configClientTLS)) } +func TestCtlV3MemberAddClientAutoTLS(t *testing.T) { + testCtl(t, memberAddTest, withCfg(configClientAutoTLS)) +} +func TestCtlV3MemberAddPeerTLS(t *testing.T) { testCtl(t, memberAddTest, withCfg(configPeerTLS)) } +func TestCtlV3MemberUpdate(t *testing.T) { testCtl(t, memberUpdateTest) } +func TestCtlV3MemberUpdateNoTLS(t *testing.T) { testCtl(t, memberUpdateTest, withCfg(configNoTLS)) } +func TestCtlV3MemberUpdateClientTLS(t *testing.T) { + testCtl(t, memberUpdateTest, withCfg(configClientTLS)) +} +func TestCtlV3MemberUpdateClientAutoTLS(t *testing.T) { + testCtl(t, memberUpdateTest, withCfg(configClientAutoTLS)) +} +func TestCtlV3MemberUpdatePeerTLS(t *testing.T) { testCtl(t, memberUpdateTest, withCfg(configPeerTLS)) } func memberListTest(cx ctlCtx) { if err := ctlV3MemberList(cx); err != nil { @@ -83,13 +122,16 @@ func ctlV3MemberRemove(cx ctlCtx, ep, memberID, clusterID string) error { } func memberAddTest(cx ctlCtx) { - if err := ctlV3MemberAdd(cx, fmt.Sprintf("http://localhost:%d", etcdProcessBasePort+11)); err != nil { + if err := ctlV3MemberAdd(cx, fmt.Sprintf("http://localhost:%d", etcdProcessBasePort+11), false); err != nil { cx.t.Fatal(err) } } -func ctlV3MemberAdd(cx ctlCtx, peerURL string) error { +func ctlV3MemberAdd(cx ctlCtx, peerURL string, isLearner bool) error { cmdArgs := append(cx.PrefixArgs(), "member", "add", "newmember", fmt.Sprintf("--peer-urls=%s", peerURL)) + if isLearner { + cmdArgs = append(cmdArgs, "--learner") + } return spawnWithExpect(cmdArgs, " added to cluster ") } diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_test.go b/vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_test.go similarity index 98% rename from vendor/github.com/coreos/etcd/e2e/ctl_v3_test.go rename to vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_test.go index 396e6c184..82bcfdac0 100644 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_test.go +++ b/vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_test.go @@ -53,6 +53,7 @@ func dialWithSchemeTest(cx ctlCtx) { type ctlCtx struct { t *testing.T + apiPrefix string cfg etcdProcessClusterConfig quotaBackendBytes int64 corruptFunc func(string) error @@ -121,6 +122,10 @@ func withNoStrictReconfig() ctlOption { return func(cx *ctlCtx) { cx.noStrictReconfig = true } } +func withApiPrefix(p string) ctlOption { + return func(cx *ctlCtx) { cx.apiPrefix = p } +} + func withFlagByEnv() ctlOption { return func(cx *ctlCtx) { cx.envMap = make(map[string]struct{}) } } diff --git a/vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_watch_cov_test.go b/vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_watch_cov_test.go deleted file mode 100644 index 77f045063..000000000 --- a/vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_watch_cov_test.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2018 The etcd Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build cov - -package e2e - -import ( - "os" - "testing" -) - -func TestCtlV3Watch(t *testing.T) { testCtl(t, watchTest) } -func TestCtlV3WatchNoTLS(t *testing.T) { testCtl(t, watchTest, withCfg(configNoTLS)) } -func TestCtlV3WatchClientTLS(t *testing.T) { testCtl(t, watchTest, withCfg(configClientTLS)) } -func TestCtlV3WatchPeerTLS(t *testing.T) { testCtl(t, watchTest, withCfg(configPeerTLS)) } -func TestCtlV3WatchTimeout(t *testing.T) { testCtl(t, watchTest, withDialTimeout(0)) } - -func TestCtlV3WatchInteractive(t *testing.T) { - testCtl(t, watchTest, withInteractive()) -} -func TestCtlV3WatchInteractiveNoTLS(t *testing.T) { - testCtl(t, watchTest, withInteractive(), withCfg(configNoTLS)) -} -func TestCtlV3WatchInteractiveClientTLS(t *testing.T) { - testCtl(t, watchTest, withInteractive(), withCfg(configClientTLS)) -} -func TestCtlV3WatchInteractivePeerTLS(t *testing.T) { - testCtl(t, watchTest, withInteractive(), withCfg(configPeerTLS)) -} - -func watchTest(cx ctlCtx) { - tests := []struct { - puts []kv - envKey string - envRange string - args []string - - wkv []kvExec - }{ - { // watch 1 key - puts: []kv{{"sample", "value"}}, - args: []string{"sample", "--rev", "1"}, - wkv: []kvExec{{key: "sample", val: "value"}}, - }, - { // watch 1 key with env - puts: []kv{{"sample", "value"}}, - envKey: "sample", - args: []string{"--rev", "1"}, - wkv: []kvExec{{key: "sample", val: "value"}}, - }, - - // coverage tests get extra arguments: - // ./bin/etcdctl_test -test.coverprofile=e2e.1525392462795198897.coverprofile -test.outputdir=../.. - // do not test watch exec commands - - { // watch 3 keys by prefix - puts: []kv{{"key1", "val1"}, {"key2", "val2"}, {"key3", "val3"}}, - args: []string{"key", "--rev", "1", "--prefix"}, - wkv: []kvExec{{key: "key1", val: "val1"}, {key: "key2", val: "val2"}, {key: "key3", val: "val3"}}, - }, - { // watch 3 keys by prefix, with env - puts: []kv{{"key1", "val1"}, {"key2", "val2"}, {"key3", "val3"}}, - envKey: "key", - args: []string{"--rev", "1", "--prefix"}, - wkv: []kvExec{{key: "key1", val: "val1"}, {key: "key2", val: "val2"}, {key: "key3", val: "val3"}}, - }, - { // watch by revision - puts: []kv{{"etcd", "revision_1"}, {"etcd", "revision_2"}, {"etcd", "revision_3"}}, - args: []string{"etcd", "--rev", "2"}, - wkv: []kvExec{{key: "etcd", val: "revision_2"}, {key: "etcd", val: "revision_3"}}, - }, - { // watch 3 keys by range - puts: []kv{{"key1", "val1"}, {"key3", "val3"}, {"key2", "val2"}}, - args: []string{"key", "key3", "--rev", "1"}, - wkv: []kvExec{{key: "key1", val: "val1"}, {key: "key2", val: "val2"}}, - }, - { // watch 3 keys by range, with env - puts: []kv{{"key1", "val1"}, {"key3", "val3"}, {"key2", "val2"}}, - envKey: "key", - envRange: "key3", - args: []string{"--rev", "1"}, - wkv: []kvExec{{key: "key1", val: "val1"}, {key: "key2", val: "val2"}}, - }, - } - - for i, tt := range tests { - donec := make(chan struct{}) - go func(i int, puts []kv) { - for j := range puts { - if err := ctlV3Put(cx, puts[j].key, puts[j].val, ""); err != nil { - cx.t.Fatalf("watchTest #%d-%d: ctlV3Put error (%v)", i, j, err) - } - } - close(donec) - }(i, tt.puts) - - unsetEnv := func() {} - if tt.envKey != "" || tt.envRange != "" { - if tt.envKey != "" { - os.Setenv("ETCDCTL_WATCH_KEY", tt.envKey) - unsetEnv = func() { os.Unsetenv("ETCDCTL_WATCH_KEY") } - } - if tt.envRange != "" { - os.Setenv("ETCDCTL_WATCH_RANGE_END", tt.envRange) - unsetEnv = func() { os.Unsetenv("ETCDCTL_WATCH_RANGE_END") } - } - if tt.envKey != "" && tt.envRange != "" { - unsetEnv = func() { - os.Unsetenv("ETCDCTL_WATCH_KEY") - os.Unsetenv("ETCDCTL_WATCH_RANGE_END") - } - } - } - if err := ctlV3Watch(cx, tt.args, tt.wkv...); err != nil { - if cx.dialTimeout > 0 && !isGRPCTimedout(err) { - cx.t.Errorf("watchTest #%d: ctlV3Watch error (%v)", i, err) - } - } - unsetEnv() - <-donec - } -} diff --git a/vendor/github.com/coreos/etcd/e2e/ctl_v3_watch_test.go b/vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_watch_test.go similarity index 58% rename from vendor/github.com/coreos/etcd/e2e/ctl_v3_watch_test.go rename to vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_watch_test.go index fe25da1b7..a230393c2 100644 --- a/vendor/github.com/coreos/etcd/e2e/ctl_v3_watch_test.go +++ b/vendor/github.com/coreos/etcd/tests/e2e/ctl_v3_watch_test.go @@ -14,7 +14,10 @@ package e2e -import "strings" +import ( + "fmt" + "strings" +) type kvExec struct { key, val string @@ -87,3 +90,60 @@ func ctlV3WatchFailPerm(cx ctlCtx, args []string) error { } return proc.Close() } + +func ctlV3Put(cx ctlCtx, key, value, leaseID string, flags ...string) error { + skipValue := false + skipLease := false + for _, f := range flags { + if f == "--ignore-value" { + skipValue = true + } + if f == "--ignore-lease" { + skipLease = true + } + } + cmdArgs := append(cx.PrefixArgs(), "put", key) + if !skipValue { + cmdArgs = append(cmdArgs, value) + } + if leaseID != "" && !skipLease { + cmdArgs = append(cmdArgs, "--lease", leaseID) + } + if len(flags) != 0 { + cmdArgs = append(cmdArgs, flags...) + } + return spawnWithExpect(cmdArgs, "OK") +} + +type kv struct { + key, val string +} + +func ctlV3Get(cx ctlCtx, args []string, kvs ...kv) error { + cmdArgs := append(cx.PrefixArgs(), "get") + cmdArgs = append(cmdArgs, args...) + if !cx.quorum { + cmdArgs = append(cmdArgs, "--consistency", "s") + } + var lines []string + for _, elem := range kvs { + lines = append(lines, elem.key, elem.val) + } + return spawnWithExpects(cmdArgs, lines...) +} + +// ctlV3GetWithErr runs "get" command expecting no output but error +func ctlV3GetWithErr(cx ctlCtx, args []string, errs []string) error { + cmdArgs := append(cx.PrefixArgs(), "get") + cmdArgs = append(cmdArgs, args...) + if !cx.quorum { + cmdArgs = append(cmdArgs, "--consistency", "s") + } + return spawnWithExpects(cmdArgs, errs...) +} + +func ctlV3Del(cx ctlCtx, args []string, num int) error { + cmdArgs := append(cx.PrefixArgs(), "del") + cmdArgs = append(cmdArgs, args...) + return spawnWithExpects(cmdArgs, fmt.Sprintf("%d", num)) +} diff --git a/vendor/github.com/coreos/etcd/e2e/etcd_process.go b/vendor/github.com/coreos/etcd/tests/e2e/etcd_process.go similarity index 94% rename from vendor/github.com/coreos/etcd/e2e/etcd_process.go rename to vendor/github.com/coreos/etcd/tests/e2e/etcd_process.go index 3663d248a..aa63f6e2d 100644 --- a/vendor/github.com/coreos/etcd/e2e/etcd_process.go +++ b/vendor/github.com/coreos/etcd/tests/e2e/etcd_process.go @@ -104,18 +104,22 @@ func (ep *etcdServerProcess) Restart() error { return ep.Start() } -func (ep *etcdServerProcess) Stop() error { +func (ep *etcdServerProcess) Stop() (err error) { if ep == nil || ep.proc == nil { return nil } - if err := ep.proc.Stop(); err != nil { + err = ep.proc.Stop() + if err != nil { return err } ep.proc = nil <-ep.donec ep.donec = make(chan struct{}) if ep.cfg.purl.Scheme == "unix" || ep.cfg.purl.Scheme == "unixs" { - os.Remove(ep.cfg.purl.Host + ep.cfg.purl.Path) + err = os.Remove(ep.cfg.purl.Host + ep.cfg.purl.Path) + if err != nil { + return err + } } return nil } diff --git a/vendor/github.com/coreos/etcd/e2e/etcd_release_upgrade_test.go b/vendor/github.com/coreos/etcd/tests/e2e/etcd_release_upgrade_test.go similarity index 65% rename from vendor/github.com/coreos/etcd/e2e/etcd_release_upgrade_test.go rename to vendor/github.com/coreos/etcd/tests/e2e/etcd_release_upgrade_test.go index 6b1d42323..4b65dad3b 100644 --- a/vendor/github.com/coreos/etcd/e2e/etcd_release_upgrade_test.go +++ b/vendor/github.com/coreos/etcd/tests/e2e/etcd_release_upgrade_test.go @@ -16,7 +16,9 @@ package e2e import ( "fmt" + "math/rand" "os" + "strings" "sync" "testing" "time" @@ -38,7 +40,7 @@ func TestReleaseUpgrade(t *testing.T) { copiedCfg := configNoTLS copiedCfg.execPath = lastReleaseBinary - copiedCfg.snapCount = 3 + copiedCfg.snapshotCount = 3 copiedCfg.baseScheme = "unix" // to avoid port conflict epc, err := newEtcdProcessCluster(&copiedCfg) @@ -113,7 +115,7 @@ func TestReleaseUpgradeWithRestart(t *testing.T) { copiedCfg := configNoTLS copiedCfg.execPath = lastReleaseBinary - copiedCfg.snapCount = 10 + copiedCfg.snapshotCount = 10 copiedCfg.baseScheme = "unix" epc, err := newEtcdProcessCluster(&copiedCfg) @@ -169,3 +171,88 @@ func TestReleaseUpgradeWithRestart(t *testing.T) { t.Fatal(err) } } + +type cURLReq struct { + username string + password string + + isTLS bool + timeout int + + endpoint string + + value string + expected string + header string + + metricsURLScheme string + + ciphers string +} + +// cURLPrefixArgs builds the beginning of a curl command for a given key +// addressed to a random URL in the given cluster. +func cURLPrefixArgs(clus *etcdProcessCluster, method string, req cURLReq) []string { + var ( + cmdArgs = []string{"curl"} + acurl = clus.procs[rand.Intn(clus.cfg.clusterSize)].Config().acurl + ) + if req.metricsURLScheme != "https" { + if req.isTLS { + if clus.cfg.clientTLS != clientTLSAndNonTLS { + panic("should not use cURLPrefixArgsUseTLS when serving only TLS or non-TLS") + } + cmdArgs = append(cmdArgs, "--cacert", caPath, "--cert", certPath, "--key", privateKeyPath) + acurl = toTLS(clus.procs[rand.Intn(clus.cfg.clusterSize)].Config().acurl) + } else if clus.cfg.clientTLS == clientTLS { + if !clus.cfg.noCN { + cmdArgs = append(cmdArgs, "--cacert", caPath, "--cert", certPath, "--key", privateKeyPath) + } else { + cmdArgs = append(cmdArgs, "--cacert", caPath, "--cert", certPath3, "--key", privateKeyPath3) + } + } + } + if req.metricsURLScheme != "" { + acurl = clus.procs[rand.Intn(clus.cfg.clusterSize)].EndpointsMetrics()[0] + } + ep := acurl + req.endpoint + + if req.username != "" || req.password != "" { + cmdArgs = append(cmdArgs, "-L", "-u", fmt.Sprintf("%s:%s", req.username, req.password), ep) + } else { + cmdArgs = append(cmdArgs, "-L", ep) + } + if req.timeout != 0 { + cmdArgs = append(cmdArgs, "-m", fmt.Sprintf("%d", req.timeout)) + } + + if req.header != "" { + cmdArgs = append(cmdArgs, "-H", req.header) + } + + if req.ciphers != "" { + cmdArgs = append(cmdArgs, "--ciphers", req.ciphers) + } + + switch method { + case "POST", "PUT": + dt := req.value + if !strings.HasPrefix(dt, "{") { // for non-JSON value + dt = "value=" + dt + } + cmdArgs = append(cmdArgs, "-X", method, "-d", dt) + } + return cmdArgs +} + +func cURLPost(clus *etcdProcessCluster, req cURLReq) error { + return spawnWithExpect(cURLPrefixArgs(clus, "POST", req), req.expected) +} + +func cURLPut(clus *etcdProcessCluster, req cURLReq) error { + return spawnWithExpect(cURLPrefixArgs(clus, "PUT", req), req.expected) +} + +func cURLGet(clus *etcdProcessCluster, req cURLReq) error { + return spawnWithExpect(cURLPrefixArgs(clus, "GET", req), req.expected) +} diff --git a/vendor/github.com/coreos/etcd/e2e/etcd_spawn_nocov.go b/vendor/github.com/coreos/etcd/tests/e2e/etcd_spawn_nocov.go similarity index 100% rename from vendor/github.com/coreos/etcd/e2e/etcd_spawn_nocov.go rename to vendor/github.com/coreos/etcd/tests/e2e/etcd_spawn_nocov.go diff --git a/vendor/github.com/coreos/etcd/e2e/main_test.go b/vendor/github.com/coreos/etcd/tests/e2e/main_test.go similarity index 76% rename from vendor/github.com/coreos/etcd/e2e/main_test.go rename to vendor/github.com/coreos/etcd/tests/e2e/main_test.go index 4c954bf63..83bccf799 100644 --- a/vendor/github.com/coreos/etcd/e2e/main_test.go +++ b/vendor/github.com/coreos/etcd/tests/e2e/main_test.go @@ -24,6 +24,9 @@ var ( certPath2 string privateKeyPath2 string + certPath3 string + privateKeyPath3 string + crlPath string revokedCertPath string revokedPrivateKeyPath string @@ -33,8 +36,8 @@ func TestMain(m *testing.M) { os.Setenv("ETCD_UNSUPPORTED_ARCH", runtime.GOARCH) os.Unsetenv("ETCDCTL_API") - flag.StringVar(&binDir, "bin-dir", "../bin", "The directory for store etcd and etcdctl binaries.") - flag.StringVar(&certDir, "cert-dir", "../integration/fixtures", "The directory for store certificate files.") + flag.StringVar(&binDir, "bin-dir", "../../bin", "The directory for store etcd and etcdctl binaries.") + flag.StringVar(&certDir, "cert-dir", "../../integration/fixtures", "The directory for store certificate files.") flag.Parse() binPath = binDir + "/etcd" @@ -49,6 +52,9 @@ func TestMain(m *testing.M) { certPath2 = certDir + "/server2.crt" privateKeyPath2 = certDir + "/server2.key.insecure" + certPath3 = certDir + "/server3.crt" + privateKeyPath3 = certDir + "/server3.key.insecure" + v := m.Run() if v == 0 && testutil.CheckLeakedGoroutine() { os.Exit(1) diff --git a/vendor/github.com/coreos/etcd/e2e/util.go b/vendor/github.com/coreos/etcd/tests/e2e/util.go similarity index 90% rename from vendor/github.com/coreos/etcd/e2e/util.go rename to vendor/github.com/coreos/etcd/tests/e2e/util.go index 6960a3acf..acbee8ae3 100644 --- a/vendor/github.com/coreos/etcd/e2e/util.go +++ b/vendor/github.com/coreos/etcd/tests/e2e/util.go @@ -15,7 +15,9 @@ package e2e import ( + "encoding/json" "fmt" + "math/rand" "strings" "time" @@ -77,6 +79,18 @@ func spawnWithExpectLines(args []string, xs ...string) ([]string, error) { return lines, perr } +func randomLeaseID() int64 { + return rand.New(rand.NewSource(time.Now().UnixNano())).Int63() +} + +func dataMarshal(data interface{}) (d string, e error) { + m, err := json.Marshal(data) + if err != nil { + return "", err + } + return string(m), nil +} + func closeWithTimeout(p *expect.ExpectProcess, d time.Duration) error { errc := make(chan error, 1) go func() { errc <- p.Close() }() diff --git a/vendor/github.com/coreos/etcd/e2e/v2_test.go b/vendor/github.com/coreos/etcd/tests/e2e/v2_test.go similarity index 100% rename from vendor/github.com/coreos/etcd/e2e/v2_test.go rename to vendor/github.com/coreos/etcd/tests/e2e/v2_test.go diff --git a/vendor/github.com/coreos/etcd/tests/semaphore.test.bash b/vendor/github.com/coreos/etcd/tests/semaphore.test.bash index f171d7563..b04a1c5a6 100755 --- a/vendor/github.com/coreos/etcd/tests/semaphore.test.bash +++ b/vendor/github.com/coreos/etcd/tests/semaphore.test.bash @@ -8,10 +8,10 @@ fi <= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Record) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovRecord(uint64(m.Type)) @@ -148,6 +233,9 @@ func (m *Record) Size() (n int) { } func (m *Snapshot) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l n += 1 + sovRecord(uint64(m.Index)) @@ -159,14 +247,7 @@ func (m *Snapshot) Size() (n int) { } func sovRecord(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozRecord(x uint64) (n int) { return sovRecord(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -186,7 +267,7 @@ func (m *Record) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -214,7 +295,7 @@ func (m *Record) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= (int64(b) & 0x7F) << shift + m.Type |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -233,7 +314,7 @@ func (m *Record) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Crc |= (uint32(b) & 0x7F) << shift + m.Crc |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -252,7 +333,7 @@ func (m *Record) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -261,6 +342,9 @@ func (m *Record) Unmarshal(dAtA []byte) error { return ErrInvalidLengthRecord } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthRecord + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -278,6 +362,9 @@ func (m *Record) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRecord } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRecord + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -306,7 +393,7 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -334,7 +421,7 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Index |= (uint64(b) & 0x7F) << shift + m.Index |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -353,7 +440,7 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Term |= (uint64(b) & 0x7F) << shift + m.Term |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -367,6 +454,9 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthRecord } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRecord + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -434,10 +524,13 @@ func skipRecord(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthRecord } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthRecord + } return iNdEx, nil case 3: for { @@ -466,6 +559,9 @@ func skipRecord(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthRecord + } } return iNdEx, nil case 4: @@ -484,21 +580,3 @@ var ( ErrInvalidLengthRecord = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowRecord = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("record.proto", fileDescriptorRecord) } - -var fileDescriptorRecord = []byte{ - // 186 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x4a, 0x4d, 0xce, - 0x2f, 0x4a, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2d, 0x4f, 0xcc, 0x29, 0x48, 0x92, - 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x8b, 0xe8, 0x83, 0x58, 0x10, 0x49, 0x25, 0x3f, 0x2e, 0xb6, - 0x20, 0xb0, 0x62, 0x21, 0x09, 0x2e, 0x96, 0x92, 0xca, 0x82, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, - 0x66, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xc0, 0x22, 0x42, 0x62, 0x5c, 0xcc, 0xc9, 0x45, - 0xc9, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xbc, 0x50, 0x09, 0x90, 0x80, 0x90, 0x10, 0x17, 0x4b, 0x4a, - 0x62, 0x49, 0xa2, 0x04, 0xb3, 0x02, 0xa3, 0x06, 0x4f, 0x10, 0x98, 0xad, 0xe4, 0xc0, 0xc5, 0x11, - 0x9c, 0x97, 0x58, 0x50, 0x9c, 0x91, 0x5f, 0x22, 0x24, 0xc5, 0xc5, 0x9a, 0x99, 0x97, 0x92, 0x5a, - 0x01, 0x36, 0x92, 0x05, 0xaa, 0x13, 0x22, 0x04, 0xb6, 0x2d, 0xb5, 0x28, 0x17, 0x6c, 0x28, 0x0b, - 0xdc, 0xb6, 0xd4, 0xa2, 0x5c, 0x27, 0x91, 0x13, 0x0f, 0xe5, 0x18, 0x4e, 0x3c, 0x92, 0x63, 0xbc, - 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x19, 0x8f, 0xe5, 0x18, 0x00, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x7f, 0x5e, 0x5c, 0x46, 0xd3, 0x00, 0x00, 0x00, -} diff --git a/vendor/github.com/coreos/pkg/.gitignore b/vendor/github.com/coreos/pkg/.gitignore new file mode 100644 index 000000000..00ae1054b --- /dev/null +++ b/vendor/github.com/coreos/pkg/.gitignore @@ -0,0 +1,27 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +bin/ +coverage/ diff --git a/vendor/github.com/coreos/pkg/.travis.yml b/vendor/github.com/coreos/pkg/.travis.yml new file mode 100644 index 000000000..21df6748c --- /dev/null +++ b/vendor/github.com/coreos/pkg/.travis.yml @@ -0,0 +1,8 @@ +language: go + +go: + - 1.5.4 + - 1.6.2 + +script: + - ./test.sh diff --git a/vendor/github.com/coreos/pkg/CONTRIBUTING.md b/vendor/github.com/coreos/pkg/CONTRIBUTING.md new file mode 100644 index 000000000..6662073a8 --- /dev/null +++ b/vendor/github.com/coreos/pkg/CONTRIBUTING.md @@ -0,0 +1,71 @@ +# How to Contribute + +CoreOS projects are [Apache 2.0 licensed](LICENSE) and accept contributions via +GitHub pull requests. This document outlines some of the conventions on +development workflow, commit message formatting, contact points and other +resources to make it easier to get your contribution accepted. + +# Certificate of Origin + +By contributing to this project you agree to the Developer Certificate of +Origin (DCO). This document was created by the Linux Kernel community and is a +simple statement that you, as a contributor, have the legal right to make the +contribution. See the [DCO](DCO) file for details. + +# Email and Chat + +The project currently uses the general CoreOS email list and IRC channel: +- Email: [coreos-dev](https://groups.google.com/forum/#!forum/coreos-dev) +- IRC: #[coreos](irc://irc.freenode.org:6667/#coreos) IRC channel on freenode.org + +Please avoid emailing maintainers found in the MAINTAINERS file directly. They +are very busy and read the mailing lists. + +## Getting Started + +- Fork the repository on GitHub +- Read the [README](README.md) for build and test instructions +- Play with the project, submit bugs, submit patches! + +## Contribution Flow + +This is a rough outline of what a contributor's workflow looks like: + +- Create a topic branch from where you want to base your work (usually master). +- Make commits of logical units. +- Make sure your commit messages are in the proper format (see below). +- Push your changes to a topic branch in your fork of the repository. +- Make sure the tests pass, and add any new tests as appropriate. +- Submit a pull request to the original repository. + +Thanks for your contributions! + +### Format of the Commit Message + +We follow a rough convention for commit messages that is designed to answer two +questions: what changed and why. The subject line should feature the what and +the body of the commit should describe the why. + +``` +scripts: add the test-cluster command + +this uses tmux to setup a test cluster that you can easily kill and +start for debugging. + +Fixes #38 +``` + +The format can be described more formally as follows: + +``` +: + + + +