From b64db4a0d22eb43325bed73d6962098e53a40003 Mon Sep 17 00:00:00 2001 From: Gaius Date: Fri, 29 Jul 2022 15:06:10 +0800 Subject: [PATCH] feat: generate grpc proto and mocks Signed-off-by: Gaius --- .gitignore | 51 +- .golangci.yml | 37 + .markdownlint.yml | 5 + Makefile | 50 + README.md | 1 + go.mod | 14 + go.sum | 163 + hack/markdownlint.sh | 9 + hack/protoc.sh | 23 + pkg/apis/cdnsystem/v1/cdnsystem.pb.go | 592 ++++ .../cdnsystem/v1/cdnsystem.pb.validate.go | 385 +++ pkg/apis/cdnsystem/v1/cdnsystem.proto | 64 + pkg/apis/cdnsystem/v1/mocks/cdnsystem_mock.go | 678 ++++ pkg/apis/cdnsystem/v1/mocks/mocks.go | 19 + pkg/apis/common/v1/common.pb.go | 1256 +++++++ pkg/apis/common/v1/common.pb.validate.go | 1035 ++++++ pkg/apis/common/v1/common.proto | 2 +- pkg/apis/dfdaemon/v1/dfdaemon.pb.go | 1276 +++++++ pkg/apis/dfdaemon/v1/dfdaemon.pb.validate.go | 1028 ++++++ pkg/apis/dfdaemon/v1/dfdaemon.proto | 35 - pkg/apis/dfdaemon/v1/mocks/dfdaemon_mock.go | 854 +++++ pkg/apis/dfdaemon/v1/mocks/mocks.go | 19 + pkg/apis/errordetails/v1/errordetails.pb.go | 178 + .../v1/errordetails.pb.validate.go | 166 + .../v1/mocks/errordetails_mock.go | 5 + pkg/apis/errordetails/v1/mocks/mocks.go | 19 + pkg/apis/manager/v1/manager.pb.go | 2639 +++++++++++++++ pkg/apis/manager/v1/manager.pb.validate.go | 2930 +++++++++++++++++ pkg/apis/manager/v1/mocks/manager_mock.go | 612 ++++ pkg/apis/manager/v1/mocks/mocks.go | 19 + pkg/apis/scheduler/v1/mocks/mocks.go | 19 + pkg/apis/scheduler/v1/mocks/scheduler_mock.go | 647 ++++ pkg/apis/scheduler/v1/scheduler.pb.go | 2097 ++++++++++++ .../scheduler/v1/scheduler.pb.validate.go | 2253 +++++++++++++ 34 files changed, 19143 insertions(+), 37 deletions(-) create mode 100644 .golangci.yml create mode 100644 .markdownlint.yml create mode 100644 Makefile create mode 100644 go.sum create mode 100755 hack/markdownlint.sh create mode 100755 hack/protoc.sh create mode 100644 pkg/apis/cdnsystem/v1/cdnsystem.pb.go create mode 100644 pkg/apis/cdnsystem/v1/cdnsystem.pb.validate.go create mode 100644 pkg/apis/cdnsystem/v1/cdnsystem.proto create mode 100644 pkg/apis/cdnsystem/v1/mocks/cdnsystem_mock.go create mode 100644 pkg/apis/cdnsystem/v1/mocks/mocks.go create mode 100644 pkg/apis/common/v1/common.pb.go create mode 100644 pkg/apis/common/v1/common.pb.validate.go create mode 100644 pkg/apis/dfdaemon/v1/dfdaemon.pb.go create mode 100644 pkg/apis/dfdaemon/v1/dfdaemon.pb.validate.go create mode 100644 pkg/apis/dfdaemon/v1/mocks/dfdaemon_mock.go create mode 100644 pkg/apis/dfdaemon/v1/mocks/mocks.go create mode 100644 pkg/apis/errordetails/v1/errordetails.pb.go create mode 100644 pkg/apis/errordetails/v1/errordetails.pb.validate.go create mode 100644 pkg/apis/errordetails/v1/mocks/errordetails_mock.go create mode 100644 pkg/apis/errordetails/v1/mocks/mocks.go create mode 100644 pkg/apis/manager/v1/manager.pb.go create mode 100644 pkg/apis/manager/v1/manager.pb.validate.go create mode 100644 pkg/apis/manager/v1/mocks/manager_mock.go create mode 100644 pkg/apis/manager/v1/mocks/mocks.go create mode 100644 pkg/apis/scheduler/v1/mocks/mocks.go create mode 100644 pkg/apis/scheduler/v1/mocks/scheduler_mock.go create mode 100644 pkg/apis/scheduler/v1/scheduler.pb.go create mode 100644 pkg/apis/scheduler/v1/scheduler.pb.validate.go diff --git a/.gitignore b/.gitignore index 66fd13c..a0d9990 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.dll *.so *.dylib +bin/ # Test binary, built with `go test -c` *.test @@ -12,4 +13,52 @@ *.out # Dependency directories (remove the comment below to include it) -# vendor/ +vendor/ +.idea +.vscode +.cache +*.DS_Store +target/ +scheduler/test/misc +.chglog + +# mysql +mysql + +# vscode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +artifacts diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..b45866a --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,37 @@ +run: + deadline: 3m + modules-download-mode: readonly + +linters-settings: + gocyclo: + min-complexity: 60 + gci: + sections: + - standard + - default + +issues: + new: true + exclude-rules: + - linters: + - staticcheck + text: "SA1019:" + +linters: + disable-all: true + enable: + - gci + - gofmt + - golint + - misspell + - govet + - goconst + - deadcode + - gocyclo + - staticcheck + - errcheck + +output: + format: colored-line-number + print-issued-lines: true + print-linter-name: true diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 0000000..d4a7960 --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,5 @@ +MD010: false +MD013: + line_length: 120 +MD046: + style: "fenced" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..949b666 --- /dev/null +++ b/Makefile @@ -0,0 +1,50 @@ +# Copyright The Dragonfly 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. + +all: help + +# Run code lint +lint: markdownlint + @echo "Begin to golangci-lint." + @golangci-lint run +.PHONY: lint + +# Run markdown lint +markdownlint: + @echo "Begin to markdownlint." + @./hack/markdownlint.sh +.PHONY: markdownlint + +# Run go generate +generate: + @go generate ./... +.PHONY: generate + +# Generate grpc protos +protoc: + @./hack/protoc.sh +.PHONY: protoc + +# Clear compiled files +clean: + @go clean + @rm -rf bin .go .cache +.PHONY: clean + +help: + @echo "make lint run code lint" + @echo "make markdownlint run markdown lint" + @echo "make generate run go generate" + @echo "make protoc generate grpc protos" + @echo "make clean clean" diff --git a/README.md b/README.md index b0baae1..f6fa5ce 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # api + Canonical location of the Dragonfly API definition diff --git a/go.mod b/go.mod index a554251..c681766 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,17 @@ module d7y.io/api go 1.18 + +require ( + github.com/envoyproxy/protoc-gen-validate v0.6.7 + google.golang.org/grpc v1.48.0 + google.golang.org/protobuf v1.28.1 +) + +require ( + github.com/golang/protobuf v1.5.2 // indirect + golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect + golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 // indirect + golang.org/x/text v0.3.7 // indirect + google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..a0092da --- /dev/null +++ b/go.sum @@ -0,0 +1,163 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.7 h1:qcZcULcd/abmQg6dwigimCNEyi4gg31M/xaciQlDml8= +github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d h1:LO7XpTYMwTqxjLcGWPijK3vRXg1aWdlNOVOHRq45d7c= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 h1:uCLL3g5wH2xjxVREVuAbP9JM5PPKjRbXKRa6IBjkzmU= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/hack/markdownlint.sh b/hack/markdownlint.sh new file mode 100755 index 0000000..eb1c8b2 --- /dev/null +++ b/hack/markdownlint.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +LINT_DIR=/data +MARKDOWNLINT_IMAGE=avtodev/markdown-lint:v1 + +docker run --rm \ + -v "$(pwd):${LINT_DIR}:ro" \ + ${MARKDOWNLINT_IMAGE} \ + -c "${LINT_DIR}/.markdownlint.yml" /data/**/*.md diff --git a/hack/protoc.sh b/hack/protoc.sh new file mode 100755 index 0000000..a07a887 --- /dev/null +++ b/hack/protoc.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +PROTOC_ALL_IMAGE=${PROTOC_ALL_IMAGE:-"namely/protoc-all:1.47_2"} +PROTO_PATH=pkg/apis +LANGUAGE=go + +proto_modules="common/v1 cdnsystem/v1 dfdaemon/v1 errordetails/v1 manager/v1 scheduler/v1" + +echo "generate protos..." + +for module in ${proto_modules}; do + if docker run --rm -v $PWD:/defs ${PROTOC_ALL_IMAGE} \ + -d ${PROTO_PATH}/$module -i . \ + -l ${LANGUAGE} -o . \ + --go-source-relative \ + --with-validator \ + --validator-source-relative; then + echo "generate protos ${module} successfully" + else + echo "generate protos ${module} failed" + fi +done + diff --git a/pkg/apis/cdnsystem/v1/cdnsystem.pb.go b/pkg/apis/cdnsystem/v1/cdnsystem.pb.go new file mode 100644 index 0000000..ea1700f --- /dev/null +++ b/pkg/apis/cdnsystem/v1/cdnsystem.pb.go @@ -0,0 +1,592 @@ +// +// Copyright 2022 The Dragonfly 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.19.4 +// source: pkg/apis/cdnsystem/v1/cdnsystem.proto + +package v1 + +import ( + context "context" + v1 "d7y.io/api/pkg/apis/common/v1" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SeedRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + UrlMeta *v1.UrlMeta `protobuf:"bytes,3,opt,name=url_meta,json=urlMeta,proto3" json:"url_meta,omitempty"` +} + +func (x *SeedRequest) Reset() { + *x = SeedRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SeedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SeedRequest) ProtoMessage() {} + +func (x *SeedRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SeedRequest.ProtoReflect.Descriptor instead. +func (*SeedRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescGZIP(), []int{0} +} + +func (x *SeedRequest) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *SeedRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *SeedRequest) GetUrlMeta() *v1.UrlMeta { + if x != nil { + return x.UrlMeta + } + return nil +} + +// keep piece meta and data separately +// check piece md5, md5s sign and total content length +type PieceSeed struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // peer id for cdn node, need suffix with _CDN + PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + // cdn host id + HostId string `protobuf:"bytes,3,opt,name=host_id,json=hostId,proto3" json:"host_id,omitempty"` + PieceInfo *v1.PieceInfo `protobuf:"bytes,4,opt,name=piece_info,json=pieceInfo,proto3" json:"piece_info,omitempty"` + // whether or not all seeds are downloaded + Done bool `protobuf:"varint,5,opt,name=done,proto3" json:"done,omitempty"` + // content total length for the url, content_length < 0 represent content length is unknown + ContentLength int64 `protobuf:"varint,6,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"` + // total piece count, -1 represents task is downloading or failed + TotalPieceCount int32 `protobuf:"varint,7,opt,name=total_piece_count,json=totalPieceCount,proto3" json:"total_piece_count,omitempty"` + // begin time for the piece downloading + BeginTime uint64 `protobuf:"varint,8,opt,name=begin_time,json=beginTime,proto3" json:"begin_time,omitempty"` + // end time for the piece downloading + EndTime uint64 `protobuf:"varint,9,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + // task extend attribute + ExtendAttribute *v1.ExtendAttribute `protobuf:"bytes,10,opt,name=extend_attribute,json=extendAttribute,proto3" json:"extend_attribute,omitempty"` +} + +func (x *PieceSeed) Reset() { + *x = PieceSeed{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PieceSeed) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PieceSeed) ProtoMessage() {} + +func (x *PieceSeed) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PieceSeed.ProtoReflect.Descriptor instead. +func (*PieceSeed) Descriptor() ([]byte, []int) { + return file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescGZIP(), []int{1} +} + +func (x *PieceSeed) GetPeerId() string { + if x != nil { + return x.PeerId + } + return "" +} + +func (x *PieceSeed) GetHostId() string { + if x != nil { + return x.HostId + } + return "" +} + +func (x *PieceSeed) GetPieceInfo() *v1.PieceInfo { + if x != nil { + return x.PieceInfo + } + return nil +} + +func (x *PieceSeed) GetDone() bool { + if x != nil { + return x.Done + } + return false +} + +func (x *PieceSeed) GetContentLength() int64 { + if x != nil { + return x.ContentLength + } + return 0 +} + +func (x *PieceSeed) GetTotalPieceCount() int32 { + if x != nil { + return x.TotalPieceCount + } + return 0 +} + +func (x *PieceSeed) GetBeginTime() uint64 { + if x != nil { + return x.BeginTime + } + return 0 +} + +func (x *PieceSeed) GetEndTime() uint64 { + if x != nil { + return x.EndTime + } + return 0 +} + +func (x *PieceSeed) GetExtendAttribute() *v1.ExtendAttribute { + if x != nil { + return x.ExtendAttribute + } + return nil +} + +var File_pkg_apis_cdnsystem_v1_cdnsystem_proto protoreflect.FileDescriptor + +var file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x64, 0x6e, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x64, 0x6e, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x64, 0x6e, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x1a, 0x1f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x77, 0x0a, 0x0b, + 0x53, 0x65, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, + 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, + 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, + 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x72, + 0x03, 0x88, 0x01, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x2a, 0x0a, 0x08, 0x75, 0x72, 0x6c, + 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x55, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x07, 0x75, 0x72, + 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x22, 0xe6, 0x02, 0x0a, 0x09, 0x50, 0x69, 0x65, 0x63, 0x65, 0x53, + 0x65, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x70, + 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x06, 0x68, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0a, 0x70, 0x69, 0x65, 0x63, 0x65, + 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, + 0x70, 0x69, 0x65, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x6f, 0x6e, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x6e, 0x65, 0x12, 0x25, 0x0a, + 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x69, + 0x65, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x69, 0x65, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x10, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0f, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x32, 0xcc, + 0x01, 0x0a, 0x06, 0x53, 0x65, 0x65, 0x64, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0b, 0x4f, 0x62, 0x74, + 0x61, 0x69, 0x6e, 0x53, 0x65, 0x65, 0x64, 0x73, 0x12, 0x16, 0x2e, 0x63, 0x64, 0x6e, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x53, 0x65, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x14, 0x2e, 0x63, 0x64, 0x6e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x50, 0x69, 0x65, + 0x63, 0x65, 0x53, 0x65, 0x65, 0x64, 0x30, 0x01, 0x12, 0x3e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, + 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, + 0x63, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x43, 0x0a, 0x0e, 0x53, 0x79, 0x6e, 0x63, + 0x50, 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x18, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, + 0x65, 0x63, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x28, 0x01, 0x30, 0x01, 0x42, 0x22, 0x5a, + 0x20, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x64, 0x6e, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x76, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescOnce sync.Once + file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescData = file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDesc +) + +func file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescGZIP() []byte { + file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescOnce.Do(func() { + file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescData) + }) + return file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDescData +} + +var file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_pkg_apis_cdnsystem_v1_cdnsystem_proto_goTypes = []interface{}{ + (*SeedRequest)(nil), // 0: cdnsystem.SeedRequest + (*PieceSeed)(nil), // 1: cdnsystem.PieceSeed + (*v1.UrlMeta)(nil), // 2: common.UrlMeta + (*v1.PieceInfo)(nil), // 3: common.PieceInfo + (*v1.ExtendAttribute)(nil), // 4: common.ExtendAttribute + (*v1.PieceTaskRequest)(nil), // 5: common.PieceTaskRequest + (*v1.PiecePacket)(nil), // 6: common.PiecePacket +} +var file_pkg_apis_cdnsystem_v1_cdnsystem_proto_depIdxs = []int32{ + 2, // 0: cdnsystem.SeedRequest.url_meta:type_name -> common.UrlMeta + 3, // 1: cdnsystem.PieceSeed.piece_info:type_name -> common.PieceInfo + 4, // 2: cdnsystem.PieceSeed.extend_attribute:type_name -> common.ExtendAttribute + 0, // 3: cdnsystem.Seeder.ObtainSeeds:input_type -> cdnsystem.SeedRequest + 5, // 4: cdnsystem.Seeder.GetPieceTasks:input_type -> common.PieceTaskRequest + 5, // 5: cdnsystem.Seeder.SyncPieceTasks:input_type -> common.PieceTaskRequest + 1, // 6: cdnsystem.Seeder.ObtainSeeds:output_type -> cdnsystem.PieceSeed + 6, // 7: cdnsystem.Seeder.GetPieceTasks:output_type -> common.PiecePacket + 6, // 8: cdnsystem.Seeder.SyncPieceTasks:output_type -> common.PiecePacket + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_pkg_apis_cdnsystem_v1_cdnsystem_proto_init() } +func file_pkg_apis_cdnsystem_v1_cdnsystem_proto_init() { + if File_pkg_apis_cdnsystem_v1_cdnsystem_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SeedRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PieceSeed); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pkg_apis_cdnsystem_v1_cdnsystem_proto_goTypes, + DependencyIndexes: file_pkg_apis_cdnsystem_v1_cdnsystem_proto_depIdxs, + MessageInfos: file_pkg_apis_cdnsystem_v1_cdnsystem_proto_msgTypes, + }.Build() + File_pkg_apis_cdnsystem_v1_cdnsystem_proto = out.File + file_pkg_apis_cdnsystem_v1_cdnsystem_proto_rawDesc = nil + file_pkg_apis_cdnsystem_v1_cdnsystem_proto_goTypes = nil + file_pkg_apis_cdnsystem_v1_cdnsystem_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// SeederClient is the client API for Seeder service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SeederClient interface { + // Generate seeds and return to scheduler + ObtainSeeds(ctx context.Context, in *SeedRequest, opts ...grpc.CallOption) (Seeder_ObtainSeedsClient, error) + // Get piece tasks from cdn + GetPieceTasks(ctx context.Context, in *v1.PieceTaskRequest, opts ...grpc.CallOption) (*v1.PiecePacket, error) + // Sync piece tasks with other peers + SyncPieceTasks(ctx context.Context, opts ...grpc.CallOption) (Seeder_SyncPieceTasksClient, error) +} + +type seederClient struct { + cc grpc.ClientConnInterface +} + +func NewSeederClient(cc grpc.ClientConnInterface) SeederClient { + return &seederClient{cc} +} + +func (c *seederClient) ObtainSeeds(ctx context.Context, in *SeedRequest, opts ...grpc.CallOption) (Seeder_ObtainSeedsClient, error) { + stream, err := c.cc.NewStream(ctx, &_Seeder_serviceDesc.Streams[0], "/cdnsystem.Seeder/ObtainSeeds", opts...) + if err != nil { + return nil, err + } + x := &seederObtainSeedsClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Seeder_ObtainSeedsClient interface { + Recv() (*PieceSeed, error) + grpc.ClientStream +} + +type seederObtainSeedsClient struct { + grpc.ClientStream +} + +func (x *seederObtainSeedsClient) Recv() (*PieceSeed, error) { + m := new(PieceSeed) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *seederClient) GetPieceTasks(ctx context.Context, in *v1.PieceTaskRequest, opts ...grpc.CallOption) (*v1.PiecePacket, error) { + out := new(v1.PiecePacket) + err := c.cc.Invoke(ctx, "/cdnsystem.Seeder/GetPieceTasks", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *seederClient) SyncPieceTasks(ctx context.Context, opts ...grpc.CallOption) (Seeder_SyncPieceTasksClient, error) { + stream, err := c.cc.NewStream(ctx, &_Seeder_serviceDesc.Streams[1], "/cdnsystem.Seeder/SyncPieceTasks", opts...) + if err != nil { + return nil, err + } + x := &seederSyncPieceTasksClient{stream} + return x, nil +} + +type Seeder_SyncPieceTasksClient interface { + Send(*v1.PieceTaskRequest) error + Recv() (*v1.PiecePacket, error) + grpc.ClientStream +} + +type seederSyncPieceTasksClient struct { + grpc.ClientStream +} + +func (x *seederSyncPieceTasksClient) Send(m *v1.PieceTaskRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *seederSyncPieceTasksClient) Recv() (*v1.PiecePacket, error) { + m := new(v1.PiecePacket) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// SeederServer is the server API for Seeder service. +type SeederServer interface { + // Generate seeds and return to scheduler + ObtainSeeds(*SeedRequest, Seeder_ObtainSeedsServer) error + // Get piece tasks from cdn + GetPieceTasks(context.Context, *v1.PieceTaskRequest) (*v1.PiecePacket, error) + // Sync piece tasks with other peers + SyncPieceTasks(Seeder_SyncPieceTasksServer) error +} + +// UnimplementedSeederServer can be embedded to have forward compatible implementations. +type UnimplementedSeederServer struct { +} + +func (*UnimplementedSeederServer) ObtainSeeds(*SeedRequest, Seeder_ObtainSeedsServer) error { + return status.Errorf(codes.Unimplemented, "method ObtainSeeds not implemented") +} +func (*UnimplementedSeederServer) GetPieceTasks(context.Context, *v1.PieceTaskRequest) (*v1.PiecePacket, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPieceTasks not implemented") +} +func (*UnimplementedSeederServer) SyncPieceTasks(Seeder_SyncPieceTasksServer) error { + return status.Errorf(codes.Unimplemented, "method SyncPieceTasks not implemented") +} + +func RegisterSeederServer(s *grpc.Server, srv SeederServer) { + s.RegisterService(&_Seeder_serviceDesc, srv) +} + +func _Seeder_ObtainSeeds_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SeedRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(SeederServer).ObtainSeeds(m, &seederObtainSeedsServer{stream}) +} + +type Seeder_ObtainSeedsServer interface { + Send(*PieceSeed) error + grpc.ServerStream +} + +type seederObtainSeedsServer struct { + grpc.ServerStream +} + +func (x *seederObtainSeedsServer) Send(m *PieceSeed) error { + return x.ServerStream.SendMsg(m) +} + +func _Seeder_GetPieceTasks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(v1.PieceTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SeederServer).GetPieceTasks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cdnsystem.Seeder/GetPieceTasks", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SeederServer).GetPieceTasks(ctx, req.(*v1.PieceTaskRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Seeder_SyncPieceTasks_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(SeederServer).SyncPieceTasks(&seederSyncPieceTasksServer{stream}) +} + +type Seeder_SyncPieceTasksServer interface { + Send(*v1.PiecePacket) error + Recv() (*v1.PieceTaskRequest, error) + grpc.ServerStream +} + +type seederSyncPieceTasksServer struct { + grpc.ServerStream +} + +func (x *seederSyncPieceTasksServer) Send(m *v1.PiecePacket) error { + return x.ServerStream.SendMsg(m) +} + +func (x *seederSyncPieceTasksServer) Recv() (*v1.PieceTaskRequest, error) { + m := new(v1.PieceTaskRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _Seeder_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cdnsystem.Seeder", + HandlerType: (*SeederServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetPieceTasks", + Handler: _Seeder_GetPieceTasks_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ObtainSeeds", + Handler: _Seeder_ObtainSeeds_Handler, + ServerStreams: true, + }, + { + StreamName: "SyncPieceTasks", + Handler: _Seeder_SyncPieceTasks_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "pkg/apis/cdnsystem/v1/cdnsystem.proto", +} diff --git a/pkg/apis/cdnsystem/v1/cdnsystem.pb.validate.go b/pkg/apis/cdnsystem/v1/cdnsystem.pb.validate.go new file mode 100644 index 0000000..463e12b --- /dev/null +++ b/pkg/apis/cdnsystem/v1/cdnsystem.pb.validate.go @@ -0,0 +1,385 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: pkg/apis/cdnsystem/v1/cdnsystem.proto + +package v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on SeedRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *SeedRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SeedRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in SeedRequestMultiError, or +// nil if none found. +func (m *SeedRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *SeedRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := SeedRequestValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if uri, err := url.Parse(m.GetUrl()); err != nil { + err = SeedRequestValidationError{ + field: "Url", + reason: "value must be a valid URI", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } else if !uri.IsAbs() { + err := SeedRequestValidationError{ + field: "Url", + reason: "value must be absolute", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetUrlMeta()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SeedRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SeedRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SeedRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return SeedRequestMultiError(errors) + } + + return nil +} + +// SeedRequestMultiError is an error wrapping multiple validation errors +// returned by SeedRequest.ValidateAll() if the designated constraints aren't met. +type SeedRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SeedRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SeedRequestMultiError) AllErrors() []error { return m } + +// SeedRequestValidationError is the validation error returned by +// SeedRequest.Validate if the designated constraints aren't met. +type SeedRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SeedRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SeedRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SeedRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SeedRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SeedRequestValidationError) ErrorName() string { return "SeedRequestValidationError" } + +// Error satisfies the builtin error interface +func (e SeedRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSeedRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SeedRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SeedRequestValidationError{} + +// Validate checks the field values on PieceSeed with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *PieceSeed) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PieceSeed with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in PieceSeedMultiError, or nil +// if none found. +func (m *PieceSeed) ValidateAll() error { + return m.validate(true) +} + +func (m *PieceSeed) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetPeerId()) < 1 { + err := PieceSeedValidationError{ + field: "PeerId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetHostId()) < 1 { + err := PieceSeedValidationError{ + field: "HostId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetPieceInfo()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PieceSeedValidationError{ + field: "PieceInfo", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PieceSeedValidationError{ + field: "PieceInfo", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetPieceInfo()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PieceSeedValidationError{ + field: "PieceInfo", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for Done + + // no validation rules for ContentLength + + // no validation rules for TotalPieceCount + + // no validation rules for BeginTime + + // no validation rules for EndTime + + if all { + switch v := interface{}(m.GetExtendAttribute()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PieceSeedValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PieceSeedValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetExtendAttribute()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PieceSeedValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return PieceSeedMultiError(errors) + } + + return nil +} + +// PieceSeedMultiError is an error wrapping multiple validation errors returned +// by PieceSeed.ValidateAll() if the designated constraints aren't met. +type PieceSeedMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PieceSeedMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PieceSeedMultiError) AllErrors() []error { return m } + +// PieceSeedValidationError is the validation error returned by +// PieceSeed.Validate if the designated constraints aren't met. +type PieceSeedValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PieceSeedValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PieceSeedValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PieceSeedValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PieceSeedValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PieceSeedValidationError) ErrorName() string { return "PieceSeedValidationError" } + +// Error satisfies the builtin error interface +func (e PieceSeedValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPieceSeed.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PieceSeedValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PieceSeedValidationError{} diff --git a/pkg/apis/cdnsystem/v1/cdnsystem.proto b/pkg/apis/cdnsystem/v1/cdnsystem.proto new file mode 100644 index 0000000..62c9af6 --- /dev/null +++ b/pkg/apis/cdnsystem/v1/cdnsystem.proto @@ -0,0 +1,64 @@ +/* + * Copyright 2022 The Dragonfly 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. + */ + +syntax = "proto3"; + +package cdnsystem; + +import "pkg/apis/common/v1/common.proto"; +import "validate/validate.proto"; + +option go_package = "d7y.io/api/pkg/apis/cdnsystem/v1"; + +message SeedRequest{ + string task_id = 1 [(validate.rules).string.min_len = 1]; + string url = 2 [(validate.rules).string.uri = true]; + common.UrlMeta url_meta = 3; +} + +// keep piece meta and data separately +// check piece md5, md5s sign and total content length +message PieceSeed{ + // peer id for cdn node, need suffix with _CDN + string peer_id = 2 [(validate.rules).string.min_len = 1]; + // cdn host id + string host_id = 3 [(validate.rules).string.min_len = 1]; + common.PieceInfo piece_info = 4; + + // whether or not all seeds are downloaded + bool done = 5; + // content total length for the url, content_length < 0 represent content length is unknown + int64 content_length = 6; + // total piece count, -1 represents task is downloading or failed + int32 total_piece_count = 7; + // begin time for the piece downloading + uint64 begin_time = 8; + // end time for the piece downloading + uint64 end_time = 9; + // task extend attribute + common.ExtendAttribute extend_attribute = 10; +} + +// CDN System RPC Service +service Seeder{ + // Generate seeds and return to scheduler + rpc ObtainSeeds(SeedRequest)returns(stream PieceSeed); + // Get piece tasks from cdn + rpc GetPieceTasks(common.PieceTaskRequest)returns(common.PiecePacket); + // Sync piece tasks with other peers + rpc SyncPieceTasks(stream common.PieceTaskRequest)returns(stream common.PiecePacket); +} + diff --git a/pkg/apis/cdnsystem/v1/mocks/cdnsystem_mock.go b/pkg/apis/cdnsystem/v1/mocks/cdnsystem_mock.go new file mode 100644 index 0000000..d047dd0 --- /dev/null +++ b/pkg/apis/cdnsystem/v1/mocks/cdnsystem_mock.go @@ -0,0 +1,678 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ../cdnsystem.pb.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + reflect "reflect" + + v1 "d7y.io/api/pkg/apis/cdnsystem/v1" + v10 "d7y.io/api/pkg/apis/common/v1" + gomock "github.com/golang/mock/gomock" + grpc "google.golang.org/grpc" + metadata "google.golang.org/grpc/metadata" +) + +// MockSeederClient is a mock of SeederClient interface. +type MockSeederClient struct { + ctrl *gomock.Controller + recorder *MockSeederClientMockRecorder +} + +// MockSeederClientMockRecorder is the mock recorder for MockSeederClient. +type MockSeederClientMockRecorder struct { + mock *MockSeederClient +} + +// NewMockSeederClient creates a new mock instance. +func NewMockSeederClient(ctrl *gomock.Controller) *MockSeederClient { + mock := &MockSeederClient{ctrl: ctrl} + mock.recorder = &MockSeederClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSeederClient) EXPECT() *MockSeederClientMockRecorder { + return m.recorder +} + +// GetPieceTasks mocks base method. +func (m *MockSeederClient) GetPieceTasks(ctx context.Context, in *v10.PieceTaskRequest, opts ...grpc.CallOption) (*v10.PiecePacket, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetPieceTasks", varargs...) + ret0, _ := ret[0].(*v10.PiecePacket) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPieceTasks indicates an expected call of GetPieceTasks. +func (mr *MockSeederClientMockRecorder) GetPieceTasks(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPieceTasks", reflect.TypeOf((*MockSeederClient)(nil).GetPieceTasks), varargs...) +} + +// ObtainSeeds mocks base method. +func (m *MockSeederClient) ObtainSeeds(ctx context.Context, in *v1.SeedRequest, opts ...grpc.CallOption) (v1.Seeder_ObtainSeedsClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ObtainSeeds", varargs...) + ret0, _ := ret[0].(v1.Seeder_ObtainSeedsClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ObtainSeeds indicates an expected call of ObtainSeeds. +func (mr *MockSeederClientMockRecorder) ObtainSeeds(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObtainSeeds", reflect.TypeOf((*MockSeederClient)(nil).ObtainSeeds), varargs...) +} + +// SyncPieceTasks mocks base method. +func (m *MockSeederClient) SyncPieceTasks(ctx context.Context, opts ...grpc.CallOption) (v1.Seeder_SyncPieceTasksClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SyncPieceTasks", varargs...) + ret0, _ := ret[0].(v1.Seeder_SyncPieceTasksClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SyncPieceTasks indicates an expected call of SyncPieceTasks. +func (mr *MockSeederClientMockRecorder) SyncPieceTasks(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SyncPieceTasks", reflect.TypeOf((*MockSeederClient)(nil).SyncPieceTasks), varargs...) +} + +// MockSeeder_ObtainSeedsClient is a mock of Seeder_ObtainSeedsClient interface. +type MockSeeder_ObtainSeedsClient struct { + ctrl *gomock.Controller + recorder *MockSeeder_ObtainSeedsClientMockRecorder +} + +// MockSeeder_ObtainSeedsClientMockRecorder is the mock recorder for MockSeeder_ObtainSeedsClient. +type MockSeeder_ObtainSeedsClientMockRecorder struct { + mock *MockSeeder_ObtainSeedsClient +} + +// NewMockSeeder_ObtainSeedsClient creates a new mock instance. +func NewMockSeeder_ObtainSeedsClient(ctrl *gomock.Controller) *MockSeeder_ObtainSeedsClient { + mock := &MockSeeder_ObtainSeedsClient{ctrl: ctrl} + mock.recorder = &MockSeeder_ObtainSeedsClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSeeder_ObtainSeedsClient) EXPECT() *MockSeeder_ObtainSeedsClientMockRecorder { + return m.recorder +} + +// CloseSend mocks base method. +func (m *MockSeeder_ObtainSeedsClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend. +func (mr *MockSeeder_ObtainSeedsClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockSeeder_ObtainSeedsClient)(nil).CloseSend)) +} + +// Context mocks base method. +func (m *MockSeeder_ObtainSeedsClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockSeeder_ObtainSeedsClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockSeeder_ObtainSeedsClient)(nil).Context)) +} + +// Header mocks base method. +func (m *MockSeeder_ObtainSeedsClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header. +func (mr *MockSeeder_ObtainSeedsClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockSeeder_ObtainSeedsClient)(nil).Header)) +} + +// Recv mocks base method. +func (m *MockSeeder_ObtainSeedsClient) Recv() (*v1.PieceSeed, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*v1.PieceSeed) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockSeeder_ObtainSeedsClientMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockSeeder_ObtainSeedsClient)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockSeeder_ObtainSeedsClient) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockSeeder_ObtainSeedsClientMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockSeeder_ObtainSeedsClient)(nil).RecvMsg), m) +} + +// SendMsg mocks base method. +func (m_2 *MockSeeder_ObtainSeedsClient) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockSeeder_ObtainSeedsClientMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockSeeder_ObtainSeedsClient)(nil).SendMsg), m) +} + +// Trailer mocks base method. +func (m *MockSeeder_ObtainSeedsClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer. +func (mr *MockSeeder_ObtainSeedsClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockSeeder_ObtainSeedsClient)(nil).Trailer)) +} + +// MockSeeder_SyncPieceTasksClient is a mock of Seeder_SyncPieceTasksClient interface. +type MockSeeder_SyncPieceTasksClient struct { + ctrl *gomock.Controller + recorder *MockSeeder_SyncPieceTasksClientMockRecorder +} + +// MockSeeder_SyncPieceTasksClientMockRecorder is the mock recorder for MockSeeder_SyncPieceTasksClient. +type MockSeeder_SyncPieceTasksClientMockRecorder struct { + mock *MockSeeder_SyncPieceTasksClient +} + +// NewMockSeeder_SyncPieceTasksClient creates a new mock instance. +func NewMockSeeder_SyncPieceTasksClient(ctrl *gomock.Controller) *MockSeeder_SyncPieceTasksClient { + mock := &MockSeeder_SyncPieceTasksClient{ctrl: ctrl} + mock.recorder = &MockSeeder_SyncPieceTasksClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSeeder_SyncPieceTasksClient) EXPECT() *MockSeeder_SyncPieceTasksClientMockRecorder { + return m.recorder +} + +// CloseSend mocks base method. +func (m *MockSeeder_SyncPieceTasksClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend. +func (mr *MockSeeder_SyncPieceTasksClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockSeeder_SyncPieceTasksClient)(nil).CloseSend)) +} + +// Context mocks base method. +func (m *MockSeeder_SyncPieceTasksClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockSeeder_SyncPieceTasksClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockSeeder_SyncPieceTasksClient)(nil).Context)) +} + +// Header mocks base method. +func (m *MockSeeder_SyncPieceTasksClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header. +func (mr *MockSeeder_SyncPieceTasksClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockSeeder_SyncPieceTasksClient)(nil).Header)) +} + +// Recv mocks base method. +func (m *MockSeeder_SyncPieceTasksClient) Recv() (*v10.PiecePacket, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*v10.PiecePacket) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockSeeder_SyncPieceTasksClientMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockSeeder_SyncPieceTasksClient)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockSeeder_SyncPieceTasksClient) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockSeeder_SyncPieceTasksClientMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockSeeder_SyncPieceTasksClient)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockSeeder_SyncPieceTasksClient) Send(arg0 *v10.PieceTaskRequest) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockSeeder_SyncPieceTasksClientMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockSeeder_SyncPieceTasksClient)(nil).Send), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockSeeder_SyncPieceTasksClient) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockSeeder_SyncPieceTasksClientMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockSeeder_SyncPieceTasksClient)(nil).SendMsg), m) +} + +// Trailer mocks base method. +func (m *MockSeeder_SyncPieceTasksClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer. +func (mr *MockSeeder_SyncPieceTasksClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockSeeder_SyncPieceTasksClient)(nil).Trailer)) +} + +// MockSeederServer is a mock of SeederServer interface. +type MockSeederServer struct { + ctrl *gomock.Controller + recorder *MockSeederServerMockRecorder +} + +// MockSeederServerMockRecorder is the mock recorder for MockSeederServer. +type MockSeederServerMockRecorder struct { + mock *MockSeederServer +} + +// NewMockSeederServer creates a new mock instance. +func NewMockSeederServer(ctrl *gomock.Controller) *MockSeederServer { + mock := &MockSeederServer{ctrl: ctrl} + mock.recorder = &MockSeederServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSeederServer) EXPECT() *MockSeederServerMockRecorder { + return m.recorder +} + +// GetPieceTasks mocks base method. +func (m *MockSeederServer) GetPieceTasks(arg0 context.Context, arg1 *v10.PieceTaskRequest) (*v10.PiecePacket, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPieceTasks", arg0, arg1) + ret0, _ := ret[0].(*v10.PiecePacket) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPieceTasks indicates an expected call of GetPieceTasks. +func (mr *MockSeederServerMockRecorder) GetPieceTasks(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPieceTasks", reflect.TypeOf((*MockSeederServer)(nil).GetPieceTasks), arg0, arg1) +} + +// ObtainSeeds mocks base method. +func (m *MockSeederServer) ObtainSeeds(arg0 *v1.SeedRequest, arg1 v1.Seeder_ObtainSeedsServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ObtainSeeds", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ObtainSeeds indicates an expected call of ObtainSeeds. +func (mr *MockSeederServerMockRecorder) ObtainSeeds(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObtainSeeds", reflect.TypeOf((*MockSeederServer)(nil).ObtainSeeds), arg0, arg1) +} + +// SyncPieceTasks mocks base method. +func (m *MockSeederServer) SyncPieceTasks(arg0 v1.Seeder_SyncPieceTasksServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SyncPieceTasks", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SyncPieceTasks indicates an expected call of SyncPieceTasks. +func (mr *MockSeederServerMockRecorder) SyncPieceTasks(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SyncPieceTasks", reflect.TypeOf((*MockSeederServer)(nil).SyncPieceTasks), arg0) +} + +// MockSeeder_ObtainSeedsServer is a mock of Seeder_ObtainSeedsServer interface. +type MockSeeder_ObtainSeedsServer struct { + ctrl *gomock.Controller + recorder *MockSeeder_ObtainSeedsServerMockRecorder +} + +// MockSeeder_ObtainSeedsServerMockRecorder is the mock recorder for MockSeeder_ObtainSeedsServer. +type MockSeeder_ObtainSeedsServerMockRecorder struct { + mock *MockSeeder_ObtainSeedsServer +} + +// NewMockSeeder_ObtainSeedsServer creates a new mock instance. +func NewMockSeeder_ObtainSeedsServer(ctrl *gomock.Controller) *MockSeeder_ObtainSeedsServer { + mock := &MockSeeder_ObtainSeedsServer{ctrl: ctrl} + mock.recorder = &MockSeeder_ObtainSeedsServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSeeder_ObtainSeedsServer) EXPECT() *MockSeeder_ObtainSeedsServerMockRecorder { + return m.recorder +} + +// Context mocks base method. +func (m *MockSeeder_ObtainSeedsServer) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockSeeder_ObtainSeedsServerMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockSeeder_ObtainSeedsServer)(nil).Context)) +} + +// RecvMsg mocks base method. +func (m_2 *MockSeeder_ObtainSeedsServer) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockSeeder_ObtainSeedsServerMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockSeeder_ObtainSeedsServer)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockSeeder_ObtainSeedsServer) Send(arg0 *v1.PieceSeed) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockSeeder_ObtainSeedsServerMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockSeeder_ObtainSeedsServer)(nil).Send), arg0) +} + +// SendHeader mocks base method. +func (m *MockSeeder_ObtainSeedsServer) SendHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendHeader indicates an expected call of SendHeader. +func (mr *MockSeeder_ObtainSeedsServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockSeeder_ObtainSeedsServer)(nil).SendHeader), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockSeeder_ObtainSeedsServer) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockSeeder_ObtainSeedsServerMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockSeeder_ObtainSeedsServer)(nil).SendMsg), m) +} + +// SetHeader mocks base method. +func (m *MockSeeder_ObtainSeedsServer) SetHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetHeader indicates an expected call of SetHeader. +func (mr *MockSeeder_ObtainSeedsServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockSeeder_ObtainSeedsServer)(nil).SetHeader), arg0) +} + +// SetTrailer mocks base method. +func (m *MockSeeder_ObtainSeedsServer) SetTrailer(arg0 metadata.MD) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetTrailer", arg0) +} + +// SetTrailer indicates an expected call of SetTrailer. +func (mr *MockSeeder_ObtainSeedsServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockSeeder_ObtainSeedsServer)(nil).SetTrailer), arg0) +} + +// MockSeeder_SyncPieceTasksServer is a mock of Seeder_SyncPieceTasksServer interface. +type MockSeeder_SyncPieceTasksServer struct { + ctrl *gomock.Controller + recorder *MockSeeder_SyncPieceTasksServerMockRecorder +} + +// MockSeeder_SyncPieceTasksServerMockRecorder is the mock recorder for MockSeeder_SyncPieceTasksServer. +type MockSeeder_SyncPieceTasksServerMockRecorder struct { + mock *MockSeeder_SyncPieceTasksServer +} + +// NewMockSeeder_SyncPieceTasksServer creates a new mock instance. +func NewMockSeeder_SyncPieceTasksServer(ctrl *gomock.Controller) *MockSeeder_SyncPieceTasksServer { + mock := &MockSeeder_SyncPieceTasksServer{ctrl: ctrl} + mock.recorder = &MockSeeder_SyncPieceTasksServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSeeder_SyncPieceTasksServer) EXPECT() *MockSeeder_SyncPieceTasksServerMockRecorder { + return m.recorder +} + +// Context mocks base method. +func (m *MockSeeder_SyncPieceTasksServer) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockSeeder_SyncPieceTasksServerMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockSeeder_SyncPieceTasksServer)(nil).Context)) +} + +// Recv mocks base method. +func (m *MockSeeder_SyncPieceTasksServer) Recv() (*v10.PieceTaskRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*v10.PieceTaskRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockSeeder_SyncPieceTasksServerMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockSeeder_SyncPieceTasksServer)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockSeeder_SyncPieceTasksServer) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockSeeder_SyncPieceTasksServerMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockSeeder_SyncPieceTasksServer)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockSeeder_SyncPieceTasksServer) Send(arg0 *v10.PiecePacket) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockSeeder_SyncPieceTasksServerMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockSeeder_SyncPieceTasksServer)(nil).Send), arg0) +} + +// SendHeader mocks base method. +func (m *MockSeeder_SyncPieceTasksServer) SendHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendHeader indicates an expected call of SendHeader. +func (mr *MockSeeder_SyncPieceTasksServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockSeeder_SyncPieceTasksServer)(nil).SendHeader), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockSeeder_SyncPieceTasksServer) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockSeeder_SyncPieceTasksServerMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockSeeder_SyncPieceTasksServer)(nil).SendMsg), m) +} + +// SetHeader mocks base method. +func (m *MockSeeder_SyncPieceTasksServer) SetHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetHeader indicates an expected call of SetHeader. +func (mr *MockSeeder_SyncPieceTasksServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockSeeder_SyncPieceTasksServer)(nil).SetHeader), arg0) +} + +// SetTrailer mocks base method. +func (m *MockSeeder_SyncPieceTasksServer) SetTrailer(arg0 metadata.MD) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetTrailer", arg0) +} + +// SetTrailer indicates an expected call of SetTrailer. +func (mr *MockSeeder_SyncPieceTasksServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockSeeder_SyncPieceTasksServer)(nil).SetTrailer), arg0) +} diff --git a/pkg/apis/cdnsystem/v1/mocks/mocks.go b/pkg/apis/cdnsystem/v1/mocks/mocks.go new file mode 100644 index 0000000..04e96cc --- /dev/null +++ b/pkg/apis/cdnsystem/v1/mocks/mocks.go @@ -0,0 +1,19 @@ +/* + * Copyright 2022 The Dragonfly 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 mocks + +//go:generate mockgen -destination cdnsystem_mock.go -source ../cdnsystem.pb.go -package mocks diff --git a/pkg/apis/common/v1/common.pb.go b/pkg/apis/common/v1/common.pb.go new file mode 100644 index 0000000..aa698dd --- /dev/null +++ b/pkg/apis/common/v1/common.pb.go @@ -0,0 +1,1256 @@ +// +// Copyright 2022 The Dragonfly 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.19.4 +// source: pkg/apis/common/v1/common.proto + +package v1 + +import ( + _ "github.com/envoyproxy/protoc-gen-validate/validate" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Code int32 + +const ( + Code_X_UNSPECIFIED Code = 0 + // success code 200-299 + Code_Success Code = 200 + // framework can not find server node + Code_ServerUnavailable Code = 500 + // common response error 1000-1999 + // client can be migrated to another scheduler/CDN + Code_ResourceLacked Code = 1000 + Code_BackToSourceAborted Code = 1001 + Code_BadRequest Code = 1400 + Code_PeerTaskNotFound Code = 1404 + Code_UnknownError Code = 1500 + Code_RequestTimeOut Code = 1504 + // client response error 4000-4999 + Code_ClientError Code = 4000 + Code_ClientPieceRequestFail Code = 4001 // get piece task from other peer error + Code_ClientScheduleTimeout Code = 4002 // wait scheduler response timeout + Code_ClientContextCanceled Code = 4003 + Code_ClientWaitPieceReady Code = 4004 // when target peer downloads from source slowly, should wait + Code_ClientPieceDownloadFail Code = 4005 + Code_ClientRequestLimitFail Code = 4006 + Code_ClientConnectionError Code = 4007 + Code_ClientBackSourceError Code = 4008 + Code_ClientPieceNotFound Code = 4404 + // scheduler response error 5000-5999 + Code_SchedError Code = 5000 + Code_SchedNeedBackSource Code = 5001 // client should try to download from source + Code_SchedPeerGone Code = 5002 // client should disconnect from scheduler + Code_SchedPeerNotFound Code = 5004 // peer not found in scheduler + Code_SchedPeerPieceResultReportFail Code = 5005 // report piece + Code_SchedTaskStatusError Code = 5006 // task status is fail + // cdnsystem response error 6000-6999 + Code_CDNTaskRegistryFail Code = 6001 + Code_CDNTaskNotFound Code = 6404 + // manager response error 7000-7999 + Code_InvalidResourceType Code = 7001 +) + +// Enum value maps for Code. +var ( + Code_name = map[int32]string{ + 0: "X_UNSPECIFIED", + 200: "Success", + 500: "ServerUnavailable", + 1000: "ResourceLacked", + 1001: "BackToSourceAborted", + 1400: "BadRequest", + 1404: "PeerTaskNotFound", + 1500: "UnknownError", + 1504: "RequestTimeOut", + 4000: "ClientError", + 4001: "ClientPieceRequestFail", + 4002: "ClientScheduleTimeout", + 4003: "ClientContextCanceled", + 4004: "ClientWaitPieceReady", + 4005: "ClientPieceDownloadFail", + 4006: "ClientRequestLimitFail", + 4007: "ClientConnectionError", + 4008: "ClientBackSourceError", + 4404: "ClientPieceNotFound", + 5000: "SchedError", + 5001: "SchedNeedBackSource", + 5002: "SchedPeerGone", + 5004: "SchedPeerNotFound", + 5005: "SchedPeerPieceResultReportFail", + 5006: "SchedTaskStatusError", + 6001: "CDNTaskRegistryFail", + 6404: "CDNTaskNotFound", + 7001: "InvalidResourceType", + } + Code_value = map[string]int32{ + "X_UNSPECIFIED": 0, + "Success": 200, + "ServerUnavailable": 500, + "ResourceLacked": 1000, + "BackToSourceAborted": 1001, + "BadRequest": 1400, + "PeerTaskNotFound": 1404, + "UnknownError": 1500, + "RequestTimeOut": 1504, + "ClientError": 4000, + "ClientPieceRequestFail": 4001, + "ClientScheduleTimeout": 4002, + "ClientContextCanceled": 4003, + "ClientWaitPieceReady": 4004, + "ClientPieceDownloadFail": 4005, + "ClientRequestLimitFail": 4006, + "ClientConnectionError": 4007, + "ClientBackSourceError": 4008, + "ClientPieceNotFound": 4404, + "SchedError": 5000, + "SchedNeedBackSource": 5001, + "SchedPeerGone": 5002, + "SchedPeerNotFound": 5004, + "SchedPeerPieceResultReportFail": 5005, + "SchedTaskStatusError": 5006, + "CDNTaskRegistryFail": 6001, + "CDNTaskNotFound": 6404, + "InvalidResourceType": 7001, + } +) + +func (x Code) Enum() *Code { + p := new(Code) + *p = x + return p +} + +func (x Code) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Code) Descriptor() protoreflect.EnumDescriptor { + return file_pkg_apis_common_v1_common_proto_enumTypes[0].Descriptor() +} + +func (Code) Type() protoreflect.EnumType { + return &file_pkg_apis_common_v1_common_proto_enumTypes[0] +} + +func (x Code) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Code.Descriptor instead. +func (Code) EnumDescriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{0} +} + +type PieceStyle int32 + +const ( + PieceStyle_PLAIN PieceStyle = 0 +) + +// Enum value maps for PieceStyle. +var ( + PieceStyle_name = map[int32]string{ + 0: "PLAIN", + } + PieceStyle_value = map[string]int32{ + "PLAIN": 0, + } +) + +func (x PieceStyle) Enum() *PieceStyle { + p := new(PieceStyle) + *p = x + return p +} + +func (x PieceStyle) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PieceStyle) Descriptor() protoreflect.EnumDescriptor { + return file_pkg_apis_common_v1_common_proto_enumTypes[1].Descriptor() +} + +func (PieceStyle) Type() protoreflect.EnumType { + return &file_pkg_apis_common_v1_common_proto_enumTypes[1] +} + +func (x PieceStyle) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PieceStyle.Descriptor instead. +func (PieceStyle) EnumDescriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{1} +} + +type SizeScope int32 + +const ( + // size > one piece size + SizeScope_NORMAL SizeScope = 0 + // 128 byte < size <= one piece size and be plain type + SizeScope_SMALL SizeScope = 1 + // size <= 128 byte and be plain type + SizeScope_TINY SizeScope = 2 +) + +// Enum value maps for SizeScope. +var ( + SizeScope_name = map[int32]string{ + 0: "NORMAL", + 1: "SMALL", + 2: "TINY", + } + SizeScope_value = map[string]int32{ + "NORMAL": 0, + "SMALL": 1, + "TINY": 2, + } +) + +func (x SizeScope) Enum() *SizeScope { + p := new(SizeScope) + *p = x + return p +} + +func (x SizeScope) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SizeScope) Descriptor() protoreflect.EnumDescriptor { + return file_pkg_apis_common_v1_common_proto_enumTypes[2].Descriptor() +} + +func (SizeScope) Type() protoreflect.EnumType { + return &file_pkg_apis_common_v1_common_proto_enumTypes[2] +} + +func (x SizeScope) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SizeScope.Descriptor instead. +func (SizeScope) EnumDescriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{2} +} + +// Pattern represents pattern of task. +type Pattern int32 + +const ( + // Default pattern, scheduler will use all p2p node + // include dfdaemon and seed peers. + Pattern_P2P Pattern = 0 + // Seed peer pattern, scheduler will use only seed peers. + Pattern_SEED_PEER Pattern = 1 + // Source pattern, scheduler will say back source + // when there is no available peer in p2p. + Pattern_SOURCE Pattern = 2 +) + +// Enum value maps for Pattern. +var ( + Pattern_name = map[int32]string{ + 0: "P2P", + 1: "SEED_PEER", + 2: "SOURCE", + } + Pattern_value = map[string]int32{ + "P2P": 0, + "SEED_PEER": 1, + "SOURCE": 2, + } +) + +func (x Pattern) Enum() *Pattern { + p := new(Pattern) + *p = x + return p +} + +func (x Pattern) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Pattern) Descriptor() protoreflect.EnumDescriptor { + return file_pkg_apis_common_v1_common_proto_enumTypes[3].Descriptor() +} + +func (Pattern) Type() protoreflect.EnumType { + return &file_pkg_apis_common_v1_common_proto_enumTypes[3] +} + +func (x Pattern) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Pattern.Descriptor instead. +func (Pattern) EnumDescriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{3} +} + +// TaskType represents type of task. +type TaskType int32 + +const ( + // Normal is normal type of task, + // normal task is a normal p2p task. + TaskType_Normal TaskType = 0 + // DfCache is dfcache type of task, + // dfcache task is a cache task, and the task url is fake url. + // It can only be used for caching and cannot be downloaded back to source. + TaskType_DfCache TaskType = 1 + // DfStore is dfstore type of task, + // dfstore task is a persistent task in backend. + TaskType_DfStore TaskType = 2 +) + +// Enum value maps for TaskType. +var ( + TaskType_name = map[int32]string{ + 0: "Normal", + 1: "DfCache", + 2: "DfStore", + } + TaskType_value = map[string]int32{ + "Normal": 0, + "DfCache": 1, + "DfStore": 2, + } +) + +func (x TaskType) Enum() *TaskType { + p := new(TaskType) + *p = x + return p +} + +func (x TaskType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TaskType) Descriptor() protoreflect.EnumDescriptor { + return file_pkg_apis_common_v1_common_proto_enumTypes[4].Descriptor() +} + +func (TaskType) Type() protoreflect.EnumType { + return &file_pkg_apis_common_v1_common_proto_enumTypes[4] +} + +func (x TaskType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TaskType.Descriptor instead. +func (TaskType) EnumDescriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{4} +} + +type GrpcDfError struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code Code `protobuf:"varint,1,opt,name=code,proto3,enum=common.Code" json:"code,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *GrpcDfError) Reset() { + *x = GrpcDfError{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GrpcDfError) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcDfError) ProtoMessage() {} + +func (x *GrpcDfError) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcDfError.ProtoReflect.Descriptor instead. +func (*GrpcDfError) Descriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{0} +} + +func (x *GrpcDfError) GetCode() Code { + if x != nil { + return x.Code + } + return Code_X_UNSPECIFIED +} + +func (x *GrpcDfError) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +// UrlMeta describes url meta info. +type UrlMeta struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // digest checks integrity of url content, for example md5:xxx or sha256:yyy + Digest string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"` + // url tag identifies different task for same url, conflict with digest + Tag string `protobuf:"bytes,2,opt,name=tag,proto3" json:"tag,omitempty"` + // content range for url + Range string `protobuf:"bytes,3,opt,name=range,proto3" json:"range,omitempty"` + // filter url used to generate task id + Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"` + // other url header infos + Header map[string]string `protobuf:"bytes,5,rep,name=header,proto3" json:"header,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *UrlMeta) Reset() { + *x = UrlMeta{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UrlMeta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UrlMeta) ProtoMessage() {} + +func (x *UrlMeta) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UrlMeta.ProtoReflect.Descriptor instead. +func (*UrlMeta) Descriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{1} +} + +func (x *UrlMeta) GetDigest() string { + if x != nil { + return x.Digest + } + return "" +} + +func (x *UrlMeta) GetTag() string { + if x != nil { + return x.Tag + } + return "" +} + +func (x *UrlMeta) GetRange() string { + if x != nil { + return x.Range + } + return "" +} + +func (x *UrlMeta) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +func (x *UrlMeta) GetHeader() map[string]string { + if x != nil { + return x.Header + } + return nil +} + +type HostLoad struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // cpu usage + CpuRatio float32 `protobuf:"fixed32,1,opt,name=cpu_ratio,json=cpuRatio,proto3" json:"cpu_ratio,omitempty"` + // memory usage + MemRatio float32 `protobuf:"fixed32,2,opt,name=mem_ratio,json=memRatio,proto3" json:"mem_ratio,omitempty"` + // disk space usage + DiskRatio float32 `protobuf:"fixed32,3,opt,name=disk_ratio,json=diskRatio,proto3" json:"disk_ratio,omitempty"` +} + +func (x *HostLoad) Reset() { + *x = HostLoad{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HostLoad) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HostLoad) ProtoMessage() {} + +func (x *HostLoad) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HostLoad.ProtoReflect.Descriptor instead. +func (*HostLoad) Descriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{2} +} + +func (x *HostLoad) GetCpuRatio() float32 { + if x != nil { + return x.CpuRatio + } + return 0 +} + +func (x *HostLoad) GetMemRatio() float32 { + if x != nil { + return x.MemRatio + } + return 0 +} + +func (x *HostLoad) GetDiskRatio() float32 { + if x != nil { + return x.DiskRatio + } + return 0 +} + +type PieceTaskRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + SrcPid string `protobuf:"bytes,2,opt,name=src_pid,json=srcPid,proto3" json:"src_pid,omitempty"` + DstPid string `protobuf:"bytes,3,opt,name=dst_pid,json=dstPid,proto3" json:"dst_pid,omitempty"` + // piece number + StartNum uint32 `protobuf:"varint,4,opt,name=start_num,json=startNum,proto3" json:"start_num,omitempty"` + // expected piece count, limit = 0 represent request pieces as many shards as possible + Limit uint32 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"` +} + +func (x *PieceTaskRequest) Reset() { + *x = PieceTaskRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PieceTaskRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PieceTaskRequest) ProtoMessage() {} + +func (x *PieceTaskRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PieceTaskRequest.ProtoReflect.Descriptor instead. +func (*PieceTaskRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{3} +} + +func (x *PieceTaskRequest) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *PieceTaskRequest) GetSrcPid() string { + if x != nil { + return x.SrcPid + } + return "" +} + +func (x *PieceTaskRequest) GetDstPid() string { + if x != nil { + return x.DstPid + } + return "" +} + +func (x *PieceTaskRequest) GetStartNum() uint32 { + if x != nil { + return x.StartNum + } + return 0 +} + +func (x *PieceTaskRequest) GetLimit() uint32 { + if x != nil { + return x.Limit + } + return 0 +} + +type PieceInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // piece_num < 0 represent start report piece flag + PieceNum int32 `protobuf:"varint,1,opt,name=piece_num,json=pieceNum,proto3" json:"piece_num,omitempty"` + RangeStart uint64 `protobuf:"varint,2,opt,name=range_start,json=rangeStart,proto3" json:"range_start,omitempty"` + RangeSize uint32 `protobuf:"varint,3,opt,name=range_size,json=rangeSize,proto3" json:"range_size,omitempty"` + PieceMd5 string `protobuf:"bytes,4,opt,name=piece_md5,json=pieceMd5,proto3" json:"piece_md5,omitempty"` + PieceOffset uint64 `protobuf:"varint,5,opt,name=piece_offset,json=pieceOffset,proto3" json:"piece_offset,omitempty"` + PieceStyle PieceStyle `protobuf:"varint,6,opt,name=piece_style,json=pieceStyle,proto3,enum=common.PieceStyle" json:"piece_style,omitempty"` + // total time(millisecond) consumed + DownloadCost uint64 `protobuf:"varint,7,opt,name=download_cost,json=downloadCost,proto3" json:"download_cost,omitempty"` +} + +func (x *PieceInfo) Reset() { + *x = PieceInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PieceInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PieceInfo) ProtoMessage() {} + +func (x *PieceInfo) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PieceInfo.ProtoReflect.Descriptor instead. +func (*PieceInfo) Descriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{4} +} + +func (x *PieceInfo) GetPieceNum() int32 { + if x != nil { + return x.PieceNum + } + return 0 +} + +func (x *PieceInfo) GetRangeStart() uint64 { + if x != nil { + return x.RangeStart + } + return 0 +} + +func (x *PieceInfo) GetRangeSize() uint32 { + if x != nil { + return x.RangeSize + } + return 0 +} + +func (x *PieceInfo) GetPieceMd5() string { + if x != nil { + return x.PieceMd5 + } + return "" +} + +func (x *PieceInfo) GetPieceOffset() uint64 { + if x != nil { + return x.PieceOffset + } + return 0 +} + +func (x *PieceInfo) GetPieceStyle() PieceStyle { + if x != nil { + return x.PieceStyle + } + return PieceStyle_PLAIN +} + +func (x *PieceInfo) GetDownloadCost() uint64 { + if x != nil { + return x.DownloadCost + } + return 0 +} + +type ExtendAttribute struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // task response header, eg: HTTP Response Header + Header map[string]string `protobuf:"bytes,1,rep,name=header,proto3" json:"header,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // task response code, eg: HTTP Status Code + StatusCode int32 `protobuf:"varint,2,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"` + // task response status, eg: HTTP Status + Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *ExtendAttribute) Reset() { + *x = ExtendAttribute{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExtendAttribute) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtendAttribute) ProtoMessage() {} + +func (x *ExtendAttribute) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtendAttribute.ProtoReflect.Descriptor instead. +func (*ExtendAttribute) Descriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{5} +} + +func (x *ExtendAttribute) GetHeader() map[string]string { + if x != nil { + return x.Header + } + return nil +} + +func (x *ExtendAttribute) GetStatusCode() int32 { + if x != nil { + return x.StatusCode + } + return 0 +} + +func (x *ExtendAttribute) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +type PiecePacket struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + DstPid string `protobuf:"bytes,3,opt,name=dst_pid,json=dstPid,proto3" json:"dst_pid,omitempty"` + // ip:port + DstAddr string `protobuf:"bytes,4,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"` + PieceInfos []*PieceInfo `protobuf:"bytes,5,rep,name=piece_infos,json=pieceInfos,proto3" json:"piece_infos,omitempty"` + // total piece count for url, total_piece represent total piece is unknown + TotalPiece int32 `protobuf:"varint,6,opt,name=total_piece,json=totalPiece,proto3" json:"total_piece,omitempty"` + // content_length < 0 represent content length is unknown + ContentLength int64 `protobuf:"varint,7,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"` + // sha256 code of all piece md5 + PieceMd5Sign string `protobuf:"bytes,8,opt,name=piece_md5_sign,json=pieceMd5Sign,proto3" json:"piece_md5_sign,omitempty"` + // task extend attribute + ExtendAttribute *ExtendAttribute `protobuf:"bytes,9,opt,name=extend_attribute,json=extendAttribute,proto3" json:"extend_attribute,omitempty"` +} + +func (x *PiecePacket) Reset() { + *x = PiecePacket{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PiecePacket) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PiecePacket) ProtoMessage() {} + +func (x *PiecePacket) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_common_v1_common_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PiecePacket.ProtoReflect.Descriptor instead. +func (*PiecePacket) Descriptor() ([]byte, []int) { + return file_pkg_apis_common_v1_common_proto_rawDescGZIP(), []int{6} +} + +func (x *PiecePacket) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *PiecePacket) GetDstPid() string { + if x != nil { + return x.DstPid + } + return "" +} + +func (x *PiecePacket) GetDstAddr() string { + if x != nil { + return x.DstAddr + } + return "" +} + +func (x *PiecePacket) GetPieceInfos() []*PieceInfo { + if x != nil { + return x.PieceInfos + } + return nil +} + +func (x *PiecePacket) GetTotalPiece() int32 { + if x != nil { + return x.TotalPiece + } + return 0 +} + +func (x *PiecePacket) GetContentLength() int64 { + if x != nil { + return x.ContentLength + } + return 0 +} + +func (x *PiecePacket) GetPieceMd5Sign() string { + if x != nil { + return x.PieceMd5Sign + } + return "" +} + +func (x *PiecePacket) GetExtendAttribute() *ExtendAttribute { + if x != nil { + return x.ExtendAttribute + } + return nil +} + +var File_pkg_apis_common_v1_common_proto protoreflect.FileDescriptor + +var file_pkg_apis_common_v1_common_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x49, 0x0a, 0x0b, 0x47, 0x72, 0x70, 0x63, 0x44, 0x66, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x12, 0x20, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x0c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, + 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x95, 0x02, + 0x0a, 0x07, 0x55, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x3f, 0x0a, 0x06, 0x64, 0x69, 0x67, + 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x27, 0xfa, 0x42, 0x24, 0x72, 0x22, + 0x32, 0x1d, 0x5e, 0x28, 0x6d, 0x64, 0x35, 0x29, 0x7c, 0x28, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, + 0x29, 0x3a, 0x5b, 0x41, 0x2d, 0x46, 0x61, 0x2d, 0x66, 0x30, 0x2d, 0x39, 0x5d, 0x2b, 0x24, 0xd0, + 0x01, 0x01, 0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, + 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x2f, 0x0a, 0x05, + 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x19, 0xfa, 0x42, 0x16, + 0x72, 0x14, 0x32, 0x0f, 0x5e, 0x5b, 0x30, 0x2d, 0x39, 0x5d, 0x2b, 0x2d, 0x5b, 0x30, 0x2d, 0x39, + 0x5d, 0x2a, 0x24, 0xd0, 0x01, 0x01, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x55, + 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x39, 0x0a, 0x0b, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x96, 0x01, 0x0a, 0x08, 0x48, 0x6f, 0x73, 0x74, 0x4c, 0x6f, + 0x61, 0x64, 0x12, 0x2c, 0x0a, 0x09, 0x63, 0x70, 0x75, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x02, 0x42, 0x0f, 0xfa, 0x42, 0x0c, 0x0a, 0x0a, 0x1d, 0x00, 0x00, 0x80, + 0x3f, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x52, 0x08, 0x63, 0x70, 0x75, 0x52, 0x61, 0x74, 0x69, 0x6f, + 0x12, 0x2c, 0x0a, 0x09, 0x6d, 0x65, 0x6d, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x02, 0x42, 0x0f, 0xfa, 0x42, 0x0c, 0x0a, 0x0a, 0x1d, 0x00, 0x00, 0x80, 0x3f, 0x2d, + 0x00, 0x00, 0x00, 0x00, 0x52, 0x08, 0x6d, 0x65, 0x6d, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x2e, + 0x0a, 0x0a, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x02, 0x42, 0x0f, 0xfa, 0x42, 0x0c, 0x0a, 0x0a, 0x1d, 0x00, 0x00, 0x80, 0x3f, 0x2d, 0x00, + 0x00, 0x00, 0x00, 0x52, 0x09, 0x64, 0x69, 0x73, 0x6b, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x22, 0xbd, + 0x01, 0x0a, 0x10, 0x50, 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, + 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x73, 0x72, 0x63, 0x5f, 0x70, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x06, 0x73, 0x72, 0x63, 0x50, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x64, 0x73, 0x74, 0x5f, 0x70, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x06, 0x64, 0x73, 0x74, 0x50, 0x69, 0x64, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, + 0x04, 0x2a, 0x02, 0x28, 0x00, 0x52, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x12, + 0x1d, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x28, 0x00, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0xe3, + 0x02, 0x0a, 0x09, 0x50, 0x69, 0x65, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a, 0x09, + 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x08, 0x70, 0x69, 0x65, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x0b, 0x72, 0x61, 0x6e, + 0x67, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x00, 0x52, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x12, 0x26, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x2a, 0x02, 0x28, 0x00, + 0x52, 0x09, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x58, 0x0a, 0x09, 0x70, + 0x69, 0x65, 0x63, 0x65, 0x5f, 0x6d, 0x64, 0x35, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x3b, + 0xfa, 0x42, 0x38, 0x72, 0x36, 0x32, 0x31, 0x28, 0x5b, 0x61, 0x2d, 0x66, 0x5c, 0x64, 0x5d, 0x7b, + 0x33, 0x32, 0x7d, 0x7c, 0x5b, 0x41, 0x2d, 0x46, 0x5c, 0x64, 0x5d, 0x7b, 0x33, 0x32, 0x7d, 0x7c, + 0x5b, 0x61, 0x2d, 0x66, 0x5c, 0x64, 0x5d, 0x7b, 0x31, 0x36, 0x7d, 0x7c, 0x5b, 0x41, 0x2d, 0x46, + 0x5c, 0x64, 0x5d, 0x7b, 0x31, 0x36, 0x7d, 0x29, 0xd0, 0x01, 0x01, 0x52, 0x08, 0x70, 0x69, 0x65, + 0x63, 0x65, 0x4d, 0x64, 0x35, 0x12, 0x2a, 0x0a, 0x0c, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, + 0x32, 0x02, 0x28, 0x00, 0x52, 0x0b, 0x70, 0x69, 0x65, 0x63, 0x65, 0x4f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x12, 0x33, 0x0a, 0x0b, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x79, 0x6c, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x50, 0x69, 0x65, 0x63, 0x65, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x52, 0x0a, 0x70, 0x69, 0x65, 0x63, + 0x65, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x2c, 0x0a, 0x0d, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, + 0x61, 0x64, 0x5f, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, + 0x42, 0x04, 0x32, 0x02, 0x28, 0x00, 0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, + 0x43, 0x6f, 0x73, 0x74, 0x22, 0xc2, 0x01, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, + 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, 0x39, + 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xdb, 0x02, 0x0a, 0x0b, 0x50, 0x69, + 0x65, 0x63, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, + 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x64, + 0x73, 0x74, 0x5f, 0x70, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, + 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x64, 0x73, 0x74, 0x50, 0x69, 0x64, 0x12, 0x22, 0x0a, + 0x08, 0x64, 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x64, 0x73, 0x74, 0x41, 0x64, 0x64, + 0x72, 0x12, 0x32, 0x0a, 0x0b, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x50, 0x69, 0x65, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x70, 0x69, 0x65, 0x63, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, + 0x69, 0x65, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x50, 0x69, 0x65, 0x63, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, + 0x0e, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x6d, 0x64, 0x35, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x69, 0x65, 0x63, 0x65, 0x4d, 0x64, 0x35, 0x53, + 0x69, 0x67, 0x6e, 0x12, 0x42, 0x0a, 0x10, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x5f, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2a, 0xae, 0x05, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, + 0x12, 0x11, 0x0a, 0x0d, 0x58, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0xc8, + 0x01, 0x12, 0x16, 0x0a, 0x11, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x55, 0x6e, 0x61, 0x76, 0x61, + 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x10, 0xf4, 0x03, 0x12, 0x13, 0x0a, 0x0e, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x10, 0xe8, 0x07, 0x12, 0x18, + 0x0a, 0x13, 0x42, 0x61, 0x63, 0x6b, 0x54, 0x6f, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x62, + 0x6f, 0x72, 0x74, 0x65, 0x64, 0x10, 0xe9, 0x07, 0x12, 0x0f, 0x0a, 0x0a, 0x42, 0x61, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x15, 0x0a, 0x10, 0x50, 0x65, 0x65, + 0x72, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xfc, 0x0a, + 0x12, 0x11, 0x0a, 0x0c, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x10, 0xdc, 0x0b, 0x12, 0x13, 0x0a, 0x0e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x69, + 0x6d, 0x65, 0x4f, 0x75, 0x74, 0x10, 0xe0, 0x0b, 0x12, 0x10, 0x0a, 0x0b, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0xa0, 0x1f, 0x12, 0x1b, 0x0a, 0x16, 0x43, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x50, 0x69, 0x65, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x46, 0x61, 0x69, 0x6c, 0x10, 0xa1, 0x1f, 0x12, 0x1a, 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, + 0x10, 0xa2, 0x1f, 0x12, 0x1a, 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x78, 0x74, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x10, 0xa3, 0x1f, 0x12, + 0x19, 0x0a, 0x14, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x57, 0x61, 0x69, 0x74, 0x50, 0x69, 0x65, + 0x63, 0x65, 0x52, 0x65, 0x61, 0x64, 0x79, 0x10, 0xa4, 0x1f, 0x12, 0x1c, 0x0a, 0x17, 0x43, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x50, 0x69, 0x65, 0x63, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, + 0x64, 0x46, 0x61, 0x69, 0x6c, 0x10, 0xa5, 0x1f, 0x12, 0x1b, 0x0a, 0x16, 0x43, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x46, 0x61, + 0x69, 0x6c, 0x10, 0xa6, 0x1f, 0x12, 0x1a, 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0xa7, + 0x1f, 0x12, 0x1a, 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x53, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0xa8, 0x1f, 0x12, 0x18, 0x0a, + 0x13, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x50, 0x69, 0x65, 0x63, 0x65, 0x4e, 0x6f, 0x74, 0x46, + 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xb4, 0x22, 0x12, 0x0f, 0x0a, 0x0a, 0x53, 0x63, 0x68, 0x65, 0x64, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x88, 0x27, 0x12, 0x18, 0x0a, 0x13, 0x53, 0x63, 0x68, 0x65, + 0x64, 0x4e, 0x65, 0x65, 0x64, 0x42, 0x61, 0x63, 0x6b, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, + 0x89, 0x27, 0x12, 0x12, 0x0a, 0x0d, 0x53, 0x63, 0x68, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x47, + 0x6f, 0x6e, 0x65, 0x10, 0x8a, 0x27, 0x12, 0x16, 0x0a, 0x11, 0x53, 0x63, 0x68, 0x65, 0x64, 0x50, + 0x65, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x8c, 0x27, 0x12, 0x23, + 0x0a, 0x1e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x50, 0x69, 0x65, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x46, 0x61, 0x69, 0x6c, + 0x10, 0x8d, 0x27, 0x12, 0x19, 0x0a, 0x14, 0x53, 0x63, 0x68, 0x65, 0x64, 0x54, 0x61, 0x73, 0x6b, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x8e, 0x27, 0x12, 0x18, + 0x0a, 0x13, 0x43, 0x44, 0x4e, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x46, 0x61, 0x69, 0x6c, 0x10, 0xf1, 0x2e, 0x12, 0x14, 0x0a, 0x0f, 0x43, 0x44, 0x4e, 0x54, + 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x84, 0x32, 0x12, 0x18, + 0x0a, 0x13, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x10, 0xd9, 0x36, 0x2a, 0x17, 0x0a, 0x0a, 0x50, 0x69, 0x65, 0x63, + 0x65, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x4c, 0x41, 0x49, 0x4e, 0x10, + 0x00, 0x2a, 0x2c, 0x0a, 0x09, 0x53, 0x69, 0x7a, 0x65, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x0a, + 0x0a, 0x06, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x4d, + 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x49, 0x4e, 0x59, 0x10, 0x02, 0x2a, + 0x2d, 0x0a, 0x07, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x32, + 0x50, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x45, 0x45, 0x44, 0x5f, 0x50, 0x45, 0x45, 0x52, + 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x10, 0x02, 0x2a, 0x30, + 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, + 0x72, 0x6d, 0x61, 0x6c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x66, 0x43, 0x61, 0x63, 0x68, + 0x65, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x66, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x10, 0x02, + 0x42, 0x1f, 0x5a, 0x1d, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_apis_common_v1_common_proto_rawDescOnce sync.Once + file_pkg_apis_common_v1_common_proto_rawDescData = file_pkg_apis_common_v1_common_proto_rawDesc +) + +func file_pkg_apis_common_v1_common_proto_rawDescGZIP() []byte { + file_pkg_apis_common_v1_common_proto_rawDescOnce.Do(func() { + file_pkg_apis_common_v1_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_common_v1_common_proto_rawDescData) + }) + return file_pkg_apis_common_v1_common_proto_rawDescData +} + +var file_pkg_apis_common_v1_common_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_pkg_apis_common_v1_common_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_pkg_apis_common_v1_common_proto_goTypes = []interface{}{ + (Code)(0), // 0: common.Code + (PieceStyle)(0), // 1: common.PieceStyle + (SizeScope)(0), // 2: common.SizeScope + (Pattern)(0), // 3: common.Pattern + (TaskType)(0), // 4: common.TaskType + (*GrpcDfError)(nil), // 5: common.GrpcDfError + (*UrlMeta)(nil), // 6: common.UrlMeta + (*HostLoad)(nil), // 7: common.HostLoad + (*PieceTaskRequest)(nil), // 8: common.PieceTaskRequest + (*PieceInfo)(nil), // 9: common.PieceInfo + (*ExtendAttribute)(nil), // 10: common.ExtendAttribute + (*PiecePacket)(nil), // 11: common.PiecePacket + nil, // 12: common.UrlMeta.HeaderEntry + nil, // 13: common.ExtendAttribute.HeaderEntry +} +var file_pkg_apis_common_v1_common_proto_depIdxs = []int32{ + 0, // 0: common.GrpcDfError.code:type_name -> common.Code + 12, // 1: common.UrlMeta.header:type_name -> common.UrlMeta.HeaderEntry + 1, // 2: common.PieceInfo.piece_style:type_name -> common.PieceStyle + 13, // 3: common.ExtendAttribute.header:type_name -> common.ExtendAttribute.HeaderEntry + 9, // 4: common.PiecePacket.piece_infos:type_name -> common.PieceInfo + 10, // 5: common.PiecePacket.extend_attribute:type_name -> common.ExtendAttribute + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_pkg_apis_common_v1_common_proto_init() } +func file_pkg_apis_common_v1_common_proto_init() { + if File_pkg_apis_common_v1_common_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pkg_apis_common_v1_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GrpcDfError); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_common_v1_common_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UrlMeta); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_common_v1_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HostLoad); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_common_v1_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PieceTaskRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_common_v1_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PieceInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_common_v1_common_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExtendAttribute); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_common_v1_common_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PiecePacket); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_apis_common_v1_common_proto_rawDesc, + NumEnums: 5, + NumMessages: 9, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pkg_apis_common_v1_common_proto_goTypes, + DependencyIndexes: file_pkg_apis_common_v1_common_proto_depIdxs, + EnumInfos: file_pkg_apis_common_v1_common_proto_enumTypes, + MessageInfos: file_pkg_apis_common_v1_common_proto_msgTypes, + }.Build() + File_pkg_apis_common_v1_common_proto = out.File + file_pkg_apis_common_v1_common_proto_rawDesc = nil + file_pkg_apis_common_v1_common_proto_goTypes = nil + file_pkg_apis_common_v1_common_proto_depIdxs = nil +} diff --git a/pkg/apis/common/v1/common.pb.validate.go b/pkg/apis/common/v1/common.pb.validate.go new file mode 100644 index 0000000..ad56a33 --- /dev/null +++ b/pkg/apis/common/v1/common.pb.validate.go @@ -0,0 +1,1035 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: pkg/apis/common/v1/common.proto + +package v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on GrpcDfError with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *GrpcDfError) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GrpcDfError with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in GrpcDfErrorMultiError, or +// nil if none found. +func (m *GrpcDfError) ValidateAll() error { + return m.validate(true) +} + +func (m *GrpcDfError) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Code + + // no validation rules for Message + + if len(errors) > 0 { + return GrpcDfErrorMultiError(errors) + } + + return nil +} + +// GrpcDfErrorMultiError is an error wrapping multiple validation errors +// returned by GrpcDfError.ValidateAll() if the designated constraints aren't met. +type GrpcDfErrorMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GrpcDfErrorMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GrpcDfErrorMultiError) AllErrors() []error { return m } + +// GrpcDfErrorValidationError is the validation error returned by +// GrpcDfError.Validate if the designated constraints aren't met. +type GrpcDfErrorValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GrpcDfErrorValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GrpcDfErrorValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GrpcDfErrorValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GrpcDfErrorValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GrpcDfErrorValidationError) ErrorName() string { return "GrpcDfErrorValidationError" } + +// Error satisfies the builtin error interface +func (e GrpcDfErrorValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGrpcDfError.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GrpcDfErrorValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GrpcDfErrorValidationError{} + +// Validate checks the field values on UrlMeta with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *UrlMeta) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UrlMeta with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in UrlMetaMultiError, or nil if none found. +func (m *UrlMeta) ValidateAll() error { + return m.validate(true) +} + +func (m *UrlMeta) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.GetDigest() != "" { + + if !_UrlMeta_Digest_Pattern.MatchString(m.GetDigest()) { + err := UrlMetaValidationError{ + field: "Digest", + reason: "value does not match regex pattern \"^(md5)|(sha256):[A-Fa-f0-9]+$\"", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + // no validation rules for Tag + + if m.GetRange() != "" { + + if !_UrlMeta_Range_Pattern.MatchString(m.GetRange()) { + err := UrlMetaValidationError{ + field: "Range", + reason: "value does not match regex pattern \"^[0-9]+-[0-9]*$\"", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + // no validation rules for Filter + + // no validation rules for Header + + if len(errors) > 0 { + return UrlMetaMultiError(errors) + } + + return nil +} + +// UrlMetaMultiError is an error wrapping multiple validation errors returned +// by UrlMeta.ValidateAll() if the designated constraints aren't met. +type UrlMetaMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UrlMetaMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UrlMetaMultiError) AllErrors() []error { return m } + +// UrlMetaValidationError is the validation error returned by UrlMeta.Validate +// if the designated constraints aren't met. +type UrlMetaValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UrlMetaValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UrlMetaValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UrlMetaValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UrlMetaValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UrlMetaValidationError) ErrorName() string { return "UrlMetaValidationError" } + +// Error satisfies the builtin error interface +func (e UrlMetaValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUrlMeta.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UrlMetaValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UrlMetaValidationError{} + +var _UrlMeta_Digest_Pattern = regexp.MustCompile("^(md5)|(sha256):[A-Fa-f0-9]+$") + +var _UrlMeta_Range_Pattern = regexp.MustCompile("^[0-9]+-[0-9]*$") + +// Validate checks the field values on HostLoad with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *HostLoad) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on HostLoad with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in HostLoadMultiError, or nil +// if none found. +func (m *HostLoad) ValidateAll() error { + return m.validate(true) +} + +func (m *HostLoad) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if val := m.GetCpuRatio(); val < 0 || val > 1 { + err := HostLoadValidationError{ + field: "CpuRatio", + reason: "value must be inside range [0, 1]", + } + if !all { + return err + } + errors = append(errors, err) + } + + if val := m.GetMemRatio(); val < 0 || val > 1 { + err := HostLoadValidationError{ + field: "MemRatio", + reason: "value must be inside range [0, 1]", + } + if !all { + return err + } + errors = append(errors, err) + } + + if val := m.GetDiskRatio(); val < 0 || val > 1 { + err := HostLoadValidationError{ + field: "DiskRatio", + reason: "value must be inside range [0, 1]", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return HostLoadMultiError(errors) + } + + return nil +} + +// HostLoadMultiError is an error wrapping multiple validation errors returned +// by HostLoad.ValidateAll() if the designated constraints aren't met. +type HostLoadMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m HostLoadMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m HostLoadMultiError) AllErrors() []error { return m } + +// HostLoadValidationError is the validation error returned by +// HostLoad.Validate if the designated constraints aren't met. +type HostLoadValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e HostLoadValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e HostLoadValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e HostLoadValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e HostLoadValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e HostLoadValidationError) ErrorName() string { return "HostLoadValidationError" } + +// Error satisfies the builtin error interface +func (e HostLoadValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sHostLoad.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = HostLoadValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = HostLoadValidationError{} + +// Validate checks the field values on PieceTaskRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *PieceTaskRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PieceTaskRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PieceTaskRequestMultiError, or nil if none found. +func (m *PieceTaskRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *PieceTaskRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := PieceTaskRequestValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetSrcPid()) < 1 { + err := PieceTaskRequestValidationError{ + field: "SrcPid", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetDstPid()) < 1 { + err := PieceTaskRequestValidationError{ + field: "DstPid", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetStartNum() < 0 { + err := PieceTaskRequestValidationError{ + field: "StartNum", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetLimit() < 0 { + err := PieceTaskRequestValidationError{ + field: "Limit", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return PieceTaskRequestMultiError(errors) + } + + return nil +} + +// PieceTaskRequestMultiError is an error wrapping multiple validation errors +// returned by PieceTaskRequest.ValidateAll() if the designated constraints +// aren't met. +type PieceTaskRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PieceTaskRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PieceTaskRequestMultiError) AllErrors() []error { return m } + +// PieceTaskRequestValidationError is the validation error returned by +// PieceTaskRequest.Validate if the designated constraints aren't met. +type PieceTaskRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PieceTaskRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PieceTaskRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PieceTaskRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PieceTaskRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PieceTaskRequestValidationError) ErrorName() string { return "PieceTaskRequestValidationError" } + +// Error satisfies the builtin error interface +func (e PieceTaskRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPieceTaskRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PieceTaskRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PieceTaskRequestValidationError{} + +// Validate checks the field values on PieceInfo with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *PieceInfo) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PieceInfo with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in PieceInfoMultiError, or nil +// if none found. +func (m *PieceInfo) ValidateAll() error { + return m.validate(true) +} + +func (m *PieceInfo) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for PieceNum + + if m.GetRangeStart() < 0 { + err := PieceInfoValidationError{ + field: "RangeStart", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetRangeSize() < 0 { + err := PieceInfoValidationError{ + field: "RangeSize", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetPieceMd5() != "" { + + if !_PieceInfo_PieceMd5_Pattern.MatchString(m.GetPieceMd5()) { + err := PieceInfoValidationError{ + field: "PieceMd5", + reason: "value does not match regex pattern \"([a-f\\\\d]{32}|[A-F\\\\d]{32}|[a-f\\\\d]{16}|[A-F\\\\d]{16})\"", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.GetPieceOffset() < 0 { + err := PieceInfoValidationError{ + field: "PieceOffset", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for PieceStyle + + if m.GetDownloadCost() < 0 { + err := PieceInfoValidationError{ + field: "DownloadCost", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return PieceInfoMultiError(errors) + } + + return nil +} + +// PieceInfoMultiError is an error wrapping multiple validation errors returned +// by PieceInfo.ValidateAll() if the designated constraints aren't met. +type PieceInfoMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PieceInfoMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PieceInfoMultiError) AllErrors() []error { return m } + +// PieceInfoValidationError is the validation error returned by +// PieceInfo.Validate if the designated constraints aren't met. +type PieceInfoValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PieceInfoValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PieceInfoValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PieceInfoValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PieceInfoValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PieceInfoValidationError) ErrorName() string { return "PieceInfoValidationError" } + +// Error satisfies the builtin error interface +func (e PieceInfoValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPieceInfo.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PieceInfoValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PieceInfoValidationError{} + +var _PieceInfo_PieceMd5_Pattern = regexp.MustCompile("([a-f\\d]{32}|[A-F\\d]{32}|[a-f\\d]{16}|[A-F\\d]{16})") + +// Validate checks the field values on ExtendAttribute with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ExtendAttribute) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ExtendAttribute with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ExtendAttributeMultiError, or nil if none found. +func (m *ExtendAttribute) ValidateAll() error { + return m.validate(true) +} + +func (m *ExtendAttribute) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Header + + // no validation rules for StatusCode + + // no validation rules for Status + + if len(errors) > 0 { + return ExtendAttributeMultiError(errors) + } + + return nil +} + +// ExtendAttributeMultiError is an error wrapping multiple validation errors +// returned by ExtendAttribute.ValidateAll() if the designated constraints +// aren't met. +type ExtendAttributeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ExtendAttributeMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ExtendAttributeMultiError) AllErrors() []error { return m } + +// ExtendAttributeValidationError is the validation error returned by +// ExtendAttribute.Validate if the designated constraints aren't met. +type ExtendAttributeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ExtendAttributeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ExtendAttributeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ExtendAttributeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ExtendAttributeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ExtendAttributeValidationError) ErrorName() string { return "ExtendAttributeValidationError" } + +// Error satisfies the builtin error interface +func (e ExtendAttributeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sExtendAttribute.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ExtendAttributeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ExtendAttributeValidationError{} + +// Validate checks the field values on PiecePacket with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *PiecePacket) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PiecePacket with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in PiecePacketMultiError, or +// nil if none found. +func (m *PiecePacket) ValidateAll() error { + return m.validate(true) +} + +func (m *PiecePacket) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := PiecePacketValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetDstPid()) < 1 { + err := PiecePacketValidationError{ + field: "DstPid", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetDstAddr()) < 1 { + err := PiecePacketValidationError{ + field: "DstAddr", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + for idx, item := range m.GetPieceInfos() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PiecePacketValidationError{ + field: fmt.Sprintf("PieceInfos[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PiecePacketValidationError{ + field: fmt.Sprintf("PieceInfos[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PiecePacketValidationError{ + field: fmt.Sprintf("PieceInfos[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + // no validation rules for TotalPiece + + // no validation rules for ContentLength + + // no validation rules for PieceMd5Sign + + if all { + switch v := interface{}(m.GetExtendAttribute()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PiecePacketValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PiecePacketValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetExtendAttribute()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PiecePacketValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return PiecePacketMultiError(errors) + } + + return nil +} + +// PiecePacketMultiError is an error wrapping multiple validation errors +// returned by PiecePacket.ValidateAll() if the designated constraints aren't met. +type PiecePacketMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PiecePacketMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PiecePacketMultiError) AllErrors() []error { return m } + +// PiecePacketValidationError is the validation error returned by +// PiecePacket.Validate if the designated constraints aren't met. +type PiecePacketValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PiecePacketValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PiecePacketValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PiecePacketValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PiecePacketValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PiecePacketValidationError) ErrorName() string { return "PiecePacketValidationError" } + +// Error satisfies the builtin error interface +func (e PiecePacketValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPiecePacket.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PiecePacketValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PiecePacketValidationError{} diff --git a/pkg/apis/common/v1/common.proto b/pkg/apis/common/v1/common.proto index 2c6ddda..ff8890c 100644 --- a/pkg/apis/common/v1/common.proto +++ b/pkg/apis/common/v1/common.proto @@ -154,7 +154,7 @@ message PieceInfo{ uint32 range_size = 3 [(validate.rules).uint32.gte = 0]; string piece_md5 = 4 [(validate.rules).string = {pattern:"([a-f\\d]{32}|[A-F\\d]{32}|[a-f\\d]{16}|[A-F\\d]{16})", ignore_empty:true}]; uint64 piece_offset = 5 [(validate.rules).uint64.gte = 0]; - base.PieceStyle piece_style = 6; + PieceStyle piece_style = 6; // total time(millisecond) consumed uint64 download_cost = 7 [(validate.rules).uint64.gte = 0]; } diff --git a/pkg/apis/dfdaemon/v1/dfdaemon.pb.go b/pkg/apis/dfdaemon/v1/dfdaemon.pb.go new file mode 100644 index 0000000..37d4f6a --- /dev/null +++ b/pkg/apis/dfdaemon/v1/dfdaemon.pb.go @@ -0,0 +1,1276 @@ +// +// Copyright 2022 The Dragonfly 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.19.4 +// source: pkg/apis/dfdaemon/v1/dfdaemon.proto + +package v1 + +import ( + context "context" + v1 "d7y.io/api/pkg/apis/common/v1" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DownRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Identify one downloading, the framework will fill it automatically. + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + // Download file from the url, not only for http. + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + // Pieces will be written to output path directly, + // at the same time, dfdaemon workspace also makes soft link to the output. + Output string `protobuf:"bytes,3,opt,name=output,proto3" json:"output,omitempty"` + // Timeout duration. + Timeout uint64 `protobuf:"varint,4,opt,name=timeout,proto3" json:"timeout,omitempty"` + // Rate limit in bytes per second. + Limit float64 `protobuf:"fixed64,5,opt,name=limit,proto3" json:"limit,omitempty"` + // Disable back-to-source. + DisableBackSource bool `protobuf:"varint,6,opt,name=disable_back_source,json=disableBackSource,proto3" json:"disable_back_source,omitempty"` + // URL meta info. + UrlMeta *v1.UrlMeta `protobuf:"bytes,7,opt,name=url_meta,json=urlMeta,proto3" json:"url_meta,omitempty"` + // Pattern has p2p/seed-peer/source, default is p2p. + Pattern string `protobuf:"bytes,8,opt,name=pattern,proto3" json:"pattern,omitempty"` + // Call system. + Callsystem string `protobuf:"bytes,9,opt,name=callsystem,proto3" json:"callsystem,omitempty"` + // User id. + Uid int64 `protobuf:"varint,10,opt,name=uid,proto3" json:"uid,omitempty"` + // Group id. + Gid int64 `protobuf:"varint,11,opt,name=gid,proto3" json:"gid,omitempty"` + // Keep original offset, used for ranged request, only available for hard link, otherwise will failed. + KeepOriginalOffset bool `protobuf:"varint,12,opt,name=keep_original_offset,json=keepOriginalOffset,proto3" json:"keep_original_offset,omitempty"` +} + +func (x *DownRequest) Reset() { + *x = DownRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DownRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DownRequest) ProtoMessage() {} + +func (x *DownRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DownRequest.ProtoReflect.Descriptor instead. +func (*DownRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescGZIP(), []int{0} +} + +func (x *DownRequest) GetUuid() string { + if x != nil { + return x.Uuid + } + return "" +} + +func (x *DownRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *DownRequest) GetOutput() string { + if x != nil { + return x.Output + } + return "" +} + +func (x *DownRequest) GetTimeout() uint64 { + if x != nil { + return x.Timeout + } + return 0 +} + +func (x *DownRequest) GetLimit() float64 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *DownRequest) GetDisableBackSource() bool { + if x != nil { + return x.DisableBackSource + } + return false +} + +func (x *DownRequest) GetUrlMeta() *v1.UrlMeta { + if x != nil { + return x.UrlMeta + } + return nil +} + +func (x *DownRequest) GetPattern() string { + if x != nil { + return x.Pattern + } + return "" +} + +func (x *DownRequest) GetCallsystem() string { + if x != nil { + return x.Callsystem + } + return "" +} + +func (x *DownRequest) GetUid() int64 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *DownRequest) GetGid() int64 { + if x != nil { + return x.Gid + } + return 0 +} + +func (x *DownRequest) GetKeepOriginalOffset() bool { + if x != nil { + return x.KeepOriginalOffset + } + return false +} + +type DownResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Task id. + TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + // Peer id. + PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + // Task has completed length. + CompletedLength uint64 `protobuf:"varint,4,opt,name=completed_length,json=completedLength,proto3" json:"completed_length,omitempty"` + // Task has been completed. + Done bool `protobuf:"varint,5,opt,name=done,proto3" json:"done,omitempty"` +} + +func (x *DownResult) Reset() { + *x = DownResult{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DownResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DownResult) ProtoMessage() {} + +func (x *DownResult) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DownResult.ProtoReflect.Descriptor instead. +func (*DownResult) Descriptor() ([]byte, []int) { + return file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescGZIP(), []int{1} +} + +func (x *DownResult) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *DownResult) GetPeerId() string { + if x != nil { + return x.PeerId + } + return "" +} + +func (x *DownResult) GetCompletedLength() uint64 { + if x != nil { + return x.CompletedLength + } + return 0 +} + +func (x *DownResult) GetDone() bool { + if x != nil { + return x.Done + } + return false +} + +type StatTaskRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Download url. + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + // URL meta info. + UrlMeta *v1.UrlMeta `protobuf:"bytes,2,opt,name=url_meta,json=urlMeta,proto3" json:"url_meta,omitempty"` + // Check local cache only. + LocalOnly bool `protobuf:"varint,3,opt,name=local_only,json=localOnly,proto3" json:"local_only,omitempty"` +} + +func (x *StatTaskRequest) Reset() { + *x = StatTaskRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatTaskRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatTaskRequest) ProtoMessage() {} + +func (x *StatTaskRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatTaskRequest.ProtoReflect.Descriptor instead. +func (*StatTaskRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescGZIP(), []int{2} +} + +func (x *StatTaskRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *StatTaskRequest) GetUrlMeta() *v1.UrlMeta { + if x != nil { + return x.UrlMeta + } + return nil +} + +func (x *StatTaskRequest) GetLocalOnly() bool { + if x != nil { + return x.LocalOnly + } + return false +} + +type ImportTaskRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Download url. + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + // URL meta info. + UrlMeta *v1.UrlMeta `protobuf:"bytes,2,opt,name=url_meta,json=urlMeta,proto3" json:"url_meta,omitempty"` + // File to be imported. + Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` + // Task type. + Type v1.TaskType `protobuf:"varint,4,opt,name=type,proto3,enum=common.TaskType" json:"type,omitempty"` +} + +func (x *ImportTaskRequest) Reset() { + *x = ImportTaskRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImportTaskRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImportTaskRequest) ProtoMessage() {} + +func (x *ImportTaskRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImportTaskRequest.ProtoReflect.Descriptor instead. +func (*ImportTaskRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescGZIP(), []int{3} +} + +func (x *ImportTaskRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *ImportTaskRequest) GetUrlMeta() *v1.UrlMeta { + if x != nil { + return x.UrlMeta + } + return nil +} + +func (x *ImportTaskRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *ImportTaskRequest) GetType() v1.TaskType { + if x != nil { + return x.Type + } + return v1.TaskType(0) +} + +type ExportTaskRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Download url. + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + // Output path of downloaded file. + Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` + // Timeout duration. + Timeout uint64 `protobuf:"varint,3,opt,name=timeout,proto3" json:"timeout,omitempty"` + // Rate limit in bytes per second. + Limit float64 `protobuf:"fixed64,4,opt,name=limit,proto3" json:"limit,omitempty"` + // URL meta info. + UrlMeta *v1.UrlMeta `protobuf:"bytes,5,opt,name=url_meta,json=urlMeta,proto3" json:"url_meta,omitempty"` + // Call system. + Callsystem string `protobuf:"bytes,6,opt,name=callsystem,proto3" json:"callsystem,omitempty"` + // User id. + Uid int64 `protobuf:"varint,7,opt,name=uid,proto3" json:"uid,omitempty"` + // Group id. + Gid int64 `protobuf:"varint,8,opt,name=gid,proto3" json:"gid,omitempty"` + // Only export from local storage. + LocalOnly bool `protobuf:"varint,9,opt,name=local_only,json=localOnly,proto3" json:"local_only,omitempty"` +} + +func (x *ExportTaskRequest) Reset() { + *x = ExportTaskRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExportTaskRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExportTaskRequest) ProtoMessage() {} + +func (x *ExportTaskRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExportTaskRequest.ProtoReflect.Descriptor instead. +func (*ExportTaskRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescGZIP(), []int{4} +} + +func (x *ExportTaskRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *ExportTaskRequest) GetOutput() string { + if x != nil { + return x.Output + } + return "" +} + +func (x *ExportTaskRequest) GetTimeout() uint64 { + if x != nil { + return x.Timeout + } + return 0 +} + +func (x *ExportTaskRequest) GetLimit() float64 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *ExportTaskRequest) GetUrlMeta() *v1.UrlMeta { + if x != nil { + return x.UrlMeta + } + return nil +} + +func (x *ExportTaskRequest) GetCallsystem() string { + if x != nil { + return x.Callsystem + } + return "" +} + +func (x *ExportTaskRequest) GetUid() int64 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *ExportTaskRequest) GetGid() int64 { + if x != nil { + return x.Gid + } + return 0 +} + +func (x *ExportTaskRequest) GetLocalOnly() bool { + if x != nil { + return x.LocalOnly + } + return false +} + +type DeleteTaskRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Download url. + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + // URL meta info. + UrlMeta *v1.UrlMeta `protobuf:"bytes,2,opt,name=url_meta,json=urlMeta,proto3" json:"url_meta,omitempty"` +} + +func (x *DeleteTaskRequest) Reset() { + *x = DeleteTaskRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteTaskRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteTaskRequest) ProtoMessage() {} + +func (x *DeleteTaskRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteTaskRequest.ProtoReflect.Descriptor instead. +func (*DeleteTaskRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescGZIP(), []int{5} +} + +func (x *DeleteTaskRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *DeleteTaskRequest) GetUrlMeta() *v1.UrlMeta { + if x != nil { + return x.UrlMeta + } + return nil +} + +var File_pkg_apis_dfdaemon_v1_dfdaemon_proto protoreflect.FileDescriptor + +var file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x64, 0x66, 0x64, 0x61, 0x65, + 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x1a, + 0x1f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x03, 0x0a, 0x0b, 0x44, 0x6f, 0x77, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x04, + 0x75, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x72, 0x03, 0x88, 0x01, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, + 0x12, 0x1f, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, + 0x74, 0x12, 0x21, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x00, 0x52, 0x07, 0x74, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x12, 0x24, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x01, 0x42, 0x0e, 0xfa, 0x42, 0x0b, 0x12, 0x09, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x69, + 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, + 0x42, 0x61, 0x63, 0x6b, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x08, 0x75, 0x72, + 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x55, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x07, 0x75, + 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x3a, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x20, 0xfa, 0x42, 0x1d, 0x72, 0x1b, 0x52, 0x03, + 0x70, 0x32, 0x70, 0x52, 0x09, 0x73, 0x65, 0x65, 0x64, 0x2d, 0x70, 0x65, 0x65, 0x72, 0x52, 0x06, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0xd0, 0x01, 0x01, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x03, 0x67, 0x69, 0x64, 0x12, 0x30, 0x0a, 0x14, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x6f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x6b, 0x65, 0x65, 0x70, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x61, 0x6c, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x0a, 0x44, 0x6f, 0x77, + 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x70, 0x65, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x10, 0x63, + 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x00, 0x52, 0x0f, + 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, + 0x12, 0x0a, 0x04, 0x64, 0x6f, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, + 0x6f, 0x6e, 0x65, 0x22, 0x77, 0x0a, 0x0f, 0x53, 0x74, 0x61, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, + 0x6c, 0x12, 0x2a, 0x0a, 0x08, 0x75, 0x72, 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x55, 0x72, 0x6c, + 0x4d, 0x65, 0x74, 0x61, 0x52, 0x07, 0x75, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x1d, 0x0a, + 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x4f, 0x6e, 0x6c, 0x79, 0x22, 0x9d, 0x01, 0x0a, + 0x11, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x2a, 0x0a, + 0x08, 0x75, 0x72, 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x55, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, + 0x52, 0x07, 0x75, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, + 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x54, 0x61, + 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xa7, 0x02, 0x0a, + 0x11, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x19, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1f, 0x0a, + 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, + 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x21, + 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x00, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, + 0x74, 0x12, 0x24, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, + 0x42, 0x0e, 0xfa, 0x42, 0x0b, 0x12, 0x09, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x2a, 0x0a, 0x08, 0x75, 0x72, 0x6c, 0x5f, 0x6d, + 0x65, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x55, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x07, 0x75, 0x72, 0x6c, 0x4d, + 0x65, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x03, 0x67, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x6c, 0x6f, 0x63, + 0x61, 0x6c, 0x4f, 0x6e, 0x6c, 0x79, 0x22, 0x5a, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x03, 0x75, + 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x2a, 0x0a, 0x08, 0x75, 0x72, 0x6c, 0x5f, 0x6d, 0x65, + 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x55, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x07, 0x75, 0x72, 0x6c, 0x4d, 0x65, + 0x74, 0x61, 0x32, 0x8f, 0x04, 0x0a, 0x06, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x12, 0x39, 0x0a, + 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x15, 0x2e, 0x64, 0x66, 0x64, 0x61, + 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x14, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x44, 0x6f, 0x77, 0x6e, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x30, 0x01, 0x12, 0x3e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, + 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, + 0x63, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x3d, 0x0a, 0x0b, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x43, 0x0a, 0x0e, 0x53, 0x79, 0x6e, 0x63, 0x50, + 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, + 0x63, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x28, 0x01, 0x30, 0x01, 0x12, 0x3d, 0x0a, 0x08, + 0x53, 0x74, 0x61, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x19, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, + 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x41, 0x0a, 0x0a, 0x49, + 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x1b, 0x2e, 0x64, 0x66, 0x64, 0x61, + 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x41, + 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x1b, 0x2e, 0x64, + 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, + 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x12, 0x41, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x12, + 0x1b, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x42, 0x21, 0x5a, 0x1f, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x64, 0x66, 0x64, 0x61, + 0x65, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescOnce sync.Once + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescData = file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDesc +) + +func file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescGZIP() []byte { + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescOnce.Do(func() { + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescData) + }) + return file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDescData +} + +var file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_pkg_apis_dfdaemon_v1_dfdaemon_proto_goTypes = []interface{}{ + (*DownRequest)(nil), // 0: dfdaemon.DownRequest + (*DownResult)(nil), // 1: dfdaemon.DownResult + (*StatTaskRequest)(nil), // 2: dfdaemon.StatTaskRequest + (*ImportTaskRequest)(nil), // 3: dfdaemon.ImportTaskRequest + (*ExportTaskRequest)(nil), // 4: dfdaemon.ExportTaskRequest + (*DeleteTaskRequest)(nil), // 5: dfdaemon.DeleteTaskRequest + (*v1.UrlMeta)(nil), // 6: common.UrlMeta + (v1.TaskType)(0), // 7: common.TaskType + (*v1.PieceTaskRequest)(nil), // 8: common.PieceTaskRequest + (*emptypb.Empty)(nil), // 9: google.protobuf.Empty + (*v1.PiecePacket)(nil), // 10: common.PiecePacket +} +var file_pkg_apis_dfdaemon_v1_dfdaemon_proto_depIdxs = []int32{ + 6, // 0: dfdaemon.DownRequest.url_meta:type_name -> common.UrlMeta + 6, // 1: dfdaemon.StatTaskRequest.url_meta:type_name -> common.UrlMeta + 6, // 2: dfdaemon.ImportTaskRequest.url_meta:type_name -> common.UrlMeta + 7, // 3: dfdaemon.ImportTaskRequest.type:type_name -> common.TaskType + 6, // 4: dfdaemon.ExportTaskRequest.url_meta:type_name -> common.UrlMeta + 6, // 5: dfdaemon.DeleteTaskRequest.url_meta:type_name -> common.UrlMeta + 0, // 6: dfdaemon.Daemon.Download:input_type -> dfdaemon.DownRequest + 8, // 7: dfdaemon.Daemon.GetPieceTasks:input_type -> common.PieceTaskRequest + 9, // 8: dfdaemon.Daemon.CheckHealth:input_type -> google.protobuf.Empty + 8, // 9: dfdaemon.Daemon.SyncPieceTasks:input_type -> common.PieceTaskRequest + 2, // 10: dfdaemon.Daemon.StatTask:input_type -> dfdaemon.StatTaskRequest + 3, // 11: dfdaemon.Daemon.ImportTask:input_type -> dfdaemon.ImportTaskRequest + 4, // 12: dfdaemon.Daemon.ExportTask:input_type -> dfdaemon.ExportTaskRequest + 5, // 13: dfdaemon.Daemon.DeleteTask:input_type -> dfdaemon.DeleteTaskRequest + 1, // 14: dfdaemon.Daemon.Download:output_type -> dfdaemon.DownResult + 10, // 15: dfdaemon.Daemon.GetPieceTasks:output_type -> common.PiecePacket + 9, // 16: dfdaemon.Daemon.CheckHealth:output_type -> google.protobuf.Empty + 10, // 17: dfdaemon.Daemon.SyncPieceTasks:output_type -> common.PiecePacket + 9, // 18: dfdaemon.Daemon.StatTask:output_type -> google.protobuf.Empty + 9, // 19: dfdaemon.Daemon.ImportTask:output_type -> google.protobuf.Empty + 9, // 20: dfdaemon.Daemon.ExportTask:output_type -> google.protobuf.Empty + 9, // 21: dfdaemon.Daemon.DeleteTask:output_type -> google.protobuf.Empty + 14, // [14:22] is the sub-list for method output_type + 6, // [6:14] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_pkg_apis_dfdaemon_v1_dfdaemon_proto_init() } +func file_pkg_apis_dfdaemon_v1_dfdaemon_proto_init() { + if File_pkg_apis_dfdaemon_v1_dfdaemon_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DownRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DownResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatTaskRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImportTaskRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExportTaskRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteTaskRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pkg_apis_dfdaemon_v1_dfdaemon_proto_goTypes, + DependencyIndexes: file_pkg_apis_dfdaemon_v1_dfdaemon_proto_depIdxs, + MessageInfos: file_pkg_apis_dfdaemon_v1_dfdaemon_proto_msgTypes, + }.Build() + File_pkg_apis_dfdaemon_v1_dfdaemon_proto = out.File + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_rawDesc = nil + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_goTypes = nil + file_pkg_apis_dfdaemon_v1_dfdaemon_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// DaemonClient is the client API for Daemon service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type DaemonClient interface { + // Trigger client to download file + Download(ctx context.Context, in *DownRequest, opts ...grpc.CallOption) (Daemon_DownloadClient, error) + // Get piece tasks from other peers + GetPieceTasks(ctx context.Context, in *v1.PieceTaskRequest, opts ...grpc.CallOption) (*v1.PiecePacket, error) + // Check daemon health + CheckHealth(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) + // Sync piece tasks with other peers + SyncPieceTasks(ctx context.Context, opts ...grpc.CallOption) (Daemon_SyncPieceTasksClient, error) + // Check if given task exists in P2P cache system + StatTask(ctx context.Context, in *StatTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // Import the given file into P2P cache system + ImportTask(ctx context.Context, in *ImportTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // Export or download file from P2P cache system + ExportTask(ctx context.Context, in *ExportTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + // Delete file from P2P cache system + DeleteTask(ctx context.Context, in *DeleteTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) +} + +type daemonClient struct { + cc grpc.ClientConnInterface +} + +func NewDaemonClient(cc grpc.ClientConnInterface) DaemonClient { + return &daemonClient{cc} +} + +func (c *daemonClient) Download(ctx context.Context, in *DownRequest, opts ...grpc.CallOption) (Daemon_DownloadClient, error) { + stream, err := c.cc.NewStream(ctx, &_Daemon_serviceDesc.Streams[0], "/dfdaemon.Daemon/Download", opts...) + if err != nil { + return nil, err + } + x := &daemonDownloadClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Daemon_DownloadClient interface { + Recv() (*DownResult, error) + grpc.ClientStream +} + +type daemonDownloadClient struct { + grpc.ClientStream +} + +func (x *daemonDownloadClient) Recv() (*DownResult, error) { + m := new(DownResult) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *daemonClient) GetPieceTasks(ctx context.Context, in *v1.PieceTaskRequest, opts ...grpc.CallOption) (*v1.PiecePacket, error) { + out := new(v1.PiecePacket) + err := c.cc.Invoke(ctx, "/dfdaemon.Daemon/GetPieceTasks", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *daemonClient) CheckHealth(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/dfdaemon.Daemon/CheckHealth", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *daemonClient) SyncPieceTasks(ctx context.Context, opts ...grpc.CallOption) (Daemon_SyncPieceTasksClient, error) { + stream, err := c.cc.NewStream(ctx, &_Daemon_serviceDesc.Streams[1], "/dfdaemon.Daemon/SyncPieceTasks", opts...) + if err != nil { + return nil, err + } + x := &daemonSyncPieceTasksClient{stream} + return x, nil +} + +type Daemon_SyncPieceTasksClient interface { + Send(*v1.PieceTaskRequest) error + Recv() (*v1.PiecePacket, error) + grpc.ClientStream +} + +type daemonSyncPieceTasksClient struct { + grpc.ClientStream +} + +func (x *daemonSyncPieceTasksClient) Send(m *v1.PieceTaskRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *daemonSyncPieceTasksClient) Recv() (*v1.PiecePacket, error) { + m := new(v1.PiecePacket) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *daemonClient) StatTask(ctx context.Context, in *StatTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/dfdaemon.Daemon/StatTask", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *daemonClient) ImportTask(ctx context.Context, in *ImportTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/dfdaemon.Daemon/ImportTask", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *daemonClient) ExportTask(ctx context.Context, in *ExportTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/dfdaemon.Daemon/ExportTask", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *daemonClient) DeleteTask(ctx context.Context, in *DeleteTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/dfdaemon.Daemon/DeleteTask", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DaemonServer is the server API for Daemon service. +type DaemonServer interface { + // Trigger client to download file + Download(*DownRequest, Daemon_DownloadServer) error + // Get piece tasks from other peers + GetPieceTasks(context.Context, *v1.PieceTaskRequest) (*v1.PiecePacket, error) + // Check daemon health + CheckHealth(context.Context, *emptypb.Empty) (*emptypb.Empty, error) + // Sync piece tasks with other peers + SyncPieceTasks(Daemon_SyncPieceTasksServer) error + // Check if given task exists in P2P cache system + StatTask(context.Context, *StatTaskRequest) (*emptypb.Empty, error) + // Import the given file into P2P cache system + ImportTask(context.Context, *ImportTaskRequest) (*emptypb.Empty, error) + // Export or download file from P2P cache system + ExportTask(context.Context, *ExportTaskRequest) (*emptypb.Empty, error) + // Delete file from P2P cache system + DeleteTask(context.Context, *DeleteTaskRequest) (*emptypb.Empty, error) +} + +// UnimplementedDaemonServer can be embedded to have forward compatible implementations. +type UnimplementedDaemonServer struct { +} + +func (*UnimplementedDaemonServer) Download(*DownRequest, Daemon_DownloadServer) error { + return status.Errorf(codes.Unimplemented, "method Download not implemented") +} +func (*UnimplementedDaemonServer) GetPieceTasks(context.Context, *v1.PieceTaskRequest) (*v1.PiecePacket, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPieceTasks not implemented") +} +func (*UnimplementedDaemonServer) CheckHealth(context.Context, *emptypb.Empty) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckHealth not implemented") +} +func (*UnimplementedDaemonServer) SyncPieceTasks(Daemon_SyncPieceTasksServer) error { + return status.Errorf(codes.Unimplemented, "method SyncPieceTasks not implemented") +} +func (*UnimplementedDaemonServer) StatTask(context.Context, *StatTaskRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method StatTask not implemented") +} +func (*UnimplementedDaemonServer) ImportTask(context.Context, *ImportTaskRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImportTask not implemented") +} +func (*UnimplementedDaemonServer) ExportTask(context.Context, *ExportTaskRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExportTask not implemented") +} +func (*UnimplementedDaemonServer) DeleteTask(context.Context, *DeleteTaskRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteTask not implemented") +} + +func RegisterDaemonServer(s *grpc.Server, srv DaemonServer) { + s.RegisterService(&_Daemon_serviceDesc, srv) +} + +func _Daemon_Download_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(DownRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(DaemonServer).Download(m, &daemonDownloadServer{stream}) +} + +type Daemon_DownloadServer interface { + Send(*DownResult) error + grpc.ServerStream +} + +type daemonDownloadServer struct { + grpc.ServerStream +} + +func (x *daemonDownloadServer) Send(m *DownResult) error { + return x.ServerStream.SendMsg(m) +} + +func _Daemon_GetPieceTasks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(v1.PieceTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DaemonServer).GetPieceTasks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dfdaemon.Daemon/GetPieceTasks", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DaemonServer).GetPieceTasks(ctx, req.(*v1.PieceTaskRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Daemon_CheckHealth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DaemonServer).CheckHealth(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dfdaemon.Daemon/CheckHealth", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DaemonServer).CheckHealth(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _Daemon_SyncPieceTasks_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(DaemonServer).SyncPieceTasks(&daemonSyncPieceTasksServer{stream}) +} + +type Daemon_SyncPieceTasksServer interface { + Send(*v1.PiecePacket) error + Recv() (*v1.PieceTaskRequest, error) + grpc.ServerStream +} + +type daemonSyncPieceTasksServer struct { + grpc.ServerStream +} + +func (x *daemonSyncPieceTasksServer) Send(m *v1.PiecePacket) error { + return x.ServerStream.SendMsg(m) +} + +func (x *daemonSyncPieceTasksServer) Recv() (*v1.PieceTaskRequest, error) { + m := new(v1.PieceTaskRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Daemon_StatTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DaemonServer).StatTask(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dfdaemon.Daemon/StatTask", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DaemonServer).StatTask(ctx, req.(*StatTaskRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Daemon_ImportTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImportTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DaemonServer).ImportTask(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dfdaemon.Daemon/ImportTask", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DaemonServer).ImportTask(ctx, req.(*ImportTaskRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Daemon_ExportTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExportTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DaemonServer).ExportTask(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dfdaemon.Daemon/ExportTask", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DaemonServer).ExportTask(ctx, req.(*ExportTaskRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Daemon_DeleteTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DaemonServer).DeleteTask(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dfdaemon.Daemon/DeleteTask", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DaemonServer).DeleteTask(ctx, req.(*DeleteTaskRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Daemon_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dfdaemon.Daemon", + HandlerType: (*DaemonServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetPieceTasks", + Handler: _Daemon_GetPieceTasks_Handler, + }, + { + MethodName: "CheckHealth", + Handler: _Daemon_CheckHealth_Handler, + }, + { + MethodName: "StatTask", + Handler: _Daemon_StatTask_Handler, + }, + { + MethodName: "ImportTask", + Handler: _Daemon_ImportTask_Handler, + }, + { + MethodName: "ExportTask", + Handler: _Daemon_ExportTask_Handler, + }, + { + MethodName: "DeleteTask", + Handler: _Daemon_DeleteTask_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Download", + Handler: _Daemon_Download_Handler, + ServerStreams: true, + }, + { + StreamName: "SyncPieceTasks", + Handler: _Daemon_SyncPieceTasks_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "pkg/apis/dfdaemon/v1/dfdaemon.proto", +} diff --git a/pkg/apis/dfdaemon/v1/dfdaemon.pb.validate.go b/pkg/apis/dfdaemon/v1/dfdaemon.pb.validate.go new file mode 100644 index 0000000..feec2f9 --- /dev/null +++ b/pkg/apis/dfdaemon/v1/dfdaemon.pb.validate.go @@ -0,0 +1,1028 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: pkg/apis/dfdaemon/v1/dfdaemon.proto + +package v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// define the regex for a UUID once up-front +var _dfdaemon_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$") + +// Validate checks the field values on DownRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *DownRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DownRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in DownRequestMultiError, or +// nil if none found. +func (m *DownRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DownRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if err := m._validateUuid(m.GetUuid()); err != nil { + err = DownRequestValidationError{ + field: "Uuid", + reason: "value must be a valid UUID", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if uri, err := url.Parse(m.GetUrl()); err != nil { + err = DownRequestValidationError{ + field: "Url", + reason: "value must be a valid URI", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } else if !uri.IsAbs() { + err := DownRequestValidationError{ + field: "Url", + reason: "value must be absolute", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetOutput()) < 1 { + err := DownRequestValidationError{ + field: "Output", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetTimeout() < 0 { + err := DownRequestValidationError{ + field: "Timeout", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetLimit() < 0 { + err := DownRequestValidationError{ + field: "Limit", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for DisableBackSource + + if all { + switch v := interface{}(m.GetUrlMeta()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, DownRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, DownRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DownRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if m.GetPattern() != "" { + + if _, ok := _DownRequest_Pattern_InLookup[m.GetPattern()]; !ok { + err := DownRequestValidationError{ + field: "Pattern", + reason: "value must be in list [p2p seed-peer source]", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + // no validation rules for Callsystem + + // no validation rules for Uid + + // no validation rules for Gid + + // no validation rules for KeepOriginalOffset + + if len(errors) > 0 { + return DownRequestMultiError(errors) + } + + return nil +} + +func (m *DownRequest) _validateUuid(uuid string) error { + if matched := _dfdaemon_uuidPattern.MatchString(uuid); !matched { + return errors.New("invalid uuid format") + } + + return nil +} + +// DownRequestMultiError is an error wrapping multiple validation errors +// returned by DownRequest.ValidateAll() if the designated constraints aren't met. +type DownRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DownRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DownRequestMultiError) AllErrors() []error { return m } + +// DownRequestValidationError is the validation error returned by +// DownRequest.Validate if the designated constraints aren't met. +type DownRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DownRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DownRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DownRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DownRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DownRequestValidationError) ErrorName() string { return "DownRequestValidationError" } + +// Error satisfies the builtin error interface +func (e DownRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDownRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DownRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DownRequestValidationError{} + +var _DownRequest_Pattern_InLookup = map[string]struct{}{ + "p2p": {}, + "seed-peer": {}, + "source": {}, +} + +// Validate checks the field values on DownResult with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *DownResult) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DownResult with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in DownResultMultiError, or +// nil if none found. +func (m *DownResult) ValidateAll() error { + return m.validate(true) +} + +func (m *DownResult) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := DownResultValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetPeerId()) < 1 { + err := DownResultValidationError{ + field: "PeerId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetCompletedLength() < 0 { + err := DownResultValidationError{ + field: "CompletedLength", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for Done + + if len(errors) > 0 { + return DownResultMultiError(errors) + } + + return nil +} + +// DownResultMultiError is an error wrapping multiple validation errors +// returned by DownResult.ValidateAll() if the designated constraints aren't met. +type DownResultMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DownResultMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DownResultMultiError) AllErrors() []error { return m } + +// DownResultValidationError is the validation error returned by +// DownResult.Validate if the designated constraints aren't met. +type DownResultValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DownResultValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DownResultValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DownResultValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DownResultValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DownResultValidationError) ErrorName() string { return "DownResultValidationError" } + +// Error satisfies the builtin error interface +func (e DownResultValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDownResult.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DownResultValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DownResultValidationError{} + +// Validate checks the field values on StatTaskRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *StatTaskRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on StatTaskRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// StatTaskRequestMultiError, or nil if none found. +func (m *StatTaskRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *StatTaskRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetUrl()) < 1 { + err := StatTaskRequestValidationError{ + field: "Url", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetUrlMeta()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, StatTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, StatTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return StatTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for LocalOnly + + if len(errors) > 0 { + return StatTaskRequestMultiError(errors) + } + + return nil +} + +// StatTaskRequestMultiError is an error wrapping multiple validation errors +// returned by StatTaskRequest.ValidateAll() if the designated constraints +// aren't met. +type StatTaskRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m StatTaskRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m StatTaskRequestMultiError) AllErrors() []error { return m } + +// StatTaskRequestValidationError is the validation error returned by +// StatTaskRequest.Validate if the designated constraints aren't met. +type StatTaskRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e StatTaskRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e StatTaskRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e StatTaskRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e StatTaskRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e StatTaskRequestValidationError) ErrorName() string { return "StatTaskRequestValidationError" } + +// Error satisfies the builtin error interface +func (e StatTaskRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sStatTaskRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = StatTaskRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = StatTaskRequestValidationError{} + +// Validate checks the field values on ImportTaskRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ImportTaskRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ImportTaskRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ImportTaskRequestMultiError, or nil if none found. +func (m *ImportTaskRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ImportTaskRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetUrl()) < 1 { + err := ImportTaskRequestValidationError{ + field: "Url", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetUrlMeta()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ImportTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ImportTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ImportTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if utf8.RuneCountInString(m.GetPath()) < 1 { + err := ImportTaskRequestValidationError{ + field: "Path", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for Type + + if len(errors) > 0 { + return ImportTaskRequestMultiError(errors) + } + + return nil +} + +// ImportTaskRequestMultiError is an error wrapping multiple validation errors +// returned by ImportTaskRequest.ValidateAll() if the designated constraints +// aren't met. +type ImportTaskRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ImportTaskRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ImportTaskRequestMultiError) AllErrors() []error { return m } + +// ImportTaskRequestValidationError is the validation error returned by +// ImportTaskRequest.Validate if the designated constraints aren't met. +type ImportTaskRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ImportTaskRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ImportTaskRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ImportTaskRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ImportTaskRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ImportTaskRequestValidationError) ErrorName() string { + return "ImportTaskRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ImportTaskRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sImportTaskRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ImportTaskRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ImportTaskRequestValidationError{} + +// Validate checks the field values on ExportTaskRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ExportTaskRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ExportTaskRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ExportTaskRequestMultiError, or nil if none found. +func (m *ExportTaskRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ExportTaskRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetUrl()) < 1 { + err := ExportTaskRequestValidationError{ + field: "Url", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetOutput()) < 1 { + err := ExportTaskRequestValidationError{ + field: "Output", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetTimeout() < 0 { + err := ExportTaskRequestValidationError{ + field: "Timeout", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetLimit() < 0 { + err := ExportTaskRequestValidationError{ + field: "Limit", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetUrlMeta()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ExportTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ExportTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ExportTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for Callsystem + + // no validation rules for Uid + + // no validation rules for Gid + + // no validation rules for LocalOnly + + if len(errors) > 0 { + return ExportTaskRequestMultiError(errors) + } + + return nil +} + +// ExportTaskRequestMultiError is an error wrapping multiple validation errors +// returned by ExportTaskRequest.ValidateAll() if the designated constraints +// aren't met. +type ExportTaskRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ExportTaskRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ExportTaskRequestMultiError) AllErrors() []error { return m } + +// ExportTaskRequestValidationError is the validation error returned by +// ExportTaskRequest.Validate if the designated constraints aren't met. +type ExportTaskRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ExportTaskRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ExportTaskRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ExportTaskRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ExportTaskRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ExportTaskRequestValidationError) ErrorName() string { + return "ExportTaskRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ExportTaskRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sExportTaskRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ExportTaskRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ExportTaskRequestValidationError{} + +// Validate checks the field values on DeleteTaskRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *DeleteTaskRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on DeleteTaskRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// DeleteTaskRequestMultiError, or nil if none found. +func (m *DeleteTaskRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *DeleteTaskRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetUrl()) < 1 { + err := DeleteTaskRequestValidationError{ + field: "Url", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetUrlMeta()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, DeleteTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, DeleteTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return DeleteTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return DeleteTaskRequestMultiError(errors) + } + + return nil +} + +// DeleteTaskRequestMultiError is an error wrapping multiple validation errors +// returned by DeleteTaskRequest.ValidateAll() if the designated constraints +// aren't met. +type DeleteTaskRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteTaskRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DeleteTaskRequestMultiError) AllErrors() []error { return m } + +// DeleteTaskRequestValidationError is the validation error returned by +// DeleteTaskRequest.Validate if the designated constraints aren't met. +type DeleteTaskRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DeleteTaskRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DeleteTaskRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DeleteTaskRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DeleteTaskRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DeleteTaskRequestValidationError) ErrorName() string { + return "DeleteTaskRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e DeleteTaskRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDeleteTaskRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DeleteTaskRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DeleteTaskRequestValidationError{} diff --git a/pkg/apis/dfdaemon/v1/dfdaemon.proto b/pkg/apis/dfdaemon/v1/dfdaemon.proto index ae9fc5d..dbd4916 100644 --- a/pkg/apis/dfdaemon/v1/dfdaemon.proto +++ b/pkg/apis/dfdaemon/v1/dfdaemon.proto @@ -24,35 +24,6 @@ import "validate/validate.proto"; option go_package = "d7y.io/api/pkg/apis/dfdaemon/v1"; -message SeedRequest{ - string task_id = 1 [(validate.rules).string.min_len = 1]; - string url = 2 [(validate.rules).string.uri = true]; - common.UrlMeta url_meta = 3; -} - -// keep piece meta and data separately -// check piece md5, md5s sign and total content length -message PieceSeed{ - // peer id for cdn node, need suffix with _CDN - string peer_id = 2 [(validate.rules).string.min_len = 1]; - // cdn host id - string host_id = 3 [(validate.rules).string.min_len = 1]; - common.PieceInfo piece_info = 4; - - // whether or not all seeds are downloaded - bool done = 5; - // content total length for the url, content_length < 0 represent content length is unknown - int64 content_length = 6; - // total piece count, -1 represents task is downloading or failed - int32 total_piece_count = 7; - // begin time for the piece downloading - uint64 begin_time = 8; - // end time for the piece downloading - uint64 end_time = 9; - // task extend attribute - common.ExtendAttribute extend_attribute = 10; -} - message DownRequest{ // Identify one downloading, the framework will fill it automatically. string uuid = 1 [(validate.rules).string.uuid = true]; @@ -158,10 +129,4 @@ service Daemon{ rpc ExportTask(ExportTaskRequest) returns(google.protobuf.Empty); // Delete file from P2P cache system rpc DeleteTask(DeleteTaskRequest) returns(google.protobuf.Empty); - // Generate seeds and return to scheduler - rpc ObtainSeeds(SeedRequest)returns(stream PieceSeed); - // Get piece tasks from cdn - rpc GetPieceTasks(common.PieceTaskRequest)returns(common.PiecePacket); - // Sync piece tasks with other peers - rpc SyncPieceTasks(stream common.PieceTaskRequest)returns(stream common.PiecePacket); } diff --git a/pkg/apis/dfdaemon/v1/mocks/dfdaemon_mock.go b/pkg/apis/dfdaemon/v1/mocks/dfdaemon_mock.go new file mode 100644 index 0000000..6fbb39c --- /dev/null +++ b/pkg/apis/dfdaemon/v1/mocks/dfdaemon_mock.go @@ -0,0 +1,854 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ../dfdaemon.pb.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + reflect "reflect" + + v1 "d7y.io/api/pkg/apis/common/v1" + v10 "d7y.io/api/pkg/apis/dfdaemon/v1" + gomock "github.com/golang/mock/gomock" + grpc "google.golang.org/grpc" + metadata "google.golang.org/grpc/metadata" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// MockDaemonClient is a mock of DaemonClient interface. +type MockDaemonClient struct { + ctrl *gomock.Controller + recorder *MockDaemonClientMockRecorder +} + +// MockDaemonClientMockRecorder is the mock recorder for MockDaemonClient. +type MockDaemonClientMockRecorder struct { + mock *MockDaemonClient +} + +// NewMockDaemonClient creates a new mock instance. +func NewMockDaemonClient(ctrl *gomock.Controller) *MockDaemonClient { + mock := &MockDaemonClient{ctrl: ctrl} + mock.recorder = &MockDaemonClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDaemonClient) EXPECT() *MockDaemonClientMockRecorder { + return m.recorder +} + +// CheckHealth mocks base method. +func (m *MockDaemonClient) CheckHealth(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CheckHealth", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CheckHealth indicates an expected call of CheckHealth. +func (mr *MockDaemonClientMockRecorder) CheckHealth(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckHealth", reflect.TypeOf((*MockDaemonClient)(nil).CheckHealth), varargs...) +} + +// DeleteTask mocks base method. +func (m *MockDaemonClient) DeleteTask(ctx context.Context, in *v10.DeleteTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteTask", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteTask indicates an expected call of DeleteTask. +func (mr *MockDaemonClientMockRecorder) DeleteTask(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTask", reflect.TypeOf((*MockDaemonClient)(nil).DeleteTask), varargs...) +} + +// Download mocks base method. +func (m *MockDaemonClient) Download(ctx context.Context, in *v10.DownRequest, opts ...grpc.CallOption) (v10.Daemon_DownloadClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Download", varargs...) + ret0, _ := ret[0].(v10.Daemon_DownloadClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Download indicates an expected call of Download. +func (mr *MockDaemonClientMockRecorder) Download(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Download", reflect.TypeOf((*MockDaemonClient)(nil).Download), varargs...) +} + +// ExportTask mocks base method. +func (m *MockDaemonClient) ExportTask(ctx context.Context, in *v10.ExportTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ExportTask", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ExportTask indicates an expected call of ExportTask. +func (mr *MockDaemonClientMockRecorder) ExportTask(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportTask", reflect.TypeOf((*MockDaemonClient)(nil).ExportTask), varargs...) +} + +// GetPieceTasks mocks base method. +func (m *MockDaemonClient) GetPieceTasks(ctx context.Context, in *v1.PieceTaskRequest, opts ...grpc.CallOption) (*v1.PiecePacket, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetPieceTasks", varargs...) + ret0, _ := ret[0].(*v1.PiecePacket) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPieceTasks indicates an expected call of GetPieceTasks. +func (mr *MockDaemonClientMockRecorder) GetPieceTasks(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPieceTasks", reflect.TypeOf((*MockDaemonClient)(nil).GetPieceTasks), varargs...) +} + +// ImportTask mocks base method. +func (m *MockDaemonClient) ImportTask(ctx context.Context, in *v10.ImportTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ImportTask", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImportTask indicates an expected call of ImportTask. +func (mr *MockDaemonClientMockRecorder) ImportTask(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportTask", reflect.TypeOf((*MockDaemonClient)(nil).ImportTask), varargs...) +} + +// StatTask mocks base method. +func (m *MockDaemonClient) StatTask(ctx context.Context, in *v10.StatTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "StatTask", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StatTask indicates an expected call of StatTask. +func (mr *MockDaemonClientMockRecorder) StatTask(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StatTask", reflect.TypeOf((*MockDaemonClient)(nil).StatTask), varargs...) +} + +// SyncPieceTasks mocks base method. +func (m *MockDaemonClient) SyncPieceTasks(ctx context.Context, opts ...grpc.CallOption) (v10.Daemon_SyncPieceTasksClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "SyncPieceTasks", varargs...) + ret0, _ := ret[0].(v10.Daemon_SyncPieceTasksClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SyncPieceTasks indicates an expected call of SyncPieceTasks. +func (mr *MockDaemonClientMockRecorder) SyncPieceTasks(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SyncPieceTasks", reflect.TypeOf((*MockDaemonClient)(nil).SyncPieceTasks), varargs...) +} + +// MockDaemon_DownloadClient is a mock of Daemon_DownloadClient interface. +type MockDaemon_DownloadClient struct { + ctrl *gomock.Controller + recorder *MockDaemon_DownloadClientMockRecorder +} + +// MockDaemon_DownloadClientMockRecorder is the mock recorder for MockDaemon_DownloadClient. +type MockDaemon_DownloadClientMockRecorder struct { + mock *MockDaemon_DownloadClient +} + +// NewMockDaemon_DownloadClient creates a new mock instance. +func NewMockDaemon_DownloadClient(ctrl *gomock.Controller) *MockDaemon_DownloadClient { + mock := &MockDaemon_DownloadClient{ctrl: ctrl} + mock.recorder = &MockDaemon_DownloadClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDaemon_DownloadClient) EXPECT() *MockDaemon_DownloadClientMockRecorder { + return m.recorder +} + +// CloseSend mocks base method. +func (m *MockDaemon_DownloadClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend. +func (mr *MockDaemon_DownloadClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockDaemon_DownloadClient)(nil).CloseSend)) +} + +// Context mocks base method. +func (m *MockDaemon_DownloadClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockDaemon_DownloadClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockDaemon_DownloadClient)(nil).Context)) +} + +// Header mocks base method. +func (m *MockDaemon_DownloadClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header. +func (mr *MockDaemon_DownloadClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockDaemon_DownloadClient)(nil).Header)) +} + +// Recv mocks base method. +func (m *MockDaemon_DownloadClient) Recv() (*v10.DownResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*v10.DownResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockDaemon_DownloadClientMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockDaemon_DownloadClient)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockDaemon_DownloadClient) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockDaemon_DownloadClientMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockDaemon_DownloadClient)(nil).RecvMsg), m) +} + +// SendMsg mocks base method. +func (m_2 *MockDaemon_DownloadClient) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockDaemon_DownloadClientMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockDaemon_DownloadClient)(nil).SendMsg), m) +} + +// Trailer mocks base method. +func (m *MockDaemon_DownloadClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer. +func (mr *MockDaemon_DownloadClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockDaemon_DownloadClient)(nil).Trailer)) +} + +// MockDaemon_SyncPieceTasksClient is a mock of Daemon_SyncPieceTasksClient interface. +type MockDaemon_SyncPieceTasksClient struct { + ctrl *gomock.Controller + recorder *MockDaemon_SyncPieceTasksClientMockRecorder +} + +// MockDaemon_SyncPieceTasksClientMockRecorder is the mock recorder for MockDaemon_SyncPieceTasksClient. +type MockDaemon_SyncPieceTasksClientMockRecorder struct { + mock *MockDaemon_SyncPieceTasksClient +} + +// NewMockDaemon_SyncPieceTasksClient creates a new mock instance. +func NewMockDaemon_SyncPieceTasksClient(ctrl *gomock.Controller) *MockDaemon_SyncPieceTasksClient { + mock := &MockDaemon_SyncPieceTasksClient{ctrl: ctrl} + mock.recorder = &MockDaemon_SyncPieceTasksClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDaemon_SyncPieceTasksClient) EXPECT() *MockDaemon_SyncPieceTasksClientMockRecorder { + return m.recorder +} + +// CloseSend mocks base method. +func (m *MockDaemon_SyncPieceTasksClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend. +func (mr *MockDaemon_SyncPieceTasksClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockDaemon_SyncPieceTasksClient)(nil).CloseSend)) +} + +// Context mocks base method. +func (m *MockDaemon_SyncPieceTasksClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockDaemon_SyncPieceTasksClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockDaemon_SyncPieceTasksClient)(nil).Context)) +} + +// Header mocks base method. +func (m *MockDaemon_SyncPieceTasksClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header. +func (mr *MockDaemon_SyncPieceTasksClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockDaemon_SyncPieceTasksClient)(nil).Header)) +} + +// Recv mocks base method. +func (m *MockDaemon_SyncPieceTasksClient) Recv() (*v1.PiecePacket, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*v1.PiecePacket) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockDaemon_SyncPieceTasksClientMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockDaemon_SyncPieceTasksClient)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockDaemon_SyncPieceTasksClient) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockDaemon_SyncPieceTasksClientMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockDaemon_SyncPieceTasksClient)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockDaemon_SyncPieceTasksClient) Send(arg0 *v1.PieceTaskRequest) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockDaemon_SyncPieceTasksClientMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockDaemon_SyncPieceTasksClient)(nil).Send), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockDaemon_SyncPieceTasksClient) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockDaemon_SyncPieceTasksClientMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockDaemon_SyncPieceTasksClient)(nil).SendMsg), m) +} + +// Trailer mocks base method. +func (m *MockDaemon_SyncPieceTasksClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer. +func (mr *MockDaemon_SyncPieceTasksClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockDaemon_SyncPieceTasksClient)(nil).Trailer)) +} + +// MockDaemonServer is a mock of DaemonServer interface. +type MockDaemonServer struct { + ctrl *gomock.Controller + recorder *MockDaemonServerMockRecorder +} + +// MockDaemonServerMockRecorder is the mock recorder for MockDaemonServer. +type MockDaemonServerMockRecorder struct { + mock *MockDaemonServer +} + +// NewMockDaemonServer creates a new mock instance. +func NewMockDaemonServer(ctrl *gomock.Controller) *MockDaemonServer { + mock := &MockDaemonServer{ctrl: ctrl} + mock.recorder = &MockDaemonServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDaemonServer) EXPECT() *MockDaemonServerMockRecorder { + return m.recorder +} + +// CheckHealth mocks base method. +func (m *MockDaemonServer) CheckHealth(arg0 context.Context, arg1 *emptypb.Empty) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckHealth", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CheckHealth indicates an expected call of CheckHealth. +func (mr *MockDaemonServerMockRecorder) CheckHealth(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckHealth", reflect.TypeOf((*MockDaemonServer)(nil).CheckHealth), arg0, arg1) +} + +// DeleteTask mocks base method. +func (m *MockDaemonServer) DeleteTask(arg0 context.Context, arg1 *v10.DeleteTaskRequest) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteTask", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteTask indicates an expected call of DeleteTask. +func (mr *MockDaemonServerMockRecorder) DeleteTask(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTask", reflect.TypeOf((*MockDaemonServer)(nil).DeleteTask), arg0, arg1) +} + +// Download mocks base method. +func (m *MockDaemonServer) Download(arg0 *v10.DownRequest, arg1 v10.Daemon_DownloadServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Download", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// Download indicates an expected call of Download. +func (mr *MockDaemonServerMockRecorder) Download(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Download", reflect.TypeOf((*MockDaemonServer)(nil).Download), arg0, arg1) +} + +// ExportTask mocks base method. +func (m *MockDaemonServer) ExportTask(arg0 context.Context, arg1 *v10.ExportTaskRequest) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ExportTask", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ExportTask indicates an expected call of ExportTask. +func (mr *MockDaemonServerMockRecorder) ExportTask(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportTask", reflect.TypeOf((*MockDaemonServer)(nil).ExportTask), arg0, arg1) +} + +// GetPieceTasks mocks base method. +func (m *MockDaemonServer) GetPieceTasks(arg0 context.Context, arg1 *v1.PieceTaskRequest) (*v1.PiecePacket, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPieceTasks", arg0, arg1) + ret0, _ := ret[0].(*v1.PiecePacket) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPieceTasks indicates an expected call of GetPieceTasks. +func (mr *MockDaemonServerMockRecorder) GetPieceTasks(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPieceTasks", reflect.TypeOf((*MockDaemonServer)(nil).GetPieceTasks), arg0, arg1) +} + +// ImportTask mocks base method. +func (m *MockDaemonServer) ImportTask(arg0 context.Context, arg1 *v10.ImportTaskRequest) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImportTask", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImportTask indicates an expected call of ImportTask. +func (mr *MockDaemonServerMockRecorder) ImportTask(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportTask", reflect.TypeOf((*MockDaemonServer)(nil).ImportTask), arg0, arg1) +} + +// StatTask mocks base method. +func (m *MockDaemonServer) StatTask(arg0 context.Context, arg1 *v10.StatTaskRequest) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StatTask", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StatTask indicates an expected call of StatTask. +func (mr *MockDaemonServerMockRecorder) StatTask(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StatTask", reflect.TypeOf((*MockDaemonServer)(nil).StatTask), arg0, arg1) +} + +// SyncPieceTasks mocks base method. +func (m *MockDaemonServer) SyncPieceTasks(arg0 v10.Daemon_SyncPieceTasksServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SyncPieceTasks", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SyncPieceTasks indicates an expected call of SyncPieceTasks. +func (mr *MockDaemonServerMockRecorder) SyncPieceTasks(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SyncPieceTasks", reflect.TypeOf((*MockDaemonServer)(nil).SyncPieceTasks), arg0) +} + +// MockDaemon_DownloadServer is a mock of Daemon_DownloadServer interface. +type MockDaemon_DownloadServer struct { + ctrl *gomock.Controller + recorder *MockDaemon_DownloadServerMockRecorder +} + +// MockDaemon_DownloadServerMockRecorder is the mock recorder for MockDaemon_DownloadServer. +type MockDaemon_DownloadServerMockRecorder struct { + mock *MockDaemon_DownloadServer +} + +// NewMockDaemon_DownloadServer creates a new mock instance. +func NewMockDaemon_DownloadServer(ctrl *gomock.Controller) *MockDaemon_DownloadServer { + mock := &MockDaemon_DownloadServer{ctrl: ctrl} + mock.recorder = &MockDaemon_DownloadServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDaemon_DownloadServer) EXPECT() *MockDaemon_DownloadServerMockRecorder { + return m.recorder +} + +// Context mocks base method. +func (m *MockDaemon_DownloadServer) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockDaemon_DownloadServerMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockDaemon_DownloadServer)(nil).Context)) +} + +// RecvMsg mocks base method. +func (m_2 *MockDaemon_DownloadServer) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockDaemon_DownloadServerMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockDaemon_DownloadServer)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockDaemon_DownloadServer) Send(arg0 *v10.DownResult) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockDaemon_DownloadServerMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockDaemon_DownloadServer)(nil).Send), arg0) +} + +// SendHeader mocks base method. +func (m *MockDaemon_DownloadServer) SendHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendHeader indicates an expected call of SendHeader. +func (mr *MockDaemon_DownloadServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockDaemon_DownloadServer)(nil).SendHeader), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockDaemon_DownloadServer) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockDaemon_DownloadServerMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockDaemon_DownloadServer)(nil).SendMsg), m) +} + +// SetHeader mocks base method. +func (m *MockDaemon_DownloadServer) SetHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetHeader indicates an expected call of SetHeader. +func (mr *MockDaemon_DownloadServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockDaemon_DownloadServer)(nil).SetHeader), arg0) +} + +// SetTrailer mocks base method. +func (m *MockDaemon_DownloadServer) SetTrailer(arg0 metadata.MD) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetTrailer", arg0) +} + +// SetTrailer indicates an expected call of SetTrailer. +func (mr *MockDaemon_DownloadServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockDaemon_DownloadServer)(nil).SetTrailer), arg0) +} + +// MockDaemon_SyncPieceTasksServer is a mock of Daemon_SyncPieceTasksServer interface. +type MockDaemon_SyncPieceTasksServer struct { + ctrl *gomock.Controller + recorder *MockDaemon_SyncPieceTasksServerMockRecorder +} + +// MockDaemon_SyncPieceTasksServerMockRecorder is the mock recorder for MockDaemon_SyncPieceTasksServer. +type MockDaemon_SyncPieceTasksServerMockRecorder struct { + mock *MockDaemon_SyncPieceTasksServer +} + +// NewMockDaemon_SyncPieceTasksServer creates a new mock instance. +func NewMockDaemon_SyncPieceTasksServer(ctrl *gomock.Controller) *MockDaemon_SyncPieceTasksServer { + mock := &MockDaemon_SyncPieceTasksServer{ctrl: ctrl} + mock.recorder = &MockDaemon_SyncPieceTasksServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDaemon_SyncPieceTasksServer) EXPECT() *MockDaemon_SyncPieceTasksServerMockRecorder { + return m.recorder +} + +// Context mocks base method. +func (m *MockDaemon_SyncPieceTasksServer) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockDaemon_SyncPieceTasksServerMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockDaemon_SyncPieceTasksServer)(nil).Context)) +} + +// Recv mocks base method. +func (m *MockDaemon_SyncPieceTasksServer) Recv() (*v1.PieceTaskRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*v1.PieceTaskRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockDaemon_SyncPieceTasksServerMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockDaemon_SyncPieceTasksServer)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockDaemon_SyncPieceTasksServer) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockDaemon_SyncPieceTasksServerMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockDaemon_SyncPieceTasksServer)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockDaemon_SyncPieceTasksServer) Send(arg0 *v1.PiecePacket) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockDaemon_SyncPieceTasksServerMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockDaemon_SyncPieceTasksServer)(nil).Send), arg0) +} + +// SendHeader mocks base method. +func (m *MockDaemon_SyncPieceTasksServer) SendHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendHeader indicates an expected call of SendHeader. +func (mr *MockDaemon_SyncPieceTasksServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockDaemon_SyncPieceTasksServer)(nil).SendHeader), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockDaemon_SyncPieceTasksServer) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockDaemon_SyncPieceTasksServerMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockDaemon_SyncPieceTasksServer)(nil).SendMsg), m) +} + +// SetHeader mocks base method. +func (m *MockDaemon_SyncPieceTasksServer) SetHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetHeader indicates an expected call of SetHeader. +func (mr *MockDaemon_SyncPieceTasksServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockDaemon_SyncPieceTasksServer)(nil).SetHeader), arg0) +} + +// SetTrailer mocks base method. +func (m *MockDaemon_SyncPieceTasksServer) SetTrailer(arg0 metadata.MD) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetTrailer", arg0) +} + +// SetTrailer indicates an expected call of SetTrailer. +func (mr *MockDaemon_SyncPieceTasksServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockDaemon_SyncPieceTasksServer)(nil).SetTrailer), arg0) +} diff --git a/pkg/apis/dfdaemon/v1/mocks/mocks.go b/pkg/apis/dfdaemon/v1/mocks/mocks.go new file mode 100644 index 0000000..fde2fd8 --- /dev/null +++ b/pkg/apis/dfdaemon/v1/mocks/mocks.go @@ -0,0 +1,19 @@ +/* + * Copyright 2022 The Dragonfly 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 mocks + +//go:generate mockgen -destination dfdaemon_mock.go -source ../dfdaemon.pb.go -package mocks diff --git a/pkg/apis/errordetails/v1/errordetails.pb.go b/pkg/apis/errordetails/v1/errordetails.pb.go new file mode 100644 index 0000000..eedb6a1 --- /dev/null +++ b/pkg/apis/errordetails/v1/errordetails.pb.go @@ -0,0 +1,178 @@ +// +// Copyright 2022 The Dragonfly 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.19.4 +// source: pkg/apis/errordetails/v1/errordetails.proto + +package v1 + +import ( + v1 "d7y.io/api/pkg/apis/common/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SourceError struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Temporary bool `protobuf:"varint,1,opt,name=temporary,proto3" json:"temporary,omitempty"` + // source response metadata, eg: HTTP Status Code, HTTP Status, HTTP Header + Metadata *v1.ExtendAttribute `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` +} + +func (x *SourceError) Reset() { + *x = SourceError{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_errordetails_v1_errordetails_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SourceError) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SourceError) ProtoMessage() {} + +func (x *SourceError) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_errordetails_v1_errordetails_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SourceError.ProtoReflect.Descriptor instead. +func (*SourceError) Descriptor() ([]byte, []int) { + return file_pkg_apis_errordetails_v1_errordetails_proto_rawDescGZIP(), []int{0} +} + +func (x *SourceError) GetTemporary() bool { + if x != nil { + return x.Temporary + } + return false +} + +func (x *SourceError) GetMetadata() *v1.ExtendAttribute { + if x != nil { + return x.Metadata + } + return nil +} + +var File_pkg_apis_errordetails_v1_errordetails_proto protoreflect.FileDescriptor + +var file_pkg_apis_errordetails_v1_errordetails_proto_rawDesc = []byte{ + 0x0a, 0x2b, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x1a, 0x1f, 0x70, 0x6b, 0x67, + 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x60, 0x0a, 0x0b, + 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x74, + 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, + 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x72, 0x79, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x25, + 0x5a, 0x23, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x64, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_apis_errordetails_v1_errordetails_proto_rawDescOnce sync.Once + file_pkg_apis_errordetails_v1_errordetails_proto_rawDescData = file_pkg_apis_errordetails_v1_errordetails_proto_rawDesc +) + +func file_pkg_apis_errordetails_v1_errordetails_proto_rawDescGZIP() []byte { + file_pkg_apis_errordetails_v1_errordetails_proto_rawDescOnce.Do(func() { + file_pkg_apis_errordetails_v1_errordetails_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_errordetails_v1_errordetails_proto_rawDescData) + }) + return file_pkg_apis_errordetails_v1_errordetails_proto_rawDescData +} + +var file_pkg_apis_errordetails_v1_errordetails_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_pkg_apis_errordetails_v1_errordetails_proto_goTypes = []interface{}{ + (*SourceError)(nil), // 0: errordetails.SourceError + (*v1.ExtendAttribute)(nil), // 1: common.ExtendAttribute +} +var file_pkg_apis_errordetails_v1_errordetails_proto_depIdxs = []int32{ + 1, // 0: errordetails.SourceError.metadata:type_name -> common.ExtendAttribute + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_pkg_apis_errordetails_v1_errordetails_proto_init() } +func file_pkg_apis_errordetails_v1_errordetails_proto_init() { + if File_pkg_apis_errordetails_v1_errordetails_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pkg_apis_errordetails_v1_errordetails_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SourceError); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_apis_errordetails_v1_errordetails_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_pkg_apis_errordetails_v1_errordetails_proto_goTypes, + DependencyIndexes: file_pkg_apis_errordetails_v1_errordetails_proto_depIdxs, + MessageInfos: file_pkg_apis_errordetails_v1_errordetails_proto_msgTypes, + }.Build() + File_pkg_apis_errordetails_v1_errordetails_proto = out.File + file_pkg_apis_errordetails_v1_errordetails_proto_rawDesc = nil + file_pkg_apis_errordetails_v1_errordetails_proto_goTypes = nil + file_pkg_apis_errordetails_v1_errordetails_proto_depIdxs = nil +} diff --git a/pkg/apis/errordetails/v1/errordetails.pb.validate.go b/pkg/apis/errordetails/v1/errordetails.pb.validate.go new file mode 100644 index 0000000..96e2b6d --- /dev/null +++ b/pkg/apis/errordetails/v1/errordetails.pb.validate.go @@ -0,0 +1,166 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: pkg/apis/errordetails/v1/errordetails.proto + +package v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on SourceError with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *SourceError) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SourceError with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in SourceErrorMultiError, or +// nil if none found. +func (m *SourceError) ValidateAll() error { + return m.validate(true) +} + +func (m *SourceError) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Temporary + + if all { + switch v := interface{}(m.GetMetadata()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SourceErrorValidationError{ + field: "Metadata", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SourceErrorValidationError{ + field: "Metadata", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SourceErrorValidationError{ + field: "Metadata", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return SourceErrorMultiError(errors) + } + + return nil +} + +// SourceErrorMultiError is an error wrapping multiple validation errors +// returned by SourceError.ValidateAll() if the designated constraints aren't met. +type SourceErrorMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SourceErrorMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SourceErrorMultiError) AllErrors() []error { return m } + +// SourceErrorValidationError is the validation error returned by +// SourceError.Validate if the designated constraints aren't met. +type SourceErrorValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SourceErrorValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SourceErrorValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SourceErrorValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SourceErrorValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SourceErrorValidationError) ErrorName() string { return "SourceErrorValidationError" } + +// Error satisfies the builtin error interface +func (e SourceErrorValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSourceError.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SourceErrorValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SourceErrorValidationError{} diff --git a/pkg/apis/errordetails/v1/mocks/errordetails_mock.go b/pkg/apis/errordetails/v1/mocks/errordetails_mock.go new file mode 100644 index 0000000..b44f461 --- /dev/null +++ b/pkg/apis/errordetails/v1/mocks/errordetails_mock.go @@ -0,0 +1,5 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ../errordetails.pb.go + +// Package mocks is a generated GoMock package. +package mocks diff --git a/pkg/apis/errordetails/v1/mocks/mocks.go b/pkg/apis/errordetails/v1/mocks/mocks.go new file mode 100644 index 0000000..b783352 --- /dev/null +++ b/pkg/apis/errordetails/v1/mocks/mocks.go @@ -0,0 +1,19 @@ +/* + * Copyright 2022 The Dragonfly 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 mocks + +//go:generate mockgen -destination errordetails_mock.go -source ../errordetails.pb.go -package mocks diff --git a/pkg/apis/manager/v1/manager.pb.go b/pkg/apis/manager/v1/manager.pb.go new file mode 100644 index 0000000..fdc245b --- /dev/null +++ b/pkg/apis/manager/v1/manager.pb.go @@ -0,0 +1,2639 @@ +// +// Copyright 2022 The Dragonfly 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.19.4 +// source: pkg/apis/manager/v1/manager.proto + +package v1 + +import ( + context "context" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Request source type. +type SourceType int32 + +const ( + // Scheduler service. + SourceType_SCHEDULER_SOURCE SourceType = 0 + // Peer service. + SourceType_PEER_SOURCE SourceType = 1 + // SeedPeer service. + SourceType_SEED_PEER_SOURCE SourceType = 2 +) + +// Enum value maps for SourceType. +var ( + SourceType_name = map[int32]string{ + 0: "SCHEDULER_SOURCE", + 1: "PEER_SOURCE", + 2: "SEED_PEER_SOURCE", + } + SourceType_value = map[string]int32{ + "SCHEDULER_SOURCE": 0, + "PEER_SOURCE": 1, + "SEED_PEER_SOURCE": 2, + } +) + +func (x SourceType) Enum() *SourceType { + p := new(SourceType) + *p = x + return p +} + +func (x SourceType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SourceType) Descriptor() protoreflect.EnumDescriptor { + return file_pkg_apis_manager_v1_manager_proto_enumTypes[0].Descriptor() +} + +func (SourceType) Type() protoreflect.EnumType { + return &file_pkg_apis_manager_v1_manager_proto_enumTypes[0] +} + +func (x SourceType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SourceType.Descriptor instead. +func (SourceType) EnumDescriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{0} +} + +// SecurityGroup represents security group of cluster. +type SecurityGroup struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Group id. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // Group name. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Group biography. + Bio string `protobuf:"bytes,3,opt,name=bio,proto3" json:"bio,omitempty"` + // Group domain. + Domain string `protobuf:"bytes,4,opt,name=domain,proto3" json:"domain,omitempty"` + // Group proxy domain. + ProxyDomain string `protobuf:"bytes,5,opt,name=proxy_domain,json=proxyDomain,proto3" json:"proxy_domain,omitempty"` +} + +func (x *SecurityGroup) Reset() { + *x = SecurityGroup{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SecurityGroup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityGroup) ProtoMessage() {} + +func (x *SecurityGroup) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SecurityGroup.ProtoReflect.Descriptor instead. +func (*SecurityGroup) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{0} +} + +func (x *SecurityGroup) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *SecurityGroup) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SecurityGroup) GetBio() string { + if x != nil { + return x.Bio + } + return "" +} + +func (x *SecurityGroup) GetDomain() string { + if x != nil { + return x.Domain + } + return "" +} + +func (x *SecurityGroup) GetProxyDomain() string { + if x != nil { + return x.ProxyDomain + } + return "" +} + +// SeedPeerCluster represents cluster of seed peer. +type SeedPeerCluster struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Cluster id. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // Cluster name. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Cluster biography. + Bio string `protobuf:"bytes,3,opt,name=bio,proto3" json:"bio,omitempty"` + // Cluster configuration. + Config []byte `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"` + // Cluster scopes. + Scopes []byte `protobuf:"bytes,5,opt,name=scopes,proto3" json:"scopes,omitempty"` + // Security group to which the seed peer cluster belongs. + SecurityGroup *SecurityGroup `protobuf:"bytes,6,opt,name=security_group,json=securityGroup,proto3" json:"security_group,omitempty"` +} + +func (x *SeedPeerCluster) Reset() { + *x = SeedPeerCluster{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SeedPeerCluster) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SeedPeerCluster) ProtoMessage() {} + +func (x *SeedPeerCluster) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SeedPeerCluster.ProtoReflect.Descriptor instead. +func (*SeedPeerCluster) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{1} +} + +func (x *SeedPeerCluster) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *SeedPeerCluster) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SeedPeerCluster) GetBio() string { + if x != nil { + return x.Bio + } + return "" +} + +func (x *SeedPeerCluster) GetConfig() []byte { + if x != nil { + return x.Config + } + return nil +} + +func (x *SeedPeerCluster) GetScopes() []byte { + if x != nil { + return x.Scopes + } + return nil +} + +func (x *SeedPeerCluster) GetSecurityGroup() *SecurityGroup { + if x != nil { + return x.SecurityGroup + } + return nil +} + +// SeedPeer represents seed peer for network. +type SeedPeer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Seed peer id. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // Seed peer hostname. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // Seed peer type. + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` + // Seed peer idc. + Idc string `protobuf:"bytes,5,opt,name=idc,proto3" json:"idc,omitempty"` + // Seed peer network topology. + NetTopology string `protobuf:"bytes,6,opt,name=net_topology,json=netTopology,proto3" json:"net_topology,omitempty"` + // Seed peer location. + Location string `protobuf:"bytes,7,opt,name=location,proto3" json:"location,omitempty"` + // Seed peer ip. + Ip string `protobuf:"bytes,8,opt,name=ip,proto3" json:"ip,omitempty"` + // Seed peer grpc port. + Port int32 `protobuf:"varint,9,opt,name=port,proto3" json:"port,omitempty"` + // Seed peer download port. + DownloadPort int32 `protobuf:"varint,10,opt,name=download_port,json=downloadPort,proto3" json:"download_port,omitempty"` + // Seed peer state. + State string `protobuf:"bytes,11,opt,name=state,proto3" json:"state,omitempty"` + // ID of the cluster to which the seed peer belongs. + SeedPeerClusterId uint64 `protobuf:"varint,12,opt,name=seed_peer_cluster_id,json=seedPeerClusterId,proto3" json:"seed_peer_cluster_id,omitempty"` + // Cluster to which the seed peer belongs. + SeedPeerCluster *SeedPeerCluster `protobuf:"bytes,13,opt,name=seed_peer_cluster,json=seedPeerCluster,proto3" json:"seed_peer_cluster,omitempty"` + // Schedulers included in seed peer. + Schedulers []*Scheduler `protobuf:"bytes,14,rep,name=schedulers,proto3" json:"schedulers,omitempty"` + // Seed peer object storage port. + ObjectStoragePort int32 `protobuf:"varint,15,opt,name=object_storage_port,json=objectStoragePort,proto3" json:"object_storage_port,omitempty"` +} + +func (x *SeedPeer) Reset() { + *x = SeedPeer{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SeedPeer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SeedPeer) ProtoMessage() {} + +func (x *SeedPeer) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SeedPeer.ProtoReflect.Descriptor instead. +func (*SeedPeer) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{2} +} + +func (x *SeedPeer) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *SeedPeer) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *SeedPeer) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *SeedPeer) GetIdc() string { + if x != nil { + return x.Idc + } + return "" +} + +func (x *SeedPeer) GetNetTopology() string { + if x != nil { + return x.NetTopology + } + return "" +} + +func (x *SeedPeer) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *SeedPeer) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *SeedPeer) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *SeedPeer) GetDownloadPort() int32 { + if x != nil { + return x.DownloadPort + } + return 0 +} + +func (x *SeedPeer) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *SeedPeer) GetSeedPeerClusterId() uint64 { + if x != nil { + return x.SeedPeerClusterId + } + return 0 +} + +func (x *SeedPeer) GetSeedPeerCluster() *SeedPeerCluster { + if x != nil { + return x.SeedPeerCluster + } + return nil +} + +func (x *SeedPeer) GetSchedulers() []*Scheduler { + if x != nil { + return x.Schedulers + } + return nil +} + +func (x *SeedPeer) GetObjectStoragePort() int32 { + if x != nil { + return x.ObjectStoragePort + } + return 0 +} + +// GetSeedPeerRequest represents request of GetSeedPeer. +type GetSeedPeerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request source type. + SourceType SourceType `protobuf:"varint,1,opt,name=source_type,json=sourceType,proto3,enum=manager.SourceType" json:"source_type,omitempty"` + // Seed peer hostname. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // ID of the cluster to which the seed peer belongs. + SeedPeerClusterId uint64 `protobuf:"varint,3,opt,name=seed_peer_cluster_id,json=seedPeerClusterId,proto3" json:"seed_peer_cluster_id,omitempty"` + // Seed peer ip. + Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"` +} + +func (x *GetSeedPeerRequest) Reset() { + *x = GetSeedPeerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSeedPeerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSeedPeerRequest) ProtoMessage() {} + +func (x *GetSeedPeerRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSeedPeerRequest.ProtoReflect.Descriptor instead. +func (*GetSeedPeerRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{3} +} + +func (x *GetSeedPeerRequest) GetSourceType() SourceType { + if x != nil { + return x.SourceType + } + return SourceType_SCHEDULER_SOURCE +} + +func (x *GetSeedPeerRequest) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *GetSeedPeerRequest) GetSeedPeerClusterId() uint64 { + if x != nil { + return x.SeedPeerClusterId + } + return 0 +} + +func (x *GetSeedPeerRequest) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +// UpdateSeedPeerRequest represents request of UpdateSeedPeer. +type UpdateSeedPeerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request source type. + SourceType SourceType `protobuf:"varint,1,opt,name=source_type,json=sourceType,proto3,enum=manager.SourceType" json:"source_type,omitempty"` + // Seed peer hostname. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // Seed peer type. + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` + // Seed peer idc. + Idc string `protobuf:"bytes,5,opt,name=idc,proto3" json:"idc,omitempty"` + // Seed peer network topology. + NetTopology string `protobuf:"bytes,6,opt,name=net_topology,json=netTopology,proto3" json:"net_topology,omitempty"` + // Seed peer location. + Location string `protobuf:"bytes,7,opt,name=location,proto3" json:"location,omitempty"` + // Seed peer ip. + Ip string `protobuf:"bytes,8,opt,name=ip,proto3" json:"ip,omitempty"` + // Seed peer port. + Port int32 `protobuf:"varint,9,opt,name=port,proto3" json:"port,omitempty"` + // Seed peer download port. + DownloadPort int32 `protobuf:"varint,10,opt,name=download_port,json=downloadPort,proto3" json:"download_port,omitempty"` + // ID of the cluster to which the seed peer belongs. + SeedPeerClusterId uint64 `protobuf:"varint,11,opt,name=seed_peer_cluster_id,json=seedPeerClusterId,proto3" json:"seed_peer_cluster_id,omitempty"` + // Seed peer object storage port. + ObjectStoragePort int32 `protobuf:"varint,12,opt,name=object_storage_port,json=objectStoragePort,proto3" json:"object_storage_port,omitempty"` +} + +func (x *UpdateSeedPeerRequest) Reset() { + *x = UpdateSeedPeerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateSeedPeerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSeedPeerRequest) ProtoMessage() {} + +func (x *UpdateSeedPeerRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateSeedPeerRequest.ProtoReflect.Descriptor instead. +func (*UpdateSeedPeerRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{4} +} + +func (x *UpdateSeedPeerRequest) GetSourceType() SourceType { + if x != nil { + return x.SourceType + } + return SourceType_SCHEDULER_SOURCE +} + +func (x *UpdateSeedPeerRequest) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *UpdateSeedPeerRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *UpdateSeedPeerRequest) GetIdc() string { + if x != nil { + return x.Idc + } + return "" +} + +func (x *UpdateSeedPeerRequest) GetNetTopology() string { + if x != nil { + return x.NetTopology + } + return "" +} + +func (x *UpdateSeedPeerRequest) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *UpdateSeedPeerRequest) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *UpdateSeedPeerRequest) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *UpdateSeedPeerRequest) GetDownloadPort() int32 { + if x != nil { + return x.DownloadPort + } + return 0 +} + +func (x *UpdateSeedPeerRequest) GetSeedPeerClusterId() uint64 { + if x != nil { + return x.SeedPeerClusterId + } + return 0 +} + +func (x *UpdateSeedPeerRequest) GetObjectStoragePort() int32 { + if x != nil { + return x.ObjectStoragePort + } + return 0 +} + +// SeedPeerCluster represents cluster of scheduler. +type SchedulerCluster struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Cluster id. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // Cluster name. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Cluster biography. + Bio string `protobuf:"bytes,3,opt,name=bio,proto3" json:"bio,omitempty"` + // Cluster config. + Config []byte `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"` + // Cluster client config. + ClientConfig []byte `protobuf:"bytes,5,opt,name=client_config,json=clientConfig,proto3" json:"client_config,omitempty"` + // Cluster scopes. + Scopes []byte `protobuf:"bytes,6,opt,name=scopes,proto3" json:"scopes,omitempty"` + // Security group to which the scheduler cluster belongs. + SecurityGroup *SecurityGroup `protobuf:"bytes,7,opt,name=security_group,json=securityGroup,proto3" json:"security_group,omitempty"` +} + +func (x *SchedulerCluster) Reset() { + *x = SchedulerCluster{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SchedulerCluster) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SchedulerCluster) ProtoMessage() {} + +func (x *SchedulerCluster) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SchedulerCluster.ProtoReflect.Descriptor instead. +func (*SchedulerCluster) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{5} +} + +func (x *SchedulerCluster) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *SchedulerCluster) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SchedulerCluster) GetBio() string { + if x != nil { + return x.Bio + } + return "" +} + +func (x *SchedulerCluster) GetConfig() []byte { + if x != nil { + return x.Config + } + return nil +} + +func (x *SchedulerCluster) GetClientConfig() []byte { + if x != nil { + return x.ClientConfig + } + return nil +} + +func (x *SchedulerCluster) GetScopes() []byte { + if x != nil { + return x.Scopes + } + return nil +} + +func (x *SchedulerCluster) GetSecurityGroup() *SecurityGroup { + if x != nil { + return x.SecurityGroup + } + return nil +} + +// SeedPeerCluster represents scheduler for network. +type Scheduler struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Scheduler id. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // Scheduler hostname. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // Deprecated: Do not use. + Vips string `protobuf:"bytes,3,opt,name=vips,proto3" json:"vips,omitempty"` + // Scheduler idc. + Idc string `protobuf:"bytes,4,opt,name=idc,proto3" json:"idc,omitempty"` + // Scheduler location. + Location string `protobuf:"bytes,5,opt,name=location,proto3" json:"location,omitempty"` + // Deprecated: Use net_topology instead. + NetConfig []byte `protobuf:"bytes,6,opt,name=net_config,json=netConfig,proto3" json:"net_config,omitempty"` + // Scheduler ip. + Ip string `protobuf:"bytes,7,opt,name=ip,proto3" json:"ip,omitempty"` + // Scheduler grpc port. + Port int32 `protobuf:"varint,8,opt,name=port,proto3" json:"port,omitempty"` + // Scheduler state. + State string `protobuf:"bytes,9,opt,name=state,proto3" json:"state,omitempty"` + // ID of the cluster to which the scheduler belongs. + SchedulerClusterId uint64 `protobuf:"varint,10,opt,name=scheduler_cluster_id,json=schedulerClusterId,proto3" json:"scheduler_cluster_id,omitempty"` + // Cluster to which the scheduler belongs. + SchedulerCluster *SchedulerCluster `protobuf:"bytes,11,opt,name=scheduler_cluster,json=schedulerCluster,proto3" json:"scheduler_cluster,omitempty"` + // Seed peers to which the scheduler belongs. + SeedPeers []*SeedPeer `protobuf:"bytes,13,rep,name=seed_peers,json=seedPeers,proto3" json:"seed_peers,omitempty"` + // Scheduler network topology. + NetTopology string `protobuf:"bytes,14,opt,name=net_topology,json=netTopology,proto3" json:"net_topology,omitempty"` +} + +func (x *Scheduler) Reset() { + *x = Scheduler{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Scheduler) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Scheduler) ProtoMessage() {} + +func (x *Scheduler) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Scheduler.ProtoReflect.Descriptor instead. +func (*Scheduler) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{6} +} + +func (x *Scheduler) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Scheduler) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *Scheduler) GetVips() string { + if x != nil { + return x.Vips + } + return "" +} + +func (x *Scheduler) GetIdc() string { + if x != nil { + return x.Idc + } + return "" +} + +func (x *Scheduler) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *Scheduler) GetNetConfig() []byte { + if x != nil { + return x.NetConfig + } + return nil +} + +func (x *Scheduler) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *Scheduler) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *Scheduler) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *Scheduler) GetSchedulerClusterId() uint64 { + if x != nil { + return x.SchedulerClusterId + } + return 0 +} + +func (x *Scheduler) GetSchedulerCluster() *SchedulerCluster { + if x != nil { + return x.SchedulerCluster + } + return nil +} + +func (x *Scheduler) GetSeedPeers() []*SeedPeer { + if x != nil { + return x.SeedPeers + } + return nil +} + +func (x *Scheduler) GetNetTopology() string { + if x != nil { + return x.NetTopology + } + return "" +} + +// GetSchedulerRequest represents request of GetScheduler. +type GetSchedulerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request source type. + SourceType SourceType `protobuf:"varint,1,opt,name=source_type,json=sourceType,proto3,enum=manager.SourceType" json:"source_type,omitempty"` + // Scheduler hostname. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // ID of the cluster to which the scheduler belongs. + SchedulerClusterId uint64 `protobuf:"varint,3,opt,name=scheduler_cluster_id,json=schedulerClusterId,proto3" json:"scheduler_cluster_id,omitempty"` + // Scheduler ip. + Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"` +} + +func (x *GetSchedulerRequest) Reset() { + *x = GetSchedulerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSchedulerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSchedulerRequest) ProtoMessage() {} + +func (x *GetSchedulerRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSchedulerRequest.ProtoReflect.Descriptor instead. +func (*GetSchedulerRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{7} +} + +func (x *GetSchedulerRequest) GetSourceType() SourceType { + if x != nil { + return x.SourceType + } + return SourceType_SCHEDULER_SOURCE +} + +func (x *GetSchedulerRequest) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *GetSchedulerRequest) GetSchedulerClusterId() uint64 { + if x != nil { + return x.SchedulerClusterId + } + return 0 +} + +func (x *GetSchedulerRequest) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +// UpdateSchedulerRequest represents request of UpdateScheduler. +type UpdateSchedulerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request source type. + SourceType SourceType `protobuf:"varint,1,opt,name=source_type,json=sourceType,proto3,enum=manager.SourceType" json:"source_type,omitempty"` + // Scheduler hostname. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // ID of the cluster to which the scheduler belongs. + SchedulerClusterId uint64 `protobuf:"varint,3,opt,name=scheduler_cluster_id,json=schedulerClusterId,proto3" json:"scheduler_cluster_id,omitempty"` + // Deprecated: Do not use. + Vips string `protobuf:"bytes,4,opt,name=vips,proto3" json:"vips,omitempty"` + // Scheduler idc. + Idc string `protobuf:"bytes,5,opt,name=idc,proto3" json:"idc,omitempty"` + // Scheduler location. + Location string `protobuf:"bytes,6,opt,name=location,proto3" json:"location,omitempty"` + // Deprecated: Use net_topology instead. + NetConfig []byte `protobuf:"bytes,7,opt,name=net_config,json=netConfig,proto3" json:"net_config,omitempty"` + // Scheduler ip. + Ip string `protobuf:"bytes,8,opt,name=ip,proto3" json:"ip,omitempty"` + // Scheduler port. + Port int32 `protobuf:"varint,9,opt,name=port,proto3" json:"port,omitempty"` + // Scheduler network topology. + NetTopology string `protobuf:"bytes,10,opt,name=net_topology,json=netTopology,proto3" json:"net_topology,omitempty"` +} + +func (x *UpdateSchedulerRequest) Reset() { + *x = UpdateSchedulerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateSchedulerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSchedulerRequest) ProtoMessage() {} + +func (x *UpdateSchedulerRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateSchedulerRequest.ProtoReflect.Descriptor instead. +func (*UpdateSchedulerRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdateSchedulerRequest) GetSourceType() SourceType { + if x != nil { + return x.SourceType + } + return SourceType_SCHEDULER_SOURCE +} + +func (x *UpdateSchedulerRequest) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *UpdateSchedulerRequest) GetSchedulerClusterId() uint64 { + if x != nil { + return x.SchedulerClusterId + } + return 0 +} + +func (x *UpdateSchedulerRequest) GetVips() string { + if x != nil { + return x.Vips + } + return "" +} + +func (x *UpdateSchedulerRequest) GetIdc() string { + if x != nil { + return x.Idc + } + return "" +} + +func (x *UpdateSchedulerRequest) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *UpdateSchedulerRequest) GetNetConfig() []byte { + if x != nil { + return x.NetConfig + } + return nil +} + +func (x *UpdateSchedulerRequest) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *UpdateSchedulerRequest) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *UpdateSchedulerRequest) GetNetTopology() string { + if x != nil { + return x.NetTopology + } + return "" +} + +// ListSchedulersRequest represents request of ListSchedulers. +type ListSchedulersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request source type. + SourceType SourceType `protobuf:"varint,1,opt,name=source_type,json=sourceType,proto3,enum=manager.SourceType" json:"source_type,omitempty"` + // Source service hostname. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // Source service ip. + Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` + // Source service host information. + HostInfo map[string]string `protobuf:"bytes,5,rep,name=host_info,json=hostInfo,proto3" json:"host_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *ListSchedulersRequest) Reset() { + *x = ListSchedulersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSchedulersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSchedulersRequest) ProtoMessage() {} + +func (x *ListSchedulersRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSchedulersRequest.ProtoReflect.Descriptor instead. +func (*ListSchedulersRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{9} +} + +func (x *ListSchedulersRequest) GetSourceType() SourceType { + if x != nil { + return x.SourceType + } + return SourceType_SCHEDULER_SOURCE +} + +func (x *ListSchedulersRequest) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *ListSchedulersRequest) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *ListSchedulersRequest) GetHostInfo() map[string]string { + if x != nil { + return x.HostInfo + } + return nil +} + +// ListSchedulersResponse represents response of ListSchedulers. +type ListSchedulersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Schedulers to which the source service belongs. + Schedulers []*Scheduler `protobuf:"bytes,1,rep,name=schedulers,proto3" json:"schedulers,omitempty"` +} + +func (x *ListSchedulersResponse) Reset() { + *x = ListSchedulersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSchedulersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSchedulersResponse) ProtoMessage() {} + +func (x *ListSchedulersResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSchedulersResponse.ProtoReflect.Descriptor instead. +func (*ListSchedulersResponse) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{10} +} + +func (x *ListSchedulersResponse) GetSchedulers() []*Scheduler { + if x != nil { + return x.Schedulers + } + return nil +} + +// ObjectStorage represents config of object storage. +type ObjectStorage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Object storage name of type. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Storage region. + Region string `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"` + // Datacenter endpoint. + Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + // Access key id. + AccessKey string `protobuf:"bytes,4,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` + // Access key secret. + SecretKey string `protobuf:"bytes,5,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"` +} + +func (x *ObjectStorage) Reset() { + *x = ObjectStorage{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ObjectStorage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectStorage) ProtoMessage() {} + +func (x *ObjectStorage) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObjectStorage.ProtoReflect.Descriptor instead. +func (*ObjectStorage) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{11} +} + +func (x *ObjectStorage) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ObjectStorage) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *ObjectStorage) GetEndpoint() string { + if x != nil { + return x.Endpoint + } + return "" +} + +func (x *ObjectStorage) GetAccessKey() string { + if x != nil { + return x.AccessKey + } + return "" +} + +func (x *ObjectStorage) GetSecretKey() string { + if x != nil { + return x.SecretKey + } + return "" +} + +// GetObjectStorageRequest represents request of GetObjectStorage. +type GetObjectStorageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request source type. + SourceType SourceType `protobuf:"varint,1,opt,name=source_type,json=sourceType,proto3,enum=manager.SourceType" json:"source_type,omitempty"` + // Source service hostname. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // Source service ip. + Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` +} + +func (x *GetObjectStorageRequest) Reset() { + *x = GetObjectStorageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetObjectStorageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetObjectStorageRequest) ProtoMessage() {} + +func (x *GetObjectStorageRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetObjectStorageRequest.ProtoReflect.Descriptor instead. +func (*GetObjectStorageRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{12} +} + +func (x *GetObjectStorageRequest) GetSourceType() SourceType { + if x != nil { + return x.SourceType + } + return SourceType_SCHEDULER_SOURCE +} + +func (x *GetObjectStorageRequest) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *GetObjectStorageRequest) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +// Bucket represents config of bucket. +type Bucket struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Bucket name. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Bucket) Reset() { + *x = Bucket{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Bucket) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Bucket) ProtoMessage() {} + +func (x *Bucket) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Bucket.ProtoReflect.Descriptor instead. +func (*Bucket) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{13} +} + +func (x *Bucket) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// ListSchedulersRequest represents request of ListBuckets. +type ListBucketsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request source type. + SourceType SourceType `protobuf:"varint,1,opt,name=source_type,json=sourceType,proto3,enum=manager.SourceType" json:"source_type,omitempty"` + // Source service hostname. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // Source service ip. + Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` +} + +func (x *ListBucketsRequest) Reset() { + *x = ListBucketsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListBucketsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListBucketsRequest) ProtoMessage() {} + +func (x *ListBucketsRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListBucketsRequest.ProtoReflect.Descriptor instead. +func (*ListBucketsRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{14} +} + +func (x *ListBucketsRequest) GetSourceType() SourceType { + if x != nil { + return x.SourceType + } + return SourceType_SCHEDULER_SOURCE +} + +func (x *ListBucketsRequest) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *ListBucketsRequest) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +// ListBucketsResponse represents response of ListBuckets. +type ListBucketsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Bucket configs. + Buckets []*Bucket `protobuf:"bytes,1,rep,name=buckets,proto3" json:"buckets,omitempty"` +} + +func (x *ListBucketsResponse) Reset() { + *x = ListBucketsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListBucketsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListBucketsResponse) ProtoMessage() {} + +func (x *ListBucketsResponse) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListBucketsResponse.ProtoReflect.Descriptor instead. +func (*ListBucketsResponse) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{15} +} + +func (x *ListBucketsResponse) GetBuckets() []*Bucket { + if x != nil { + return x.Buckets + } + return nil +} + +// KeepAliveRequest represents request of KeepAlive. +type KeepAliveRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Request source type. + SourceType SourceType `protobuf:"varint,1,opt,name=source_type,json=sourceType,proto3,enum=manager.SourceType" json:"source_type,omitempty"` + // Source service hostname. + HostName string `protobuf:"bytes,2,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // ID of the cluster to which the source service belongs. + ClusterId uint64 `protobuf:"varint,3,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` + // Source service ip. + Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"` +} + +func (x *KeepAliveRequest) Reset() { + *x = KeepAliveRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeepAliveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeepAliveRequest) ProtoMessage() {} + +func (x *KeepAliveRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_manager_v1_manager_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeepAliveRequest.ProtoReflect.Descriptor instead. +func (*KeepAliveRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_manager_v1_manager_proto_rawDescGZIP(), []int{16} +} + +func (x *KeepAliveRequest) GetSourceType() SourceType { + if x != nil { + return x.SourceType + } + return SourceType_SCHEDULER_SOURCE +} + +func (x *KeepAliveRequest) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *KeepAliveRequest) GetClusterId() uint64 { + if x != nil { + return x.ClusterId + } + return 0 +} + +func (x *KeepAliveRequest) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +var File_pkg_apis_manager_v1_manager_proto protoreflect.FileDescriptor + +var file_pkg_apis_manager_v1_manager_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x1a, 0x1b, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x80, 0x01, 0x0a, 0x0d, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x69, 0x6f, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x62, 0x69, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, + 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, + 0x69, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x64, 0x6f, 0x6d, 0x61, + 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x44, + 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0xb6, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x65, 0x64, 0x50, 0x65, + 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x62, 0x69, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x62, 0x69, 0x6f, 0x12, + 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, + 0x3d, 0x0a, 0x0e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, + 0x0d, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0xd6, + 0x03, 0x0a, 0x08, 0x53, 0x65, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x68, + 0x6f, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x68, 0x6f, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x69, 0x64, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x63, 0x12, 0x21, + 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, + 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, + 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x70, 0x6f, + 0x72, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, + 0x61, 0x64, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x14, + 0x73, 0x65, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x73, 0x65, 0x65, 0x64, + 0x50, 0x65, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x44, 0x0a, + 0x11, 0x73, 0x65, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x53, 0x65, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x52, 0x0f, 0x73, 0x65, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, + 0x74, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, + 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x52, 0x0a, 0x73, 0x63, 0x68, + 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x0f, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x22, 0xd0, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, + 0x65, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, + 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, + 0x10, 0x01, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, + 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x68, 0x01, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x14, 0x73, 0x65, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x65, + 0x72, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x01, 0x52, 0x11, 0x73, 0x65, 0x65, + 0x64, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, + 0x0a, 0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, + 0x05, 0x70, 0x01, 0xd0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x70, 0x22, 0x91, 0x04, 0x0a, 0x15, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, + 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x68, 0x01, + 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xfa, 0x42, 0x17, 0x72, 0x15, 0x52, + 0x05, 0x73, 0x75, 0x70, 0x65, 0x72, 0x52, 0x06, 0x73, 0x74, 0x72, 0x6f, 0x6e, 0x67, 0x52, 0x04, + 0x77, 0x65, 0x61, 0x6b, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x03, 0x69, 0x64, + 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, + 0x18, 0x80, 0x08, 0xd0, 0x01, 0x01, 0x52, 0x03, 0x69, 0x64, 0x63, 0x12, 0x30, 0x0a, 0x0c, 0x6e, + 0x65, 0x74, 0x5f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0x18, 0x80, 0x08, 0xd0, 0x01, 0x01, + 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x12, 0x27, 0x0a, + 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x0b, 0xfa, 0x42, 0x08, 0x72, 0x06, 0x18, 0x80, 0x08, 0xd0, 0x01, 0x01, 0x52, 0x08, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x70, 0x01, 0x52, 0x02, 0x69, 0x70, 0x12, + 0x20, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0c, 0xfa, + 0x42, 0x09, 0x1a, 0x07, 0x10, 0xff, 0xff, 0x03, 0x28, 0x80, 0x08, 0x52, 0x04, 0x70, 0x6f, 0x72, + 0x74, 0x12, 0x31, 0x0a, 0x0d, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x70, 0x6f, + 0x72, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0c, 0xfa, 0x42, 0x09, 0x1a, 0x07, 0x10, + 0xff, 0xff, 0x03, 0x28, 0x80, 0x08, 0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, + 0x50, 0x6f, 0x72, 0x74, 0x12, 0x38, 0x0a, 0x14, 0x73, 0x65, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x65, + 0x72, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x01, 0x52, 0x11, 0x73, 0x65, 0x65, + 0x64, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x3e, + 0x0a, 0x13, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, + 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0e, 0xfa, 0x42, 0x0b, + 0x1a, 0x09, 0x10, 0xff, 0xff, 0x03, 0x28, 0x80, 0x08, 0x40, 0x01, 0x52, 0x11, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x22, 0xdc, + 0x01, 0x0a, 0x10, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, + 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x69, 0x6f, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x62, 0x69, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x3d, + 0x0a, 0x0e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0d, + 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x22, 0xa2, 0x03, + 0x0a, 0x09, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x68, + 0x6f, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x68, 0x6f, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x69, 0x70, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x76, 0x69, 0x70, 0x73, 0x12, 0x10, 0x0a, 0x03, + 0x69, 0x64, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x63, 0x12, 0x1a, + 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, + 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x6e, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, + 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, + 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x12, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, + 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x46, 0x0a, 0x11, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, + 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6c, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x10, 0x73, 0x63, 0x68, + 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x30, 0x0a, + 0x0a, 0x73, 0x65, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x65, 0x64, + 0x50, 0x65, 0x65, 0x72, 0x52, 0x09, 0x73, 0x65, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, + 0x21, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x18, + 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, + 0x67, 0x79, 0x22, 0xd2, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, + 0x6c, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x0b, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x13, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0a, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x68, 0x6f, + 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, + 0x42, 0x04, 0x72, 0x02, 0x68, 0x01, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x39, 0x0a, 0x14, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x5f, 0x63, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x01, 0x52, 0x12, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, + 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x02, 0x69, + 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x70, 0x01, + 0xd0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x70, 0x22, 0xbf, 0x03, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, + 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x68, 0x01, 0x52, 0x08, + 0x68, 0x6f, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x14, 0x73, 0x63, 0x68, 0x65, + 0x64, 0x75, 0x6c, 0x65, 0x72, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x01, 0x52, + 0x12, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, + 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x04, 0x76, 0x69, 0x70, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0x18, 0x80, 0x08, 0xd0, 0x01, 0x01, + 0x52, 0x04, 0x76, 0x69, 0x70, 0x73, 0x12, 0x1f, 0x0a, 0x03, 0x69, 0x64, 0x63, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0x18, 0x80, 0x08, 0xd0, + 0x01, 0x01, 0x52, 0x03, 0x69, 0x64, 0x63, 0x12, 0x29, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, + 0x10, 0x01, 0x18, 0x80, 0x08, 0xd0, 0x01, 0x01, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x0a, 0x6e, 0x65, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x09, 0xfa, 0x42, 0x06, 0x7a, 0x04, 0x10, 0x01, 0x70, + 0x01, 0x52, 0x09, 0x6e, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x17, 0x0a, 0x02, + 0x69, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x70, + 0x01, 0x52, 0x02, 0x69, 0x70, 0x12, 0x20, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x05, 0x42, 0x0c, 0xfa, 0x42, 0x09, 0x1a, 0x07, 0x10, 0xff, 0xff, 0x03, 0x28, 0x80, + 0x08, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x30, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x5f, 0x74, + 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, + 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0x18, 0x80, 0x08, 0xd0, 0x01, 0x01, 0x52, 0x0b, 0x6e, 0x65, + 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x22, 0xa8, 0x02, 0x0a, 0x15, 0x4c, 0x69, + 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, + 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x68, 0x01, 0x52, + 0x08, 0x68, 0x6f, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x70, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x70, 0x01, 0x52, 0x02, + 0x69, 0x70, 0x12, 0x53, 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x9a, 0x01, 0x02, 0x30, 0x01, 0x52, 0x08, 0x68, + 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x3b, 0x0a, 0x0d, 0x48, 0x6f, 0x73, 0x74, 0x49, + 0x6e, 0x66, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0x4c, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, + 0x64, 0x75, 0x6c, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, + 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x63, 0x68, + 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x52, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, + 0x72, 0x73, 0x22, 0xdd, 0x01, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0x80, 0x08, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0x18, 0x80, 0x08, + 0xd0, 0x01, 0x01, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x08, 0x65, + 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, + 0x42, 0x0a, 0x72, 0x08, 0x10, 0x01, 0x18, 0x80, 0x08, 0xd0, 0x01, 0x01, 0x52, 0x08, 0x65, 0x6e, + 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, + 0x08, 0x10, 0x01, 0x18, 0x80, 0x08, 0xd0, 0x01, 0x01, 0x52, 0x09, 0x61, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x4b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6b, + 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xfa, 0x42, 0x0a, 0x72, 0x08, 0x10, + 0x01, 0x18, 0x80, 0x08, 0xd0, 0x01, 0x01, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, + 0x65, 0x79, 0x22, 0x98, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, + 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, + 0x10, 0x01, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, + 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x68, 0x01, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x70, 0x01, 0x52, 0x02, 0x69, 0x70, 0x22, 0x28, 0x0a, + 0x06, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1e, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0x80, + 0x08, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, + 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, + 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, + 0x10, 0x01, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, + 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x68, 0x01, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x70, 0x01, 0x52, 0x02, 0x69, 0x70, 0x22, 0x40, 0x0a, + 0x13, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x22, + 0xbc, 0x01, 0x0a, 0x10, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, + 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x68, 0x01, + 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0a, 0x63, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x32, 0x02, 0x28, 0x01, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, + 0xfa, 0x42, 0x07, 0x72, 0x05, 0x70, 0x01, 0xd0, 0x01, 0x01, 0x52, 0x02, 0x69, 0x70, 0x2a, 0x49, + 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, + 0x53, 0x43, 0x48, 0x45, 0x44, 0x55, 0x4c, 0x45, 0x52, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, + 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, + 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x45, 0x45, 0x44, 0x5f, 0x50, 0x45, 0x45, 0x52, + 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x10, 0x02, 0x32, 0xc4, 0x04, 0x0a, 0x07, 0x4d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x53, 0x65, 0x65, 0x64, + 0x50, 0x65, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x47, + 0x65, 0x74, 0x53, 0x65, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x11, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x65, 0x64, + 0x50, 0x65, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, + 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x2e, 0x53, 0x65, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x0c, 0x47, 0x65, 0x74, + 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x0f, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x12, 0x1f, + 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, + 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x12, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, + 0x6c, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6c, 0x65, 0x72, 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x20, 0x2e, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x12, 0x48, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x75, 0x63, 0x6b, + 0x65, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1c, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, + 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, + 0x0a, 0x09, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x12, 0x19, 0x2e, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x28, 0x01, + 0x42, 0x20, 0x5a, 0x1e, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, + 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, + 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_apis_manager_v1_manager_proto_rawDescOnce sync.Once + file_pkg_apis_manager_v1_manager_proto_rawDescData = file_pkg_apis_manager_v1_manager_proto_rawDesc +) + +func file_pkg_apis_manager_v1_manager_proto_rawDescGZIP() []byte { + file_pkg_apis_manager_v1_manager_proto_rawDescOnce.Do(func() { + file_pkg_apis_manager_v1_manager_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_manager_v1_manager_proto_rawDescData) + }) + return file_pkg_apis_manager_v1_manager_proto_rawDescData +} + +var file_pkg_apis_manager_v1_manager_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_pkg_apis_manager_v1_manager_proto_msgTypes = make([]protoimpl.MessageInfo, 18) +var file_pkg_apis_manager_v1_manager_proto_goTypes = []interface{}{ + (SourceType)(0), // 0: manager.SourceType + (*SecurityGroup)(nil), // 1: manager.SecurityGroup + (*SeedPeerCluster)(nil), // 2: manager.SeedPeerCluster + (*SeedPeer)(nil), // 3: manager.SeedPeer + (*GetSeedPeerRequest)(nil), // 4: manager.GetSeedPeerRequest + (*UpdateSeedPeerRequest)(nil), // 5: manager.UpdateSeedPeerRequest + (*SchedulerCluster)(nil), // 6: manager.SchedulerCluster + (*Scheduler)(nil), // 7: manager.Scheduler + (*GetSchedulerRequest)(nil), // 8: manager.GetSchedulerRequest + (*UpdateSchedulerRequest)(nil), // 9: manager.UpdateSchedulerRequest + (*ListSchedulersRequest)(nil), // 10: manager.ListSchedulersRequest + (*ListSchedulersResponse)(nil), // 11: manager.ListSchedulersResponse + (*ObjectStorage)(nil), // 12: manager.ObjectStorage + (*GetObjectStorageRequest)(nil), // 13: manager.GetObjectStorageRequest + (*Bucket)(nil), // 14: manager.Bucket + (*ListBucketsRequest)(nil), // 15: manager.ListBucketsRequest + (*ListBucketsResponse)(nil), // 16: manager.ListBucketsResponse + (*KeepAliveRequest)(nil), // 17: manager.KeepAliveRequest + nil, // 18: manager.ListSchedulersRequest.HostInfoEntry + (*emptypb.Empty)(nil), // 19: google.protobuf.Empty +} +var file_pkg_apis_manager_v1_manager_proto_depIdxs = []int32{ + 1, // 0: manager.SeedPeerCluster.security_group:type_name -> manager.SecurityGroup + 2, // 1: manager.SeedPeer.seed_peer_cluster:type_name -> manager.SeedPeerCluster + 7, // 2: manager.SeedPeer.schedulers:type_name -> manager.Scheduler + 0, // 3: manager.GetSeedPeerRequest.source_type:type_name -> manager.SourceType + 0, // 4: manager.UpdateSeedPeerRequest.source_type:type_name -> manager.SourceType + 1, // 5: manager.SchedulerCluster.security_group:type_name -> manager.SecurityGroup + 6, // 6: manager.Scheduler.scheduler_cluster:type_name -> manager.SchedulerCluster + 3, // 7: manager.Scheduler.seed_peers:type_name -> manager.SeedPeer + 0, // 8: manager.GetSchedulerRequest.source_type:type_name -> manager.SourceType + 0, // 9: manager.UpdateSchedulerRequest.source_type:type_name -> manager.SourceType + 0, // 10: manager.ListSchedulersRequest.source_type:type_name -> manager.SourceType + 18, // 11: manager.ListSchedulersRequest.host_info:type_name -> manager.ListSchedulersRequest.HostInfoEntry + 7, // 12: manager.ListSchedulersResponse.schedulers:type_name -> manager.Scheduler + 0, // 13: manager.GetObjectStorageRequest.source_type:type_name -> manager.SourceType + 0, // 14: manager.ListBucketsRequest.source_type:type_name -> manager.SourceType + 14, // 15: manager.ListBucketsResponse.buckets:type_name -> manager.Bucket + 0, // 16: manager.KeepAliveRequest.source_type:type_name -> manager.SourceType + 4, // 17: manager.Manager.GetSeedPeer:input_type -> manager.GetSeedPeerRequest + 5, // 18: manager.Manager.UpdateSeedPeer:input_type -> manager.UpdateSeedPeerRequest + 8, // 19: manager.Manager.GetScheduler:input_type -> manager.GetSchedulerRequest + 9, // 20: manager.Manager.UpdateScheduler:input_type -> manager.UpdateSchedulerRequest + 10, // 21: manager.Manager.ListSchedulers:input_type -> manager.ListSchedulersRequest + 13, // 22: manager.Manager.GetObjectStorage:input_type -> manager.GetObjectStorageRequest + 15, // 23: manager.Manager.ListBuckets:input_type -> manager.ListBucketsRequest + 17, // 24: manager.Manager.KeepAlive:input_type -> manager.KeepAliveRequest + 3, // 25: manager.Manager.GetSeedPeer:output_type -> manager.SeedPeer + 3, // 26: manager.Manager.UpdateSeedPeer:output_type -> manager.SeedPeer + 7, // 27: manager.Manager.GetScheduler:output_type -> manager.Scheduler + 7, // 28: manager.Manager.UpdateScheduler:output_type -> manager.Scheduler + 11, // 29: manager.Manager.ListSchedulers:output_type -> manager.ListSchedulersResponse + 12, // 30: manager.Manager.GetObjectStorage:output_type -> manager.ObjectStorage + 16, // 31: manager.Manager.ListBuckets:output_type -> manager.ListBucketsResponse + 19, // 32: manager.Manager.KeepAlive:output_type -> google.protobuf.Empty + 25, // [25:33] is the sub-list for method output_type + 17, // [17:25] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name +} + +func init() { file_pkg_apis_manager_v1_manager_proto_init() } +func file_pkg_apis_manager_v1_manager_proto_init() { + if File_pkg_apis_manager_v1_manager_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pkg_apis_manager_v1_manager_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SecurityGroup); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SeedPeerCluster); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SeedPeer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSeedPeerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateSeedPeerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SchedulerCluster); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Scheduler); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSchedulerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateSchedulerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSchedulersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSchedulersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ObjectStorage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetObjectStorageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Bucket); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListBucketsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListBucketsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_manager_v1_manager_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeepAliveRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_apis_manager_v1_manager_proto_rawDesc, + NumEnums: 1, + NumMessages: 18, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pkg_apis_manager_v1_manager_proto_goTypes, + DependencyIndexes: file_pkg_apis_manager_v1_manager_proto_depIdxs, + EnumInfos: file_pkg_apis_manager_v1_manager_proto_enumTypes, + MessageInfos: file_pkg_apis_manager_v1_manager_proto_msgTypes, + }.Build() + File_pkg_apis_manager_v1_manager_proto = out.File + file_pkg_apis_manager_v1_manager_proto_rawDesc = nil + file_pkg_apis_manager_v1_manager_proto_goTypes = nil + file_pkg_apis_manager_v1_manager_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// ManagerClient is the client API for Manager service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ManagerClient interface { + // Get SeedPeer and SeedPeer cluster configuration. + GetSeedPeer(ctx context.Context, in *GetSeedPeerRequest, opts ...grpc.CallOption) (*SeedPeer, error) + // Update SeedPeer configuration. + UpdateSeedPeer(ctx context.Context, in *UpdateSeedPeerRequest, opts ...grpc.CallOption) (*SeedPeer, error) + // Get Scheduler and Scheduler cluster configuration. + GetScheduler(ctx context.Context, in *GetSchedulerRequest, opts ...grpc.CallOption) (*Scheduler, error) + // Update scheduler configuration. + UpdateScheduler(ctx context.Context, in *UpdateSchedulerRequest, opts ...grpc.CallOption) (*Scheduler, error) + // List acitve schedulers configuration. + ListSchedulers(ctx context.Context, in *ListSchedulersRequest, opts ...grpc.CallOption) (*ListSchedulersResponse, error) + // Get ObjectStorage configuration. + GetObjectStorage(ctx context.Context, in *GetObjectStorageRequest, opts ...grpc.CallOption) (*ObjectStorage, error) + // List buckets configuration. + ListBuckets(ctx context.Context, in *ListBucketsRequest, opts ...grpc.CallOption) (*ListBucketsResponse, error) + // KeepAlive with manager. + KeepAlive(ctx context.Context, opts ...grpc.CallOption) (Manager_KeepAliveClient, error) +} + +type managerClient struct { + cc grpc.ClientConnInterface +} + +func NewManagerClient(cc grpc.ClientConnInterface) ManagerClient { + return &managerClient{cc} +} + +func (c *managerClient) GetSeedPeer(ctx context.Context, in *GetSeedPeerRequest, opts ...grpc.CallOption) (*SeedPeer, error) { + out := new(SeedPeer) + err := c.cc.Invoke(ctx, "/manager.Manager/GetSeedPeer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managerClient) UpdateSeedPeer(ctx context.Context, in *UpdateSeedPeerRequest, opts ...grpc.CallOption) (*SeedPeer, error) { + out := new(SeedPeer) + err := c.cc.Invoke(ctx, "/manager.Manager/UpdateSeedPeer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managerClient) GetScheduler(ctx context.Context, in *GetSchedulerRequest, opts ...grpc.CallOption) (*Scheduler, error) { + out := new(Scheduler) + err := c.cc.Invoke(ctx, "/manager.Manager/GetScheduler", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managerClient) UpdateScheduler(ctx context.Context, in *UpdateSchedulerRequest, opts ...grpc.CallOption) (*Scheduler, error) { + out := new(Scheduler) + err := c.cc.Invoke(ctx, "/manager.Manager/UpdateScheduler", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managerClient) ListSchedulers(ctx context.Context, in *ListSchedulersRequest, opts ...grpc.CallOption) (*ListSchedulersResponse, error) { + out := new(ListSchedulersResponse) + err := c.cc.Invoke(ctx, "/manager.Manager/ListSchedulers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managerClient) GetObjectStorage(ctx context.Context, in *GetObjectStorageRequest, opts ...grpc.CallOption) (*ObjectStorage, error) { + out := new(ObjectStorage) + err := c.cc.Invoke(ctx, "/manager.Manager/GetObjectStorage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managerClient) ListBuckets(ctx context.Context, in *ListBucketsRequest, opts ...grpc.CallOption) (*ListBucketsResponse, error) { + out := new(ListBucketsResponse) + err := c.cc.Invoke(ctx, "/manager.Manager/ListBuckets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *managerClient) KeepAlive(ctx context.Context, opts ...grpc.CallOption) (Manager_KeepAliveClient, error) { + stream, err := c.cc.NewStream(ctx, &_Manager_serviceDesc.Streams[0], "/manager.Manager/KeepAlive", opts...) + if err != nil { + return nil, err + } + x := &managerKeepAliveClient{stream} + return x, nil +} + +type Manager_KeepAliveClient interface { + Send(*KeepAliveRequest) error + CloseAndRecv() (*emptypb.Empty, error) + grpc.ClientStream +} + +type managerKeepAliveClient struct { + grpc.ClientStream +} + +func (x *managerKeepAliveClient) Send(m *KeepAliveRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *managerKeepAliveClient) CloseAndRecv() (*emptypb.Empty, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(emptypb.Empty) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// ManagerServer is the server API for Manager service. +type ManagerServer interface { + // Get SeedPeer and SeedPeer cluster configuration. + GetSeedPeer(context.Context, *GetSeedPeerRequest) (*SeedPeer, error) + // Update SeedPeer configuration. + UpdateSeedPeer(context.Context, *UpdateSeedPeerRequest) (*SeedPeer, error) + // Get Scheduler and Scheduler cluster configuration. + GetScheduler(context.Context, *GetSchedulerRequest) (*Scheduler, error) + // Update scheduler configuration. + UpdateScheduler(context.Context, *UpdateSchedulerRequest) (*Scheduler, error) + // List acitve schedulers configuration. + ListSchedulers(context.Context, *ListSchedulersRequest) (*ListSchedulersResponse, error) + // Get ObjectStorage configuration. + GetObjectStorage(context.Context, *GetObjectStorageRequest) (*ObjectStorage, error) + // List buckets configuration. + ListBuckets(context.Context, *ListBucketsRequest) (*ListBucketsResponse, error) + // KeepAlive with manager. + KeepAlive(Manager_KeepAliveServer) error +} + +// UnimplementedManagerServer can be embedded to have forward compatible implementations. +type UnimplementedManagerServer struct { +} + +func (*UnimplementedManagerServer) GetSeedPeer(context.Context, *GetSeedPeerRequest) (*SeedPeer, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSeedPeer not implemented") +} +func (*UnimplementedManagerServer) UpdateSeedPeer(context.Context, *UpdateSeedPeerRequest) (*SeedPeer, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateSeedPeer not implemented") +} +func (*UnimplementedManagerServer) GetScheduler(context.Context, *GetSchedulerRequest) (*Scheduler, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetScheduler not implemented") +} +func (*UnimplementedManagerServer) UpdateScheduler(context.Context, *UpdateSchedulerRequest) (*Scheduler, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateScheduler not implemented") +} +func (*UnimplementedManagerServer) ListSchedulers(context.Context, *ListSchedulersRequest) (*ListSchedulersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListSchedulers not implemented") +} +func (*UnimplementedManagerServer) GetObjectStorage(context.Context, *GetObjectStorageRequest) (*ObjectStorage, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetObjectStorage not implemented") +} +func (*UnimplementedManagerServer) ListBuckets(context.Context, *ListBucketsRequest) (*ListBucketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListBuckets not implemented") +} +func (*UnimplementedManagerServer) KeepAlive(Manager_KeepAliveServer) error { + return status.Errorf(codes.Unimplemented, "method KeepAlive not implemented") +} + +func RegisterManagerServer(s *grpc.Server, srv ManagerServer) { + s.RegisterService(&_Manager_serviceDesc, srv) +} + +func _Manager_GetSeedPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSeedPeerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagerServer).GetSeedPeer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/manager.Manager/GetSeedPeer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagerServer).GetSeedPeer(ctx, req.(*GetSeedPeerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Manager_UpdateSeedPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateSeedPeerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagerServer).UpdateSeedPeer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/manager.Manager/UpdateSeedPeer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagerServer).UpdateSeedPeer(ctx, req.(*UpdateSeedPeerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Manager_GetScheduler_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSchedulerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagerServer).GetScheduler(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/manager.Manager/GetScheduler", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagerServer).GetScheduler(ctx, req.(*GetSchedulerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Manager_UpdateScheduler_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateSchedulerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagerServer).UpdateScheduler(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/manager.Manager/UpdateScheduler", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagerServer).UpdateScheduler(ctx, req.(*UpdateSchedulerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Manager_ListSchedulers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListSchedulersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagerServer).ListSchedulers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/manager.Manager/ListSchedulers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagerServer).ListSchedulers(ctx, req.(*ListSchedulersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Manager_GetObjectStorage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetObjectStorageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagerServer).GetObjectStorage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/manager.Manager/GetObjectStorage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagerServer).GetObjectStorage(ctx, req.(*GetObjectStorageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Manager_ListBuckets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListBucketsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ManagerServer).ListBuckets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/manager.Manager/ListBuckets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ManagerServer).ListBuckets(ctx, req.(*ListBucketsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Manager_KeepAlive_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ManagerServer).KeepAlive(&managerKeepAliveServer{stream}) +} + +type Manager_KeepAliveServer interface { + SendAndClose(*emptypb.Empty) error + Recv() (*KeepAliveRequest, error) + grpc.ServerStream +} + +type managerKeepAliveServer struct { + grpc.ServerStream +} + +func (x *managerKeepAliveServer) SendAndClose(m *emptypb.Empty) error { + return x.ServerStream.SendMsg(m) +} + +func (x *managerKeepAliveServer) Recv() (*KeepAliveRequest, error) { + m := new(KeepAliveRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _Manager_serviceDesc = grpc.ServiceDesc{ + ServiceName: "manager.Manager", + HandlerType: (*ManagerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetSeedPeer", + Handler: _Manager_GetSeedPeer_Handler, + }, + { + MethodName: "UpdateSeedPeer", + Handler: _Manager_UpdateSeedPeer_Handler, + }, + { + MethodName: "GetScheduler", + Handler: _Manager_GetScheduler_Handler, + }, + { + MethodName: "UpdateScheduler", + Handler: _Manager_UpdateScheduler_Handler, + }, + { + MethodName: "ListSchedulers", + Handler: _Manager_ListSchedulers_Handler, + }, + { + MethodName: "GetObjectStorage", + Handler: _Manager_GetObjectStorage_Handler, + }, + { + MethodName: "ListBuckets", + Handler: _Manager_ListBuckets_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "KeepAlive", + Handler: _Manager_KeepAlive_Handler, + ClientStreams: true, + }, + }, + Metadata: "pkg/apis/manager/v1/manager.proto", +} diff --git a/pkg/apis/manager/v1/manager.pb.validate.go b/pkg/apis/manager/v1/manager.pb.validate.go new file mode 100644 index 0000000..c731558 --- /dev/null +++ b/pkg/apis/manager/v1/manager.pb.validate.go @@ -0,0 +1,2930 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: pkg/apis/manager/v1/manager.proto + +package v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on SecurityGroup with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *SecurityGroup) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SecurityGroup with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in SecurityGroupMultiError, or +// nil if none found. +func (m *SecurityGroup) ValidateAll() error { + return m.validate(true) +} + +func (m *SecurityGroup) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for Name + + // no validation rules for Bio + + // no validation rules for Domain + + // no validation rules for ProxyDomain + + if len(errors) > 0 { + return SecurityGroupMultiError(errors) + } + + return nil +} + +// SecurityGroupMultiError is an error wrapping multiple validation errors +// returned by SecurityGroup.ValidateAll() if the designated constraints +// aren't met. +type SecurityGroupMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SecurityGroupMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SecurityGroupMultiError) AllErrors() []error { return m } + +// SecurityGroupValidationError is the validation error returned by +// SecurityGroup.Validate if the designated constraints aren't met. +type SecurityGroupValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SecurityGroupValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SecurityGroupValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SecurityGroupValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SecurityGroupValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SecurityGroupValidationError) ErrorName() string { return "SecurityGroupValidationError" } + +// Error satisfies the builtin error interface +func (e SecurityGroupValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSecurityGroup.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SecurityGroupValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SecurityGroupValidationError{} + +// Validate checks the field values on SeedPeerCluster with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *SeedPeerCluster) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SeedPeerCluster with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// SeedPeerClusterMultiError, or nil if none found. +func (m *SeedPeerCluster) ValidateAll() error { + return m.validate(true) +} + +func (m *SeedPeerCluster) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for Name + + // no validation rules for Bio + + // no validation rules for Config + + // no validation rules for Scopes + + if all { + switch v := interface{}(m.GetSecurityGroup()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SeedPeerClusterValidationError{ + field: "SecurityGroup", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SeedPeerClusterValidationError{ + field: "SecurityGroup", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSecurityGroup()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SeedPeerClusterValidationError{ + field: "SecurityGroup", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return SeedPeerClusterMultiError(errors) + } + + return nil +} + +// SeedPeerClusterMultiError is an error wrapping multiple validation errors +// returned by SeedPeerCluster.ValidateAll() if the designated constraints +// aren't met. +type SeedPeerClusterMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SeedPeerClusterMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SeedPeerClusterMultiError) AllErrors() []error { return m } + +// SeedPeerClusterValidationError is the validation error returned by +// SeedPeerCluster.Validate if the designated constraints aren't met. +type SeedPeerClusterValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SeedPeerClusterValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SeedPeerClusterValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SeedPeerClusterValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SeedPeerClusterValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SeedPeerClusterValidationError) ErrorName() string { return "SeedPeerClusterValidationError" } + +// Error satisfies the builtin error interface +func (e SeedPeerClusterValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSeedPeerCluster.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SeedPeerClusterValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SeedPeerClusterValidationError{} + +// Validate checks the field values on SeedPeer with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *SeedPeer) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SeedPeer with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in SeedPeerMultiError, or nil +// if none found. +func (m *SeedPeer) ValidateAll() error { + return m.validate(true) +} + +func (m *SeedPeer) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for HostName + + // no validation rules for Type + + // no validation rules for Idc + + // no validation rules for NetTopology + + // no validation rules for Location + + // no validation rules for Ip + + // no validation rules for Port + + // no validation rules for DownloadPort + + // no validation rules for State + + // no validation rules for SeedPeerClusterId + + if all { + switch v := interface{}(m.GetSeedPeerCluster()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SeedPeerValidationError{ + field: "SeedPeerCluster", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SeedPeerValidationError{ + field: "SeedPeerCluster", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSeedPeerCluster()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SeedPeerValidationError{ + field: "SeedPeerCluster", + reason: "embedded message failed validation", + cause: err, + } + } + } + + for idx, item := range m.GetSchedulers() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SeedPeerValidationError{ + field: fmt.Sprintf("Schedulers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SeedPeerValidationError{ + field: fmt.Sprintf("Schedulers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SeedPeerValidationError{ + field: fmt.Sprintf("Schedulers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + // no validation rules for ObjectStoragePort + + if len(errors) > 0 { + return SeedPeerMultiError(errors) + } + + return nil +} + +// SeedPeerMultiError is an error wrapping multiple validation errors returned +// by SeedPeer.ValidateAll() if the designated constraints aren't met. +type SeedPeerMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SeedPeerMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SeedPeerMultiError) AllErrors() []error { return m } + +// SeedPeerValidationError is the validation error returned by +// SeedPeer.Validate if the designated constraints aren't met. +type SeedPeerValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SeedPeerValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SeedPeerValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SeedPeerValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SeedPeerValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SeedPeerValidationError) ErrorName() string { return "SeedPeerValidationError" } + +// Error satisfies the builtin error interface +func (e SeedPeerValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSeedPeer.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SeedPeerValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SeedPeerValidationError{} + +// Validate checks the field values on GetSeedPeerRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetSeedPeerRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetSeedPeerRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetSeedPeerRequestMultiError, or nil if none found. +func (m *GetSeedPeerRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetSeedPeerRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { + err := GetSeedPeerRequestValidationError{ + field: "SourceType", + reason: "value must be one of the defined enum values", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateHostname(m.GetHostName()); err != nil { + err = GetSeedPeerRequestValidationError{ + field: "HostName", + reason: "value must be a valid hostname", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetSeedPeerClusterId() < 1 { + err := GetSeedPeerRequestValidationError{ + field: "SeedPeerClusterId", + reason: "value must be greater than or equal to 1", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetIp() != "" { + + if ip := net.ParseIP(m.GetIp()); ip == nil { + err := GetSeedPeerRequestValidationError{ + field: "Ip", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if len(errors) > 0 { + return GetSeedPeerRequestMultiError(errors) + } + + return nil +} + +func (m *GetSeedPeerRequest) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +// GetSeedPeerRequestMultiError is an error wrapping multiple validation errors +// returned by GetSeedPeerRequest.ValidateAll() if the designated constraints +// aren't met. +type GetSeedPeerRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetSeedPeerRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetSeedPeerRequestMultiError) AllErrors() []error { return m } + +// GetSeedPeerRequestValidationError is the validation error returned by +// GetSeedPeerRequest.Validate if the designated constraints aren't met. +type GetSeedPeerRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetSeedPeerRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetSeedPeerRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetSeedPeerRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetSeedPeerRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetSeedPeerRequestValidationError) ErrorName() string { + return "GetSeedPeerRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetSeedPeerRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetSeedPeerRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetSeedPeerRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetSeedPeerRequestValidationError{} + +// Validate checks the field values on UpdateSeedPeerRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *UpdateSeedPeerRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateSeedPeerRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// UpdateSeedPeerRequestMultiError, or nil if none found. +func (m *UpdateSeedPeerRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateSeedPeerRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { + err := UpdateSeedPeerRequestValidationError{ + field: "SourceType", + reason: "value must be one of the defined enum values", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateHostname(m.GetHostName()); err != nil { + err = UpdateSeedPeerRequestValidationError{ + field: "HostName", + reason: "value must be a valid hostname", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if _, ok := _UpdateSeedPeerRequest_Type_InLookup[m.GetType()]; !ok { + err := UpdateSeedPeerRequestValidationError{ + field: "Type", + reason: "value must be in list [super strong weak]", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetIdc() != "" { + + if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 { + err := UpdateSeedPeerRequestValidationError{ + field: "Idc", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.GetNetTopology() != "" { + + if l := utf8.RuneCountInString(m.GetNetTopology()); l < 1 || l > 1024 { + err := UpdateSeedPeerRequestValidationError{ + field: "NetTopology", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.GetLocation() != "" { + + if utf8.RuneCountInString(m.GetLocation()) > 1024 { + err := UpdateSeedPeerRequestValidationError{ + field: "Location", + reason: "value length must be at most 1024 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if ip := net.ParseIP(m.GetIp()); ip == nil { + err := UpdateSeedPeerRequestValidationError{ + field: "Ip", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + if val := m.GetPort(); val < 1024 || val >= 65535 { + err := UpdateSeedPeerRequestValidationError{ + field: "Port", + reason: "value must be inside range [1024, 65535)", + } + if !all { + return err + } + errors = append(errors, err) + } + + if val := m.GetDownloadPort(); val < 1024 || val >= 65535 { + err := UpdateSeedPeerRequestValidationError{ + field: "DownloadPort", + reason: "value must be inside range [1024, 65535)", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetSeedPeerClusterId() < 1 { + err := UpdateSeedPeerRequestValidationError{ + field: "SeedPeerClusterId", + reason: "value must be greater than or equal to 1", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetObjectStoragePort() != 0 { + + if val := m.GetObjectStoragePort(); val < 1024 || val >= 65535 { + err := UpdateSeedPeerRequestValidationError{ + field: "ObjectStoragePort", + reason: "value must be inside range [1024, 65535)", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if len(errors) > 0 { + return UpdateSeedPeerRequestMultiError(errors) + } + + return nil +} + +func (m *UpdateSeedPeerRequest) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +// UpdateSeedPeerRequestMultiError is an error wrapping multiple validation +// errors returned by UpdateSeedPeerRequest.ValidateAll() if the designated +// constraints aren't met. +type UpdateSeedPeerRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateSeedPeerRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UpdateSeedPeerRequestMultiError) AllErrors() []error { return m } + +// UpdateSeedPeerRequestValidationError is the validation error returned by +// UpdateSeedPeerRequest.Validate if the designated constraints aren't met. +type UpdateSeedPeerRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateSeedPeerRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateSeedPeerRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateSeedPeerRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateSeedPeerRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateSeedPeerRequestValidationError) ErrorName() string { + return "UpdateSeedPeerRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateSeedPeerRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpdateSeedPeerRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateSeedPeerRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateSeedPeerRequestValidationError{} + +var _UpdateSeedPeerRequest_Type_InLookup = map[string]struct{}{ + "super": {}, + "strong": {}, + "weak": {}, +} + +// Validate checks the field values on SchedulerCluster with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *SchedulerCluster) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SchedulerCluster with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// SchedulerClusterMultiError, or nil if none found. +func (m *SchedulerCluster) ValidateAll() error { + return m.validate(true) +} + +func (m *SchedulerCluster) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for Name + + // no validation rules for Bio + + // no validation rules for Config + + // no validation rules for ClientConfig + + // no validation rules for Scopes + + if all { + switch v := interface{}(m.GetSecurityGroup()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SchedulerClusterValidationError{ + field: "SecurityGroup", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SchedulerClusterValidationError{ + field: "SecurityGroup", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSecurityGroup()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SchedulerClusterValidationError{ + field: "SecurityGroup", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return SchedulerClusterMultiError(errors) + } + + return nil +} + +// SchedulerClusterMultiError is an error wrapping multiple validation errors +// returned by SchedulerCluster.ValidateAll() if the designated constraints +// aren't met. +type SchedulerClusterMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SchedulerClusterMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SchedulerClusterMultiError) AllErrors() []error { return m } + +// SchedulerClusterValidationError is the validation error returned by +// SchedulerCluster.Validate if the designated constraints aren't met. +type SchedulerClusterValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SchedulerClusterValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SchedulerClusterValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SchedulerClusterValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SchedulerClusterValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SchedulerClusterValidationError) ErrorName() string { return "SchedulerClusterValidationError" } + +// Error satisfies the builtin error interface +func (e SchedulerClusterValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSchedulerCluster.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SchedulerClusterValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SchedulerClusterValidationError{} + +// Validate checks the field values on Scheduler with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *Scheduler) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Scheduler with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in SchedulerMultiError, or nil +// if none found. +func (m *Scheduler) ValidateAll() error { + return m.validate(true) +} + +func (m *Scheduler) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for HostName + + // no validation rules for Vips + + // no validation rules for Idc + + // no validation rules for Location + + // no validation rules for NetConfig + + // no validation rules for Ip + + // no validation rules for Port + + // no validation rules for State + + // no validation rules for SchedulerClusterId + + if all { + switch v := interface{}(m.GetSchedulerCluster()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SchedulerValidationError{ + field: "SchedulerCluster", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SchedulerValidationError{ + field: "SchedulerCluster", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSchedulerCluster()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SchedulerValidationError{ + field: "SchedulerCluster", + reason: "embedded message failed validation", + cause: err, + } + } + } + + for idx, item := range m.GetSeedPeers() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SchedulerValidationError{ + field: fmt.Sprintf("SeedPeers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SchedulerValidationError{ + field: fmt.Sprintf("SeedPeers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SchedulerValidationError{ + field: fmt.Sprintf("SeedPeers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + // no validation rules for NetTopology + + if len(errors) > 0 { + return SchedulerMultiError(errors) + } + + return nil +} + +// SchedulerMultiError is an error wrapping multiple validation errors returned +// by Scheduler.ValidateAll() if the designated constraints aren't met. +type SchedulerMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SchedulerMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SchedulerMultiError) AllErrors() []error { return m } + +// SchedulerValidationError is the validation error returned by +// Scheduler.Validate if the designated constraints aren't met. +type SchedulerValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SchedulerValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SchedulerValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SchedulerValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SchedulerValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SchedulerValidationError) ErrorName() string { return "SchedulerValidationError" } + +// Error satisfies the builtin error interface +func (e SchedulerValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sScheduler.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SchedulerValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SchedulerValidationError{} + +// Validate checks the field values on GetSchedulerRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetSchedulerRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetSchedulerRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetSchedulerRequestMultiError, or nil if none found. +func (m *GetSchedulerRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetSchedulerRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { + err := GetSchedulerRequestValidationError{ + field: "SourceType", + reason: "value must be one of the defined enum values", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateHostname(m.GetHostName()); err != nil { + err = GetSchedulerRequestValidationError{ + field: "HostName", + reason: "value must be a valid hostname", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetSchedulerClusterId() < 1 { + err := GetSchedulerRequestValidationError{ + field: "SchedulerClusterId", + reason: "value must be greater than or equal to 1", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetIp() != "" { + + if ip := net.ParseIP(m.GetIp()); ip == nil { + err := GetSchedulerRequestValidationError{ + field: "Ip", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if len(errors) > 0 { + return GetSchedulerRequestMultiError(errors) + } + + return nil +} + +func (m *GetSchedulerRequest) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +// GetSchedulerRequestMultiError is an error wrapping multiple validation +// errors returned by GetSchedulerRequest.ValidateAll() if the designated +// constraints aren't met. +type GetSchedulerRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetSchedulerRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetSchedulerRequestMultiError) AllErrors() []error { return m } + +// GetSchedulerRequestValidationError is the validation error returned by +// GetSchedulerRequest.Validate if the designated constraints aren't met. +type GetSchedulerRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetSchedulerRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetSchedulerRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetSchedulerRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetSchedulerRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetSchedulerRequestValidationError) ErrorName() string { + return "GetSchedulerRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetSchedulerRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetSchedulerRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetSchedulerRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetSchedulerRequestValidationError{} + +// Validate checks the field values on UpdateSchedulerRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *UpdateSchedulerRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UpdateSchedulerRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// UpdateSchedulerRequestMultiError, or nil if none found. +func (m *UpdateSchedulerRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UpdateSchedulerRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { + err := UpdateSchedulerRequestValidationError{ + field: "SourceType", + reason: "value must be one of the defined enum values", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateHostname(m.GetHostName()); err != nil { + err = UpdateSchedulerRequestValidationError{ + field: "HostName", + reason: "value must be a valid hostname", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetSchedulerClusterId() < 1 { + err := UpdateSchedulerRequestValidationError{ + field: "SchedulerClusterId", + reason: "value must be greater than or equal to 1", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetVips() != "" { + + if l := utf8.RuneCountInString(m.GetVips()); l < 1 || l > 1024 { + err := UpdateSchedulerRequestValidationError{ + field: "Vips", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.GetIdc() != "" { + + if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 { + err := UpdateSchedulerRequestValidationError{ + field: "Idc", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.GetLocation() != "" { + + if l := utf8.RuneCountInString(m.GetLocation()); l < 1 || l > 1024 { + err := UpdateSchedulerRequestValidationError{ + field: "Location", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if len(m.GetNetConfig()) > 0 { + + if len(m.GetNetConfig()) < 1 { + err := UpdateSchedulerRequestValidationError{ + field: "NetConfig", + reason: "value length must be at least 1 bytes", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if ip := net.ParseIP(m.GetIp()); ip == nil { + err := UpdateSchedulerRequestValidationError{ + field: "Ip", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + if val := m.GetPort(); val < 1024 || val >= 65535 { + err := UpdateSchedulerRequestValidationError{ + field: "Port", + reason: "value must be inside range [1024, 65535)", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetNetTopology() != "" { + + if l := utf8.RuneCountInString(m.GetNetTopology()); l < 1 || l > 1024 { + err := UpdateSchedulerRequestValidationError{ + field: "NetTopology", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if len(errors) > 0 { + return UpdateSchedulerRequestMultiError(errors) + } + + return nil +} + +func (m *UpdateSchedulerRequest) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +// UpdateSchedulerRequestMultiError is an error wrapping multiple validation +// errors returned by UpdateSchedulerRequest.ValidateAll() if the designated +// constraints aren't met. +type UpdateSchedulerRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UpdateSchedulerRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UpdateSchedulerRequestMultiError) AllErrors() []error { return m } + +// UpdateSchedulerRequestValidationError is the validation error returned by +// UpdateSchedulerRequest.Validate if the designated constraints aren't met. +type UpdateSchedulerRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UpdateSchedulerRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UpdateSchedulerRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UpdateSchedulerRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UpdateSchedulerRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UpdateSchedulerRequestValidationError) ErrorName() string { + return "UpdateSchedulerRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e UpdateSchedulerRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUpdateSchedulerRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UpdateSchedulerRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UpdateSchedulerRequestValidationError{} + +// Validate checks the field values on ListSchedulersRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ListSchedulersRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListSchedulersRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListSchedulersRequestMultiError, or nil if none found. +func (m *ListSchedulersRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ListSchedulersRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { + err := ListSchedulersRequestValidationError{ + field: "SourceType", + reason: "value must be one of the defined enum values", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateHostname(m.GetHostName()); err != nil { + err = ListSchedulersRequestValidationError{ + field: "HostName", + reason: "value must be a valid hostname", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if ip := net.ParseIP(m.GetIp()); ip == nil { + err := ListSchedulersRequestValidationError{ + field: "Ip", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(m.GetHostInfo()) > 0 { + + } + + if len(errors) > 0 { + return ListSchedulersRequestMultiError(errors) + } + + return nil +} + +func (m *ListSchedulersRequest) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +// ListSchedulersRequestMultiError is an error wrapping multiple validation +// errors returned by ListSchedulersRequest.ValidateAll() if the designated +// constraints aren't met. +type ListSchedulersRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListSchedulersRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListSchedulersRequestMultiError) AllErrors() []error { return m } + +// ListSchedulersRequestValidationError is the validation error returned by +// ListSchedulersRequest.Validate if the designated constraints aren't met. +type ListSchedulersRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListSchedulersRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListSchedulersRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListSchedulersRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListSchedulersRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListSchedulersRequestValidationError) ErrorName() string { + return "ListSchedulersRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListSchedulersRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListSchedulersRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListSchedulersRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListSchedulersRequestValidationError{} + +// Validate checks the field values on ListSchedulersResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ListSchedulersResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListSchedulersResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListSchedulersResponseMultiError, or nil if none found. +func (m *ListSchedulersResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ListSchedulersResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetSchedulers() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListSchedulersResponseValidationError{ + field: fmt.Sprintf("Schedulers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListSchedulersResponseValidationError{ + field: fmt.Sprintf("Schedulers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListSchedulersResponseValidationError{ + field: fmt.Sprintf("Schedulers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ListSchedulersResponseMultiError(errors) + } + + return nil +} + +// ListSchedulersResponseMultiError is an error wrapping multiple validation +// errors returned by ListSchedulersResponse.ValidateAll() if the designated +// constraints aren't met. +type ListSchedulersResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListSchedulersResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListSchedulersResponseMultiError) AllErrors() []error { return m } + +// ListSchedulersResponseValidationError is the validation error returned by +// ListSchedulersResponse.Validate if the designated constraints aren't met. +type ListSchedulersResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListSchedulersResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListSchedulersResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListSchedulersResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListSchedulersResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListSchedulersResponseValidationError) ErrorName() string { + return "ListSchedulersResponseValidationError" +} + +// Error satisfies the builtin error interface +func (e ListSchedulersResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListSchedulersResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListSchedulersResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListSchedulersResponseValidationError{} + +// Validate checks the field values on ObjectStorage with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ObjectStorage) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ObjectStorage with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ObjectStorageMultiError, or +// nil if none found. +func (m *ObjectStorage) ValidateAll() error { + return m.validate(true) +} + +func (m *ObjectStorage) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 1024 { + err := ObjectStorageValidationError{ + field: "Name", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetRegion() != "" { + + if l := utf8.RuneCountInString(m.GetRegion()); l < 1 || l > 1024 { + err := ObjectStorageValidationError{ + field: "Region", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.GetEndpoint() != "" { + + if l := utf8.RuneCountInString(m.GetEndpoint()); l < 1 || l > 1024 { + err := ObjectStorageValidationError{ + field: "Endpoint", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.GetAccessKey() != "" { + + if l := utf8.RuneCountInString(m.GetAccessKey()); l < 1 || l > 1024 { + err := ObjectStorageValidationError{ + field: "AccessKey", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.GetSecretKey() != "" { + + if l := utf8.RuneCountInString(m.GetSecretKey()); l < 1 || l > 1024 { + err := ObjectStorageValidationError{ + field: "SecretKey", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if len(errors) > 0 { + return ObjectStorageMultiError(errors) + } + + return nil +} + +// ObjectStorageMultiError is an error wrapping multiple validation errors +// returned by ObjectStorage.ValidateAll() if the designated constraints +// aren't met. +type ObjectStorageMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ObjectStorageMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ObjectStorageMultiError) AllErrors() []error { return m } + +// ObjectStorageValidationError is the validation error returned by +// ObjectStorage.Validate if the designated constraints aren't met. +type ObjectStorageValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ObjectStorageValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ObjectStorageValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ObjectStorageValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ObjectStorageValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ObjectStorageValidationError) ErrorName() string { return "ObjectStorageValidationError" } + +// Error satisfies the builtin error interface +func (e ObjectStorageValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sObjectStorage.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ObjectStorageValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ObjectStorageValidationError{} + +// Validate checks the field values on GetObjectStorageRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *GetObjectStorageRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on GetObjectStorageRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// GetObjectStorageRequestMultiError, or nil if none found. +func (m *GetObjectStorageRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *GetObjectStorageRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { + err := GetObjectStorageRequestValidationError{ + field: "SourceType", + reason: "value must be one of the defined enum values", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateHostname(m.GetHostName()); err != nil { + err = GetObjectStorageRequestValidationError{ + field: "HostName", + reason: "value must be a valid hostname", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if ip := net.ParseIP(m.GetIp()); ip == nil { + err := GetObjectStorageRequestValidationError{ + field: "Ip", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return GetObjectStorageRequestMultiError(errors) + } + + return nil +} + +func (m *GetObjectStorageRequest) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +// GetObjectStorageRequestMultiError is an error wrapping multiple validation +// errors returned by GetObjectStorageRequest.ValidateAll() if the designated +// constraints aren't met. +type GetObjectStorageRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m GetObjectStorageRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m GetObjectStorageRequestMultiError) AllErrors() []error { return m } + +// GetObjectStorageRequestValidationError is the validation error returned by +// GetObjectStorageRequest.Validate if the designated constraints aren't met. +type GetObjectStorageRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e GetObjectStorageRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e GetObjectStorageRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e GetObjectStorageRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e GetObjectStorageRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e GetObjectStorageRequestValidationError) ErrorName() string { + return "GetObjectStorageRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e GetObjectStorageRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sGetObjectStorageRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = GetObjectStorageRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = GetObjectStorageRequestValidationError{} + +// Validate checks the field values on Bucket with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *Bucket) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Bucket with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in BucketMultiError, or nil if none found. +func (m *Bucket) ValidateAll() error { + return m.validate(true) +} + +func (m *Bucket) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 1024 { + err := BucketValidationError{ + field: "Name", + reason: "value length must be between 1 and 1024 runes, inclusive", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return BucketMultiError(errors) + } + + return nil +} + +// BucketMultiError is an error wrapping multiple validation errors returned by +// Bucket.ValidateAll() if the designated constraints aren't met. +type BucketMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m BucketMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m BucketMultiError) AllErrors() []error { return m } + +// BucketValidationError is the validation error returned by Bucket.Validate if +// the designated constraints aren't met. +type BucketValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e BucketValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e BucketValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e BucketValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e BucketValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e BucketValidationError) ErrorName() string { return "BucketValidationError" } + +// Error satisfies the builtin error interface +func (e BucketValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sBucket.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = BucketValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = BucketValidationError{} + +// Validate checks the field values on ListBucketsRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ListBucketsRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListBucketsRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListBucketsRequestMultiError, or nil if none found. +func (m *ListBucketsRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ListBucketsRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { + err := ListBucketsRequestValidationError{ + field: "SourceType", + reason: "value must be one of the defined enum values", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateHostname(m.GetHostName()); err != nil { + err = ListBucketsRequestValidationError{ + field: "HostName", + reason: "value must be a valid hostname", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if ip := net.ParseIP(m.GetIp()); ip == nil { + err := ListBucketsRequestValidationError{ + field: "Ip", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return ListBucketsRequestMultiError(errors) + } + + return nil +} + +func (m *ListBucketsRequest) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +// ListBucketsRequestMultiError is an error wrapping multiple validation errors +// returned by ListBucketsRequest.ValidateAll() if the designated constraints +// aren't met. +type ListBucketsRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListBucketsRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListBucketsRequestMultiError) AllErrors() []error { return m } + +// ListBucketsRequestValidationError is the validation error returned by +// ListBucketsRequest.Validate if the designated constraints aren't met. +type ListBucketsRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListBucketsRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListBucketsRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListBucketsRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListBucketsRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListBucketsRequestValidationError) ErrorName() string { + return "ListBucketsRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ListBucketsRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListBucketsRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListBucketsRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListBucketsRequestValidationError{} + +// Validate checks the field values on ListBucketsResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ListBucketsResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListBucketsResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListBucketsResponseMultiError, or nil if none found. +func (m *ListBucketsResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ListBucketsResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetBuckets() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListBucketsResponseValidationError{ + field: fmt.Sprintf("Buckets[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListBucketsResponseValidationError{ + field: fmt.Sprintf("Buckets[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListBucketsResponseValidationError{ + field: fmt.Sprintf("Buckets[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ListBucketsResponseMultiError(errors) + } + + return nil +} + +// ListBucketsResponseMultiError is an error wrapping multiple validation +// errors returned by ListBucketsResponse.ValidateAll() if the designated +// constraints aren't met. +type ListBucketsResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListBucketsResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListBucketsResponseMultiError) AllErrors() []error { return m } + +// ListBucketsResponseValidationError is the validation error returned by +// ListBucketsResponse.Validate if the designated constraints aren't met. +type ListBucketsResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListBucketsResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListBucketsResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListBucketsResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListBucketsResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListBucketsResponseValidationError) ErrorName() string { + return "ListBucketsResponseValidationError" +} + +// Error satisfies the builtin error interface +func (e ListBucketsResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListBucketsResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListBucketsResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListBucketsResponseValidationError{} + +// Validate checks the field values on KeepAliveRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *KeepAliveRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeepAliveRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// KeepAliveRequestMultiError, or nil if none found. +func (m *KeepAliveRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *KeepAliveRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { + err := KeepAliveRequestValidationError{ + field: "SourceType", + reason: "value must be one of the defined enum values", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateHostname(m.GetHostName()); err != nil { + err = KeepAliveRequestValidationError{ + field: "HostName", + reason: "value must be a valid hostname", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetClusterId() < 1 { + err := KeepAliveRequestValidationError{ + field: "ClusterId", + reason: "value must be greater than or equal to 1", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetIp() != "" { + + if ip := net.ParseIP(m.GetIp()); ip == nil { + err := KeepAliveRequestValidationError{ + field: "Ip", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if len(errors) > 0 { + return KeepAliveRequestMultiError(errors) + } + + return nil +} + +func (m *KeepAliveRequest) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +// KeepAliveRequestMultiError is an error wrapping multiple validation errors +// returned by KeepAliveRequest.ValidateAll() if the designated constraints +// aren't met. +type KeepAliveRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeepAliveRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeepAliveRequestMultiError) AllErrors() []error { return m } + +// KeepAliveRequestValidationError is the validation error returned by +// KeepAliveRequest.Validate if the designated constraints aren't met. +type KeepAliveRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeepAliveRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeepAliveRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeepAliveRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeepAliveRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeepAliveRequestValidationError) ErrorName() string { return "KeepAliveRequestValidationError" } + +// Error satisfies the builtin error interface +func (e KeepAliveRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeepAliveRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeepAliveRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeepAliveRequestValidationError{} diff --git a/pkg/apis/manager/v1/mocks/manager_mock.go b/pkg/apis/manager/v1/mocks/manager_mock.go new file mode 100644 index 0000000..e7f1c34 --- /dev/null +++ b/pkg/apis/manager/v1/mocks/manager_mock.go @@ -0,0 +1,612 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ../manager.pb.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + reflect "reflect" + + v1 "d7y.io/api/pkg/apis/manager/v1" + gomock "github.com/golang/mock/gomock" + grpc "google.golang.org/grpc" + metadata "google.golang.org/grpc/metadata" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// MockManagerClient is a mock of ManagerClient interface. +type MockManagerClient struct { + ctrl *gomock.Controller + recorder *MockManagerClientMockRecorder +} + +// MockManagerClientMockRecorder is the mock recorder for MockManagerClient. +type MockManagerClientMockRecorder struct { + mock *MockManagerClient +} + +// NewMockManagerClient creates a new mock instance. +func NewMockManagerClient(ctrl *gomock.Controller) *MockManagerClient { + mock := &MockManagerClient{ctrl: ctrl} + mock.recorder = &MockManagerClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockManagerClient) EXPECT() *MockManagerClientMockRecorder { + return m.recorder +} + +// GetObjectStorage mocks base method. +func (m *MockManagerClient) GetObjectStorage(ctx context.Context, in *v1.GetObjectStorageRequest, opts ...grpc.CallOption) (*v1.ObjectStorage, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetObjectStorage", varargs...) + ret0, _ := ret[0].(*v1.ObjectStorage) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetObjectStorage indicates an expected call of GetObjectStorage. +func (mr *MockManagerClientMockRecorder) GetObjectStorage(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjectStorage", reflect.TypeOf((*MockManagerClient)(nil).GetObjectStorage), varargs...) +} + +// GetScheduler mocks base method. +func (m *MockManagerClient) GetScheduler(ctx context.Context, in *v1.GetSchedulerRequest, opts ...grpc.CallOption) (*v1.Scheduler, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetScheduler", varargs...) + ret0, _ := ret[0].(*v1.Scheduler) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetScheduler indicates an expected call of GetScheduler. +func (mr *MockManagerClientMockRecorder) GetScheduler(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScheduler", reflect.TypeOf((*MockManagerClient)(nil).GetScheduler), varargs...) +} + +// GetSeedPeer mocks base method. +func (m *MockManagerClient) GetSeedPeer(ctx context.Context, in *v1.GetSeedPeerRequest, opts ...grpc.CallOption) (*v1.SeedPeer, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetSeedPeer", varargs...) + ret0, _ := ret[0].(*v1.SeedPeer) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetSeedPeer indicates an expected call of GetSeedPeer. +func (mr *MockManagerClientMockRecorder) GetSeedPeer(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSeedPeer", reflect.TypeOf((*MockManagerClient)(nil).GetSeedPeer), varargs...) +} + +// KeepAlive mocks base method. +func (m *MockManagerClient) KeepAlive(ctx context.Context, opts ...grpc.CallOption) (v1.Manager_KeepAliveClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "KeepAlive", varargs...) + ret0, _ := ret[0].(v1.Manager_KeepAliveClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// KeepAlive indicates an expected call of KeepAlive. +func (mr *MockManagerClientMockRecorder) KeepAlive(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeepAlive", reflect.TypeOf((*MockManagerClient)(nil).KeepAlive), varargs...) +} + +// ListBuckets mocks base method. +func (m *MockManagerClient) ListBuckets(ctx context.Context, in *v1.ListBucketsRequest, opts ...grpc.CallOption) (*v1.ListBucketsResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListBuckets", varargs...) + ret0, _ := ret[0].(*v1.ListBucketsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListBuckets indicates an expected call of ListBuckets. +func (mr *MockManagerClientMockRecorder) ListBuckets(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBuckets", reflect.TypeOf((*MockManagerClient)(nil).ListBuckets), varargs...) +} + +// ListSchedulers mocks base method. +func (m *MockManagerClient) ListSchedulers(ctx context.Context, in *v1.ListSchedulersRequest, opts ...grpc.CallOption) (*v1.ListSchedulersResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListSchedulers", varargs...) + ret0, _ := ret[0].(*v1.ListSchedulersResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSchedulers indicates an expected call of ListSchedulers. +func (mr *MockManagerClientMockRecorder) ListSchedulers(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSchedulers", reflect.TypeOf((*MockManagerClient)(nil).ListSchedulers), varargs...) +} + +// UpdateScheduler mocks base method. +func (m *MockManagerClient) UpdateScheduler(ctx context.Context, in *v1.UpdateSchedulerRequest, opts ...grpc.CallOption) (*v1.Scheduler, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateScheduler", varargs...) + ret0, _ := ret[0].(*v1.Scheduler) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateScheduler indicates an expected call of UpdateScheduler. +func (mr *MockManagerClientMockRecorder) UpdateScheduler(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateScheduler", reflect.TypeOf((*MockManagerClient)(nil).UpdateScheduler), varargs...) +} + +// UpdateSeedPeer mocks base method. +func (m *MockManagerClient) UpdateSeedPeer(ctx context.Context, in *v1.UpdateSeedPeerRequest, opts ...grpc.CallOption) (*v1.SeedPeer, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateSeedPeer", varargs...) + ret0, _ := ret[0].(*v1.SeedPeer) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateSeedPeer indicates an expected call of UpdateSeedPeer. +func (mr *MockManagerClientMockRecorder) UpdateSeedPeer(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSeedPeer", reflect.TypeOf((*MockManagerClient)(nil).UpdateSeedPeer), varargs...) +} + +// MockManager_KeepAliveClient is a mock of Manager_KeepAliveClient interface. +type MockManager_KeepAliveClient struct { + ctrl *gomock.Controller + recorder *MockManager_KeepAliveClientMockRecorder +} + +// MockManager_KeepAliveClientMockRecorder is the mock recorder for MockManager_KeepAliveClient. +type MockManager_KeepAliveClientMockRecorder struct { + mock *MockManager_KeepAliveClient +} + +// NewMockManager_KeepAliveClient creates a new mock instance. +func NewMockManager_KeepAliveClient(ctrl *gomock.Controller) *MockManager_KeepAliveClient { + mock := &MockManager_KeepAliveClient{ctrl: ctrl} + mock.recorder = &MockManager_KeepAliveClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockManager_KeepAliveClient) EXPECT() *MockManager_KeepAliveClientMockRecorder { + return m.recorder +} + +// CloseAndRecv mocks base method. +func (m *MockManager_KeepAliveClient) CloseAndRecv() (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseAndRecv") + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CloseAndRecv indicates an expected call of CloseAndRecv. +func (mr *MockManager_KeepAliveClientMockRecorder) CloseAndRecv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseAndRecv", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).CloseAndRecv)) +} + +// CloseSend mocks base method. +func (m *MockManager_KeepAliveClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend. +func (mr *MockManager_KeepAliveClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).CloseSend)) +} + +// Context mocks base method. +func (m *MockManager_KeepAliveClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockManager_KeepAliveClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).Context)) +} + +// Header mocks base method. +func (m *MockManager_KeepAliveClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header. +func (mr *MockManager_KeepAliveClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).Header)) +} + +// RecvMsg mocks base method. +func (m_2 *MockManager_KeepAliveClient) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockManager_KeepAliveClientMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockManager_KeepAliveClient) Send(arg0 *v1.KeepAliveRequest) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockManager_KeepAliveClientMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).Send), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockManager_KeepAliveClient) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockManager_KeepAliveClientMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).SendMsg), m) +} + +// Trailer mocks base method. +func (m *MockManager_KeepAliveClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer. +func (mr *MockManager_KeepAliveClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockManager_KeepAliveClient)(nil).Trailer)) +} + +// MockManagerServer is a mock of ManagerServer interface. +type MockManagerServer struct { + ctrl *gomock.Controller + recorder *MockManagerServerMockRecorder +} + +// MockManagerServerMockRecorder is the mock recorder for MockManagerServer. +type MockManagerServerMockRecorder struct { + mock *MockManagerServer +} + +// NewMockManagerServer creates a new mock instance. +func NewMockManagerServer(ctrl *gomock.Controller) *MockManagerServer { + mock := &MockManagerServer{ctrl: ctrl} + mock.recorder = &MockManagerServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockManagerServer) EXPECT() *MockManagerServerMockRecorder { + return m.recorder +} + +// GetObjectStorage mocks base method. +func (m *MockManagerServer) GetObjectStorage(arg0 context.Context, arg1 *v1.GetObjectStorageRequest) (*v1.ObjectStorage, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetObjectStorage", arg0, arg1) + ret0, _ := ret[0].(*v1.ObjectStorage) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetObjectStorage indicates an expected call of GetObjectStorage. +func (mr *MockManagerServerMockRecorder) GetObjectStorage(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjectStorage", reflect.TypeOf((*MockManagerServer)(nil).GetObjectStorage), arg0, arg1) +} + +// GetScheduler mocks base method. +func (m *MockManagerServer) GetScheduler(arg0 context.Context, arg1 *v1.GetSchedulerRequest) (*v1.Scheduler, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetScheduler", arg0, arg1) + ret0, _ := ret[0].(*v1.Scheduler) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetScheduler indicates an expected call of GetScheduler. +func (mr *MockManagerServerMockRecorder) GetScheduler(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScheduler", reflect.TypeOf((*MockManagerServer)(nil).GetScheduler), arg0, arg1) +} + +// GetSeedPeer mocks base method. +func (m *MockManagerServer) GetSeedPeer(arg0 context.Context, arg1 *v1.GetSeedPeerRequest) (*v1.SeedPeer, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSeedPeer", arg0, arg1) + ret0, _ := ret[0].(*v1.SeedPeer) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetSeedPeer indicates an expected call of GetSeedPeer. +func (mr *MockManagerServerMockRecorder) GetSeedPeer(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSeedPeer", reflect.TypeOf((*MockManagerServer)(nil).GetSeedPeer), arg0, arg1) +} + +// KeepAlive mocks base method. +func (m *MockManagerServer) KeepAlive(arg0 v1.Manager_KeepAliveServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "KeepAlive", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// KeepAlive indicates an expected call of KeepAlive. +func (mr *MockManagerServerMockRecorder) KeepAlive(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KeepAlive", reflect.TypeOf((*MockManagerServer)(nil).KeepAlive), arg0) +} + +// ListBuckets mocks base method. +func (m *MockManagerServer) ListBuckets(arg0 context.Context, arg1 *v1.ListBucketsRequest) (*v1.ListBucketsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListBuckets", arg0, arg1) + ret0, _ := ret[0].(*v1.ListBucketsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListBuckets indicates an expected call of ListBuckets. +func (mr *MockManagerServerMockRecorder) ListBuckets(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBuckets", reflect.TypeOf((*MockManagerServer)(nil).ListBuckets), arg0, arg1) +} + +// ListSchedulers mocks base method. +func (m *MockManagerServer) ListSchedulers(arg0 context.Context, arg1 *v1.ListSchedulersRequest) (*v1.ListSchedulersResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListSchedulers", arg0, arg1) + ret0, _ := ret[0].(*v1.ListSchedulersResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListSchedulers indicates an expected call of ListSchedulers. +func (mr *MockManagerServerMockRecorder) ListSchedulers(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSchedulers", reflect.TypeOf((*MockManagerServer)(nil).ListSchedulers), arg0, arg1) +} + +// UpdateScheduler mocks base method. +func (m *MockManagerServer) UpdateScheduler(arg0 context.Context, arg1 *v1.UpdateSchedulerRequest) (*v1.Scheduler, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateScheduler", arg0, arg1) + ret0, _ := ret[0].(*v1.Scheduler) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateScheduler indicates an expected call of UpdateScheduler. +func (mr *MockManagerServerMockRecorder) UpdateScheduler(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateScheduler", reflect.TypeOf((*MockManagerServer)(nil).UpdateScheduler), arg0, arg1) +} + +// UpdateSeedPeer mocks base method. +func (m *MockManagerServer) UpdateSeedPeer(arg0 context.Context, arg1 *v1.UpdateSeedPeerRequest) (*v1.SeedPeer, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateSeedPeer", arg0, arg1) + ret0, _ := ret[0].(*v1.SeedPeer) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateSeedPeer indicates an expected call of UpdateSeedPeer. +func (mr *MockManagerServerMockRecorder) UpdateSeedPeer(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSeedPeer", reflect.TypeOf((*MockManagerServer)(nil).UpdateSeedPeer), arg0, arg1) +} + +// MockManager_KeepAliveServer is a mock of Manager_KeepAliveServer interface. +type MockManager_KeepAliveServer struct { + ctrl *gomock.Controller + recorder *MockManager_KeepAliveServerMockRecorder +} + +// MockManager_KeepAliveServerMockRecorder is the mock recorder for MockManager_KeepAliveServer. +type MockManager_KeepAliveServerMockRecorder struct { + mock *MockManager_KeepAliveServer +} + +// NewMockManager_KeepAliveServer creates a new mock instance. +func NewMockManager_KeepAliveServer(ctrl *gomock.Controller) *MockManager_KeepAliveServer { + mock := &MockManager_KeepAliveServer{ctrl: ctrl} + mock.recorder = &MockManager_KeepAliveServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockManager_KeepAliveServer) EXPECT() *MockManager_KeepAliveServerMockRecorder { + return m.recorder +} + +// Context mocks base method. +func (m *MockManager_KeepAliveServer) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockManager_KeepAliveServerMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).Context)) +} + +// Recv mocks base method. +func (m *MockManager_KeepAliveServer) Recv() (*v1.KeepAliveRequest, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*v1.KeepAliveRequest) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockManager_KeepAliveServerMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockManager_KeepAliveServer) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockManager_KeepAliveServerMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).RecvMsg), m) +} + +// SendAndClose mocks base method. +func (m *MockManager_KeepAliveServer) SendAndClose(arg0 *emptypb.Empty) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendAndClose", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendAndClose indicates an expected call of SendAndClose. +func (mr *MockManager_KeepAliveServerMockRecorder) SendAndClose(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendAndClose", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).SendAndClose), arg0) +} + +// SendHeader mocks base method. +func (m *MockManager_KeepAliveServer) SendHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendHeader indicates an expected call of SendHeader. +func (mr *MockManager_KeepAliveServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).SendHeader), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockManager_KeepAliveServer) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockManager_KeepAliveServerMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).SendMsg), m) +} + +// SetHeader mocks base method. +func (m *MockManager_KeepAliveServer) SetHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetHeader indicates an expected call of SetHeader. +func (mr *MockManager_KeepAliveServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).SetHeader), arg0) +} + +// SetTrailer mocks base method. +func (m *MockManager_KeepAliveServer) SetTrailer(arg0 metadata.MD) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetTrailer", arg0) +} + +// SetTrailer indicates an expected call of SetTrailer. +func (mr *MockManager_KeepAliveServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockManager_KeepAliveServer)(nil).SetTrailer), arg0) +} diff --git a/pkg/apis/manager/v1/mocks/mocks.go b/pkg/apis/manager/v1/mocks/mocks.go new file mode 100644 index 0000000..60d8433 --- /dev/null +++ b/pkg/apis/manager/v1/mocks/mocks.go @@ -0,0 +1,19 @@ +/* + * Copyright 2022 The Dragonfly 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 mocks + +//go:generate mockgen -destination manager_mock.go -source ../manager.pb.go -package mocks diff --git a/pkg/apis/scheduler/v1/mocks/mocks.go b/pkg/apis/scheduler/v1/mocks/mocks.go new file mode 100644 index 0000000..00736ce --- /dev/null +++ b/pkg/apis/scheduler/v1/mocks/mocks.go @@ -0,0 +1,19 @@ +/* + * Copyright 2022 The Dragonfly 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 mocks + +//go:generate mockgen -destination scheduler_mock.go -source ../scheduler.pb.go -package mocks diff --git a/pkg/apis/scheduler/v1/mocks/scheduler_mock.go b/pkg/apis/scheduler/v1/mocks/scheduler_mock.go new file mode 100644 index 0000000..c963183 --- /dev/null +++ b/pkg/apis/scheduler/v1/mocks/scheduler_mock.go @@ -0,0 +1,647 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ../scheduler.pb.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + reflect "reflect" + + v1 "d7y.io/api/pkg/apis/scheduler/v1" + gomock "github.com/golang/mock/gomock" + grpc "google.golang.org/grpc" + metadata "google.golang.org/grpc/metadata" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// MockisRegisterResult_DirectPiece is a mock of isRegisterResult_DirectPiece interface. +type MockisRegisterResult_DirectPiece struct { + ctrl *gomock.Controller + recorder *MockisRegisterResult_DirectPieceMockRecorder +} + +// MockisRegisterResult_DirectPieceMockRecorder is the mock recorder for MockisRegisterResult_DirectPiece. +type MockisRegisterResult_DirectPieceMockRecorder struct { + mock *MockisRegisterResult_DirectPiece +} + +// NewMockisRegisterResult_DirectPiece creates a new mock instance. +func NewMockisRegisterResult_DirectPiece(ctrl *gomock.Controller) *MockisRegisterResult_DirectPiece { + mock := &MockisRegisterResult_DirectPiece{ctrl: ctrl} + mock.recorder = &MockisRegisterResult_DirectPieceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockisRegisterResult_DirectPiece) EXPECT() *MockisRegisterResult_DirectPieceMockRecorder { + return m.recorder +} + +// isRegisterResult_DirectPiece mocks base method. +func (m *MockisRegisterResult_DirectPiece) isRegisterResult_DirectPiece() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "isRegisterResult_DirectPiece") +} + +// isRegisterResult_DirectPiece indicates an expected call of isRegisterResult_DirectPiece. +func (mr *MockisRegisterResult_DirectPieceMockRecorder) isRegisterResult_DirectPiece() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "isRegisterResult_DirectPiece", reflect.TypeOf((*MockisRegisterResult_DirectPiece)(nil).isRegisterResult_DirectPiece)) +} + +// MockisPeerPacket_Errordetails is a mock of isPeerPacket_Errordetails interface. +type MockisPeerPacket_Errordetails struct { + ctrl *gomock.Controller + recorder *MockisPeerPacket_ErrordetailsMockRecorder +} + +// MockisPeerPacket_ErrordetailsMockRecorder is the mock recorder for MockisPeerPacket_Errordetails. +type MockisPeerPacket_ErrordetailsMockRecorder struct { + mock *MockisPeerPacket_Errordetails +} + +// NewMockisPeerPacket_Errordetails creates a new mock instance. +func NewMockisPeerPacket_Errordetails(ctrl *gomock.Controller) *MockisPeerPacket_Errordetails { + mock := &MockisPeerPacket_Errordetails{ctrl: ctrl} + mock.recorder = &MockisPeerPacket_ErrordetailsMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockisPeerPacket_Errordetails) EXPECT() *MockisPeerPacket_ErrordetailsMockRecorder { + return m.recorder +} + +// isPeerPacket_Errordetails mocks base method. +func (m *MockisPeerPacket_Errordetails) isPeerPacket_Errordetails() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "isPeerPacket_Errordetails") +} + +// isPeerPacket_Errordetails indicates an expected call of isPeerPacket_Errordetails. +func (mr *MockisPeerPacket_ErrordetailsMockRecorder) isPeerPacket_Errordetails() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "isPeerPacket_Errordetails", reflect.TypeOf((*MockisPeerPacket_Errordetails)(nil).isPeerPacket_Errordetails)) +} + +// MockisPeerResult_Errordetails is a mock of isPeerResult_Errordetails interface. +type MockisPeerResult_Errordetails struct { + ctrl *gomock.Controller + recorder *MockisPeerResult_ErrordetailsMockRecorder +} + +// MockisPeerResult_ErrordetailsMockRecorder is the mock recorder for MockisPeerResult_Errordetails. +type MockisPeerResult_ErrordetailsMockRecorder struct { + mock *MockisPeerResult_Errordetails +} + +// NewMockisPeerResult_Errordetails creates a new mock instance. +func NewMockisPeerResult_Errordetails(ctrl *gomock.Controller) *MockisPeerResult_Errordetails { + mock := &MockisPeerResult_Errordetails{ctrl: ctrl} + mock.recorder = &MockisPeerResult_ErrordetailsMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockisPeerResult_Errordetails) EXPECT() *MockisPeerResult_ErrordetailsMockRecorder { + return m.recorder +} + +// isPeerResult_Errordetails mocks base method. +func (m *MockisPeerResult_Errordetails) isPeerResult_Errordetails() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "isPeerResult_Errordetails") +} + +// isPeerResult_Errordetails indicates an expected call of isPeerResult_Errordetails. +func (mr *MockisPeerResult_ErrordetailsMockRecorder) isPeerResult_Errordetails() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "isPeerResult_Errordetails", reflect.TypeOf((*MockisPeerResult_Errordetails)(nil).isPeerResult_Errordetails)) +} + +// MockSchedulerClient is a mock of SchedulerClient interface. +type MockSchedulerClient struct { + ctrl *gomock.Controller + recorder *MockSchedulerClientMockRecorder +} + +// MockSchedulerClientMockRecorder is the mock recorder for MockSchedulerClient. +type MockSchedulerClientMockRecorder struct { + mock *MockSchedulerClient +} + +// NewMockSchedulerClient creates a new mock instance. +func NewMockSchedulerClient(ctrl *gomock.Controller) *MockSchedulerClient { + mock := &MockSchedulerClient{ctrl: ctrl} + mock.recorder = &MockSchedulerClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSchedulerClient) EXPECT() *MockSchedulerClientMockRecorder { + return m.recorder +} + +// AnnounceTask mocks base method. +func (m *MockSchedulerClient) AnnounceTask(ctx context.Context, in *v1.AnnounceTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AnnounceTask", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AnnounceTask indicates an expected call of AnnounceTask. +func (mr *MockSchedulerClientMockRecorder) AnnounceTask(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AnnounceTask", reflect.TypeOf((*MockSchedulerClient)(nil).AnnounceTask), varargs...) +} + +// LeaveTask mocks base method. +func (m *MockSchedulerClient) LeaveTask(ctx context.Context, in *v1.PeerTarget, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "LeaveTask", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// LeaveTask indicates an expected call of LeaveTask. +func (mr *MockSchedulerClientMockRecorder) LeaveTask(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LeaveTask", reflect.TypeOf((*MockSchedulerClient)(nil).LeaveTask), varargs...) +} + +// RegisterPeerTask mocks base method. +func (m *MockSchedulerClient) RegisterPeerTask(ctx context.Context, in *v1.PeerTaskRequest, opts ...grpc.CallOption) (*v1.RegisterResult, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RegisterPeerTask", varargs...) + ret0, _ := ret[0].(*v1.RegisterResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RegisterPeerTask indicates an expected call of RegisterPeerTask. +func (mr *MockSchedulerClientMockRecorder) RegisterPeerTask(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterPeerTask", reflect.TypeOf((*MockSchedulerClient)(nil).RegisterPeerTask), varargs...) +} + +// ReportPeerResult mocks base method. +func (m *MockSchedulerClient) ReportPeerResult(ctx context.Context, in *v1.PeerResult, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ReportPeerResult", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReportPeerResult indicates an expected call of ReportPeerResult. +func (mr *MockSchedulerClientMockRecorder) ReportPeerResult(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportPeerResult", reflect.TypeOf((*MockSchedulerClient)(nil).ReportPeerResult), varargs...) +} + +// ReportPieceResult mocks base method. +func (m *MockSchedulerClient) ReportPieceResult(ctx context.Context, opts ...grpc.CallOption) (v1.Scheduler_ReportPieceResultClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ReportPieceResult", varargs...) + ret0, _ := ret[0].(v1.Scheduler_ReportPieceResultClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReportPieceResult indicates an expected call of ReportPieceResult. +func (mr *MockSchedulerClientMockRecorder) ReportPieceResult(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportPieceResult", reflect.TypeOf((*MockSchedulerClient)(nil).ReportPieceResult), varargs...) +} + +// StatTask mocks base method. +func (m *MockSchedulerClient) StatTask(ctx context.Context, in *v1.StatTaskRequest, opts ...grpc.CallOption) (*v1.Task, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "StatTask", varargs...) + ret0, _ := ret[0].(*v1.Task) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StatTask indicates an expected call of StatTask. +func (mr *MockSchedulerClientMockRecorder) StatTask(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StatTask", reflect.TypeOf((*MockSchedulerClient)(nil).StatTask), varargs...) +} + +// MockScheduler_ReportPieceResultClient is a mock of Scheduler_ReportPieceResultClient interface. +type MockScheduler_ReportPieceResultClient struct { + ctrl *gomock.Controller + recorder *MockScheduler_ReportPieceResultClientMockRecorder +} + +// MockScheduler_ReportPieceResultClientMockRecorder is the mock recorder for MockScheduler_ReportPieceResultClient. +type MockScheduler_ReportPieceResultClientMockRecorder struct { + mock *MockScheduler_ReportPieceResultClient +} + +// NewMockScheduler_ReportPieceResultClient creates a new mock instance. +func NewMockScheduler_ReportPieceResultClient(ctrl *gomock.Controller) *MockScheduler_ReportPieceResultClient { + mock := &MockScheduler_ReportPieceResultClient{ctrl: ctrl} + mock.recorder = &MockScheduler_ReportPieceResultClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockScheduler_ReportPieceResultClient) EXPECT() *MockScheduler_ReportPieceResultClientMockRecorder { + return m.recorder +} + +// CloseSend mocks base method. +func (m *MockScheduler_ReportPieceResultClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend. +func (mr *MockScheduler_ReportPieceResultClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockScheduler_ReportPieceResultClient)(nil).CloseSend)) +} + +// Context mocks base method. +func (m *MockScheduler_ReportPieceResultClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockScheduler_ReportPieceResultClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockScheduler_ReportPieceResultClient)(nil).Context)) +} + +// Header mocks base method. +func (m *MockScheduler_ReportPieceResultClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header. +func (mr *MockScheduler_ReportPieceResultClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockScheduler_ReportPieceResultClient)(nil).Header)) +} + +// Recv mocks base method. +func (m *MockScheduler_ReportPieceResultClient) Recv() (*v1.PeerPacket, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*v1.PeerPacket) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockScheduler_ReportPieceResultClientMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockScheduler_ReportPieceResultClient)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockScheduler_ReportPieceResultClient) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockScheduler_ReportPieceResultClientMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockScheduler_ReportPieceResultClient)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockScheduler_ReportPieceResultClient) Send(arg0 *v1.PieceResult) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockScheduler_ReportPieceResultClientMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockScheduler_ReportPieceResultClient)(nil).Send), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockScheduler_ReportPieceResultClient) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockScheduler_ReportPieceResultClientMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockScheduler_ReportPieceResultClient)(nil).SendMsg), m) +} + +// Trailer mocks base method. +func (m *MockScheduler_ReportPieceResultClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer. +func (mr *MockScheduler_ReportPieceResultClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockScheduler_ReportPieceResultClient)(nil).Trailer)) +} + +// MockSchedulerServer is a mock of SchedulerServer interface. +type MockSchedulerServer struct { + ctrl *gomock.Controller + recorder *MockSchedulerServerMockRecorder +} + +// MockSchedulerServerMockRecorder is the mock recorder for MockSchedulerServer. +type MockSchedulerServerMockRecorder struct { + mock *MockSchedulerServer +} + +// NewMockSchedulerServer creates a new mock instance. +func NewMockSchedulerServer(ctrl *gomock.Controller) *MockSchedulerServer { + mock := &MockSchedulerServer{ctrl: ctrl} + mock.recorder = &MockSchedulerServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockSchedulerServer) EXPECT() *MockSchedulerServerMockRecorder { + return m.recorder +} + +// AnnounceTask mocks base method. +func (m *MockSchedulerServer) AnnounceTask(arg0 context.Context, arg1 *v1.AnnounceTaskRequest) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AnnounceTask", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AnnounceTask indicates an expected call of AnnounceTask. +func (mr *MockSchedulerServerMockRecorder) AnnounceTask(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AnnounceTask", reflect.TypeOf((*MockSchedulerServer)(nil).AnnounceTask), arg0, arg1) +} + +// LeaveTask mocks base method. +func (m *MockSchedulerServer) LeaveTask(arg0 context.Context, arg1 *v1.PeerTarget) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "LeaveTask", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// LeaveTask indicates an expected call of LeaveTask. +func (mr *MockSchedulerServerMockRecorder) LeaveTask(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LeaveTask", reflect.TypeOf((*MockSchedulerServer)(nil).LeaveTask), arg0, arg1) +} + +// RegisterPeerTask mocks base method. +func (m *MockSchedulerServer) RegisterPeerTask(arg0 context.Context, arg1 *v1.PeerTaskRequest) (*v1.RegisterResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RegisterPeerTask", arg0, arg1) + ret0, _ := ret[0].(*v1.RegisterResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RegisterPeerTask indicates an expected call of RegisterPeerTask. +func (mr *MockSchedulerServerMockRecorder) RegisterPeerTask(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterPeerTask", reflect.TypeOf((*MockSchedulerServer)(nil).RegisterPeerTask), arg0, arg1) +} + +// ReportPeerResult mocks base method. +func (m *MockSchedulerServer) ReportPeerResult(arg0 context.Context, arg1 *v1.PeerResult) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReportPeerResult", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReportPeerResult indicates an expected call of ReportPeerResult. +func (mr *MockSchedulerServerMockRecorder) ReportPeerResult(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportPeerResult", reflect.TypeOf((*MockSchedulerServer)(nil).ReportPeerResult), arg0, arg1) +} + +// ReportPieceResult mocks base method. +func (m *MockSchedulerServer) ReportPieceResult(arg0 v1.Scheduler_ReportPieceResultServer) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReportPieceResult", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// ReportPieceResult indicates an expected call of ReportPieceResult. +func (mr *MockSchedulerServerMockRecorder) ReportPieceResult(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportPieceResult", reflect.TypeOf((*MockSchedulerServer)(nil).ReportPieceResult), arg0) +} + +// StatTask mocks base method. +func (m *MockSchedulerServer) StatTask(arg0 context.Context, arg1 *v1.StatTaskRequest) (*v1.Task, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StatTask", arg0, arg1) + ret0, _ := ret[0].(*v1.Task) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// StatTask indicates an expected call of StatTask. +func (mr *MockSchedulerServerMockRecorder) StatTask(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StatTask", reflect.TypeOf((*MockSchedulerServer)(nil).StatTask), arg0, arg1) +} + +// MockScheduler_ReportPieceResultServer is a mock of Scheduler_ReportPieceResultServer interface. +type MockScheduler_ReportPieceResultServer struct { + ctrl *gomock.Controller + recorder *MockScheduler_ReportPieceResultServerMockRecorder +} + +// MockScheduler_ReportPieceResultServerMockRecorder is the mock recorder for MockScheduler_ReportPieceResultServer. +type MockScheduler_ReportPieceResultServerMockRecorder struct { + mock *MockScheduler_ReportPieceResultServer +} + +// NewMockScheduler_ReportPieceResultServer creates a new mock instance. +func NewMockScheduler_ReportPieceResultServer(ctrl *gomock.Controller) *MockScheduler_ReportPieceResultServer { + mock := &MockScheduler_ReportPieceResultServer{ctrl: ctrl} + mock.recorder = &MockScheduler_ReportPieceResultServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockScheduler_ReportPieceResultServer) EXPECT() *MockScheduler_ReportPieceResultServerMockRecorder { + return m.recorder +} + +// Context mocks base method. +func (m *MockScheduler_ReportPieceResultServer) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockScheduler_ReportPieceResultServerMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockScheduler_ReportPieceResultServer)(nil).Context)) +} + +// Recv mocks base method. +func (m *MockScheduler_ReportPieceResultServer) Recv() (*v1.PieceResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*v1.PieceResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockScheduler_ReportPieceResultServerMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockScheduler_ReportPieceResultServer)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockScheduler_ReportPieceResultServer) RecvMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockScheduler_ReportPieceResultServerMockRecorder) RecvMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockScheduler_ReportPieceResultServer)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockScheduler_ReportPieceResultServer) Send(arg0 *v1.PeerPacket) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockScheduler_ReportPieceResultServerMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockScheduler_ReportPieceResultServer)(nil).Send), arg0) +} + +// SendHeader mocks base method. +func (m *MockScheduler_ReportPieceResultServer) SendHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendHeader indicates an expected call of SendHeader. +func (mr *MockScheduler_ReportPieceResultServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockScheduler_ReportPieceResultServer)(nil).SendHeader), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockScheduler_ReportPieceResultServer) SendMsg(m interface{}) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockScheduler_ReportPieceResultServerMockRecorder) SendMsg(m interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockScheduler_ReportPieceResultServer)(nil).SendMsg), m) +} + +// SetHeader mocks base method. +func (m *MockScheduler_ReportPieceResultServer) SetHeader(arg0 metadata.MD) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetHeader", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetHeader indicates an expected call of SetHeader. +func (mr *MockScheduler_ReportPieceResultServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockScheduler_ReportPieceResultServer)(nil).SetHeader), arg0) +} + +// SetTrailer mocks base method. +func (m *MockScheduler_ReportPieceResultServer) SetTrailer(arg0 metadata.MD) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetTrailer", arg0) +} + +// SetTrailer indicates an expected call of SetTrailer. +func (mr *MockScheduler_ReportPieceResultServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockScheduler_ReportPieceResultServer)(nil).SetTrailer), arg0) +} diff --git a/pkg/apis/scheduler/v1/scheduler.pb.go b/pkg/apis/scheduler/v1/scheduler.pb.go new file mode 100644 index 0000000..0bcfd2d --- /dev/null +++ b/pkg/apis/scheduler/v1/scheduler.pb.go @@ -0,0 +1,2097 @@ +// +// Copyright 2022 The Dragonfly 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. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.19.4 +// source: pkg/apis/scheduler/v1/scheduler.proto + +package v1 + +import ( + context "context" + v1 "d7y.io/api/pkg/apis/common/v1" + v11 "d7y.io/api/pkg/apis/errordetails/v1" + _ "github.com/envoyproxy/protoc-gen-validate/validate" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// PeerTaskRequest represents request of RegisterPeerTask. +type PeerTaskRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Download url. + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + // URL meta info. + UrlMeta *v1.UrlMeta `protobuf:"bytes,2,opt,name=url_meta,json=urlMeta,proto3" json:"url_meta,omitempty"` + // Peer id and it must be global uniqueness. + PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + // Peer host info. + PeerHost *PeerHost `protobuf:"bytes,4,opt,name=peer_host,json=peerHost,proto3" json:"peer_host,omitempty"` + // Peer host load. + HostLoad *v1.HostLoad `protobuf:"bytes,5,opt,name=host_load,json=hostLoad,proto3" json:"host_load,omitempty"` + // Whether this request is caused by migration. + IsMigrating bool `protobuf:"varint,6,opt,name=is_migrating,json=isMigrating,proto3" json:"is_migrating,omitempty"` + // Pattern includes p2p, seed-peer and source. + Pattern v1.Pattern `protobuf:"varint,7,opt,name=pattern,proto3,enum=common.Pattern" json:"pattern,omitempty"` + // Task id. + TaskId string `protobuf:"bytes,8,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` +} + +func (x *PeerTaskRequest) Reset() { + *x = PeerTaskRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerTaskRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerTaskRequest) ProtoMessage() {} + +func (x *PeerTaskRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerTaskRequest.ProtoReflect.Descriptor instead. +func (*PeerTaskRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{0} +} + +func (x *PeerTaskRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *PeerTaskRequest) GetUrlMeta() *v1.UrlMeta { + if x != nil { + return x.UrlMeta + } + return nil +} + +func (x *PeerTaskRequest) GetPeerId() string { + if x != nil { + return x.PeerId + } + return "" +} + +func (x *PeerTaskRequest) GetPeerHost() *PeerHost { + if x != nil { + return x.PeerHost + } + return nil +} + +func (x *PeerTaskRequest) GetHostLoad() *v1.HostLoad { + if x != nil { + return x.HostLoad + } + return nil +} + +func (x *PeerTaskRequest) GetIsMigrating() bool { + if x != nil { + return x.IsMigrating + } + return false +} + +func (x *PeerTaskRequest) GetPattern() v1.Pattern { + if x != nil { + return x.Pattern + } + return v1.Pattern(0) +} + +func (x *PeerTaskRequest) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +// RegisterResult represents response of RegisterPeerTask. +type RegisterResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Task type. + TaskType v1.TaskType `protobuf:"varint,1,opt,name=task_type,json=taskType,proto3,enum=common.TaskType" json:"task_type,omitempty"` + // Task id + TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + // File size scope. + SizeScope v1.SizeScope `protobuf:"varint,3,opt,name=size_scope,json=sizeScope,proto3,enum=common.SizeScope" json:"size_scope,omitempty"` + // Download the only piece directly for small or tiny file. + // + // Types that are assignable to DirectPiece: + // *RegisterResult_SinglePiece + // *RegisterResult_PieceContent + DirectPiece isRegisterResult_DirectPiece `protobuf_oneof:"direct_piece"` + // Task extend attribute, + // only direct_piece will carry extend attribute. + ExtendAttribute *v1.ExtendAttribute `protobuf:"bytes,6,opt,name=extend_attribute,json=extendAttribute,proto3" json:"extend_attribute,omitempty"` +} + +func (x *RegisterResult) Reset() { + *x = RegisterResult{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterResult) ProtoMessage() {} + +func (x *RegisterResult) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterResult.ProtoReflect.Descriptor instead. +func (*RegisterResult) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{1} +} + +func (x *RegisterResult) GetTaskType() v1.TaskType { + if x != nil { + return x.TaskType + } + return v1.TaskType(0) +} + +func (x *RegisterResult) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *RegisterResult) GetSizeScope() v1.SizeScope { + if x != nil { + return x.SizeScope + } + return v1.SizeScope(0) +} + +func (m *RegisterResult) GetDirectPiece() isRegisterResult_DirectPiece { + if m != nil { + return m.DirectPiece + } + return nil +} + +func (x *RegisterResult) GetSinglePiece() *SinglePiece { + if x, ok := x.GetDirectPiece().(*RegisterResult_SinglePiece); ok { + return x.SinglePiece + } + return nil +} + +func (x *RegisterResult) GetPieceContent() []byte { + if x, ok := x.GetDirectPiece().(*RegisterResult_PieceContent); ok { + return x.PieceContent + } + return nil +} + +func (x *RegisterResult) GetExtendAttribute() *v1.ExtendAttribute { + if x != nil { + return x.ExtendAttribute + } + return nil +} + +type isRegisterResult_DirectPiece interface { + isRegisterResult_DirectPiece() +} + +type RegisterResult_SinglePiece struct { + // Return single piece info when size scope is small. + SinglePiece *SinglePiece `protobuf:"bytes,4,opt,name=single_piece,json=singlePiece,proto3,oneof"` +} + +type RegisterResult_PieceContent struct { + // Return task content when size scope is tiny. + PieceContent []byte `protobuf:"bytes,5,opt,name=piece_content,json=pieceContent,proto3,oneof"` +} + +func (*RegisterResult_SinglePiece) isRegisterResult_DirectPiece() {} + +func (*RegisterResult_PieceContent) isRegisterResult_DirectPiece() {} + +// SinglePiece represents information of single piece. +type SinglePiece struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Destination peer id. + DstPid string `protobuf:"bytes,1,opt,name=dst_pid,json=dstPid,proto3" json:"dst_pid,omitempty"` + // Destination download address. + DstAddr string `protobuf:"bytes,2,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"` + // Piece info. + PieceInfo *v1.PieceInfo `protobuf:"bytes,3,opt,name=piece_info,json=pieceInfo,proto3" json:"piece_info,omitempty"` +} + +func (x *SinglePiece) Reset() { + *x = SinglePiece{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SinglePiece) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SinglePiece) ProtoMessage() {} + +func (x *SinglePiece) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SinglePiece.ProtoReflect.Descriptor instead. +func (*SinglePiece) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{2} +} + +func (x *SinglePiece) GetDstPid() string { + if x != nil { + return x.DstPid + } + return "" +} + +func (x *SinglePiece) GetDstAddr() string { + if x != nil { + return x.DstAddr + } + return "" +} + +func (x *SinglePiece) GetPieceInfo() *v1.PieceInfo { + if x != nil { + return x.PieceInfo + } + return nil +} + +// PeerHost represents information of peer host. +type PeerHost struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Peer host id. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // peer host ip + Ip string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"` + // Port of grpc service. + RpcPort int32 `protobuf:"varint,3,opt,name=rpc_port,json=rpcPort,proto3" json:"rpc_port,omitempty"` + // Port of download server. + DownPort int32 `protobuf:"varint,4,opt,name=down_port,json=downPort,proto3" json:"down_port,omitempty"` + // Peer hostname. + HostName string `protobuf:"bytes,5,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // Security domain for network. + SecurityDomain string `protobuf:"bytes,6,opt,name=security_domain,json=securityDomain,proto3" json:"security_domain,omitempty"` + // Location path(area|country|province|city|...). + Location string `protobuf:"bytes,7,opt,name=location,proto3" json:"location,omitempty"` + // IDC where the peer host is located + Idc string `protobuf:"bytes,8,opt,name=idc,proto3" json:"idc,omitempty"` + // Network topology(switch|router|...). + NetTopology string `protobuf:"bytes,9,opt,name=net_topology,json=netTopology,proto3" json:"net_topology,omitempty"` +} + +func (x *PeerHost) Reset() { + *x = PeerHost{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerHost) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerHost) ProtoMessage() {} + +func (x *PeerHost) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerHost.ProtoReflect.Descriptor instead. +func (*PeerHost) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{3} +} + +func (x *PeerHost) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PeerHost) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *PeerHost) GetRpcPort() int32 { + if x != nil { + return x.RpcPort + } + return 0 +} + +func (x *PeerHost) GetDownPort() int32 { + if x != nil { + return x.DownPort + } + return 0 +} + +func (x *PeerHost) GetHostName() string { + if x != nil { + return x.HostName + } + return "" +} + +func (x *PeerHost) GetSecurityDomain() string { + if x != nil { + return x.SecurityDomain + } + return "" +} + +func (x *PeerHost) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +func (x *PeerHost) GetIdc() string { + if x != nil { + return x.Idc + } + return "" +} + +func (x *PeerHost) GetNetTopology() string { + if x != nil { + return x.NetTopology + } + return "" +} + +// PieceResult represents request of ReportPieceResult. +type PieceResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Task id. + TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + // Source peer id. + SrcPid string `protobuf:"bytes,2,opt,name=src_pid,json=srcPid,proto3" json:"src_pid,omitempty"` + // Destination peer id. + DstPid string `protobuf:"bytes,3,opt,name=dst_pid,json=dstPid,proto3" json:"dst_pid,omitempty"` + // Piece info. + PieceInfo *v1.PieceInfo `protobuf:"bytes,4,opt,name=piece_info,json=pieceInfo,proto3" json:"piece_info,omitempty"` + // Begin time of the piece downloading. + BeginTime uint64 `protobuf:"varint,5,opt,name=begin_time,json=beginTime,proto3" json:"begin_time,omitempty"` + // End time of the piece downloading. + EndTime uint64 `protobuf:"varint,6,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + // Whether the piece downloading is successfully. + Success bool `protobuf:"varint,7,opt,name=success,proto3" json:"success,omitempty"` + // Result code. + Code v1.Code `protobuf:"varint,8,opt,name=code,proto3,enum=common.Code" json:"code,omitempty"` + // Peer host load. + HostLoad *v1.HostLoad `protobuf:"bytes,9,opt,name=host_load,json=hostLoad,proto3" json:"host_load,omitempty"` + // Finished count. + FinishedCount int32 `protobuf:"varint,10,opt,name=finished_count,json=finishedCount,proto3" json:"finished_count,omitempty"` + // Task extend attribute, + // only first success back source piece will carry extend attribute. + ExtendAttribute *v1.ExtendAttribute `protobuf:"bytes,11,opt,name=extend_attribute,json=extendAttribute,proto3" json:"extend_attribute,omitempty"` +} + +func (x *PieceResult) Reset() { + *x = PieceResult{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PieceResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PieceResult) ProtoMessage() {} + +func (x *PieceResult) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PieceResult.ProtoReflect.Descriptor instead. +func (*PieceResult) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{4} +} + +func (x *PieceResult) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *PieceResult) GetSrcPid() string { + if x != nil { + return x.SrcPid + } + return "" +} + +func (x *PieceResult) GetDstPid() string { + if x != nil { + return x.DstPid + } + return "" +} + +func (x *PieceResult) GetPieceInfo() *v1.PieceInfo { + if x != nil { + return x.PieceInfo + } + return nil +} + +func (x *PieceResult) GetBeginTime() uint64 { + if x != nil { + return x.BeginTime + } + return 0 +} + +func (x *PieceResult) GetEndTime() uint64 { + if x != nil { + return x.EndTime + } + return 0 +} + +func (x *PieceResult) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *PieceResult) GetCode() v1.Code { + if x != nil { + return x.Code + } + return v1.Code(0) +} + +func (x *PieceResult) GetHostLoad() *v1.HostLoad { + if x != nil { + return x.HostLoad + } + return nil +} + +func (x *PieceResult) GetFinishedCount() int32 { + if x != nil { + return x.FinishedCount + } + return 0 +} + +func (x *PieceResult) GetExtendAttribute() *v1.ExtendAttribute { + if x != nil { + return x.ExtendAttribute + } + return nil +} + +// PeerPacket represents response of ReportPieceResult. +type PeerPacket struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Task id. + TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + // Source peer id. + SrcPid string `protobuf:"bytes,3,opt,name=src_pid,json=srcPid,proto3" json:"src_pid,omitempty"` + // Concurrent downloading count from main peer. + ParallelCount int32 `protobuf:"varint,4,opt,name=parallel_count,json=parallelCount,proto3" json:"parallel_count,omitempty"` + // Main peer. + MainPeer *PeerPacket_DestPeer `protobuf:"bytes,5,opt,name=main_peer,json=mainPeer,proto3" json:"main_peer,omitempty"` + // Candidate peers. + CandidatePeers []*PeerPacket_DestPeer `protobuf:"bytes,6,rep,name=candidate_peers,json=candidatePeers,proto3" json:"candidate_peers,omitempty"` + // Result code. + Code v1.Code `protobuf:"varint,7,opt,name=code,proto3,enum=common.Code" json:"code,omitempty"` + // Error detail. + // + // Types that are assignable to Errordetails: + // *PeerPacket_SourceError + Errordetails isPeerPacket_Errordetails `protobuf_oneof:"errordetails"` +} + +func (x *PeerPacket) Reset() { + *x = PeerPacket{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerPacket) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerPacket) ProtoMessage() {} + +func (x *PeerPacket) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerPacket.ProtoReflect.Descriptor instead. +func (*PeerPacket) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{5} +} + +func (x *PeerPacket) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *PeerPacket) GetSrcPid() string { + if x != nil { + return x.SrcPid + } + return "" +} + +func (x *PeerPacket) GetParallelCount() int32 { + if x != nil { + return x.ParallelCount + } + return 0 +} + +func (x *PeerPacket) GetMainPeer() *PeerPacket_DestPeer { + if x != nil { + return x.MainPeer + } + return nil +} + +func (x *PeerPacket) GetCandidatePeers() []*PeerPacket_DestPeer { + if x != nil { + return x.CandidatePeers + } + return nil +} + +func (x *PeerPacket) GetCode() v1.Code { + if x != nil { + return x.Code + } + return v1.Code(0) +} + +func (m *PeerPacket) GetErrordetails() isPeerPacket_Errordetails { + if m != nil { + return m.Errordetails + } + return nil +} + +func (x *PeerPacket) GetSourceError() *v11.SourceError { + if x, ok := x.GetErrordetails().(*PeerPacket_SourceError); ok { + return x.SourceError + } + return nil +} + +type isPeerPacket_Errordetails interface { + isPeerPacket_Errordetails() +} + +type PeerPacket_SourceError struct { + // Source error. + SourceError *v11.SourceError `protobuf:"bytes,8,opt,name=source_error,json=sourceError,proto3,oneof"` +} + +func (*PeerPacket_SourceError) isPeerPacket_Errordetails() {} + +// PeerResult represents response of ReportPeerResult. +type PeerResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Task id. + TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + // Peer id. + PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + // Source host ip. + SrcIp string `protobuf:"bytes,3,opt,name=src_ip,json=srcIp,proto3" json:"src_ip,omitempty"` + // Security domain. + SecurityDomain string `protobuf:"bytes,4,opt,name=security_domain,json=securityDomain,proto3" json:"security_domain,omitempty"` + // IDC where the peer host is located + Idc string `protobuf:"bytes,5,opt,name=idc,proto3" json:"idc,omitempty"` + // Download url. + Url string `protobuf:"bytes,6,opt,name=url,proto3" json:"url,omitempty"` + // Total content length. + ContentLength int64 `protobuf:"varint,7,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"` + // Total network traffic. + Traffic uint64 `protobuf:"varint,8,opt,name=traffic,proto3" json:"traffic,omitempty"` + // Total cost time. + Cost uint32 `protobuf:"varint,9,opt,name=cost,proto3" json:"cost,omitempty"` + // Whether peer downloading file is successfully. + Success bool `protobuf:"varint,10,opt,name=success,proto3" json:"success,omitempty"` + // Result code. + Code v1.Code `protobuf:"varint,11,opt,name=code,proto3,enum=common.Code" json:"code,omitempty"` + // Task total piece count. + TotalPieceCount int32 `protobuf:"varint,12,opt,name=total_piece_count,json=totalPieceCount,proto3" json:"total_piece_count,omitempty"` + // Error detail. + // + // Types that are assignable to Errordetails: + // *PeerResult_SourceError + Errordetails isPeerResult_Errordetails `protobuf_oneof:"errordetails"` +} + +func (x *PeerResult) Reset() { + *x = PeerResult{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerResult) ProtoMessage() {} + +func (x *PeerResult) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerResult.ProtoReflect.Descriptor instead. +func (*PeerResult) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{6} +} + +func (x *PeerResult) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *PeerResult) GetPeerId() string { + if x != nil { + return x.PeerId + } + return "" +} + +func (x *PeerResult) GetSrcIp() string { + if x != nil { + return x.SrcIp + } + return "" +} + +func (x *PeerResult) GetSecurityDomain() string { + if x != nil { + return x.SecurityDomain + } + return "" +} + +func (x *PeerResult) GetIdc() string { + if x != nil { + return x.Idc + } + return "" +} + +func (x *PeerResult) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *PeerResult) GetContentLength() int64 { + if x != nil { + return x.ContentLength + } + return 0 +} + +func (x *PeerResult) GetTraffic() uint64 { + if x != nil { + return x.Traffic + } + return 0 +} + +func (x *PeerResult) GetCost() uint32 { + if x != nil { + return x.Cost + } + return 0 +} + +func (x *PeerResult) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *PeerResult) GetCode() v1.Code { + if x != nil { + return x.Code + } + return v1.Code(0) +} + +func (x *PeerResult) GetTotalPieceCount() int32 { + if x != nil { + return x.TotalPieceCount + } + return 0 +} + +func (m *PeerResult) GetErrordetails() isPeerResult_Errordetails { + if m != nil { + return m.Errordetails + } + return nil +} + +func (x *PeerResult) GetSourceError() *v11.SourceError { + if x, ok := x.GetErrordetails().(*PeerResult_SourceError); ok { + return x.SourceError + } + return nil +} + +type isPeerResult_Errordetails interface { + isPeerResult_Errordetails() +} + +type PeerResult_SourceError struct { + // Source error. + SourceError *v11.SourceError `protobuf:"bytes,13,opt,name=source_error,json=sourceError,proto3,oneof"` +} + +func (*PeerResult_SourceError) isPeerResult_Errordetails() {} + +// PeerTarget represents request of LeaveTask. +type PeerTarget struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Task id. + TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + // Peer id. + PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` +} + +func (x *PeerTarget) Reset() { + *x = PeerTarget{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerTarget) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerTarget) ProtoMessage() {} + +func (x *PeerTarget) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerTarget.ProtoReflect.Descriptor instead. +func (*PeerTarget) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{7} +} + +func (x *PeerTarget) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *PeerTarget) GetPeerId() string { + if x != nil { + return x.PeerId + } + return "" +} + +// StatTaskRequest represents request of StatTask. +type StatTaskRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Task id. + TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` +} + +func (x *StatTaskRequest) Reset() { + *x = StatTaskRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatTaskRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatTaskRequest) ProtoMessage() {} + +func (x *StatTaskRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatTaskRequest.ProtoReflect.Descriptor instead. +func (*StatTaskRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{8} +} + +func (x *StatTaskRequest) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +// Task represents download task. +type Task struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Task id. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Task type. + Type v1.TaskType `protobuf:"varint,2,opt,name=type,proto3,enum=common.TaskType" json:"type,omitempty"` + // Task content length. + ContentLength int64 `protobuf:"varint,3,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"` + // Task total piece count. + TotalPieceCount int32 `protobuf:"varint,4,opt,name=total_piece_count,json=totalPieceCount,proto3" json:"total_piece_count,omitempty"` + // Task state. + State string `protobuf:"bytes,5,opt,name=state,proto3" json:"state,omitempty"` + // Task peer count. + PeerCount int32 `protobuf:"varint,6,opt,name=peer_count,json=peerCount,proto3" json:"peer_count,omitempty"` + // Task contains available peer. + HasAvailablePeer bool `protobuf:"varint,7,opt,name=hasAvailablePeer,proto3" json:"hasAvailablePeer,omitempty"` +} + +func (x *Task) Reset() { + *x = Task{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Task) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Task) ProtoMessage() {} + +func (x *Task) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Task.ProtoReflect.Descriptor instead. +func (*Task) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{9} +} + +func (x *Task) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Task) GetType() v1.TaskType { + if x != nil { + return x.Type + } + return v1.TaskType(0) +} + +func (x *Task) GetContentLength() int64 { + if x != nil { + return x.ContentLength + } + return 0 +} + +func (x *Task) GetTotalPieceCount() int32 { + if x != nil { + return x.TotalPieceCount + } + return 0 +} + +func (x *Task) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *Task) GetPeerCount() int32 { + if x != nil { + return x.PeerCount + } + return 0 +} + +func (x *Task) GetHasAvailablePeer() bool { + if x != nil { + return x.HasAvailablePeer + } + return false +} + +// AnnounceTaskRequest represents request of AnnounceTask. +type AnnounceTaskRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Task id. + TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + // Download url. + Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` + // URL meta info. + UrlMeta *v1.UrlMeta `protobuf:"bytes,3,opt,name=url_meta,json=urlMeta,proto3" json:"url_meta,omitempty"` + // Peer host info. + PeerHost *PeerHost `protobuf:"bytes,4,opt,name=peer_host,json=peerHost,proto3" json:"peer_host,omitempty"` + // Task piece info. + PiecePacket *v1.PiecePacket `protobuf:"bytes,5,opt,name=piece_packet,json=piecePacket,proto3" json:"piece_packet,omitempty"` + // Task type. + TaskType v1.TaskType `protobuf:"varint,6,opt,name=task_type,json=taskType,proto3,enum=common.TaskType" json:"task_type,omitempty"` +} + +func (x *AnnounceTaskRequest) Reset() { + *x = AnnounceTaskRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AnnounceTaskRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnnounceTaskRequest) ProtoMessage() {} + +func (x *AnnounceTaskRequest) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AnnounceTaskRequest.ProtoReflect.Descriptor instead. +func (*AnnounceTaskRequest) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{10} +} + +func (x *AnnounceTaskRequest) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *AnnounceTaskRequest) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *AnnounceTaskRequest) GetUrlMeta() *v1.UrlMeta { + if x != nil { + return x.UrlMeta + } + return nil +} + +func (x *AnnounceTaskRequest) GetPeerHost() *PeerHost { + if x != nil { + return x.PeerHost + } + return nil +} + +func (x *AnnounceTaskRequest) GetPiecePacket() *v1.PiecePacket { + if x != nil { + return x.PiecePacket + } + return nil +} + +func (x *AnnounceTaskRequest) GetTaskType() v1.TaskType { + if x != nil { + return x.TaskType + } + return v1.TaskType(0) +} + +type PeerPacket_DestPeer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Destination ip. + Ip string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"` + // Port of grpc service. + RpcPort int32 `protobuf:"varint,2,opt,name=rpc_port,json=rpcPort,proto3" json:"rpc_port,omitempty"` + // Destination peer id. + PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` +} + +func (x *PeerPacket_DestPeer) Reset() { + *x = PeerPacket_DestPeer{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerPacket_DestPeer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerPacket_DestPeer) ProtoMessage() {} + +func (x *PeerPacket_DestPeer) ProtoReflect() protoreflect.Message { + mi := &file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerPacket_DestPeer.ProtoReflect.Descriptor instead. +func (*PeerPacket_DestPeer) Descriptor() ([]byte, []int) { + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *PeerPacket_DestPeer) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *PeerPacket_DestPeer) GetRpcPort() int32 { + if x != nil { + return x.RpcPort + } + return 0 +} + +func (x *PeerPacket_DestPeer) GetPeerId() string { + if x != nil { + return x.PeerId + } + return "" +} + +var File_pkg_apis_scheduler_v1_scheduler_proto protoreflect.FileDescriptor + +var file_pkg_apis_scheduler_v1_scheduler_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, + 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, + 0x65, 0x72, 0x1a, 0x1f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x2b, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x02, 0x0a, 0x0f, 0x50, 0x65, 0x65, 0x72, 0x54, + 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x03, 0x75, 0x72, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x72, 0x03, 0x88, 0x01, + 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x34, 0x0a, 0x08, 0x75, 0x72, 0x6c, 0x5f, 0x6d, 0x65, + 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x55, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, + 0x02, 0x10, 0x01, 0x52, 0x07, 0x75, 0x72, 0x6c, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x07, + 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, + 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x30, + 0x0a, 0x09, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x65, + 0x65, 0x72, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x48, 0x6f, 0x73, 0x74, + 0x12, 0x2d, 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x48, 0x6f, 0x73, + 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x12, + 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, + 0x6e, 0x67, 0x12, 0x29, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x17, 0x0a, + 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0xd5, 0x02, 0x0a, 0x0e, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x2d, 0x0a, 0x09, 0x74, 0x61, 0x73, + 0x6b, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, + 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, + 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x0a, 0x73, 0x69, + 0x7a, 0x65, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x69, 0x7a, 0x65, 0x53, 0x63, 0x6f, 0x70, + 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x09, 0x73, 0x69, 0x7a, + 0x65, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x3b, 0x0a, 0x0c, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, + 0x5f, 0x70, 0x69, 0x65, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, + 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, + 0x69, 0x65, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x69, + 0x65, 0x63, 0x65, 0x12, 0x25, 0x0a, 0x0d, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0c, 0x70, 0x69, + 0x65, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x10, 0x65, 0x78, + 0x74, 0x65, 0x6e, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0f, 0x65, + 0x78, 0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x42, 0x0e, + 0x0a, 0x0c, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x69, 0x65, 0x63, 0x65, 0x22, 0x85, + 0x01, 0x0a, 0x0b, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x69, 0x65, 0x63, 0x65, 0x12, 0x20, + 0x0a, 0x07, 0x64, 0x73, 0x74, 0x5f, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x64, 0x73, 0x74, 0x50, 0x69, 0x64, + 0x12, 0x22, 0x0a, 0x08, 0x64, 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x07, 0x64, 0x73, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x12, 0x30, 0x0a, 0x0a, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x69, 0x6e, + 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x70, 0x69, 0x65, + 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xb0, 0x02, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x48, + 0x6f, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x02, + 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x70, + 0x01, 0x52, 0x02, 0x69, 0x70, 0x12, 0x27, 0x0a, 0x08, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x6f, 0x72, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0c, 0xfa, 0x42, 0x09, 0x1a, 0x07, 0x10, 0xff, + 0xff, 0x03, 0x28, 0x80, 0x08, 0x52, 0x07, 0x72, 0x70, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x29, + 0x0a, 0x09, 0x64, 0x6f, 0x77, 0x6e, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x05, 0x42, 0x0c, 0xfa, 0x42, 0x09, 0x1a, 0x07, 0x10, 0xff, 0xff, 0x03, 0x28, 0x80, 0x08, 0x52, + 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x24, 0x0a, 0x09, 0x68, 0x6f, 0x73, + 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, + 0x04, 0x72, 0x02, 0x68, 0x01, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x6f, 0x6d, 0x61, + 0x69, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, + 0x74, 0x79, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x69, 0x64, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x5f, 0x74, 0x6f, + 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x65, + 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x22, 0xac, 0x03, 0x0a, 0x0b, 0x50, 0x69, + 0x65, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, + 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x73, + 0x72, 0x63, 0x5f, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, + 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x72, 0x63, 0x50, 0x69, 0x64, 0x12, 0x17, 0x0a, + 0x07, 0x64, 0x73, 0x74, 0x5f, 0x70, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x64, 0x73, 0x74, 0x50, 0x69, 0x64, 0x12, 0x30, 0x0a, 0x0a, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, + 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x70, + 0x69, 0x65, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x65, 0x67, 0x69, + 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x62, 0x65, + 0x67, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, + 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x20, 0x0a, 0x04, + 0x63, 0x6f, 0x64, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x2d, + 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x4c, + 0x6f, 0x61, 0x64, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x12, 0x25, 0x0a, + 0x0e, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x10, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x5f, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x22, 0xe8, 0x03, 0x0a, 0x0a, 0x50, 0x65, 0x65, + 0x72, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, + 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x73, 0x72, 0x63, + 0x5f, 0x70, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x06, 0x73, 0x72, 0x63, 0x50, 0x69, 0x64, 0x12, 0x2e, 0x0a, 0x0e, 0x70, + 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, 0x02, 0x28, 0x01, 0x52, 0x0d, 0x70, 0x61, + 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x09, 0x6d, + 0x61, 0x69, 0x6e, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x50, + 0x61, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x44, 0x65, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x08, + 0x6d, 0x61, 0x69, 0x6e, 0x50, 0x65, 0x65, 0x72, 0x12, 0x47, 0x0a, 0x0f, 0x63, 0x61, 0x6e, 0x64, + 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x65, + 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x44, 0x65, 0x73, 0x74, 0x50, 0x65, 0x65, + 0x72, 0x52, 0x0e, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x50, 0x65, 0x65, 0x72, + 0x73, 0x12, 0x20, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x0c, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, + 0x6f, 0x64, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x1a, 0x6e, 0x0a, 0x08, 0x44, 0x65, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x12, + 0x17, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, + 0x72, 0x02, 0x70, 0x01, 0x52, 0x02, 0x69, 0x70, 0x12, 0x27, 0x0a, 0x08, 0x72, 0x70, 0x63, 0x5f, + 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0c, 0xfa, 0x42, 0x09, 0x1a, + 0x07, 0x10, 0xff, 0xff, 0x03, 0x28, 0x80, 0x08, 0x52, 0x07, 0x72, 0x70, 0x63, 0x50, 0x6f, 0x72, + 0x74, 0x12, 0x20, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x70, 0x65, 0x65, + 0x72, 0x49, 0x64, 0x42, 0x0e, 0x0a, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x22, 0xf8, 0x03, 0x0a, 0x0a, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, + 0x73, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, + 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x06, 0x73, 0x72, 0x63, 0x5f, 0x69, 0x70, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x70, 0x01, 0x52, + 0x05, 0x73, 0x72, 0x63, 0x49, 0x70, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, + 0x74, 0x79, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, + 0x10, 0x0a, 0x03, 0x69, 0x64, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, + 0x63, 0x12, 0x1a, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, + 0xfa, 0x42, 0x05, 0x72, 0x03, 0x88, 0x01, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x37, 0x0a, + 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x03, 0x42, 0x10, 0xfa, 0x42, 0x0d, 0x22, 0x0b, 0x28, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, + 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, + 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, + 0x63, 0x6f, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x20, + 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, + 0x12, 0x3c, 0x0a, 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x42, 0x10, 0xfa, 0x42, 0x0d, + 0x1a, 0x0b, 0x28, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x52, 0x0f, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x69, 0x65, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3e, + 0x0a, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, + 0x00, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x0e, + 0x0a, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x50, + 0x0a, 0x0a, 0x50, 0x65, 0x65, 0x72, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x07, + 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, + 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x20, + 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, + 0x22, 0x33, 0x0a, 0x0f, 0x53, 0x74, 0x61, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, + 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x9d, 0x02, 0x0a, 0x04, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x17, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x24, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x54, + 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2e, 0x0a, + 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x28, 0x01, 0x52, 0x0d, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x33, 0x0a, + 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, 0x02, 0x28, + 0x01, 0x52, 0x0f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x69, 0x65, 0x63, 0x65, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x26, 0x0a, 0x0a, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x05, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x09, + 0x70, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x10, 0x68, 0x61, 0x73, + 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x50, 0x65, 0x65, 0x72, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x10, 0x68, 0x61, 0x73, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, + 0x65, 0x50, 0x65, 0x65, 0x72, 0x22, 0xaf, 0x02, 0x0a, 0x13, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, + 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, + 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, + 0x1d, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xfa, 0x42, + 0x08, 0x72, 0x06, 0x88, 0x01, 0x01, 0xd0, 0x01, 0x01, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x34, + 0x0a, 0x08, 0x75, 0x72, 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x55, 0x72, 0x6c, 0x4d, 0x65, 0x74, + 0x61, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x07, 0x75, 0x72, 0x6c, + 0x4d, 0x65, 0x74, 0x61, 0x12, 0x30, 0x0a, 0x09, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x68, 0x6f, 0x73, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, + 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x08, 0x70, 0x65, + 0x65, 0x72, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x0c, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, + 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x0b, 0x70, 0x69, 0x65, + 0x63, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x2d, 0x0a, 0x09, 0x74, 0x61, 0x73, 0x6b, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x74, + 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x32, 0x9e, 0x03, 0x0a, 0x09, 0x53, 0x63, 0x68, 0x65, + 0x64, 0x75, 0x6c, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x10, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x50, 0x65, 0x65, 0x72, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x1a, 0x2e, 0x73, 0x63, 0x68, 0x65, + 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, + 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x46, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x69, 0x65, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, + 0x72, 0x2e, 0x50, 0x69, 0x65, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x1a, 0x15, 0x2e, + 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x50, 0x61, + 0x63, 0x6b, 0x65, 0x74, 0x28, 0x01, 0x30, 0x01, 0x12, 0x41, 0x0a, 0x10, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x15, 0x2e, 0x73, + 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3a, 0x0a, 0x09, 0x4c, + 0x65, 0x61, 0x76, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x15, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, + 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x37, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x74, 0x54, + 0x61, 0x73, 0x6b, 0x12, 0x1a, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, + 0x53, 0x74, 0x61, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x0f, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x54, 0x61, 0x73, 0x6b, + 0x12, 0x46, 0x0a, 0x0c, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, + 0x12, 0x1e, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x6e, + 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x22, 0x5a, 0x20, 0x64, 0x37, 0x79, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, + 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_pkg_apis_scheduler_v1_scheduler_proto_rawDescOnce sync.Once + file_pkg_apis_scheduler_v1_scheduler_proto_rawDescData = file_pkg_apis_scheduler_v1_scheduler_proto_rawDesc +) + +func file_pkg_apis_scheduler_v1_scheduler_proto_rawDescGZIP() []byte { + file_pkg_apis_scheduler_v1_scheduler_proto_rawDescOnce.Do(func() { + file_pkg_apis_scheduler_v1_scheduler_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_apis_scheduler_v1_scheduler_proto_rawDescData) + }) + return file_pkg_apis_scheduler_v1_scheduler_proto_rawDescData +} + +var file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_pkg_apis_scheduler_v1_scheduler_proto_goTypes = []interface{}{ + (*PeerTaskRequest)(nil), // 0: scheduler.PeerTaskRequest + (*RegisterResult)(nil), // 1: scheduler.RegisterResult + (*SinglePiece)(nil), // 2: scheduler.SinglePiece + (*PeerHost)(nil), // 3: scheduler.PeerHost + (*PieceResult)(nil), // 4: scheduler.PieceResult + (*PeerPacket)(nil), // 5: scheduler.PeerPacket + (*PeerResult)(nil), // 6: scheduler.PeerResult + (*PeerTarget)(nil), // 7: scheduler.PeerTarget + (*StatTaskRequest)(nil), // 8: scheduler.StatTaskRequest + (*Task)(nil), // 9: scheduler.Task + (*AnnounceTaskRequest)(nil), // 10: scheduler.AnnounceTaskRequest + (*PeerPacket_DestPeer)(nil), // 11: scheduler.PeerPacket.DestPeer + (*v1.UrlMeta)(nil), // 12: common.UrlMeta + (*v1.HostLoad)(nil), // 13: common.HostLoad + (v1.Pattern)(0), // 14: common.Pattern + (v1.TaskType)(0), // 15: common.TaskType + (v1.SizeScope)(0), // 16: common.SizeScope + (*v1.ExtendAttribute)(nil), // 17: common.ExtendAttribute + (*v1.PieceInfo)(nil), // 18: common.PieceInfo + (v1.Code)(0), // 19: common.Code + (*v11.SourceError)(nil), // 20: errordetails.SourceError + (*v1.PiecePacket)(nil), // 21: common.PiecePacket + (*emptypb.Empty)(nil), // 22: google.protobuf.Empty +} +var file_pkg_apis_scheduler_v1_scheduler_proto_depIdxs = []int32{ + 12, // 0: scheduler.PeerTaskRequest.url_meta:type_name -> common.UrlMeta + 3, // 1: scheduler.PeerTaskRequest.peer_host:type_name -> scheduler.PeerHost + 13, // 2: scheduler.PeerTaskRequest.host_load:type_name -> common.HostLoad + 14, // 3: scheduler.PeerTaskRequest.pattern:type_name -> common.Pattern + 15, // 4: scheduler.RegisterResult.task_type:type_name -> common.TaskType + 16, // 5: scheduler.RegisterResult.size_scope:type_name -> common.SizeScope + 2, // 6: scheduler.RegisterResult.single_piece:type_name -> scheduler.SinglePiece + 17, // 7: scheduler.RegisterResult.extend_attribute:type_name -> common.ExtendAttribute + 18, // 8: scheduler.SinglePiece.piece_info:type_name -> common.PieceInfo + 18, // 9: scheduler.PieceResult.piece_info:type_name -> common.PieceInfo + 19, // 10: scheduler.PieceResult.code:type_name -> common.Code + 13, // 11: scheduler.PieceResult.host_load:type_name -> common.HostLoad + 17, // 12: scheduler.PieceResult.extend_attribute:type_name -> common.ExtendAttribute + 11, // 13: scheduler.PeerPacket.main_peer:type_name -> scheduler.PeerPacket.DestPeer + 11, // 14: scheduler.PeerPacket.candidate_peers:type_name -> scheduler.PeerPacket.DestPeer + 19, // 15: scheduler.PeerPacket.code:type_name -> common.Code + 20, // 16: scheduler.PeerPacket.source_error:type_name -> errordetails.SourceError + 19, // 17: scheduler.PeerResult.code:type_name -> common.Code + 20, // 18: scheduler.PeerResult.source_error:type_name -> errordetails.SourceError + 15, // 19: scheduler.Task.type:type_name -> common.TaskType + 12, // 20: scheduler.AnnounceTaskRequest.url_meta:type_name -> common.UrlMeta + 3, // 21: scheduler.AnnounceTaskRequest.peer_host:type_name -> scheduler.PeerHost + 21, // 22: scheduler.AnnounceTaskRequest.piece_packet:type_name -> common.PiecePacket + 15, // 23: scheduler.AnnounceTaskRequest.task_type:type_name -> common.TaskType + 0, // 24: scheduler.Scheduler.RegisterPeerTask:input_type -> scheduler.PeerTaskRequest + 4, // 25: scheduler.Scheduler.ReportPieceResult:input_type -> scheduler.PieceResult + 6, // 26: scheduler.Scheduler.ReportPeerResult:input_type -> scheduler.PeerResult + 7, // 27: scheduler.Scheduler.LeaveTask:input_type -> scheduler.PeerTarget + 8, // 28: scheduler.Scheduler.StatTask:input_type -> scheduler.StatTaskRequest + 10, // 29: scheduler.Scheduler.AnnounceTask:input_type -> scheduler.AnnounceTaskRequest + 1, // 30: scheduler.Scheduler.RegisterPeerTask:output_type -> scheduler.RegisterResult + 5, // 31: scheduler.Scheduler.ReportPieceResult:output_type -> scheduler.PeerPacket + 22, // 32: scheduler.Scheduler.ReportPeerResult:output_type -> google.protobuf.Empty + 22, // 33: scheduler.Scheduler.LeaveTask:output_type -> google.protobuf.Empty + 9, // 34: scheduler.Scheduler.StatTask:output_type -> scheduler.Task + 22, // 35: scheduler.Scheduler.AnnounceTask:output_type -> google.protobuf.Empty + 30, // [30:36] is the sub-list for method output_type + 24, // [24:30] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] is the sub-list for field type_name +} + +func init() { file_pkg_apis_scheduler_v1_scheduler_proto_init() } +func file_pkg_apis_scheduler_v1_scheduler_proto_init() { + if File_pkg_apis_scheduler_v1_scheduler_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerTaskRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SinglePiece); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerHost); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PieceResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerPacket); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerTarget); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatTaskRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Task); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AnnounceTaskRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerPacket_DestPeer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*RegisterResult_SinglePiece)(nil), + (*RegisterResult_PieceContent)(nil), + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[5].OneofWrappers = []interface{}{ + (*PeerPacket_SourceError)(nil), + } + file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes[6].OneofWrappers = []interface{}{ + (*PeerResult_SourceError)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_pkg_apis_scheduler_v1_scheduler_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_pkg_apis_scheduler_v1_scheduler_proto_goTypes, + DependencyIndexes: file_pkg_apis_scheduler_v1_scheduler_proto_depIdxs, + MessageInfos: file_pkg_apis_scheduler_v1_scheduler_proto_msgTypes, + }.Build() + File_pkg_apis_scheduler_v1_scheduler_proto = out.File + file_pkg_apis_scheduler_v1_scheduler_proto_rawDesc = nil + file_pkg_apis_scheduler_v1_scheduler_proto_goTypes = nil + file_pkg_apis_scheduler_v1_scheduler_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// SchedulerClient is the client API for Scheduler service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SchedulerClient interface { + // RegisterPeerTask registers a peer into task. + RegisterPeerTask(ctx context.Context, in *PeerTaskRequest, opts ...grpc.CallOption) (*RegisterResult, error) + // ReportPieceResult reports piece results and receives peer packets. + ReportPieceResult(ctx context.Context, opts ...grpc.CallOption) (Scheduler_ReportPieceResultClient, error) + // ReportPeerResult reports downloading result for the peer. + ReportPeerResult(ctx context.Context, in *PeerResult, opts ...grpc.CallOption) (*emptypb.Empty, error) + // LeaveTask makes the peer leaving from task. + LeaveTask(ctx context.Context, in *PeerTarget, opts ...grpc.CallOption) (*emptypb.Empty, error) + // Checks if any peer has the given task. + StatTask(ctx context.Context, in *StatTaskRequest, opts ...grpc.CallOption) (*Task, error) + // A peer announces that it has the announced task to other peers. + AnnounceTask(ctx context.Context, in *AnnounceTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) +} + +type schedulerClient struct { + cc grpc.ClientConnInterface +} + +func NewSchedulerClient(cc grpc.ClientConnInterface) SchedulerClient { + return &schedulerClient{cc} +} + +func (c *schedulerClient) RegisterPeerTask(ctx context.Context, in *PeerTaskRequest, opts ...grpc.CallOption) (*RegisterResult, error) { + out := new(RegisterResult) + err := c.cc.Invoke(ctx, "/scheduler.Scheduler/RegisterPeerTask", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *schedulerClient) ReportPieceResult(ctx context.Context, opts ...grpc.CallOption) (Scheduler_ReportPieceResultClient, error) { + stream, err := c.cc.NewStream(ctx, &_Scheduler_serviceDesc.Streams[0], "/scheduler.Scheduler/ReportPieceResult", opts...) + if err != nil { + return nil, err + } + x := &schedulerReportPieceResultClient{stream} + return x, nil +} + +type Scheduler_ReportPieceResultClient interface { + Send(*PieceResult) error + Recv() (*PeerPacket, error) + grpc.ClientStream +} + +type schedulerReportPieceResultClient struct { + grpc.ClientStream +} + +func (x *schedulerReportPieceResultClient) Send(m *PieceResult) error { + return x.ClientStream.SendMsg(m) +} + +func (x *schedulerReportPieceResultClient) Recv() (*PeerPacket, error) { + m := new(PeerPacket) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *schedulerClient) ReportPeerResult(ctx context.Context, in *PeerResult, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/scheduler.Scheduler/ReportPeerResult", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *schedulerClient) LeaveTask(ctx context.Context, in *PeerTarget, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/scheduler.Scheduler/LeaveTask", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *schedulerClient) StatTask(ctx context.Context, in *StatTaskRequest, opts ...grpc.CallOption) (*Task, error) { + out := new(Task) + err := c.cc.Invoke(ctx, "/scheduler.Scheduler/StatTask", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *schedulerClient) AnnounceTask(ctx context.Context, in *AnnounceTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/scheduler.Scheduler/AnnounceTask", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SchedulerServer is the server API for Scheduler service. +type SchedulerServer interface { + // RegisterPeerTask registers a peer into task. + RegisterPeerTask(context.Context, *PeerTaskRequest) (*RegisterResult, error) + // ReportPieceResult reports piece results and receives peer packets. + ReportPieceResult(Scheduler_ReportPieceResultServer) error + // ReportPeerResult reports downloading result for the peer. + ReportPeerResult(context.Context, *PeerResult) (*emptypb.Empty, error) + // LeaveTask makes the peer leaving from task. + LeaveTask(context.Context, *PeerTarget) (*emptypb.Empty, error) + // Checks if any peer has the given task. + StatTask(context.Context, *StatTaskRequest) (*Task, error) + // A peer announces that it has the announced task to other peers. + AnnounceTask(context.Context, *AnnounceTaskRequest) (*emptypb.Empty, error) +} + +// UnimplementedSchedulerServer can be embedded to have forward compatible implementations. +type UnimplementedSchedulerServer struct { +} + +func (*UnimplementedSchedulerServer) RegisterPeerTask(context.Context, *PeerTaskRequest) (*RegisterResult, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterPeerTask not implemented") +} +func (*UnimplementedSchedulerServer) ReportPieceResult(Scheduler_ReportPieceResultServer) error { + return status.Errorf(codes.Unimplemented, "method ReportPieceResult not implemented") +} +func (*UnimplementedSchedulerServer) ReportPeerResult(context.Context, *PeerResult) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReportPeerResult not implemented") +} +func (*UnimplementedSchedulerServer) LeaveTask(context.Context, *PeerTarget) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method LeaveTask not implemented") +} +func (*UnimplementedSchedulerServer) StatTask(context.Context, *StatTaskRequest) (*Task, error) { + return nil, status.Errorf(codes.Unimplemented, "method StatTask not implemented") +} +func (*UnimplementedSchedulerServer) AnnounceTask(context.Context, *AnnounceTaskRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method AnnounceTask not implemented") +} + +func RegisterSchedulerServer(s *grpc.Server, srv SchedulerServer) { + s.RegisterService(&_Scheduler_serviceDesc, srv) +} + +func _Scheduler_RegisterPeerTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PeerTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SchedulerServer).RegisterPeerTask(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/scheduler.Scheduler/RegisterPeerTask", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SchedulerServer).RegisterPeerTask(ctx, req.(*PeerTaskRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Scheduler_ReportPieceResult_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(SchedulerServer).ReportPieceResult(&schedulerReportPieceResultServer{stream}) +} + +type Scheduler_ReportPieceResultServer interface { + Send(*PeerPacket) error + Recv() (*PieceResult, error) + grpc.ServerStream +} + +type schedulerReportPieceResultServer struct { + grpc.ServerStream +} + +func (x *schedulerReportPieceResultServer) Send(m *PeerPacket) error { + return x.ServerStream.SendMsg(m) +} + +func (x *schedulerReportPieceResultServer) Recv() (*PieceResult, error) { + m := new(PieceResult) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Scheduler_ReportPeerResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PeerResult) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SchedulerServer).ReportPeerResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/scheduler.Scheduler/ReportPeerResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SchedulerServer).ReportPeerResult(ctx, req.(*PeerResult)) + } + return interceptor(ctx, in, info, handler) +} + +func _Scheduler_LeaveTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PeerTarget) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SchedulerServer).LeaveTask(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/scheduler.Scheduler/LeaveTask", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SchedulerServer).LeaveTask(ctx, req.(*PeerTarget)) + } + return interceptor(ctx, in, info, handler) +} + +func _Scheduler_StatTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SchedulerServer).StatTask(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/scheduler.Scheduler/StatTask", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SchedulerServer).StatTask(ctx, req.(*StatTaskRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Scheduler_AnnounceTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnnounceTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SchedulerServer).AnnounceTask(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/scheduler.Scheduler/AnnounceTask", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SchedulerServer).AnnounceTask(ctx, req.(*AnnounceTaskRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Scheduler_serviceDesc = grpc.ServiceDesc{ + ServiceName: "scheduler.Scheduler", + HandlerType: (*SchedulerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterPeerTask", + Handler: _Scheduler_RegisterPeerTask_Handler, + }, + { + MethodName: "ReportPeerResult", + Handler: _Scheduler_ReportPeerResult_Handler, + }, + { + MethodName: "LeaveTask", + Handler: _Scheduler_LeaveTask_Handler, + }, + { + MethodName: "StatTask", + Handler: _Scheduler_StatTask_Handler, + }, + { + MethodName: "AnnounceTask", + Handler: _Scheduler_AnnounceTask_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ReportPieceResult", + Handler: _Scheduler_ReportPieceResult_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "pkg/apis/scheduler/v1/scheduler.proto", +} diff --git a/pkg/apis/scheduler/v1/scheduler.pb.validate.go b/pkg/apis/scheduler/v1/scheduler.pb.validate.go new file mode 100644 index 0000000..d634a1e --- /dev/null +++ b/pkg/apis/scheduler/v1/scheduler.pb.validate.go @@ -0,0 +1,2253 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: pkg/apis/scheduler/v1/scheduler.proto + +package v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on PeerTaskRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *PeerTaskRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PeerTaskRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PeerTaskRequestMultiError, or nil if none found. +func (m *PeerTaskRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *PeerTaskRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if uri, err := url.Parse(m.GetUrl()); err != nil { + err = PeerTaskRequestValidationError{ + field: "Url", + reason: "value must be a valid URI", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } else if !uri.IsAbs() { + err := PeerTaskRequestValidationError{ + field: "Url", + reason: "value must be absolute", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetUrlMeta() == nil { + err := PeerTaskRequestValidationError{ + field: "UrlMeta", + reason: "value is required", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetUrlMeta()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PeerTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PeerTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PeerTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if utf8.RuneCountInString(m.GetPeerId()) < 1 { + err := PeerTaskRequestValidationError{ + field: "PeerId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetPeerHost()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PeerTaskRequestValidationError{ + field: "PeerHost", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PeerTaskRequestValidationError{ + field: "PeerHost", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetPeerHost()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PeerTaskRequestValidationError{ + field: "PeerHost", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetHostLoad()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PeerTaskRequestValidationError{ + field: "HostLoad", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PeerTaskRequestValidationError{ + field: "HostLoad", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetHostLoad()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PeerTaskRequestValidationError{ + field: "HostLoad", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for IsMigrating + + // no validation rules for Pattern + + // no validation rules for TaskId + + if len(errors) > 0 { + return PeerTaskRequestMultiError(errors) + } + + return nil +} + +// PeerTaskRequestMultiError is an error wrapping multiple validation errors +// returned by PeerTaskRequest.ValidateAll() if the designated constraints +// aren't met. +type PeerTaskRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PeerTaskRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PeerTaskRequestMultiError) AllErrors() []error { return m } + +// PeerTaskRequestValidationError is the validation error returned by +// PeerTaskRequest.Validate if the designated constraints aren't met. +type PeerTaskRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PeerTaskRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PeerTaskRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PeerTaskRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PeerTaskRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PeerTaskRequestValidationError) ErrorName() string { return "PeerTaskRequestValidationError" } + +// Error satisfies the builtin error interface +func (e PeerTaskRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPeerTaskRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PeerTaskRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PeerTaskRequestValidationError{} + +// Validate checks the field values on RegisterResult with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *RegisterResult) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on RegisterResult with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in RegisterResultMultiError, +// or nil if none found. +func (m *RegisterResult) ValidateAll() error { + return m.validate(true) +} + +func (m *RegisterResult) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for TaskType + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := RegisterResultValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if _, ok := v1.SizeScope_name[int32(m.GetSizeScope())]; !ok { + err := RegisterResultValidationError{ + field: "SizeScope", + reason: "value must be one of the defined enum values", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetExtendAttribute()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RegisterResultValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RegisterResultValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetExtendAttribute()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RegisterResultValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + } + } + } + + switch m.DirectPiece.(type) { + + case *RegisterResult_SinglePiece: + + if all { + switch v := interface{}(m.GetSinglePiece()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, RegisterResultValidationError{ + field: "SinglePiece", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, RegisterResultValidationError{ + field: "SinglePiece", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSinglePiece()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return RegisterResultValidationError{ + field: "SinglePiece", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *RegisterResult_PieceContent: + // no validation rules for PieceContent + + } + + if len(errors) > 0 { + return RegisterResultMultiError(errors) + } + + return nil +} + +// RegisterResultMultiError is an error wrapping multiple validation errors +// returned by RegisterResult.ValidateAll() if the designated constraints +// aren't met. +type RegisterResultMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m RegisterResultMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m RegisterResultMultiError) AllErrors() []error { return m } + +// RegisterResultValidationError is the validation error returned by +// RegisterResult.Validate if the designated constraints aren't met. +type RegisterResultValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e RegisterResultValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e RegisterResultValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e RegisterResultValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e RegisterResultValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e RegisterResultValidationError) ErrorName() string { return "RegisterResultValidationError" } + +// Error satisfies the builtin error interface +func (e RegisterResultValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sRegisterResult.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = RegisterResultValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = RegisterResultValidationError{} + +// Validate checks the field values on SinglePiece with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *SinglePiece) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SinglePiece with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in SinglePieceMultiError, or +// nil if none found. +func (m *SinglePiece) ValidateAll() error { + return m.validate(true) +} + +func (m *SinglePiece) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetDstPid()) < 1 { + err := SinglePieceValidationError{ + field: "DstPid", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetDstAddr()) < 1 { + err := SinglePieceValidationError{ + field: "DstAddr", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetPieceInfo()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SinglePieceValidationError{ + field: "PieceInfo", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SinglePieceValidationError{ + field: "PieceInfo", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetPieceInfo()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SinglePieceValidationError{ + field: "PieceInfo", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return SinglePieceMultiError(errors) + } + + return nil +} + +// SinglePieceMultiError is an error wrapping multiple validation errors +// returned by SinglePiece.ValidateAll() if the designated constraints aren't met. +type SinglePieceMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SinglePieceMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SinglePieceMultiError) AllErrors() []error { return m } + +// SinglePieceValidationError is the validation error returned by +// SinglePiece.Validate if the designated constraints aren't met. +type SinglePieceValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SinglePieceValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SinglePieceValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SinglePieceValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SinglePieceValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SinglePieceValidationError) ErrorName() string { return "SinglePieceValidationError" } + +// Error satisfies the builtin error interface +func (e SinglePieceValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSinglePiece.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SinglePieceValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SinglePieceValidationError{} + +// Validate checks the field values on PeerHost with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *PeerHost) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PeerHost with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in PeerHostMultiError, or nil +// if none found. +func (m *PeerHost) ValidateAll() error { + return m.validate(true) +} + +func (m *PeerHost) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetId()) < 1 { + err := PeerHostValidationError{ + field: "Id", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if ip := net.ParseIP(m.GetIp()); ip == nil { + err := PeerHostValidationError{ + field: "Ip", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + if val := m.GetRpcPort(); val < 1024 || val >= 65535 { + err := PeerHostValidationError{ + field: "RpcPort", + reason: "value must be inside range [1024, 65535)", + } + if !all { + return err + } + errors = append(errors, err) + } + + if val := m.GetDownPort(); val < 1024 || val >= 65535 { + err := PeerHostValidationError{ + field: "DownPort", + reason: "value must be inside range [1024, 65535)", + } + if !all { + return err + } + errors = append(errors, err) + } + + if err := m._validateHostname(m.GetHostName()); err != nil { + err = PeerHostValidationError{ + field: "HostName", + reason: "value must be a valid hostname", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for SecurityDomain + + // no validation rules for Location + + // no validation rules for Idc + + // no validation rules for NetTopology + + if len(errors) > 0 { + return PeerHostMultiError(errors) + } + + return nil +} + +func (m *PeerHost) _validateHostname(host string) error { + s := strings.ToLower(strings.TrimSuffix(host, ".")) + + if len(host) > 253 { + return errors.New("hostname cannot exceed 253 characters") + } + + for _, part := range strings.Split(s, ".") { + if l := len(part); l == 0 || l > 63 { + return errors.New("hostname part must be non-empty and cannot exceed 63 characters") + } + + if part[0] == '-' { + return errors.New("hostname parts cannot begin with hyphens") + } + + if part[len(part)-1] == '-' { + return errors.New("hostname parts cannot end with hyphens") + } + + for _, r := range part { + if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { + return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) + } + } + } + + return nil +} + +// PeerHostMultiError is an error wrapping multiple validation errors returned +// by PeerHost.ValidateAll() if the designated constraints aren't met. +type PeerHostMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PeerHostMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PeerHostMultiError) AllErrors() []error { return m } + +// PeerHostValidationError is the validation error returned by +// PeerHost.Validate if the designated constraints aren't met. +type PeerHostValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PeerHostValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PeerHostValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PeerHostValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PeerHostValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PeerHostValidationError) ErrorName() string { return "PeerHostValidationError" } + +// Error satisfies the builtin error interface +func (e PeerHostValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPeerHost.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PeerHostValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PeerHostValidationError{} + +// Validate checks the field values on PieceResult with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *PieceResult) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PieceResult with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in PieceResultMultiError, or +// nil if none found. +func (m *PieceResult) ValidateAll() error { + return m.validate(true) +} + +func (m *PieceResult) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := PieceResultValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetSrcPid()) < 1 { + err := PieceResultValidationError{ + field: "SrcPid", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for DstPid + + if all { + switch v := interface{}(m.GetPieceInfo()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PieceResultValidationError{ + field: "PieceInfo", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PieceResultValidationError{ + field: "PieceInfo", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetPieceInfo()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PieceResultValidationError{ + field: "PieceInfo", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for BeginTime + + // no validation rules for EndTime + + // no validation rules for Success + + // no validation rules for Code + + if all { + switch v := interface{}(m.GetHostLoad()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PieceResultValidationError{ + field: "HostLoad", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PieceResultValidationError{ + field: "HostLoad", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetHostLoad()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PieceResultValidationError{ + field: "HostLoad", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for FinishedCount + + if all { + switch v := interface{}(m.GetExtendAttribute()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PieceResultValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PieceResultValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetExtendAttribute()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PieceResultValidationError{ + field: "ExtendAttribute", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return PieceResultMultiError(errors) + } + + return nil +} + +// PieceResultMultiError is an error wrapping multiple validation errors +// returned by PieceResult.ValidateAll() if the designated constraints aren't met. +type PieceResultMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PieceResultMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PieceResultMultiError) AllErrors() []error { return m } + +// PieceResultValidationError is the validation error returned by +// PieceResult.Validate if the designated constraints aren't met. +type PieceResultValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PieceResultValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PieceResultValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PieceResultValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PieceResultValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PieceResultValidationError) ErrorName() string { return "PieceResultValidationError" } + +// Error satisfies the builtin error interface +func (e PieceResultValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPieceResult.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PieceResultValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PieceResultValidationError{} + +// Validate checks the field values on PeerPacket with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *PeerPacket) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PeerPacket with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in PeerPacketMultiError, or +// nil if none found. +func (m *PeerPacket) ValidateAll() error { + return m.validate(true) +} + +func (m *PeerPacket) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := PeerPacketValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetSrcPid()) < 1 { + err := PeerPacketValidationError{ + field: "SrcPid", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetParallelCount() < 1 { + err := PeerPacketValidationError{ + field: "ParallelCount", + reason: "value must be greater than or equal to 1", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetMainPeer()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PeerPacketValidationError{ + field: "MainPeer", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PeerPacketValidationError{ + field: "MainPeer", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetMainPeer()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PeerPacketValidationError{ + field: "MainPeer", + reason: "embedded message failed validation", + cause: err, + } + } + } + + for idx, item := range m.GetCandidatePeers() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PeerPacketValidationError{ + field: fmt.Sprintf("CandidatePeers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PeerPacketValidationError{ + field: fmt.Sprintf("CandidatePeers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PeerPacketValidationError{ + field: fmt.Sprintf("CandidatePeers[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + // no validation rules for Code + + switch m.Errordetails.(type) { + + case *PeerPacket_SourceError: + + if all { + switch v := interface{}(m.GetSourceError()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PeerPacketValidationError{ + field: "SourceError", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PeerPacketValidationError{ + field: "SourceError", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSourceError()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PeerPacketValidationError{ + field: "SourceError", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return PeerPacketMultiError(errors) + } + + return nil +} + +// PeerPacketMultiError is an error wrapping multiple validation errors +// returned by PeerPacket.ValidateAll() if the designated constraints aren't met. +type PeerPacketMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PeerPacketMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PeerPacketMultiError) AllErrors() []error { return m } + +// PeerPacketValidationError is the validation error returned by +// PeerPacket.Validate if the designated constraints aren't met. +type PeerPacketValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PeerPacketValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PeerPacketValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PeerPacketValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PeerPacketValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PeerPacketValidationError) ErrorName() string { return "PeerPacketValidationError" } + +// Error satisfies the builtin error interface +func (e PeerPacketValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPeerPacket.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PeerPacketValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PeerPacketValidationError{} + +// Validate checks the field values on PeerResult with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *PeerResult) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PeerResult with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in PeerResultMultiError, or +// nil if none found. +func (m *PeerResult) ValidateAll() error { + return m.validate(true) +} + +func (m *PeerResult) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := PeerResultValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetPeerId()) < 1 { + err := PeerResultValidationError{ + field: "PeerId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if ip := net.ParseIP(m.GetSrcIp()); ip == nil { + err := PeerResultValidationError{ + field: "SrcIp", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for SecurityDomain + + // no validation rules for Idc + + if uri, err := url.Parse(m.GetUrl()); err != nil { + err = PeerResultValidationError{ + field: "Url", + reason: "value must be a valid URI", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } else if !uri.IsAbs() { + err := PeerResultValidationError{ + field: "Url", + reason: "value must be absolute", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetContentLength() < -1 { + err := PeerResultValidationError{ + field: "ContentLength", + reason: "value must be greater than or equal to -1", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for Traffic + + // no validation rules for Cost + + // no validation rules for Success + + // no validation rules for Code + + if m.GetTotalPieceCount() < -1 { + err := PeerResultValidationError{ + field: "TotalPieceCount", + reason: "value must be greater than or equal to -1", + } + if !all { + return err + } + errors = append(errors, err) + } + + switch m.Errordetails.(type) { + + case *PeerResult_SourceError: + + if all { + switch v := interface{}(m.GetSourceError()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PeerResultValidationError{ + field: "SourceError", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PeerResultValidationError{ + field: "SourceError", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSourceError()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PeerResultValidationError{ + field: "SourceError", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return PeerResultMultiError(errors) + } + + return nil +} + +// PeerResultMultiError is an error wrapping multiple validation errors +// returned by PeerResult.ValidateAll() if the designated constraints aren't met. +type PeerResultMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PeerResultMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PeerResultMultiError) AllErrors() []error { return m } + +// PeerResultValidationError is the validation error returned by +// PeerResult.Validate if the designated constraints aren't met. +type PeerResultValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PeerResultValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PeerResultValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PeerResultValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PeerResultValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PeerResultValidationError) ErrorName() string { return "PeerResultValidationError" } + +// Error satisfies the builtin error interface +func (e PeerResultValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPeerResult.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PeerResultValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PeerResultValidationError{} + +// Validate checks the field values on PeerTarget with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *PeerTarget) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PeerTarget with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in PeerTargetMultiError, or +// nil if none found. +func (m *PeerTarget) ValidateAll() error { + return m.validate(true) +} + +func (m *PeerTarget) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := PeerTargetValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetPeerId()) < 1 { + err := PeerTargetValidationError{ + field: "PeerId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return PeerTargetMultiError(errors) + } + + return nil +} + +// PeerTargetMultiError is an error wrapping multiple validation errors +// returned by PeerTarget.ValidateAll() if the designated constraints aren't met. +type PeerTargetMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PeerTargetMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PeerTargetMultiError) AllErrors() []error { return m } + +// PeerTargetValidationError is the validation error returned by +// PeerTarget.Validate if the designated constraints aren't met. +type PeerTargetValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PeerTargetValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PeerTargetValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PeerTargetValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PeerTargetValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PeerTargetValidationError) ErrorName() string { return "PeerTargetValidationError" } + +// Error satisfies the builtin error interface +func (e PeerTargetValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPeerTarget.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PeerTargetValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PeerTargetValidationError{} + +// Validate checks the field values on StatTaskRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *StatTaskRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on StatTaskRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// StatTaskRequestMultiError, or nil if none found. +func (m *StatTaskRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *StatTaskRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := StatTaskRequestValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return StatTaskRequestMultiError(errors) + } + + return nil +} + +// StatTaskRequestMultiError is an error wrapping multiple validation errors +// returned by StatTaskRequest.ValidateAll() if the designated constraints +// aren't met. +type StatTaskRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m StatTaskRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m StatTaskRequestMultiError) AllErrors() []error { return m } + +// StatTaskRequestValidationError is the validation error returned by +// StatTaskRequest.Validate if the designated constraints aren't met. +type StatTaskRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e StatTaskRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e StatTaskRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e StatTaskRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e StatTaskRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e StatTaskRequestValidationError) ErrorName() string { return "StatTaskRequestValidationError" } + +// Error satisfies the builtin error interface +func (e StatTaskRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sStatTaskRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = StatTaskRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = StatTaskRequestValidationError{} + +// Validate checks the field values on Task with the rules defined in the proto +// definition for this message. If any rules are violated, the first error +// encountered is returned, or nil if there are no violations. +func (m *Task) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Task with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in TaskMultiError, or nil if none found. +func (m *Task) ValidateAll() error { + return m.validate(true) +} + +func (m *Task) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetId()) < 1 { + err := TaskValidationError{ + field: "Id", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for Type + + if m.GetContentLength() < 1 { + err := TaskValidationError{ + field: "ContentLength", + reason: "value must be greater than or equal to 1", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetTotalPieceCount() < 1 { + err := TaskValidationError{ + field: "TotalPieceCount", + reason: "value must be greater than or equal to 1", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetState()) < 1 { + err := TaskValidationError{ + field: "State", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetPeerCount() < 0 { + err := TaskValidationError{ + field: "PeerCount", + reason: "value must be greater than or equal to 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + // no validation rules for HasAvailablePeer + + if len(errors) > 0 { + return TaskMultiError(errors) + } + + return nil +} + +// TaskMultiError is an error wrapping multiple validation errors returned by +// Task.ValidateAll() if the designated constraints aren't met. +type TaskMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m TaskMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m TaskMultiError) AllErrors() []error { return m } + +// TaskValidationError is the validation error returned by Task.Validate if the +// designated constraints aren't met. +type TaskValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e TaskValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e TaskValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e TaskValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e TaskValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e TaskValidationError) ErrorName() string { return "TaskValidationError" } + +// Error satisfies the builtin error interface +func (e TaskValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTask.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = TaskValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = TaskValidationError{} + +// Validate checks the field values on AnnounceTaskRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *AnnounceTaskRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on AnnounceTaskRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// AnnounceTaskRequestMultiError, or nil if none found. +func (m *AnnounceTaskRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *AnnounceTaskRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetTaskId()) < 1 { + err := AnnounceTaskRequestValidationError{ + field: "TaskId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if m.GetUrl() != "" { + + if uri, err := url.Parse(m.GetUrl()); err != nil { + err = AnnounceTaskRequestValidationError{ + field: "Url", + reason: "value must be a valid URI", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } else if !uri.IsAbs() { + err := AnnounceTaskRequestValidationError{ + field: "Url", + reason: "value must be absolute", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + + if m.GetUrlMeta() == nil { + err := AnnounceTaskRequestValidationError{ + field: "UrlMeta", + reason: "value is required", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetUrlMeta()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AnnounceTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AnnounceTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUrlMeta()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AnnounceTaskRequestValidationError{ + field: "UrlMeta", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetPeerHost()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AnnounceTaskRequestValidationError{ + field: "PeerHost", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AnnounceTaskRequestValidationError{ + field: "PeerHost", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetPeerHost()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AnnounceTaskRequestValidationError{ + field: "PeerHost", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if m.GetPiecePacket() == nil { + err := AnnounceTaskRequestValidationError{ + field: "PiecePacket", + reason: "value is required", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetPiecePacket()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AnnounceTaskRequestValidationError{ + field: "PiecePacket", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AnnounceTaskRequestValidationError{ + field: "PiecePacket", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetPiecePacket()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AnnounceTaskRequestValidationError{ + field: "PiecePacket", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for TaskType + + if len(errors) > 0 { + return AnnounceTaskRequestMultiError(errors) + } + + return nil +} + +// AnnounceTaskRequestMultiError is an error wrapping multiple validation +// errors returned by AnnounceTaskRequest.ValidateAll() if the designated +// constraints aren't met. +type AnnounceTaskRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AnnounceTaskRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m AnnounceTaskRequestMultiError) AllErrors() []error { return m } + +// AnnounceTaskRequestValidationError is the validation error returned by +// AnnounceTaskRequest.Validate if the designated constraints aren't met. +type AnnounceTaskRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AnnounceTaskRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AnnounceTaskRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AnnounceTaskRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AnnounceTaskRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AnnounceTaskRequestValidationError) ErrorName() string { + return "AnnounceTaskRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e AnnounceTaskRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAnnounceTaskRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AnnounceTaskRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AnnounceTaskRequestValidationError{} + +// Validate checks the field values on PeerPacket_DestPeer with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *PeerPacket_DestPeer) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on PeerPacket_DestPeer with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// PeerPacket_DestPeerMultiError, or nil if none found. +func (m *PeerPacket_DestPeer) ValidateAll() error { + return m.validate(true) +} + +func (m *PeerPacket_DestPeer) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if ip := net.ParseIP(m.GetIp()); ip == nil { + err := PeerPacket_DestPeerValidationError{ + field: "Ip", + reason: "value must be a valid IP address", + } + if !all { + return err + } + errors = append(errors, err) + } + + if val := m.GetRpcPort(); val < 1024 || val >= 65535 { + err := PeerPacket_DestPeerValidationError{ + field: "RpcPort", + reason: "value must be inside range [1024, 65535)", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetPeerId()) < 1 { + err := PeerPacket_DestPeerValidationError{ + field: "PeerId", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return PeerPacket_DestPeerMultiError(errors) + } + + return nil +} + +// PeerPacket_DestPeerMultiError is an error wrapping multiple validation +// errors returned by PeerPacket_DestPeer.ValidateAll() if the designated +// constraints aren't met. +type PeerPacket_DestPeerMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PeerPacket_DestPeerMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PeerPacket_DestPeerMultiError) AllErrors() []error { return m } + +// PeerPacket_DestPeerValidationError is the validation error returned by +// PeerPacket_DestPeer.Validate if the designated constraints aren't met. +type PeerPacket_DestPeerValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PeerPacket_DestPeerValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PeerPacket_DestPeerValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PeerPacket_DestPeerValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PeerPacket_DestPeerValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PeerPacket_DestPeerValidationError) ErrorName() string { + return "PeerPacket_DestPeerValidationError" +} + +// Error satisfies the builtin error interface +func (e PeerPacket_DestPeerValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPeerPacket_DestPeer.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PeerPacket_DestPeerValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PeerPacket_DestPeerValidationError{}