Bump grpc to v1.50.1
Signed-off-by: Luca Comellini <luca.com@gmail.com>
This commit is contained in:
parent
6948d89e56
commit
ab194e65f9
9
go.mod
9
go.mod
@ -30,7 +30,7 @@ require (
|
|||||||
github.com/docker/go-units v0.4.0
|
github.com/docker/go-units v0.4.0
|
||||||
github.com/emicklei/go-restful/v3 v3.8.0
|
github.com/emicklei/go-restful/v3 v3.8.0
|
||||||
github.com/fsnotify/fsnotify v1.5.1
|
github.com/fsnotify/fsnotify v1.5.1
|
||||||
github.com/google/go-cmp v0.5.8
|
github.com/google/go-cmp v0.5.9
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
||||||
@ -65,9 +65,9 @@ require (
|
|||||||
go.opentelemetry.io/otel/trace v1.7.0
|
go.opentelemetry.io/otel/trace v1.7.0
|
||||||
golang.org/x/sync v0.1.0
|
golang.org/x/sync v0.1.0
|
||||||
golang.org/x/sys v0.1.0
|
golang.org/x/sys v0.1.0
|
||||||
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21
|
google.golang.org/genproto v0.0.0-20221107162902-2d387536bcdd
|
||||||
google.golang.org/grpc v1.47.0
|
google.golang.org/grpc v1.50.1
|
||||||
google.golang.org/protobuf v1.28.0
|
google.golang.org/protobuf v1.28.1
|
||||||
k8s.io/api v0.25.3
|
k8s.io/api v0.25.3
|
||||||
k8s.io/apimachinery v0.25.3
|
k8s.io/apimachinery v0.25.3
|
||||||
k8s.io/apiserver v0.25.3
|
k8s.io/apiserver v0.25.3
|
||||||
@ -79,6 +79,7 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
cloud.google.com/go/compute/metadata v0.2.1 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/blang/semver v3.5.1+incompatible // indirect
|
github.com/blang/semver v3.5.1+incompatible // indirect
|
||||||
github.com/blang/semver/v4 v4.0.0 // indirect
|
github.com/blang/semver/v4 v4.0.0 // indirect
|
||||||
|
20
go.sum
20
go.sum
@ -20,13 +20,16 @@ cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmW
|
|||||||
cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
|
cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
|
||||||
cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
|
cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
|
||||||
cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
|
cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
|
||||||
cloud.google.com/go v0.97.0 h1:3DXvAyifywvq64LfkKaMOmkWPS1CikIQdMe2lY9vxU8=
|
cloud.google.com/go v0.105.0 h1:DNtEKRBAAzeS4KyIory52wWHuClNaXJ5x1F7xa4q+5Y=
|
||||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
||||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
||||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||||
|
cloud.google.com/go/compute v1.12.1 h1:gKVJMEyqV5c/UnpzjjQbo3Rjvvqpr9B1DFSbJC4OXr0=
|
||||||
|
cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48=
|
||||||
|
cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM=
|
||||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||||
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
||||||
@ -502,8 +505,8 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||||||
github.com/google/go-cmp v0.5.5/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/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
||||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0=
|
github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
@ -1440,8 +1443,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH
|
|||||||
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||||
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 h1:hrbNEivu7Zn1pxvHk6MBrq9iE22woVILTHqexqBxe6I=
|
google.golang.org/genproto v0.0.0-20221107162902-2d387536bcdd h1:1eV6KuDTxraYYsYGWksp1thEGP+8dtX/TINL9h+ppiI=
|
||||||
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
|
google.golang.org/genproto v0.0.0-20221107162902-2d387536bcdd/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
|
||||||
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||||
@ -1471,8 +1474,8 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K
|
|||||||
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||||
google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8=
|
google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY=
|
||||||
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
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-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 v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
@ -1486,8 +1489,9 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
|
|||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
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.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
|
||||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
|
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/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
|
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
@ -38,7 +38,7 @@ require (
|
|||||||
github.com/godbus/dbus/v5 v5.0.6 // indirect
|
github.com/godbus/dbus/v5 v5.0.6 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/google/go-cmp v0.5.8 // indirect
|
github.com/google/go-cmp v0.5.9 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
github.com/imdario/mergo v0.3.12 // indirect
|
github.com/imdario/mergo v0.3.12 // indirect
|
||||||
github.com/klauspost/compress v1.15.9 // indirect
|
github.com/klauspost/compress v1.15.9 // indirect
|
||||||
@ -59,9 +59,9 @@ require (
|
|||||||
golang.org/x/sync v0.1.0 // indirect
|
golang.org/x/sync v0.1.0 // indirect
|
||||||
golang.org/x/text v0.4.0 // indirect
|
golang.org/x/text v0.4.0 // indirect
|
||||||
golang.org/x/tools v0.2.0 // indirect
|
golang.org/x/tools v0.2.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
|
google.golang.org/genproto v0.0.0-20221107162902-2d387536bcdd // indirect
|
||||||
google.golang.org/grpc v1.47.0 // indirect
|
google.golang.org/grpc v1.50.1 // indirect
|
||||||
google.golang.org/protobuf v1.28.0 // indirect
|
google.golang.org/protobuf v1.28.1 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,24 +26,341 @@ cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aD
|
|||||||
cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
|
cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
|
||||||
cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4=
|
cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4=
|
||||||
cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc=
|
cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc=
|
||||||
|
cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA=
|
||||||
|
cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A=
|
||||||
|
cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc=
|
||||||
|
cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU=
|
||||||
|
cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA=
|
||||||
|
cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM=
|
||||||
|
cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4=
|
||||||
|
cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw=
|
||||||
|
cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp+CE8dkrszb4oK9CWyvD4o=
|
||||||
|
cloud.google.com/go/accesscontextmanager v1.4.0/go.mod h1:/Kjh7BBu/Gh83sv+K60vN9QE5NJcd80sU33vIe2IFPE=
|
||||||
|
cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw=
|
||||||
|
cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY=
|
||||||
|
cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI=
|
||||||
|
cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4=
|
||||||
|
cloud.google.com/go/apigateway v1.3.0/go.mod h1:89Z8Bhpmxu6AmUxuVRg/ECRGReEdiP3vQtk4Z1J9rJk=
|
||||||
|
cloud.google.com/go/apigateway v1.4.0/go.mod h1:pHVY9MKGaH9PQ3pJ4YLzoj6U5FUDeDFBllIz7WmzJoc=
|
||||||
|
cloud.google.com/go/apigeeconnect v1.3.0/go.mod h1:G/AwXFAKo0gIXkPTVfZDd2qA1TxBXJ3MgMRBQkIi9jc=
|
||||||
|
cloud.google.com/go/apigeeconnect v1.4.0/go.mod h1:kV4NwOKqjvt2JYR0AoIWo2QGfoRtn/pkS3QlHp0Ni04=
|
||||||
|
cloud.google.com/go/appengine v1.4.0/go.mod h1:CS2NhuBuDXM9f+qscZ6V86m1MIIqPj3WC/UoEuR1Sno=
|
||||||
|
cloud.google.com/go/appengine v1.5.0/go.mod h1:TfasSozdkFI0zeoxW3PTBLiNqRmzraodCWatWI9Dmak=
|
||||||
|
cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4=
|
||||||
|
cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0=
|
||||||
|
cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ=
|
||||||
|
cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk=
|
||||||
|
cloud.google.com/go/artifactregistry v1.8.0/go.mod h1:w3GQXkJX8hiKN0v+at4b0qotwijQbYUqF2GWkZzAhC0=
|
||||||
|
cloud.google.com/go/artifactregistry v1.9.0/go.mod h1:2K2RqvA2CYvAeARHRkLDhMDJ3OXy26h3XW+3/Jh2uYc=
|
||||||
|
cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o=
|
||||||
|
cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s=
|
||||||
|
cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0=
|
||||||
|
cloud.google.com/go/asset v1.9.0/go.mod h1:83MOE6jEJBMqFKadM9NLRcs80Gdw76qGuHn8m3h8oHQ=
|
||||||
|
cloud.google.com/go/asset v1.10.0/go.mod h1:pLz7uokL80qKhzKr4xXGvBQXnzHn5evJAEAtZiIb0wY=
|
||||||
|
cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY=
|
||||||
|
cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw=
|
||||||
|
cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI=
|
||||||
|
cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo=
|
||||||
|
cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0=
|
||||||
|
cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0=
|
||||||
|
cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8=
|
||||||
|
cloud.google.com/go/automl v1.7.0/go.mod h1:RL9MYCCsJEOmt0Wf3z9uzG0a7adTT1fe+aObgSpkCt8=
|
||||||
|
cloud.google.com/go/automl v1.8.0/go.mod h1:xWx7G/aPEe/NP+qzYXktoBSDfjO+vnKMGgsApGJJquM=
|
||||||
|
cloud.google.com/go/baremetalsolution v0.3.0/go.mod h1:XOrocE+pvK1xFfleEnShBlNAXf+j5blPPxrhjKgnIFc=
|
||||||
|
cloud.google.com/go/baremetalsolution v0.4.0/go.mod h1:BymplhAadOO/eBa7KewQ0Ppg4A4Wplbn+PsFKRLo0uI=
|
||||||
|
cloud.google.com/go/batch v0.3.0/go.mod h1:TR18ZoAekj1GuirsUsR1ZTKN3FC/4UDnScjT8NXImFE=
|
||||||
|
cloud.google.com/go/batch v0.4.0/go.mod h1:WZkHnP43R/QCGQsZ+0JyG4i79ranE2u8xvjq/9+STPE=
|
||||||
|
cloud.google.com/go/beyondcorp v0.2.0/go.mod h1:TB7Bd+EEtcw9PCPQhCJtJGjk/7TC6ckmnSFS+xwTfm4=
|
||||||
|
cloud.google.com/go/beyondcorp v0.3.0/go.mod h1:E5U5lcrcXMsCuoDNyGrpyTm/hn7ne941Jz2vmksAxW8=
|
||||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
||||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
||||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||||
|
cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA=
|
||||||
|
cloud.google.com/go/bigquery v1.43.0/go.mod h1:ZMQcXHsl+xmU1z36G2jNGZmKp9zNY5BUua5wDgmNCfw=
|
||||||
|
cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY=
|
||||||
|
cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s=
|
||||||
|
cloud.google.com/go/billing v1.6.0/go.mod h1:WoXzguj+BeHXPbKfNWkqVtDdzORazmCjraY+vrxcyvI=
|
||||||
|
cloud.google.com/go/billing v1.7.0/go.mod h1:q457N3Hbj9lYwwRbnlD7vUpyjq6u5U1RAOArInEiD5Y=
|
||||||
|
cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM=
|
||||||
|
cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI=
|
||||||
|
cloud.google.com/go/binaryauthorization v1.3.0/go.mod h1:lRZbKgjDIIQvzYQS1p99A7/U1JqvqeZg0wiI5tp6tg0=
|
||||||
|
cloud.google.com/go/binaryauthorization v1.4.0/go.mod h1:tsSPQrBd77VLplV70GUhBf/Zm3FsKmgSqgm4UmiDItk=
|
||||||
|
cloud.google.com/go/certificatemanager v1.3.0/go.mod h1:n6twGDvcUBFu9uBgt4eYvvf3sQ6My8jADcOVwHmzadg=
|
||||||
|
cloud.google.com/go/certificatemanager v1.4.0/go.mod h1:vowpercVFyqs8ABSmrdV+GiFf2H/ch3KyudYQEMM590=
|
||||||
|
cloud.google.com/go/channel v1.8.0/go.mod h1:W5SwCXDJsq/rg3tn3oG0LOxpAo6IMxNa09ngphpSlnk=
|
||||||
|
cloud.google.com/go/channel v1.9.0/go.mod h1:jcu05W0my9Vx4mt3/rEHpfxc9eKi9XwsdDL8yBMbKUk=
|
||||||
|
cloud.google.com/go/cloudbuild v1.3.0/go.mod h1:WequR4ULxlqvMsjDEEEFnOG5ZSRSgWOywXYDb1vPE6U=
|
||||||
|
cloud.google.com/go/cloudbuild v1.4.0/go.mod h1:5Qwa40LHiOXmz3386FrjrYM93rM/hdRr7b53sySrTqA=
|
||||||
|
cloud.google.com/go/clouddms v1.3.0/go.mod h1:oK6XsCDdW4Ib3jCCBugx+gVjevp2TMXFtgxvPSee3OM=
|
||||||
|
cloud.google.com/go/clouddms v1.4.0/go.mod h1:Eh7sUGCC+aKry14O1NRljhjyrr0NFC0G2cjwX0cByRk=
|
||||||
|
cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY=
|
||||||
|
cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI=
|
||||||
|
cloud.google.com/go/cloudtasks v1.7.0/go.mod h1:ImsfdYWwlWNJbdgPIIGJWC+gemEGTBK/SunNQQNCAb4=
|
||||||
|
cloud.google.com/go/cloudtasks v1.8.0/go.mod h1:gQXUIwCSOI4yPVK7DgTVFiiP0ZW/eQkydWzwVMdHxrI=
|
||||||
|
cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow=
|
||||||
|
cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM=
|
||||||
|
cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M=
|
||||||
|
cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s=
|
||||||
|
cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU=
|
||||||
|
cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U=
|
||||||
|
cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU=
|
||||||
|
cloud.google.com/go/compute v1.12.0/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU=
|
||||||
|
cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU=
|
||||||
|
cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU=
|
||||||
|
cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM=
|
||||||
|
cloud.google.com/go/contactcenterinsights v1.3.0/go.mod h1:Eu2oemoePuEFc/xKFPjbTuPSj0fYJcPls9TFlPNnHHY=
|
||||||
|
cloud.google.com/go/contactcenterinsights v1.4.0/go.mod h1:L2YzkGbPsv+vMQMCADxJoT9YiTTnSEd6fEvCeHTYVck=
|
||||||
|
cloud.google.com/go/container v1.6.0/go.mod h1:Xazp7GjJSeUYo688S+6J5V+n/t+G5sKBTFkKNudGRxg=
|
||||||
|
cloud.google.com/go/container v1.7.0/go.mod h1:Dp5AHtmothHGX3DwwIHPgq45Y8KmNsgN3amoYfxVkLo=
|
||||||
|
cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I=
|
||||||
|
cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4=
|
||||||
|
cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0=
|
||||||
|
cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs=
|
||||||
|
cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc=
|
||||||
|
cloud.google.com/go/datacatalog v1.7.0/go.mod h1:9mEl4AuDYWw81UGc41HonIHH7/sn52H0/tc8f8ZbZIE=
|
||||||
|
cloud.google.com/go/datacatalog v1.8.0/go.mod h1:KYuoVOv9BM8EYz/4eMFxrr4DUKhGIOXxZoKYF5wdISM=
|
||||||
|
cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM=
|
||||||
|
cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ=
|
||||||
|
cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo=
|
||||||
|
cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE=
|
||||||
|
cloud.google.com/go/dataform v0.5.0/go.mod h1:GFUYRe8IBa2hcomWplodVmUx/iTL0FrsauObOM3Ipr0=
|
||||||
|
cloud.google.com/go/datafusion v1.4.0/go.mod h1:1Zb6VN+W6ALo85cXnM1IKiPw+yQMKMhB9TsTSRDo/38=
|
||||||
|
cloud.google.com/go/datafusion v1.5.0/go.mod h1:Kz+l1FGHB0J+4XF2fud96WMmRiq/wj8N9u007vyXZ2w=
|
||||||
|
cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I=
|
||||||
|
cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ=
|
||||||
|
cloud.google.com/go/dataplex v1.3.0/go.mod h1:hQuRtDg+fCiFgC8j0zV222HvzFQdRd+SVX8gdmFcZzA=
|
||||||
|
cloud.google.com/go/dataplex v1.4.0/go.mod h1:X51GfLXEMVJ6UN47ESVqvlsRplbLhcsAt0kZCCKsU0A=
|
||||||
|
cloud.google.com/go/dataproc v1.7.0/go.mod h1:CKAlMjII9H90RXaMpSxQ8EU6dQx6iAYNPcYPOkSbi8s=
|
||||||
|
cloud.google.com/go/dataproc v1.8.0/go.mod h1:5OW+zNAH0pMpw14JVrPONsxMQYMBqJuzORhIBfBn9uI=
|
||||||
|
cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo=
|
||||||
|
cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA=
|
||||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||||
|
cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo=
|
||||||
|
cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ=
|
||||||
|
cloud.google.com/go/datastream v1.4.0/go.mod h1:h9dpzScPhDTs5noEMQVWP8Wx8AFBRyS0s8KWPx/9r0g=
|
||||||
|
cloud.google.com/go/datastream v1.5.0/go.mod h1:6TZMMNPwjUqZHBKPQ1wwXpb0d5VDVPl2/XoS5yi88q4=
|
||||||
|
cloud.google.com/go/deploy v1.4.0/go.mod h1:5Xghikd4VrmMLNaF6FiRFDlHb59VM59YoDQnOUdsH/c=
|
||||||
|
cloud.google.com/go/deploy v1.5.0/go.mod h1:ffgdD0B89tToyW/U/D2eL0jN2+IEV/3EMuXHA0l4r+s=
|
||||||
|
cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4=
|
||||||
|
cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0=
|
||||||
|
cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8=
|
||||||
|
cloud.google.com/go/dialogflow v1.18.0/go.mod h1:trO7Zu5YdyEuR+BhSNOqJezyFQ3aUzz0njv7sMx/iek=
|
||||||
|
cloud.google.com/go/dialogflow v1.19.0/go.mod h1:JVmlG1TwykZDtxtTXujec4tQ+D8SBFMoosgy+6Gn0s0=
|
||||||
|
cloud.google.com/go/dlp v1.6.0/go.mod h1:9eyB2xIhpU0sVwUixfBubDoRwP+GjeUoxxeueZmqvmM=
|
||||||
|
cloud.google.com/go/dlp v1.7.0/go.mod h1:68ak9vCiMBjbasxeVD17hVPxDEck+ExiHavX8kiHG+Q=
|
||||||
|
cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU=
|
||||||
|
cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU=
|
||||||
|
cloud.google.com/go/documentai v1.9.0/go.mod h1:FS5485S8R00U10GhgBC0aNGrJxBP8ZVpEeJ7PQDZd6k=
|
||||||
|
cloud.google.com/go/documentai v1.10.0/go.mod h1:vod47hKQIPeCfN2QS/jULIvQTugbmdc0ZvxxfQY1bg4=
|
||||||
|
cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y=
|
||||||
|
cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg=
|
||||||
|
cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk=
|
||||||
|
cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w=
|
||||||
|
cloud.google.com/go/essentialcontacts v1.3.0/go.mod h1:r+OnHa5jfj90qIfZDO/VztSFqbQan7HV75p8sA+mdGI=
|
||||||
|
cloud.google.com/go/essentialcontacts v1.4.0/go.mod h1:8tRldvHYsmnBCHdFpvU+GL75oWiBKl80BiqlFh9tp+8=
|
||||||
|
cloud.google.com/go/eventarc v1.7.0/go.mod h1:6ctpF3zTnaQCxUjHUdcfgcA1A2T309+omHZth7gDfmc=
|
||||||
|
cloud.google.com/go/eventarc v1.8.0/go.mod h1:imbzxkyAU4ubfsaKYdQg04WS1NvncblHEup4kvF+4gw=
|
||||||
|
cloud.google.com/go/filestore v1.3.0/go.mod h1:+qbvHGvXU1HaKX2nD0WEPo92TP/8AQuCVEBXNY9z0+w=
|
||||||
|
cloud.google.com/go/filestore v1.4.0/go.mod h1:PaG5oDfo9r224f8OYXURtAsY+Fbyq/bLYoINEK8XQAI=
|
||||||
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
||||||
|
cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk=
|
||||||
|
cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg=
|
||||||
|
cloud.google.com/go/functions v1.8.0/go.mod h1:RTZ4/HsQjIqIYP9a9YPbU+QFoQsAlYgrwOXJWHn1POY=
|
||||||
|
cloud.google.com/go/functions v1.9.0/go.mod h1:Y+Dz8yGguzO3PpIjhLTbnqV1CWmgQ5UwtlpzoyquQ08=
|
||||||
|
cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM=
|
||||||
|
cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA=
|
||||||
|
cloud.google.com/go/gaming v1.7.0/go.mod h1:LrB8U7MHdGgFG851iHAfqUdLcKBdQ55hzXy9xBJz0+w=
|
||||||
|
cloud.google.com/go/gaming v1.8.0/go.mod h1:xAqjS8b7jAVW0KFYeRUxngo9My3f33kFmua++Pi+ggM=
|
||||||
|
cloud.google.com/go/gkebackup v0.2.0/go.mod h1:XKvv/4LfG829/B8B7xRkk8zRrOEbKtEam6yNfuQNH60=
|
||||||
|
cloud.google.com/go/gkebackup v0.3.0/go.mod h1:n/E671i1aOQvUxT541aTkCwExO/bTer2HDlj4TsBRAo=
|
||||||
|
cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o=
|
||||||
|
cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A=
|
||||||
|
cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0=
|
||||||
|
cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0=
|
||||||
|
cloud.google.com/go/gkemulticloud v0.3.0/go.mod h1:7orzy7O0S+5kq95e4Hpn7RysVA7dPs8W/GgfUtsPbrA=
|
||||||
|
cloud.google.com/go/gkemulticloud v0.4.0/go.mod h1:E9gxVBnseLWCk24ch+P9+B2CoDFJZTyIgLKSalC7tuI=
|
||||||
|
cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc=
|
||||||
|
cloud.google.com/go/gsuiteaddons v1.3.0/go.mod h1:EUNK/J1lZEZO8yPtykKxLXI6JSVN2rg9bN8SXOa0bgM=
|
||||||
|
cloud.google.com/go/gsuiteaddons v1.4.0/go.mod h1:rZK5I8hht7u7HxFQcFei0+AtfS9uSushomRlg+3ua1o=
|
||||||
|
cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY=
|
||||||
|
cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc=
|
||||||
|
cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc=
|
||||||
|
cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg=
|
||||||
|
cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc=
|
||||||
|
cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A=
|
||||||
|
cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM=
|
||||||
|
cloud.google.com/go/ids v1.2.0/go.mod h1:5WXvp4n25S0rA/mQWAg1YEEBBq6/s+7ml1RDCW1IrcY=
|
||||||
|
cloud.google.com/go/iot v1.3.0/go.mod h1:r7RGh2B61+B8oz0AGE+J72AhA0G7tdXItODWsaA2oLs=
|
||||||
|
cloud.google.com/go/iot v1.4.0/go.mod h1:dIDxPOn0UvNDUMD8Ger7FIaTuvMkj+aGk94RPP0iV+g=
|
||||||
|
cloud.google.com/go/kms v1.5.0/go.mod h1:QJS2YY0eJGBg3mnDfuaCyLauWwBJiHRboYxJ++1xJNg=
|
||||||
|
cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6OgjA0=
|
||||||
|
cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic=
|
||||||
|
cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI=
|
||||||
|
cloud.google.com/go/language v1.7.0/go.mod h1:DJ6dYN/W+SQOjF8e1hLQXMF21AkH2w9wiPzPCJa2MIE=
|
||||||
|
cloud.google.com/go/language v1.8.0/go.mod h1:qYPVHf7SPoNNiCL2Dr0FfEFNil1qi3pQEyygwpgVKB8=
|
||||||
|
cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8=
|
||||||
|
cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08=
|
||||||
|
cloud.google.com/go/longrunning v0.1.1/go.mod h1:UUFxuDWkv22EuY93jjmDMFT5GPQKeFVJBIF6QlTqdsE=
|
||||||
|
cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc=
|
||||||
|
cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE=
|
||||||
|
cloud.google.com/go/managedidentities v1.4.0/go.mod h1:NWSBYbEMgqmbZsLIyKvxrYbtqOsxY1ZrGM+9RgDqInM=
|
||||||
|
cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4=
|
||||||
|
cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w=
|
||||||
|
cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE=
|
||||||
|
cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM=
|
||||||
|
cloud.google.com/go/memcache v1.6.0/go.mod h1:XS5xB0eQZdHtTuTF9Hf8eJkKtR3pVRCcvJwtm68T3rA=
|
||||||
|
cloud.google.com/go/memcache v1.7.0/go.mod h1:ywMKfjWhNtkQTxrWxCkCFkoPjLHPW6A7WOTVI8xy3LY=
|
||||||
|
cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY=
|
||||||
|
cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s=
|
||||||
|
cloud.google.com/go/metastore v1.7.0/go.mod h1:s45D0B4IlsINu87/AsWiEVYbLaIMeUSoxlKKDqBGFS8=
|
||||||
|
cloud.google.com/go/metastore v1.8.0/go.mod h1:zHiMc4ZUpBiM7twCIFQmJ9JMEkDSyZS9U12uf7wHqSI=
|
||||||
|
cloud.google.com/go/monitoring v1.7.0/go.mod h1:HpYse6kkGo//7p6sT0wsIC6IBDET0RhIsnmlA53dvEk=
|
||||||
|
cloud.google.com/go/monitoring v1.8.0/go.mod h1:E7PtoMJ1kQXWxPjB6mv2fhC5/15jInuulFdYYtlcvT4=
|
||||||
|
cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA=
|
||||||
|
cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o=
|
||||||
|
cloud.google.com/go/networkconnectivity v1.6.0/go.mod h1:OJOoEXW+0LAxHh89nXd64uGG+FbQoeH8DtxCHVOMlaM=
|
||||||
|
cloud.google.com/go/networkconnectivity v1.7.0/go.mod h1:RMuSbkdbPwNMQjB5HBWD5MpTBnNm39iAVpC3TmsExt8=
|
||||||
|
cloud.google.com/go/networkmanagement v1.4.0/go.mod h1:Q9mdLLRn60AsOrPc8rs8iNV6OHXaGcDdsIQe1ohekq8=
|
||||||
|
cloud.google.com/go/networkmanagement v1.5.0/go.mod h1:ZnOeZ/evzUdUsnvRt792H0uYEnHQEMaz+REhhzJRcf4=
|
||||||
|
cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ=
|
||||||
|
cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU=
|
||||||
|
cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY=
|
||||||
|
cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34=
|
||||||
|
cloud.google.com/go/notebooks v1.4.0/go.mod h1:4QPMngcwmgb6uw7Po99B2xv5ufVoIQ7nOGDyL4P8AgA=
|
||||||
|
cloud.google.com/go/notebooks v1.5.0/go.mod h1:q8mwhnP9aR8Hpfnrc5iN5IBhrXUy8S2vuYs+kBJ/gu0=
|
||||||
|
cloud.google.com/go/optimization v1.1.0/go.mod h1:5po+wfvX5AQlPznyVEZjGJTMr4+CAkJf2XSTQOOl9l4=
|
||||||
|
cloud.google.com/go/optimization v1.2.0/go.mod h1:Lr7SOHdRDENsh+WXVmQhQTrzdu9ybg0NecjHidBq6xs=
|
||||||
|
cloud.google.com/go/orchestration v1.3.0/go.mod h1:Sj5tq/JpWiB//X/q3Ngwdl5K7B7Y0KZ7bfv0wL6fqVA=
|
||||||
|
cloud.google.com/go/orchestration v1.4.0/go.mod h1:6W5NLFWs2TlniBphAViZEVhrXRSMgUGDfW7vrWKvsBk=
|
||||||
|
cloud.google.com/go/orgpolicy v1.4.0/go.mod h1:xrSLIV4RePWmP9P3tBl8S93lTmlAxjm06NSm2UTmKvE=
|
||||||
|
cloud.google.com/go/orgpolicy v1.5.0/go.mod h1:hZEc5q3wzwXJaKrsx5+Ewg0u1LxJ51nNFlext7Tanwc=
|
||||||
|
cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs=
|
||||||
|
cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg=
|
||||||
|
cloud.google.com/go/osconfig v1.9.0/go.mod h1:Yx+IeIZJ3bdWmzbQU4fxNl8xsZ4amB+dygAwFPlvnNo=
|
||||||
|
cloud.google.com/go/osconfig v1.10.0/go.mod h1:uMhCzqC5I8zfD9zDEAfvgVhDS8oIjySWh+l4WK6GnWw=
|
||||||
|
cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E=
|
||||||
|
cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU=
|
||||||
|
cloud.google.com/go/oslogin v1.6.0/go.mod h1:zOJ1O3+dTU8WPlGEkFSh7qeHPPSoxrcMbbK1Nm2iX70=
|
||||||
|
cloud.google.com/go/oslogin v1.7.0/go.mod h1:e04SN0xO1UNJ1M5GP0vzVBFicIe4O53FOfcixIqTyXo=
|
||||||
|
cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0=
|
||||||
|
cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA=
|
||||||
|
cloud.google.com/go/policytroubleshooter v1.3.0/go.mod h1:qy0+VwANja+kKrjlQuOzmlvscn4RNsAc0e15GGqfMxg=
|
||||||
|
cloud.google.com/go/policytroubleshooter v1.4.0/go.mod h1:DZT4BcRw3QoO8ota9xw/LKtPa8lKeCByYeKTIf/vxdE=
|
||||||
|
cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0=
|
||||||
|
cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI=
|
||||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||||
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
||||||
|
cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4=
|
||||||
|
cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o=
|
||||||
|
cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk=
|
||||||
|
cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo=
|
||||||
|
cloud.google.com/go/recaptchaenterprise/v2 v2.4.0/go.mod h1:Am3LHfOuBstrLrNCBrlI5sbwx9LBg3te2N6hGvHn2mE=
|
||||||
|
cloud.google.com/go/recaptchaenterprise/v2 v2.5.0/go.mod h1:O8LzcHXN3rz0j+LBC91jrwI3R+1ZSZEWrfL7XHgNo9U=
|
||||||
|
cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg=
|
||||||
|
cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4=
|
||||||
|
cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg=
|
||||||
|
cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c=
|
||||||
|
cloud.google.com/go/recommender v1.7.0/go.mod h1:XLHs/W+T8olwlGOgfQenXBTbIseGclClff6lhFVe9Bs=
|
||||||
|
cloud.google.com/go/recommender v1.8.0/go.mod h1:PkjXrTT05BFKwxaUxQmtIlrtj0kph108r02ZZQ5FE70=
|
||||||
|
cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y=
|
||||||
|
cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A=
|
||||||
|
cloud.google.com/go/redis v1.9.0/go.mod h1:HMYQuajvb2D0LvMgZmLDZW8V5aOC/WxstZHiy4g8OiA=
|
||||||
|
cloud.google.com/go/redis v1.10.0/go.mod h1:ThJf3mMBQtW18JzGgh41/Wld6vnDDc/F/F35UolRZPM=
|
||||||
|
cloud.google.com/go/resourcemanager v1.3.0/go.mod h1:bAtrTjZQFJkiWTPDb1WBjzvc6/kifjj4QBYuKCCoqKA=
|
||||||
|
cloud.google.com/go/resourcemanager v1.4.0/go.mod h1:MwxuzkumyTX7/a3n37gmsT3py7LIXwrShilPh3P1tR0=
|
||||||
|
cloud.google.com/go/resourcesettings v1.3.0/go.mod h1:lzew8VfESA5DQ8gdlHwMrqZs1S9V87v3oCnKCWoOuQU=
|
||||||
|
cloud.google.com/go/resourcesettings v1.4.0/go.mod h1:ldiH9IJpcrlC3VSuCGvjR5of/ezRrOxFtpJoJo5SmXg=
|
||||||
|
cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4=
|
||||||
|
cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY=
|
||||||
|
cloud.google.com/go/retail v1.10.0/go.mod h1:2gDk9HsL4HMS4oZwz6daui2/jmKvqShXKQuB2RZ+cCc=
|
||||||
|
cloud.google.com/go/retail v1.11.0/go.mod h1:MBLk1NaWPmh6iVFSz9MeKG/Psyd7TAgm6y/9L2B4x9Y=
|
||||||
|
cloud.google.com/go/run v0.2.0/go.mod h1:CNtKsTA1sDcnqqIFR3Pb5Tq0usWxJJvsWOCPldRU3Do=
|
||||||
|
cloud.google.com/go/run v0.3.0/go.mod h1:TuyY1+taHxTjrD0ZFk2iAR+xyOXEA0ztb7U3UNA0zBo=
|
||||||
|
cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s=
|
||||||
|
cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI=
|
||||||
|
cloud.google.com/go/scheduler v1.6.0/go.mod h1:SgeKVM7MIwPn3BqtcBntpLyrIJftQISRrYB5ZtT+KOk=
|
||||||
|
cloud.google.com/go/scheduler v1.7.0/go.mod h1:jyCiBqWW956uBjjPMMuX09n3x37mtyPJegEWKxRsn44=
|
||||||
|
cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA=
|
||||||
|
cloud.google.com/go/secretmanager v1.8.0/go.mod h1:hnVgi/bN5MYHd3Gt0SPuTPPp5ENina1/LxM+2W9U9J4=
|
||||||
|
cloud.google.com/go/secretmanager v1.9.0/go.mod h1:b71qH2l1yHmWQHt9LC80akm86mX8AL6X1MA01dW8ht4=
|
||||||
|
cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4=
|
||||||
|
cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0=
|
||||||
|
cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU=
|
||||||
|
cloud.google.com/go/security v1.9.0/go.mod h1:6Ta1bO8LXI89nZnmnsZGp9lVoVWXqsVbIq/t9dzI+2Q=
|
||||||
|
cloud.google.com/go/security v1.10.0/go.mod h1:QtOMZByJVlibUT2h9afNDWRZ1G96gVywH8T5GUSb9IA=
|
||||||
|
cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU=
|
||||||
|
cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc=
|
||||||
|
cloud.google.com/go/securitycenter v1.15.0/go.mod h1:PeKJ0t8MoFmmXLXWm41JidyzI3PJjd8sXWaVqg43WWk=
|
||||||
|
cloud.google.com/go/securitycenter v1.16.0/go.mod h1:Q9GMaLQFUD+5ZTabrbujNWLtSLZIZF7SAR0wWECrjdk=
|
||||||
|
cloud.google.com/go/servicecontrol v1.4.0/go.mod h1:o0hUSJ1TXJAmi/7fLJAedOovnujSEvjKCAFNXPQ1RaU=
|
||||||
|
cloud.google.com/go/servicecontrol v1.5.0/go.mod h1:qM0CnXHhyqKVuiZnGKrIurvVImCs8gmqWsDoqe9sU1s=
|
||||||
|
cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs=
|
||||||
|
cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg=
|
||||||
|
cloud.google.com/go/servicedirectory v1.6.0/go.mod h1:pUlbnWsLH9c13yGkxCmfumWEPjsRs1RlmJ4pqiNjVL4=
|
||||||
|
cloud.google.com/go/servicedirectory v1.7.0/go.mod h1:5p/U5oyvgYGYejufvxhgwjL8UVXjkuw7q5XcG10wx1U=
|
||||||
|
cloud.google.com/go/servicemanagement v1.4.0/go.mod h1:d8t8MDbezI7Z2R1O/wu8oTggo3BI2GKYbdG4y/SJTco=
|
||||||
|
cloud.google.com/go/servicemanagement v1.5.0/go.mod h1:XGaCRe57kfqu4+lRxaFEAuqmjzF0r+gWHjWqKqBvKFo=
|
||||||
|
cloud.google.com/go/serviceusage v1.3.0/go.mod h1:Hya1cozXM4SeSKTAgGXgj97GlqUvF5JaoXacR1JTP/E=
|
||||||
|
cloud.google.com/go/serviceusage v1.4.0/go.mod h1:SB4yxXSaYVuUBYUml6qklyONXNLt83U0Rb+CXyhjEeU=
|
||||||
|
cloud.google.com/go/shell v1.3.0/go.mod h1:VZ9HmRjZBsjLGXusm7K5Q5lzzByZmJHf1d0IWHEN5X4=
|
||||||
|
cloud.google.com/go/shell v1.4.0/go.mod h1:HDxPzZf3GkDdhExzD/gs8Grqk+dmYcEjGShZgYa9URw=
|
||||||
|
cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM=
|
||||||
|
cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ=
|
||||||
|
cloud.google.com/go/speech v1.8.0/go.mod h1:9bYIl1/tjsAnMgKGHKmBZzXKEkGgtU+MpdDPTE9f7y0=
|
||||||
|
cloud.google.com/go/speech v1.9.0/go.mod h1:xQ0jTcmnRFFM2RfX/U+rk6FQNUF6DQlydUSyoooSpco=
|
||||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||||
|
cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y=
|
||||||
|
cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc=
|
||||||
|
cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s=
|
||||||
|
cloud.google.com/go/storagetransfer v1.5.0/go.mod h1:dxNzUopWy7RQevYFHewchb29POFv3/AaBgnhqzqiK0w=
|
||||||
|
cloud.google.com/go/storagetransfer v1.6.0/go.mod h1:y77xm4CQV/ZhFZH75PLEXY0ROiS7Gh6pSKrM8dJyg6I=
|
||||||
|
cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw=
|
||||||
|
cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g=
|
||||||
|
cloud.google.com/go/talent v1.3.0/go.mod h1:CmcxwJ/PKfRgd1pBjQgU6W3YBwiewmUzQYH5HHmSCmM=
|
||||||
|
cloud.google.com/go/talent v1.4.0/go.mod h1:ezFtAgVuRf8jRsvyE6EwmbTK5LKciD4KVnHuDEFmOOA=
|
||||||
|
cloud.google.com/go/texttospeech v1.4.0/go.mod h1:FX8HQHA6sEpJ7rCMSfXuzBcysDAuWusNNNvN9FELDd8=
|
||||||
|
cloud.google.com/go/texttospeech v1.5.0/go.mod h1:oKPLhR4n4ZdQqWKURdwxMy0uiTS1xU161C8W57Wkea4=
|
||||||
|
cloud.google.com/go/tpu v1.3.0/go.mod h1:aJIManG0o20tfDQlRIej44FcwGGl/cD0oiRyMKG19IQ=
|
||||||
|
cloud.google.com/go/tpu v1.4.0/go.mod h1:mjZaX8p0VBgllCzF6wcU2ovUXN9TONFLd7iz227X2Xg=
|
||||||
|
cloud.google.com/go/trace v1.3.0/go.mod h1:FFUE83d9Ca57C+K8rDl/Ih8LwOzWIV1krKgxg6N0G28=
|
||||||
|
cloud.google.com/go/trace v1.4.0/go.mod h1:UG0v8UBqzusp+z63o7FK74SdFE+AXpCLdFb1rshXG+Y=
|
||||||
|
cloud.google.com/go/translate v1.3.0/go.mod h1:gzMUwRjvOqj5i69y/LYLd8RrNQk+hOmIXTi9+nb3Djs=
|
||||||
|
cloud.google.com/go/translate v1.4.0/go.mod h1:06Dn/ppvLD6WvA5Rhdp029IX2Mi3Mn7fpMRLPvXT5Wg=
|
||||||
|
cloud.google.com/go/video v1.8.0/go.mod h1:sTzKFc0bUSByE8Yoh8X0mn8bMymItVGPfTuUBUyRgxk=
|
||||||
|
cloud.google.com/go/video v1.9.0/go.mod h1:0RhNKFRF5v92f8dQt0yhaHrEuH95m068JYOvLZYnJSw=
|
||||||
|
cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU=
|
||||||
|
cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4=
|
||||||
|
cloud.google.com/go/videointelligence v1.8.0/go.mod h1:dIcCn4gVDdS7yte/w+koiXn5dWVplOZkE+xwG9FgK+M=
|
||||||
|
cloud.google.com/go/videointelligence v1.9.0/go.mod h1:29lVRMPDYHikk3v8EdPSaL8Ku+eMzDljjuvRs105XoU=
|
||||||
|
cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0=
|
||||||
|
cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo=
|
||||||
|
cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo=
|
||||||
|
cloud.google.com/go/vision/v2 v2.4.0/go.mod h1:VtI579ll9RpVTrdKdkMzckdnwMyX2JILb+MhPqRbPsY=
|
||||||
|
cloud.google.com/go/vision/v2 v2.5.0/go.mod h1:MmaezXOOE+IWa+cS7OhRRLK2cNv1ZL98zhqFFZaaH2E=
|
||||||
|
cloud.google.com/go/vmmigration v1.2.0/go.mod h1:IRf0o7myyWFSmVR1ItrBSFLFD/rJkfDCUTO4vLlJvsE=
|
||||||
|
cloud.google.com/go/vmmigration v1.3.0/go.mod h1:oGJ6ZgGPQOFdjHuocGcLqX4lc98YQ7Ygq8YQwHh9A7g=
|
||||||
|
cloud.google.com/go/vpcaccess v1.4.0/go.mod h1:aQHVbTWDYUR1EbTApSVvMq1EnT57ppDmQzZ3imqIk4w=
|
||||||
|
cloud.google.com/go/vpcaccess v1.5.0/go.mod h1:drmg4HLk9NkZpGfCmZ3Tz0Bwnm2+DKqViEpeEpOq0m8=
|
||||||
|
cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE=
|
||||||
|
cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg=
|
||||||
|
cloud.google.com/go/webrisk v1.6.0/go.mod h1:65sW9V9rOosnc9ZY7A7jsy1zoHS5W9IAXv6dGqhMQMc=
|
||||||
|
cloud.google.com/go/webrisk v1.7.0/go.mod h1:mVMHgEYH0r337nmt1JyLthzMr6YxwN1aAIEc2fTcq7A=
|
||||||
|
cloud.google.com/go/websecurityscanner v1.3.0/go.mod h1:uImdKm2wyeXQevQJXeh8Uun/Ym1VqworNDlBXQevGMo=
|
||||||
|
cloud.google.com/go/websecurityscanner v1.4.0/go.mod h1:ebit/Fp0a+FWu5j4JOmJEV8S8CzdTkAS77oDsiSqYWQ=
|
||||||
|
cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0=
|
||||||
|
cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M=
|
||||||
|
cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M=
|
||||||
|
cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA=
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20220824214621-3c06a36a6952/go.mod h1:i9fr2JpcEcY/IHEvzCM3qXUZYOQHgR89dt4es1CgMhc=
|
github.com/AdaLogics/go-fuzz-headers v0.0.0-20220824214621-3c06a36a6952/go.mod h1:i9fr2JpcEcY/IHEvzCM3qXUZYOQHgR89dt4es1CgMhc=
|
||||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20221103172237-443f56ff4ba8 h1:d+pBUmsteW5tM87xmVXHZ4+LibHRFn40SPAoZJOg2ak=
|
github.com/AdaLogics/go-fuzz-headers v0.0.0-20221103172237-443f56ff4ba8 h1:d+pBUmsteW5tM87xmVXHZ4+LibHRFn40SPAoZJOg2ak=
|
||||||
@ -350,8 +667,9 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||||||
github.com/google/go-cmp v0.5.5/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/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
||||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
|
||||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
|
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||||
|
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0=
|
github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
@ -380,12 +698,22 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
|
|||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=
|
||||||
|
github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=
|
||||||
|
github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=
|
||||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||||
github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
|
github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo=
|
||||||
|
github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY=
|
||||||
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
|
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
|
||||||
github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU=
|
github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU=
|
||||||
github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA=
|
github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA=
|
||||||
|
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||||
@ -861,9 +1189,18 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx
|
|||||||
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
|
golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
|
golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
|
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
|
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
|
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
|
golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||||
|
golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||||
|
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||||
golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=
|
golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=
|
||||||
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
@ -883,6 +1220,15 @@ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ
|
|||||||
golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||||
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
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-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-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@ -894,7 +1240,9 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
|
|||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@ -985,15 +1333,27 @@ golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
|
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
|
||||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
@ -1008,6 +1368,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|||||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
|
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||||
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
|
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
|
||||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
@ -1092,6 +1453,10 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
|
|||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/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-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||||
|
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||||
|
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||||
@ -1120,7 +1485,29 @@ google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNe
|
|||||||
google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU=
|
google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU=
|
||||||
google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k=
|
google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k=
|
||||||
google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
|
google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
|
||||||
|
google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
|
||||||
google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI=
|
google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI=
|
||||||
|
google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I=
|
||||||
|
google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo=
|
||||||
|
google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g=
|
||||||
|
google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA=
|
||||||
|
google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8=
|
||||||
|
google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs=
|
||||||
|
google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA=
|
||||||
|
google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA=
|
||||||
|
google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw=
|
||||||
|
google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg=
|
||||||
|
google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o=
|
||||||
|
google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g=
|
||||||
|
google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw=
|
||||||
|
google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw=
|
||||||
|
google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI=
|
||||||
|
google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=
|
||||||
|
google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=
|
||||||
|
google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=
|
||||||
|
google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91A08=
|
||||||
|
google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70=
|
||||||
|
google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo=
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
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/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
@ -1172,6 +1559,7 @@ google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6D
|
|||||||
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||||
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||||
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||||
|
google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
|
||||||
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
|
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
|
||||||
google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=
|
google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=
|
||||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
||||||
@ -1187,10 +1575,56 @@ google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEc
|
|||||||
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||||
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||||
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||||
|
google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||||
google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 h1:hrbNEivu7Zn1pxvHk6MBrq9iE22woVILTHqexqBxe6I=
|
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
|
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
|
google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
|
google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
|
google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||||
|
google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
|
||||||
|
google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
|
||||||
|
google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
|
||||||
|
google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
|
||||||
|
google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
|
||||||
|
google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
|
||||||
|
google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
|
||||||
|
google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
|
||||||
|
google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
|
||||||
|
google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
|
||||||
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
|
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
|
||||||
|
google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
|
||||||
|
google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
|
||||||
|
google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
|
||||||
|
google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
|
||||||
|
google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
|
||||||
|
google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
|
||||||
|
google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
|
||||||
|
google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
|
||||||
|
google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE=
|
||||||
|
google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc=
|
||||||
|
google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
|
||||||
|
google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
|
||||||
|
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
|
||||||
|
google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
|
||||||
|
google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
|
||||||
|
google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
|
||||||
|
google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
|
||||||
|
google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
|
||||||
|
google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
|
||||||
|
google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
|
||||||
|
google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw=
|
||||||
|
google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI=
|
||||||
|
google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI=
|
||||||
|
google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U=
|
||||||
|
google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM=
|
||||||
|
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM=
|
||||||
|
google.golang.org/genproto v0.0.0-20221024153911-1573dae28c9c/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s=
|
||||||
|
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s=
|
||||||
|
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo=
|
||||||
|
google.golang.org/genproto v0.0.0-20221107162902-2d387536bcdd h1:1eV6KuDTxraYYsYGWksp1thEGP+8dtX/TINL9h+ppiI=
|
||||||
|
google.golang.org/genproto v0.0.0-20221107162902-2d387536bcdd/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||||
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||||
@ -1217,11 +1651,19 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ
|
|||||||
google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
||||||
google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
||||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||||
|
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||||
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
|
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
|
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
|
||||||
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||||
google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8=
|
google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||||
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||||
|
google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||||
|
google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
||||||
|
google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
||||||
|
google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY=
|
||||||
|
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
||||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
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-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
@ -1236,8 +1678,9 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
|
|||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
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.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
|
||||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
|
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/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
44
vendor/github.com/google/go-cmp/cmp/compare.go
generated
vendored
44
vendor/github.com/google/go-cmp/cmp/compare.go
generated
vendored
@ -13,21 +13,21 @@
|
|||||||
//
|
//
|
||||||
// The primary features of cmp are:
|
// The primary features of cmp are:
|
||||||
//
|
//
|
||||||
// • When the default behavior of equality does not suit the needs of the test,
|
// - When the default behavior of equality does not suit the test's needs,
|
||||||
// custom equality functions can override the equality operation.
|
// custom equality functions can override the equality operation.
|
||||||
// For example, an equality function may report floats as equal so long as they
|
// For example, an equality function may report floats as equal so long as
|
||||||
// are within some tolerance of each other.
|
// they are within some tolerance of each other.
|
||||||
//
|
//
|
||||||
// • Types that have an Equal method may use that method to determine equality.
|
// - Types with an Equal method may use that method to determine equality.
|
||||||
// This allows package authors to determine the equality operation for the types
|
// This allows package authors to determine the equality operation
|
||||||
// that they define.
|
// for the types that they define.
|
||||||
//
|
//
|
||||||
// • If no custom equality functions are used and no Equal method is defined,
|
// - If no custom equality functions are used and no Equal method is defined,
|
||||||
// equality is determined by recursively comparing the primitive kinds on both
|
// equality is determined by recursively comparing the primitive kinds on
|
||||||
// values, much like reflect.DeepEqual. Unlike reflect.DeepEqual, unexported
|
// both values, much like reflect.DeepEqual. Unlike reflect.DeepEqual,
|
||||||
// fields are not compared by default; they result in panics unless suppressed
|
// unexported fields are not compared by default; they result in panics
|
||||||
// by using an Ignore option (see cmpopts.IgnoreUnexported) or explicitly
|
// unless suppressed by using an Ignore option (see cmpopts.IgnoreUnexported)
|
||||||
// compared using the Exporter option.
|
// or explicitly compared using the Exporter option.
|
||||||
package cmp
|
package cmp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -45,24 +45,24 @@ import (
|
|||||||
// Equal reports whether x and y are equal by recursively applying the
|
// Equal reports whether x and y are equal by recursively applying the
|
||||||
// following rules in the given order to x and y and all of their sub-values:
|
// following rules in the given order to x and y and all of their sub-values:
|
||||||
//
|
//
|
||||||
// • Let S be the set of all Ignore, Transformer, and Comparer options that
|
// - Let S be the set of all Ignore, Transformer, and Comparer options that
|
||||||
// remain after applying all path filters, value filters, and type filters.
|
// remain after applying all path filters, value filters, and type filters.
|
||||||
// If at least one Ignore exists in S, then the comparison is ignored.
|
// If at least one Ignore exists in S, then the comparison is ignored.
|
||||||
// If the number of Transformer and Comparer options in S is greater than one,
|
// If the number of Transformer and Comparer options in S is non-zero,
|
||||||
// then Equal panics because it is ambiguous which option to use.
|
// then Equal panics because it is ambiguous which option to use.
|
||||||
// If S contains a single Transformer, then use that to transform the current
|
// If S contains a single Transformer, then use that to transform
|
||||||
// values and recursively call Equal on the output values.
|
// the current values and recursively call Equal on the output values.
|
||||||
// If S contains a single Comparer, then use that to compare the current values.
|
// If S contains a single Comparer, then use that to compare the current values.
|
||||||
// Otherwise, evaluation proceeds to the next rule.
|
// Otherwise, evaluation proceeds to the next rule.
|
||||||
//
|
//
|
||||||
// • If the values have an Equal method of the form "(T) Equal(T) bool" or
|
// - If the values have an Equal method of the form "(T) Equal(T) bool" or
|
||||||
// "(T) Equal(I) bool" where T is assignable to I, then use the result of
|
// "(T) Equal(I) bool" where T is assignable to I, then use the result of
|
||||||
// x.Equal(y) even if x or y is nil. Otherwise, no such method exists and
|
// x.Equal(y) even if x or y is nil. Otherwise, no such method exists and
|
||||||
// evaluation proceeds to the next rule.
|
// evaluation proceeds to the next rule.
|
||||||
//
|
//
|
||||||
// • Lastly, try to compare x and y based on their basic kinds.
|
// - Lastly, try to compare x and y based on their basic kinds.
|
||||||
// Simple kinds like booleans, integers, floats, complex numbers, strings, and
|
// Simple kinds like booleans, integers, floats, complex numbers, strings,
|
||||||
// channels are compared using the equivalent of the == operator in Go.
|
// and channels are compared using the equivalent of the == operator in Go.
|
||||||
// Functions are only equal if they are both nil, otherwise they are unequal.
|
// Functions are only equal if they are both nil, otherwise they are unequal.
|
||||||
//
|
//
|
||||||
// Structs are equal if recursively calling Equal on all fields report equal.
|
// Structs are equal if recursively calling Equal on all fields report equal.
|
||||||
@ -144,7 +144,7 @@ func rootStep(x, y interface{}) PathStep {
|
|||||||
// so that they have the same parent type.
|
// so that they have the same parent type.
|
||||||
var t reflect.Type
|
var t reflect.Type
|
||||||
if !vx.IsValid() || !vy.IsValid() || vx.Type() != vy.Type() {
|
if !vx.IsValid() || !vy.IsValid() || vx.Type() != vy.Type() {
|
||||||
t = reflect.TypeOf((*interface{})(nil)).Elem()
|
t = anyType
|
||||||
if vx.IsValid() {
|
if vx.IsValid() {
|
||||||
vvx := reflect.New(t).Elem()
|
vvx := reflect.New(t).Elem()
|
||||||
vvx.Set(vx)
|
vvx.Set(vx)
|
||||||
@ -639,7 +639,9 @@ type dynChecker struct{ curr, next int }
|
|||||||
// Next increments the state and reports whether a check should be performed.
|
// Next increments the state and reports whether a check should be performed.
|
||||||
//
|
//
|
||||||
// Checks occur every Nth function call, where N is a triangular number:
|
// Checks occur every Nth function call, where N is a triangular number:
|
||||||
|
//
|
||||||
// 0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 ...
|
// 0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 ...
|
||||||
|
//
|
||||||
// See https://en.wikipedia.org/wiki/Triangular_number
|
// See https://en.wikipedia.org/wiki/Triangular_number
|
||||||
//
|
//
|
||||||
// This sequence ensures that the cost of checks drops significantly as
|
// This sequence ensures that the cost of checks drops significantly as
|
||||||
|
40
vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go
generated
vendored
40
vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go
generated
vendored
@ -127,9 +127,9 @@ var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0
|
|||||||
// This function returns an edit-script, which is a sequence of operations
|
// This function returns an edit-script, which is a sequence of operations
|
||||||
// needed to convert one list into the other. The following invariants for
|
// needed to convert one list into the other. The following invariants for
|
||||||
// the edit-script are maintained:
|
// the edit-script are maintained:
|
||||||
// • eq == (es.Dist()==0)
|
// - eq == (es.Dist()==0)
|
||||||
// • nx == es.LenX()
|
// - nx == es.LenX()
|
||||||
// • ny == es.LenY()
|
// - ny == es.LenY()
|
||||||
//
|
//
|
||||||
// This algorithm is not guaranteed to be an optimal solution (i.e., one that
|
// This algorithm is not guaranteed to be an optimal solution (i.e., one that
|
||||||
// produces an edit-script with a minimal Levenshtein distance). This algorithm
|
// produces an edit-script with a minimal Levenshtein distance). This algorithm
|
||||||
@ -169,12 +169,13 @@ func Difference(nx, ny int, f EqualFunc) (es EditScript) {
|
|||||||
// A diagonal edge is equivalent to a matching symbol between both X and Y.
|
// A diagonal edge is equivalent to a matching symbol between both X and Y.
|
||||||
|
|
||||||
// Invariants:
|
// Invariants:
|
||||||
// • 0 ≤ fwdPath.X ≤ (fwdFrontier.X, revFrontier.X) ≤ revPath.X ≤ nx
|
// - 0 ≤ fwdPath.X ≤ (fwdFrontier.X, revFrontier.X) ≤ revPath.X ≤ nx
|
||||||
// • 0 ≤ fwdPath.Y ≤ (fwdFrontier.Y, revFrontier.Y) ≤ revPath.Y ≤ ny
|
// - 0 ≤ fwdPath.Y ≤ (fwdFrontier.Y, revFrontier.Y) ≤ revPath.Y ≤ ny
|
||||||
//
|
//
|
||||||
// In general:
|
// In general:
|
||||||
// • fwdFrontier.X < revFrontier.X
|
// - fwdFrontier.X < revFrontier.X
|
||||||
// • fwdFrontier.Y < revFrontier.Y
|
// - fwdFrontier.Y < revFrontier.Y
|
||||||
|
//
|
||||||
// Unless, it is time for the algorithm to terminate.
|
// Unless, it is time for the algorithm to terminate.
|
||||||
fwdPath := path{+1, point{0, 0}, make(EditScript, 0, (nx+ny)/2)}
|
fwdPath := path{+1, point{0, 0}, make(EditScript, 0, (nx+ny)/2)}
|
||||||
revPath := path{-1, point{nx, ny}, make(EditScript, 0)}
|
revPath := path{-1, point{nx, ny}, make(EditScript, 0)}
|
||||||
@ -195,18 +196,20 @@ func Difference(nx, ny int, f EqualFunc) (es EditScript) {
|
|||||||
// computing sub-optimal edit-scripts between two lists.
|
// computing sub-optimal edit-scripts between two lists.
|
||||||
//
|
//
|
||||||
// The algorithm is approximately as follows:
|
// The algorithm is approximately as follows:
|
||||||
// • Searching for differences switches back-and-forth between
|
// - Searching for differences switches back-and-forth between
|
||||||
// a search that starts at the beginning (the top-left corner), and
|
// a search that starts at the beginning (the top-left corner), and
|
||||||
// a search that starts at the end (the bottom-right corner). The goal of
|
// a search that starts at the end (the bottom-right corner).
|
||||||
// the search is connect with the search from the opposite corner.
|
// The goal of the search is connect with the search
|
||||||
// • As we search, we build a path in a greedy manner, where the first
|
// from the opposite corner.
|
||||||
// match seen is added to the path (this is sub-optimal, but provides a
|
// - As we search, we build a path in a greedy manner,
|
||||||
// decent result in practice). When matches are found, we try the next pair
|
// where the first match seen is added to the path (this is sub-optimal,
|
||||||
// of symbols in the lists and follow all matches as far as possible.
|
// but provides a decent result in practice). When matches are found,
|
||||||
// • When searching for matches, we search along a diagonal going through
|
// we try the next pair of symbols in the lists and follow all matches
|
||||||
// through the "frontier" point. If no matches are found, we advance the
|
// as far as possible.
|
||||||
// frontier towards the opposite corner.
|
// - When searching for matches, we search along a diagonal going through
|
||||||
// • This algorithm terminates when either the X coordinates or the
|
// through the "frontier" point. If no matches are found,
|
||||||
|
// we advance the frontier towards the opposite corner.
|
||||||
|
// - This algorithm terminates when either the X coordinates or the
|
||||||
// Y coordinates of the forward and reverse frontier points ever intersect.
|
// Y coordinates of the forward and reverse frontier points ever intersect.
|
||||||
|
|
||||||
// This algorithm is correct even if searching only in the forward direction
|
// This algorithm is correct even if searching only in the forward direction
|
||||||
@ -389,6 +392,7 @@ type point struct{ X, Y int }
|
|||||||
func (p *point) add(dx, dy int) { p.X += dx; p.Y += dy }
|
func (p *point) add(dx, dy int) { p.X += dx; p.Y += dy }
|
||||||
|
|
||||||
// zigzag maps a consecutive sequence of integers to a zig-zag sequence.
|
// zigzag maps a consecutive sequence of integers to a zig-zag sequence.
|
||||||
|
//
|
||||||
// [0 1 2 3 4 5 ...] => [0 -1 +1 -2 +2 ...]
|
// [0 1 2 3 4 5 ...] => [0 -1 +1 -2 +2 ...]
|
||||||
func zigzag(x int) int {
|
func zigzag(x int) int {
|
||||||
if x&1 != 0 {
|
if x&1 != 0 {
|
||||||
|
48
vendor/github.com/google/go-cmp/cmp/internal/value/zero.go
generated
vendored
48
vendor/github.com/google/go-cmp/cmp/internal/value/zero.go
generated
vendored
@ -1,48 +0,0 @@
|
|||||||
// Copyright 2017, The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package value
|
|
||||||
|
|
||||||
import (
|
|
||||||
"math"
|
|
||||||
"reflect"
|
|
||||||
)
|
|
||||||
|
|
||||||
// IsZero reports whether v is the zero value.
|
|
||||||
// This does not rely on Interface and so can be used on unexported fields.
|
|
||||||
func IsZero(v reflect.Value) bool {
|
|
||||||
switch v.Kind() {
|
|
||||||
case reflect.Bool:
|
|
||||||
return v.Bool() == false
|
|
||||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
|
||||||
return v.Int() == 0
|
|
||||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
|
||||||
return v.Uint() == 0
|
|
||||||
case reflect.Float32, reflect.Float64:
|
|
||||||
return math.Float64bits(v.Float()) == 0
|
|
||||||
case reflect.Complex64, reflect.Complex128:
|
|
||||||
return math.Float64bits(real(v.Complex())) == 0 && math.Float64bits(imag(v.Complex())) == 0
|
|
||||||
case reflect.String:
|
|
||||||
return v.String() == ""
|
|
||||||
case reflect.UnsafePointer:
|
|
||||||
return v.Pointer() == 0
|
|
||||||
case reflect.Chan, reflect.Func, reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice:
|
|
||||||
return v.IsNil()
|
|
||||||
case reflect.Array:
|
|
||||||
for i := 0; i < v.Len(); i++ {
|
|
||||||
if !IsZero(v.Index(i)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
case reflect.Struct:
|
|
||||||
for i := 0; i < v.NumField(); i++ {
|
|
||||||
if !IsZero(v.Field(i)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
10
vendor/github.com/google/go-cmp/cmp/options.go
generated
vendored
10
vendor/github.com/google/go-cmp/cmp/options.go
generated
vendored
@ -33,6 +33,7 @@ type Option interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// applicableOption represents the following types:
|
// applicableOption represents the following types:
|
||||||
|
//
|
||||||
// Fundamental: ignore | validator | *comparer | *transformer
|
// Fundamental: ignore | validator | *comparer | *transformer
|
||||||
// Grouping: Options
|
// Grouping: Options
|
||||||
type applicableOption interface {
|
type applicableOption interface {
|
||||||
@ -43,6 +44,7 @@ type applicableOption interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// coreOption represents the following types:
|
// coreOption represents the following types:
|
||||||
|
//
|
||||||
// Fundamental: ignore | validator | *comparer | *transformer
|
// Fundamental: ignore | validator | *comparer | *transformer
|
||||||
// Filters: *pathFilter | *valuesFilter
|
// Filters: *pathFilter | *valuesFilter
|
||||||
type coreOption interface {
|
type coreOption interface {
|
||||||
@ -336,9 +338,9 @@ func (tr transformer) String() string {
|
|||||||
// both implement T.
|
// both implement T.
|
||||||
//
|
//
|
||||||
// The equality function must be:
|
// The equality function must be:
|
||||||
// • Symmetric: equal(x, y) == equal(y, x)
|
// - Symmetric: equal(x, y) == equal(y, x)
|
||||||
// • Deterministic: equal(x, y) == equal(x, y)
|
// - Deterministic: equal(x, y) == equal(x, y)
|
||||||
// • Pure: equal(x, y) does not modify x or y
|
// - Pure: equal(x, y) does not modify x or y
|
||||||
func Comparer(f interface{}) Option {
|
func Comparer(f interface{}) Option {
|
||||||
v := reflect.ValueOf(f)
|
v := reflect.ValueOf(f)
|
||||||
if !function.IsType(v.Type(), function.Equal) || v.IsNil() {
|
if !function.IsType(v.Type(), function.Equal) || v.IsNil() {
|
||||||
@ -430,7 +432,7 @@ func AllowUnexported(types ...interface{}) Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Result represents the comparison result for a single node and
|
// Result represents the comparison result for a single node and
|
||||||
// is provided by cmp when calling Result (see Reporter).
|
// is provided by cmp when calling Report (see Reporter).
|
||||||
type Result struct {
|
type Result struct {
|
||||||
_ [0]func() // Make Result incomparable
|
_ [0]func() // Make Result incomparable
|
||||||
flags resultFlags
|
flags resultFlags
|
||||||
|
12
vendor/github.com/google/go-cmp/cmp/path.go
generated
vendored
12
vendor/github.com/google/go-cmp/cmp/path.go
generated
vendored
@ -41,12 +41,12 @@ type PathStep interface {
|
|||||||
// The type of each valid value is guaranteed to be identical to Type.
|
// The type of each valid value is guaranteed to be identical to Type.
|
||||||
//
|
//
|
||||||
// In some cases, one or both may be invalid or have restrictions:
|
// In some cases, one or both may be invalid or have restrictions:
|
||||||
// • For StructField, both are not interface-able if the current field
|
// - For StructField, both are not interface-able if the current field
|
||||||
// is unexported and the struct type is not explicitly permitted by
|
// is unexported and the struct type is not explicitly permitted by
|
||||||
// an Exporter to traverse unexported fields.
|
// an Exporter to traverse unexported fields.
|
||||||
// • For SliceIndex, one may be invalid if an element is missing from
|
// - For SliceIndex, one may be invalid if an element is missing from
|
||||||
// either the x or y slice.
|
// either the x or y slice.
|
||||||
// • For MapIndex, one may be invalid if an entry is missing from
|
// - For MapIndex, one may be invalid if an entry is missing from
|
||||||
// either the x or y map.
|
// either the x or y map.
|
||||||
//
|
//
|
||||||
// The provided values must not be mutated.
|
// The provided values must not be mutated.
|
||||||
@ -94,6 +94,7 @@ func (pa Path) Index(i int) PathStep {
|
|||||||
// The simplified path only contains struct field accesses.
|
// The simplified path only contains struct field accesses.
|
||||||
//
|
//
|
||||||
// For example:
|
// For example:
|
||||||
|
//
|
||||||
// MyMap.MySlices.MyField
|
// MyMap.MySlices.MyField
|
||||||
func (pa Path) String() string {
|
func (pa Path) String() string {
|
||||||
var ss []string
|
var ss []string
|
||||||
@ -108,6 +109,7 @@ func (pa Path) String() string {
|
|||||||
// GoString returns the path to a specific node using Go syntax.
|
// GoString returns the path to a specific node using Go syntax.
|
||||||
//
|
//
|
||||||
// For example:
|
// For example:
|
||||||
|
//
|
||||||
// (*root.MyMap["key"].(*mypkg.MyStruct).MySlices)[2][3].MyField
|
// (*root.MyMap["key"].(*mypkg.MyStruct).MySlices)[2][3].MyField
|
||||||
func (pa Path) GoString() string {
|
func (pa Path) GoString() string {
|
||||||
var ssPre, ssPost []string
|
var ssPre, ssPost []string
|
||||||
@ -159,7 +161,7 @@ func (ps pathStep) String() string {
|
|||||||
if ps.typ == nil {
|
if ps.typ == nil {
|
||||||
return "<nil>"
|
return "<nil>"
|
||||||
}
|
}
|
||||||
s := ps.typ.String()
|
s := value.TypeString(ps.typ, false)
|
||||||
if s == "" || strings.ContainsAny(s, "{}\n") {
|
if s == "" || strings.ContainsAny(s, "{}\n") {
|
||||||
return "root" // Type too simple or complex to print
|
return "root" // Type too simple or complex to print
|
||||||
}
|
}
|
||||||
@ -282,7 +284,7 @@ type typeAssertion struct {
|
|||||||
|
|
||||||
func (ta TypeAssertion) Type() reflect.Type { return ta.typ }
|
func (ta TypeAssertion) Type() reflect.Type { return ta.typ }
|
||||||
func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy }
|
func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy }
|
||||||
func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", ta.typ) }
|
func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", value.TypeString(ta.typ, false)) }
|
||||||
|
|
||||||
// Transform is a transformation from the parent type to the current type.
|
// Transform is a transformation from the parent type to the current type.
|
||||||
type Transform struct{ *transform }
|
type Transform struct{ *transform }
|
||||||
|
10
vendor/github.com/google/go-cmp/cmp/report_compare.go
generated
vendored
10
vendor/github.com/google/go-cmp/cmp/report_compare.go
generated
vendored
@ -7,8 +7,6 @@ package cmp
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/google/go-cmp/cmp/internal/value"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// numContextRecords is the number of surrounding equal records to print.
|
// numContextRecords is the number of surrounding equal records to print.
|
||||||
@ -117,7 +115,7 @@ func (opts formatOptions) FormatDiff(v *valueNode, ptrs *pointerReferences) (out
|
|||||||
|
|
||||||
// For leaf nodes, format the value based on the reflect.Values alone.
|
// For leaf nodes, format the value based on the reflect.Values alone.
|
||||||
// As a special case, treat equal []byte as a leaf nodes.
|
// As a special case, treat equal []byte as a leaf nodes.
|
||||||
isBytes := v.Type.Kind() == reflect.Slice && v.Type.Elem() == reflect.TypeOf(byte(0))
|
isBytes := v.Type.Kind() == reflect.Slice && v.Type.Elem() == byteType
|
||||||
isEqualBytes := isBytes && v.NumDiff+v.NumIgnored+v.NumTransformed == 0
|
isEqualBytes := isBytes && v.NumDiff+v.NumIgnored+v.NumTransformed == 0
|
||||||
if v.MaxDepth == 0 || isEqualBytes {
|
if v.MaxDepth == 0 || isEqualBytes {
|
||||||
switch opts.DiffMode {
|
switch opts.DiffMode {
|
||||||
@ -248,11 +246,11 @@ func (opts formatOptions) formatDiffList(recs []reportRecord, k reflect.Kind, pt
|
|||||||
var isZero bool
|
var isZero bool
|
||||||
switch opts.DiffMode {
|
switch opts.DiffMode {
|
||||||
case diffIdentical:
|
case diffIdentical:
|
||||||
isZero = value.IsZero(r.Value.ValueX) || value.IsZero(r.Value.ValueY)
|
isZero = r.Value.ValueX.IsZero() || r.Value.ValueY.IsZero()
|
||||||
case diffRemoved:
|
case diffRemoved:
|
||||||
isZero = value.IsZero(r.Value.ValueX)
|
isZero = r.Value.ValueX.IsZero()
|
||||||
case diffInserted:
|
case diffInserted:
|
||||||
isZero = value.IsZero(r.Value.ValueY)
|
isZero = r.Value.ValueY.IsZero()
|
||||||
}
|
}
|
||||||
if isZero {
|
if isZero {
|
||||||
continue
|
continue
|
||||||
|
11
vendor/github.com/google/go-cmp/cmp/report_reflect.go
generated
vendored
11
vendor/github.com/google/go-cmp/cmp/report_reflect.go
generated
vendored
@ -16,6 +16,13 @@ import (
|
|||||||
"github.com/google/go-cmp/cmp/internal/value"
|
"github.com/google/go-cmp/cmp/internal/value"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
anyType = reflect.TypeOf((*interface{})(nil)).Elem()
|
||||||
|
stringType = reflect.TypeOf((*string)(nil)).Elem()
|
||||||
|
bytesType = reflect.TypeOf((*[]byte)(nil)).Elem()
|
||||||
|
byteType = reflect.TypeOf((*byte)(nil)).Elem()
|
||||||
|
)
|
||||||
|
|
||||||
type formatValueOptions struct {
|
type formatValueOptions struct {
|
||||||
// AvoidStringer controls whether to avoid calling custom stringer
|
// AvoidStringer controls whether to avoid calling custom stringer
|
||||||
// methods like error.Error or fmt.Stringer.String.
|
// methods like error.Error or fmt.Stringer.String.
|
||||||
@ -184,7 +191,7 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind,
|
|||||||
}
|
}
|
||||||
for i := 0; i < v.NumField(); i++ {
|
for i := 0; i < v.NumField(); i++ {
|
||||||
vv := v.Field(i)
|
vv := v.Field(i)
|
||||||
if value.IsZero(vv) {
|
if vv.IsZero() {
|
||||||
continue // Elide fields with zero values
|
continue // Elide fields with zero values
|
||||||
}
|
}
|
||||||
if len(list) == maxLen {
|
if len(list) == maxLen {
|
||||||
@ -205,7 +212,7 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check whether this is a []byte of text data.
|
// Check whether this is a []byte of text data.
|
||||||
if t.Elem() == reflect.TypeOf(byte(0)) {
|
if t.Elem() == byteType {
|
||||||
b := v.Bytes()
|
b := v.Bytes()
|
||||||
isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) || unicode.IsSpace(r) }
|
isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) || unicode.IsSpace(r) }
|
||||||
if len(b) > 0 && utf8.Valid(b) && len(bytes.TrimFunc(b, isPrintSpace)) == 0 {
|
if len(b) > 0 && utf8.Valid(b) && len(bytes.TrimFunc(b, isPrintSpace)) == 0 {
|
||||||
|
25
vendor/github.com/google/go-cmp/cmp/report_slices.go
generated
vendored
25
vendor/github.com/google/go-cmp/cmp/report_slices.go
generated
vendored
@ -104,7 +104,7 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
|
|||||||
case t.Kind() == reflect.String:
|
case t.Kind() == reflect.String:
|
||||||
sx, sy = vx.String(), vy.String()
|
sx, sy = vx.String(), vy.String()
|
||||||
isString = true
|
isString = true
|
||||||
case t.Kind() == reflect.Slice && t.Elem() == reflect.TypeOf(byte(0)):
|
case t.Kind() == reflect.Slice && t.Elem() == byteType:
|
||||||
sx, sy = string(vx.Bytes()), string(vy.Bytes())
|
sx, sy = string(vx.Bytes()), string(vy.Bytes())
|
||||||
isString = true
|
isString = true
|
||||||
case t.Kind() == reflect.Array:
|
case t.Kind() == reflect.Array:
|
||||||
@ -147,7 +147,10 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
|
|||||||
})
|
})
|
||||||
efficiencyLines := float64(esLines.Dist()) / float64(len(esLines))
|
efficiencyLines := float64(esLines.Dist()) / float64(len(esLines))
|
||||||
efficiencyBytes := float64(esBytes.Dist()) / float64(len(esBytes))
|
efficiencyBytes := float64(esBytes.Dist()) / float64(len(esBytes))
|
||||||
isPureLinedText = efficiencyLines < 4*efficiencyBytes
|
quotedLength := len(strconv.Quote(sx + sy))
|
||||||
|
unquotedLength := len(sx) + len(sy)
|
||||||
|
escapeExpansionRatio := float64(quotedLength) / float64(unquotedLength)
|
||||||
|
isPureLinedText = efficiencyLines < 4*efficiencyBytes || escapeExpansionRatio > 1.1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,12 +174,13 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
|
|||||||
// differences in a string literal. This format is more readable,
|
// differences in a string literal. This format is more readable,
|
||||||
// but has edge-cases where differences are visually indistinguishable.
|
// but has edge-cases where differences are visually indistinguishable.
|
||||||
// This format is avoided under the following conditions:
|
// This format is avoided under the following conditions:
|
||||||
// • A line starts with `"""`
|
// - A line starts with `"""`
|
||||||
// • A line starts with "..."
|
// - A line starts with "..."
|
||||||
// • A line contains non-printable characters
|
// - A line contains non-printable characters
|
||||||
// • Adjacent different lines differ only by whitespace
|
// - Adjacent different lines differ only by whitespace
|
||||||
//
|
//
|
||||||
// For example:
|
// For example:
|
||||||
|
//
|
||||||
// """
|
// """
|
||||||
// ... // 3 identical lines
|
// ... // 3 identical lines
|
||||||
// foo
|
// foo
|
||||||
@ -231,7 +235,7 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
|
|||||||
var out textNode = &textWrap{Prefix: "(", Value: list2, Suffix: ")"}
|
var out textNode = &textWrap{Prefix: "(", Value: list2, Suffix: ")"}
|
||||||
switch t.Kind() {
|
switch t.Kind() {
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
if t != reflect.TypeOf(string("")) {
|
if t != stringType {
|
||||||
out = opts.FormatType(t, out)
|
out = opts.FormatType(t, out)
|
||||||
}
|
}
|
||||||
case reflect.Slice:
|
case reflect.Slice:
|
||||||
@ -326,12 +330,12 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
|
|||||||
switch t.Kind() {
|
switch t.Kind() {
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
out = &textWrap{Prefix: "strings.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)}
|
out = &textWrap{Prefix: "strings.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)}
|
||||||
if t != reflect.TypeOf(string("")) {
|
if t != stringType {
|
||||||
out = opts.FormatType(t, out)
|
out = opts.FormatType(t, out)
|
||||||
}
|
}
|
||||||
case reflect.Slice:
|
case reflect.Slice:
|
||||||
out = &textWrap{Prefix: "bytes.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)}
|
out = &textWrap{Prefix: "bytes.Join(", Value: out, Suffix: fmt.Sprintf(", %q)", delim)}
|
||||||
if t != reflect.TypeOf([]byte(nil)) {
|
if t != bytesType {
|
||||||
out = opts.FormatType(t, out)
|
out = opts.FormatType(t, out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -446,7 +450,6 @@ func (opts formatOptions) formatDiffSlice(
|
|||||||
// {NumIdentical: 3},
|
// {NumIdentical: 3},
|
||||||
// {NumInserted: 1},
|
// {NumInserted: 1},
|
||||||
// ]
|
// ]
|
||||||
//
|
|
||||||
func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats) {
|
func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats) {
|
||||||
var prevMode byte
|
var prevMode byte
|
||||||
lastStats := func(mode byte) *diffStats {
|
lastStats := func(mode byte) *diffStats {
|
||||||
@ -503,7 +506,6 @@ func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats)
|
|||||||
// {NumIdentical: 8, NumRemoved: 12, NumInserted: 3},
|
// {NumIdentical: 8, NumRemoved: 12, NumInserted: 3},
|
||||||
// {NumIdentical: 63},
|
// {NumIdentical: 63},
|
||||||
// ]
|
// ]
|
||||||
//
|
|
||||||
func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStats {
|
func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStats {
|
||||||
groups, groupsOrig := groups[:0], groups
|
groups, groupsOrig := groups[:0], groups
|
||||||
for i, ds := range groupsOrig {
|
for i, ds := range groupsOrig {
|
||||||
@ -548,7 +550,6 @@ func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStat
|
|||||||
// {NumRemoved: 9},
|
// {NumRemoved: 9},
|
||||||
// {NumIdentical: 64}, // incremented by 10
|
// {NumIdentical: 64}, // incremented by 10
|
||||||
// ]
|
// ]
|
||||||
//
|
|
||||||
func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []diffStats {
|
func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []diffStats {
|
||||||
var ix, iy int // indexes into sequence x and y
|
var ix, iy int // indexes into sequence x and y
|
||||||
for i, ds := range groups {
|
for i, ds := range groups {
|
||||||
|
1
vendor/github.com/google/go-cmp/cmp/report_text.go
generated
vendored
1
vendor/github.com/google/go-cmp/cmp/report_text.go
generated
vendored
@ -393,6 +393,7 @@ func (s diffStats) Append(ds diffStats) diffStats {
|
|||||||
// String prints a humanly-readable summary of coalesced records.
|
// String prints a humanly-readable summary of coalesced records.
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
|
//
|
||||||
// diffStats{Name: "Field", NumIgnored: 5}.String() => "5 ignored fields"
|
// diffStats{Name: "Field", NumIgnored: 5}.String() => "5 ignored fields"
|
||||||
func (s diffStats) String() string {
|
func (s diffStats) String() string {
|
||||||
var ss []string
|
var ss []string
|
||||||
|
1
vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go
generated
vendored
1
vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go
generated
vendored
@ -40,7 +40,6 @@ const (
|
|||||||
// payload formats that can't be represented as JSON, such as raw binary or
|
// payload formats that can't be represented as JSON, such as raw binary or
|
||||||
// an HTML page.
|
// an HTML page.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// This message can be used both in streaming and non-streaming API methods in
|
// This message can be used both in streaming and non-streaming API methods in
|
||||||
// the request as well as the response.
|
// the request as well as the response.
|
||||||
//
|
//
|
||||||
|
1
vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go
generated
vendored
1
vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go
generated
vendored
@ -37,7 +37,6 @@ const (
|
|||||||
|
|
||||||
// The canonical error codes for gRPC APIs.
|
// The canonical error codes for gRPC APIs.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Sometimes multiple error codes may apply. Services should return
|
// Sometimes multiple error codes may apply. Services should return
|
||||||
// the most specific error code that applies. For example, prefer
|
// the most specific error code that applies. For example, prefer
|
||||||
// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply.
|
// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply.
|
||||||
|
55
vendor/google.golang.org/grpc/balancer/balancer.go
generated
vendored
55
vendor/google.golang.org/grpc/balancer/balancer.go
generated
vendored
@ -244,7 +244,7 @@ type DoneInfo struct {
|
|||||||
// ServerLoad is the load received from server. It's usually sent as part of
|
// ServerLoad is the load received from server. It's usually sent as part of
|
||||||
// trailing metadata.
|
// trailing metadata.
|
||||||
//
|
//
|
||||||
// The only supported type now is *orca_v1.LoadReport.
|
// The only supported type now is *orca_v3.LoadReport.
|
||||||
ServerLoad interface{}
|
ServerLoad interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,56 +371,3 @@ type ClientConnState struct {
|
|||||||
// ErrBadResolverState may be returned by UpdateClientConnState to indicate a
|
// ErrBadResolverState may be returned by UpdateClientConnState to indicate a
|
||||||
// problem with the provided name resolver data.
|
// problem with the provided name resolver data.
|
||||||
var ErrBadResolverState = errors.New("bad resolver state")
|
var ErrBadResolverState = errors.New("bad resolver state")
|
||||||
|
|
||||||
// ConnectivityStateEvaluator takes the connectivity states of multiple SubConns
|
|
||||||
// and returns one aggregated connectivity state.
|
|
||||||
//
|
|
||||||
// It's not thread safe.
|
|
||||||
type ConnectivityStateEvaluator struct {
|
|
||||||
numReady uint64 // Number of addrConns in ready state.
|
|
||||||
numConnecting uint64 // Number of addrConns in connecting state.
|
|
||||||
numTransientFailure uint64 // Number of addrConns in transient failure state.
|
|
||||||
numIdle uint64 // Number of addrConns in idle state.
|
|
||||||
}
|
|
||||||
|
|
||||||
// RecordTransition records state change happening in subConn and based on that
|
|
||||||
// it evaluates what aggregated state should be.
|
|
||||||
//
|
|
||||||
// - If at least one SubConn in Ready, the aggregated state is Ready;
|
|
||||||
// - Else if at least one SubConn in Connecting, the aggregated state is Connecting;
|
|
||||||
// - Else if at least one SubConn is TransientFailure, the aggregated state is Transient Failure;
|
|
||||||
// - Else if at least one SubConn is Idle, the aggregated state is Idle;
|
|
||||||
// - Else there are no subconns and the aggregated state is Transient Failure
|
|
||||||
//
|
|
||||||
// Shutdown is not considered.
|
|
||||||
func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState connectivity.State) connectivity.State {
|
|
||||||
// Update counters.
|
|
||||||
for idx, state := range []connectivity.State{oldState, newState} {
|
|
||||||
updateVal := 2*uint64(idx) - 1 // -1 for oldState and +1 for new.
|
|
||||||
switch state {
|
|
||||||
case connectivity.Ready:
|
|
||||||
cse.numReady += updateVal
|
|
||||||
case connectivity.Connecting:
|
|
||||||
cse.numConnecting += updateVal
|
|
||||||
case connectivity.TransientFailure:
|
|
||||||
cse.numTransientFailure += updateVal
|
|
||||||
case connectivity.Idle:
|
|
||||||
cse.numIdle += updateVal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Evaluate.
|
|
||||||
if cse.numReady > 0 {
|
|
||||||
return connectivity.Ready
|
|
||||||
}
|
|
||||||
if cse.numConnecting > 0 {
|
|
||||||
return connectivity.Connecting
|
|
||||||
}
|
|
||||||
if cse.numTransientFailure > 0 {
|
|
||||||
return connectivity.TransientFailure
|
|
||||||
}
|
|
||||||
if cse.numIdle > 0 {
|
|
||||||
return connectivity.Idle
|
|
||||||
}
|
|
||||||
return connectivity.TransientFailure
|
|
||||||
}
|
|
||||||
|
4
vendor/google.golang.org/grpc/balancer/base/balancer.go
generated
vendored
4
vendor/google.golang.org/grpc/balancer/base/balancer.go
generated
vendored
@ -45,6 +45,7 @@ func (bb *baseBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions)
|
|||||||
scStates: make(map[balancer.SubConn]connectivity.State),
|
scStates: make(map[balancer.SubConn]connectivity.State),
|
||||||
csEvltr: &balancer.ConnectivityStateEvaluator{},
|
csEvltr: &balancer.ConnectivityStateEvaluator{},
|
||||||
config: bb.config,
|
config: bb.config,
|
||||||
|
state: connectivity.Connecting,
|
||||||
}
|
}
|
||||||
// Initialize picker to a picker that always returns
|
// Initialize picker to a picker that always returns
|
||||||
// ErrNoSubConnAvailable, because when state of a SubConn changes, we
|
// ErrNoSubConnAvailable, because when state of a SubConn changes, we
|
||||||
@ -134,6 +135,9 @@ func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) error {
|
|||||||
b.ResolverError(errors.New("produced zero addresses"))
|
b.ResolverError(errors.New("produced zero addresses"))
|
||||||
return balancer.ErrBadResolverState
|
return balancer.ErrBadResolverState
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b.regeneratePicker()
|
||||||
|
b.cc.UpdateState(balancer.State{ConnectivityState: b.state, Picker: b.picker})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
70
vendor/google.golang.org/grpc/balancer/conn_state_evaluator.go
generated
vendored
Normal file
70
vendor/google.golang.org/grpc/balancer/conn_state_evaluator.go
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2022 gRPC authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package balancer
|
||||||
|
|
||||||
|
import "google.golang.org/grpc/connectivity"
|
||||||
|
|
||||||
|
// ConnectivityStateEvaluator takes the connectivity states of multiple SubConns
|
||||||
|
// and returns one aggregated connectivity state.
|
||||||
|
//
|
||||||
|
// It's not thread safe.
|
||||||
|
type ConnectivityStateEvaluator struct {
|
||||||
|
numReady uint64 // Number of addrConns in ready state.
|
||||||
|
numConnecting uint64 // Number of addrConns in connecting state.
|
||||||
|
numTransientFailure uint64 // Number of addrConns in transient failure state.
|
||||||
|
numIdle uint64 // Number of addrConns in idle state.
|
||||||
|
}
|
||||||
|
|
||||||
|
// RecordTransition records state change happening in subConn and based on that
|
||||||
|
// it evaluates what aggregated state should be.
|
||||||
|
//
|
||||||
|
// - If at least one SubConn in Ready, the aggregated state is Ready;
|
||||||
|
// - Else if at least one SubConn in Connecting, the aggregated state is Connecting;
|
||||||
|
// - Else if at least one SubConn is Idle, the aggregated state is Idle;
|
||||||
|
// - Else if at least one SubConn is TransientFailure (or there are no SubConns), the aggregated state is Transient Failure.
|
||||||
|
//
|
||||||
|
// Shutdown is not considered.
|
||||||
|
func (cse *ConnectivityStateEvaluator) RecordTransition(oldState, newState connectivity.State) connectivity.State {
|
||||||
|
// Update counters.
|
||||||
|
for idx, state := range []connectivity.State{oldState, newState} {
|
||||||
|
updateVal := 2*uint64(idx) - 1 // -1 for oldState and +1 for new.
|
||||||
|
switch state {
|
||||||
|
case connectivity.Ready:
|
||||||
|
cse.numReady += updateVal
|
||||||
|
case connectivity.Connecting:
|
||||||
|
cse.numConnecting += updateVal
|
||||||
|
case connectivity.TransientFailure:
|
||||||
|
cse.numTransientFailure += updateVal
|
||||||
|
case connectivity.Idle:
|
||||||
|
cse.numIdle += updateVal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Evaluate.
|
||||||
|
if cse.numReady > 0 {
|
||||||
|
return connectivity.Ready
|
||||||
|
}
|
||||||
|
if cse.numConnecting > 0 {
|
||||||
|
return connectivity.Connecting
|
||||||
|
}
|
||||||
|
if cse.numIdle > 0 {
|
||||||
|
return connectivity.Idle
|
||||||
|
}
|
||||||
|
return connectivity.TransientFailure
|
||||||
|
}
|
16
vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go
generated
vendored
16
vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go
generated
vendored
@ -22,7 +22,7 @@
|
|||||||
package roundrobin
|
package roundrobin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync/atomic"
|
||||||
|
|
||||||
"google.golang.org/grpc/balancer"
|
"google.golang.org/grpc/balancer"
|
||||||
"google.golang.org/grpc/balancer/base"
|
"google.golang.org/grpc/balancer/base"
|
||||||
@ -60,7 +60,7 @@ func (*rrPickerBuilder) Build(info base.PickerBuildInfo) balancer.Picker {
|
|||||||
// Start at a random index, as the same RR balancer rebuilds a new
|
// Start at a random index, as the same RR balancer rebuilds a new
|
||||||
// picker when SubConn states change, and we don't want to apply excess
|
// picker when SubConn states change, and we don't want to apply excess
|
||||||
// load to the first server in the list.
|
// load to the first server in the list.
|
||||||
next: grpcrand.Intn(len(scs)),
|
next: uint32(grpcrand.Intn(len(scs))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,15 +69,13 @@ type rrPicker struct {
|
|||||||
// created. The slice is immutable. Each Get() will do a round robin
|
// created. The slice is immutable. Each Get() will do a round robin
|
||||||
// selection from it and return the selected SubConn.
|
// selection from it and return the selected SubConn.
|
||||||
subConns []balancer.SubConn
|
subConns []balancer.SubConn
|
||||||
|
next uint32
|
||||||
mu sync.Mutex
|
|
||||||
next int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *rrPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) {
|
func (p *rrPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) {
|
||||||
p.mu.Lock()
|
subConnsLen := uint32(len(p.subConns))
|
||||||
sc := p.subConns[p.next]
|
nextIndex := atomic.AddUint32(&p.next, 1)
|
||||||
p.next = (p.next + 1) % len(p.subConns)
|
|
||||||
p.mu.Unlock()
|
sc := p.subConns[nextIndex%subConnsLen]
|
||||||
return balancer.PickResult{SubConn: sc}, nil
|
return balancer.PickResult{SubConn: sc}, nil
|
||||||
}
|
}
|
||||||
|
7
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
7
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
@ -146,6 +146,10 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *
|
|||||||
cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{nil})
|
cc.safeConfigSelector.UpdateConfigSelector(&defaultConfigSelector{nil})
|
||||||
cc.ctx, cc.cancel = context.WithCancel(context.Background())
|
cc.ctx, cc.cancel = context.WithCancel(context.Background())
|
||||||
|
|
||||||
|
for _, opt := range extraDialOptions {
|
||||||
|
opt.apply(&cc.dopts)
|
||||||
|
}
|
||||||
|
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt.apply(&cc.dopts)
|
opt.apply(&cc.dopts)
|
||||||
}
|
}
|
||||||
@ -708,8 +712,8 @@ func (cc *ClientConn) newAddrConn(addrs []resolver.Address, opts balancer.NewSub
|
|||||||
ac.ctx, ac.cancel = context.WithCancel(cc.ctx)
|
ac.ctx, ac.cancel = context.WithCancel(cc.ctx)
|
||||||
// Track ac in cc. This needs to be done before any getTransport(...) is called.
|
// Track ac in cc. This needs to be done before any getTransport(...) is called.
|
||||||
cc.mu.Lock()
|
cc.mu.Lock()
|
||||||
|
defer cc.mu.Unlock()
|
||||||
if cc.conns == nil {
|
if cc.conns == nil {
|
||||||
cc.mu.Unlock()
|
|
||||||
return nil, ErrClientConnClosing
|
return nil, ErrClientConnClosing
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,7 +732,6 @@ func (cc *ClientConn) newAddrConn(addrs []resolver.Address, opts balancer.NewSub
|
|||||||
})
|
})
|
||||||
|
|
||||||
cc.conns[ac] = struct{}{}
|
cc.conns[ac] = struct{}{}
|
||||||
cc.mu.Unlock()
|
|
||||||
return ac, nil
|
return ac, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
49
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
49
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
@ -29,12 +29,23 @@ import (
|
|||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
"google.golang.org/grpc/internal"
|
"google.golang.org/grpc/internal"
|
||||||
internalbackoff "google.golang.org/grpc/internal/backoff"
|
internalbackoff "google.golang.org/grpc/internal/backoff"
|
||||||
|
"google.golang.org/grpc/internal/binarylog"
|
||||||
"google.golang.org/grpc/internal/transport"
|
"google.golang.org/grpc/internal/transport"
|
||||||
"google.golang.org/grpc/keepalive"
|
"google.golang.org/grpc/keepalive"
|
||||||
"google.golang.org/grpc/resolver"
|
"google.golang.org/grpc/resolver"
|
||||||
"google.golang.org/grpc/stats"
|
"google.golang.org/grpc/stats"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
internal.AddGlobalDialOptions = func(opt ...DialOption) {
|
||||||
|
extraDialOptions = append(extraDialOptions, opt...)
|
||||||
|
}
|
||||||
|
internal.ClearGlobalDialOptions = func() {
|
||||||
|
extraDialOptions = nil
|
||||||
|
}
|
||||||
|
internal.WithBinaryLogger = withBinaryLogger
|
||||||
|
}
|
||||||
|
|
||||||
// dialOptions configure a Dial call. dialOptions are set by the DialOption
|
// dialOptions configure a Dial call. dialOptions are set by the DialOption
|
||||||
// values passed to Dial.
|
// values passed to Dial.
|
||||||
type dialOptions struct {
|
type dialOptions struct {
|
||||||
@ -52,6 +63,7 @@ type dialOptions struct {
|
|||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
scChan <-chan ServiceConfig
|
scChan <-chan ServiceConfig
|
||||||
authority string
|
authority string
|
||||||
|
binaryLogger binarylog.Logger
|
||||||
copts transport.ConnectOptions
|
copts transport.ConnectOptions
|
||||||
callOptions []CallOption
|
callOptions []CallOption
|
||||||
channelzParentID *channelz.Identifier
|
channelzParentID *channelz.Identifier
|
||||||
@ -70,10 +82,12 @@ type DialOption interface {
|
|||||||
apply(*dialOptions)
|
apply(*dialOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var extraDialOptions []DialOption
|
||||||
|
|
||||||
// EmptyDialOption does not alter the dial configuration. It can be embedded in
|
// EmptyDialOption does not alter the dial configuration. It can be embedded in
|
||||||
// another structure to build custom dial options.
|
// another structure to build custom dial options.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -264,7 +278,7 @@ func WithBlock() DialOption {
|
|||||||
// the context.DeadlineExceeded error.
|
// the context.DeadlineExceeded error.
|
||||||
// Implies WithBlock()
|
// Implies WithBlock()
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -293,7 +307,7 @@ func WithInsecure() DialOption {
|
|||||||
// WithNoProxy returns a DialOption which disables the use of proxies for this
|
// WithNoProxy returns a DialOption which disables the use of proxies for this
|
||||||
// ClientConn. This is ignored if WithDialer or WithContextDialer are used.
|
// ClientConn. This is ignored if WithDialer or WithContextDialer are used.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -324,7 +338,7 @@ func WithPerRPCCredentials(creds credentials.PerRPCCredentials) DialOption {
|
|||||||
// the ClientConn.WithCreds. This should not be used together with
|
// the ClientConn.WithCreds. This should not be used together with
|
||||||
// WithTransportCredentials.
|
// WithTransportCredentials.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -380,7 +394,21 @@ func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption {
|
|||||||
// all the RPCs and underlying network connections in this ClientConn.
|
// all the RPCs and underlying network connections in this ClientConn.
|
||||||
func WithStatsHandler(h stats.Handler) DialOption {
|
func WithStatsHandler(h stats.Handler) DialOption {
|
||||||
return newFuncDialOption(func(o *dialOptions) {
|
return newFuncDialOption(func(o *dialOptions) {
|
||||||
o.copts.StatsHandler = h
|
if h == nil {
|
||||||
|
logger.Error("ignoring nil parameter in grpc.WithStatsHandler ClientOption")
|
||||||
|
// Do not allow a nil stats handler, which would otherwise cause
|
||||||
|
// panics.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
o.copts.StatsHandlers = append(o.copts.StatsHandlers, h)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// withBinaryLogger returns a DialOption that specifies the binary logger for
|
||||||
|
// this ClientConn.
|
||||||
|
func withBinaryLogger(bl binarylog.Logger) DialOption {
|
||||||
|
return newFuncDialOption(func(o *dialOptions) {
|
||||||
|
o.binaryLogger = bl
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +420,7 @@ func WithStatsHandler(h stats.Handler) DialOption {
|
|||||||
// FailOnNonTempDialError only affects the initial dial, and does not do
|
// FailOnNonTempDialError only affects the initial dial, and does not do
|
||||||
// anything useful unless you are also using WithBlock().
|
// anything useful unless you are also using WithBlock().
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -472,7 +500,7 @@ func WithAuthority(a string) DialOption {
|
|||||||
// current ClientConn's parent. This function is used in nested channel creation
|
// current ClientConn's parent. This function is used in nested channel creation
|
||||||
// (e.g. grpclb dial).
|
// (e.g. grpclb dial).
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -517,9 +545,6 @@ func WithDefaultServiceConfig(s string) DialOption {
|
|||||||
// service config enables them. This does not impact transparent retries, which
|
// service config enables them. This does not impact transparent retries, which
|
||||||
// will happen automatically if no data is written to the wire or if the RPC is
|
// will happen automatically if no data is written to the wire or if the RPC is
|
||||||
// unprocessed by the remote server.
|
// unprocessed by the remote server.
|
||||||
//
|
|
||||||
// Retry support is currently enabled by default, but may be disabled by
|
|
||||||
// setting the environment variable "GRPC_GO_RETRY" to "off".
|
|
||||||
func WithDisableRetry() DialOption {
|
func WithDisableRetry() DialOption {
|
||||||
return newFuncDialOption(func(o *dialOptions) {
|
return newFuncDialOption(func(o *dialOptions) {
|
||||||
o.disableRetry = true
|
o.disableRetry = true
|
||||||
@ -537,7 +562,7 @@ func WithMaxHeaderListSize(s uint32) DialOption {
|
|||||||
// WithDisableHealthCheck disables the LB channel health checking for all
|
// WithDisableHealthCheck disables the LB channel health checking for all
|
||||||
// SubConns of this ClientConn.
|
// SubConns of this ClientConn.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -584,7 +609,7 @@ func withMinConnectDeadline(f func() time.Duration) DialOption {
|
|||||||
// resolver.Register. They will be matched against the scheme used for the
|
// resolver.Register. They will be matched against the scheme used for the
|
||||||
// current Dial only, and will take precedence over the global registry.
|
// current Dial only, and will take precedence over the global registry.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
|
17
vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go
generated
vendored
17
vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go
generated
vendored
@ -1,3 +1,20 @@
|
|||||||
|
// Copyright 2015 The gRPC 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.
|
||||||
|
|
||||||
|
// The canonical version of this proto can be found at
|
||||||
|
// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
|
||||||
|
|
||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-grpc v1.2.0
|
// - protoc-gen-go-grpc v1.2.0
|
||||||
|
2
vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go
generated
vendored
2
vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go
generated
vendored
@ -193,6 +193,8 @@ func (gsb *Balancer) ExitIdle() {
|
|||||||
ei.ExitIdle()
|
ei.ExitIdle()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
gsb.mu.Lock()
|
||||||
|
defer gsb.mu.Unlock()
|
||||||
for sc := range balToUpdate.subconns {
|
for sc := range balToUpdate.subconns {
|
||||||
sc.Connect()
|
sc.Connect()
|
||||||
}
|
}
|
||||||
|
24
vendor/google.golang.org/grpc/internal/binarylog/binarylog.go
generated
vendored
24
vendor/google.golang.org/grpc/internal/binarylog/binarylog.go
generated
vendored
@ -37,30 +37,30 @@ type Logger interface {
|
|||||||
// binLogger is the global binary logger for the binary. One of this should be
|
// binLogger is the global binary logger for the binary. One of this should be
|
||||||
// built at init time from the configuration (environment variable or flags).
|
// built at init time from the configuration (environment variable or flags).
|
||||||
//
|
//
|
||||||
// It is used to get a methodLogger for each individual method.
|
// It is used to get a MethodLogger for each individual method.
|
||||||
var binLogger Logger
|
var binLogger Logger
|
||||||
|
|
||||||
var grpclogLogger = grpclog.Component("binarylog")
|
var grpclogLogger = grpclog.Component("binarylog")
|
||||||
|
|
||||||
// SetLogger sets the binarg logger.
|
// SetLogger sets the binary logger.
|
||||||
//
|
//
|
||||||
// Only call this at init time.
|
// Only call this at init time.
|
||||||
func SetLogger(l Logger) {
|
func SetLogger(l Logger) {
|
||||||
binLogger = l
|
binLogger = l
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLogger gets the binarg logger.
|
// GetLogger gets the binary logger.
|
||||||
//
|
//
|
||||||
// Only call this at init time.
|
// Only call this at init time.
|
||||||
func GetLogger() Logger {
|
func GetLogger() Logger {
|
||||||
return binLogger
|
return binLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMethodLogger returns the methodLogger for the given methodName.
|
// GetMethodLogger returns the MethodLogger for the given methodName.
|
||||||
//
|
//
|
||||||
// methodName should be in the format of "/service/method".
|
// methodName should be in the format of "/service/method".
|
||||||
//
|
//
|
||||||
// Each methodLogger returned by this method is a new instance. This is to
|
// Each MethodLogger returned by this method is a new instance. This is to
|
||||||
// generate sequence id within the call.
|
// generate sequence id within the call.
|
||||||
func GetMethodLogger(methodName string) MethodLogger {
|
func GetMethodLogger(methodName string) MethodLogger {
|
||||||
if binLogger == nil {
|
if binLogger == nil {
|
||||||
@ -117,7 +117,7 @@ func (l *logger) setDefaultMethodLogger(ml *MethodLoggerConfig) error {
|
|||||||
|
|
||||||
// Set method logger for "service/*".
|
// Set method logger for "service/*".
|
||||||
//
|
//
|
||||||
// New methodLogger with same service overrides the old one.
|
// New MethodLogger with same service overrides the old one.
|
||||||
func (l *logger) setServiceMethodLogger(service string, ml *MethodLoggerConfig) error {
|
func (l *logger) setServiceMethodLogger(service string, ml *MethodLoggerConfig) error {
|
||||||
if _, ok := l.config.Services[service]; ok {
|
if _, ok := l.config.Services[service]; ok {
|
||||||
return fmt.Errorf("conflicting service rules for service %v found", service)
|
return fmt.Errorf("conflicting service rules for service %v found", service)
|
||||||
@ -131,7 +131,7 @@ func (l *logger) setServiceMethodLogger(service string, ml *MethodLoggerConfig)
|
|||||||
|
|
||||||
// Set method logger for "service/method".
|
// Set method logger for "service/method".
|
||||||
//
|
//
|
||||||
// New methodLogger with same method overrides the old one.
|
// New MethodLogger with same method overrides the old one.
|
||||||
func (l *logger) setMethodMethodLogger(method string, ml *MethodLoggerConfig) error {
|
func (l *logger) setMethodMethodLogger(method string, ml *MethodLoggerConfig) error {
|
||||||
if _, ok := l.config.Blacklist[method]; ok {
|
if _, ok := l.config.Blacklist[method]; ok {
|
||||||
return fmt.Errorf("conflicting blacklist rules for method %v found", method)
|
return fmt.Errorf("conflicting blacklist rules for method %v found", method)
|
||||||
@ -161,11 +161,11 @@ func (l *logger) setBlacklist(method string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getMethodLogger returns the methodLogger for the given methodName.
|
// getMethodLogger returns the MethodLogger for the given methodName.
|
||||||
//
|
//
|
||||||
// methodName should be in the format of "/service/method".
|
// methodName should be in the format of "/service/method".
|
||||||
//
|
//
|
||||||
// Each methodLogger returned by this method is a new instance. This is to
|
// Each MethodLogger returned by this method is a new instance. This is to
|
||||||
// generate sequence id within the call.
|
// generate sequence id within the call.
|
||||||
func (l *logger) GetMethodLogger(methodName string) MethodLogger {
|
func (l *logger) GetMethodLogger(methodName string) MethodLogger {
|
||||||
s, m, err := grpcutil.ParseMethod(methodName)
|
s, m, err := grpcutil.ParseMethod(methodName)
|
||||||
@ -174,16 +174,16 @@ func (l *logger) GetMethodLogger(methodName string) MethodLogger {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if ml, ok := l.config.Methods[s+"/"+m]; ok {
|
if ml, ok := l.config.Methods[s+"/"+m]; ok {
|
||||||
return newMethodLogger(ml.Header, ml.Message)
|
return NewTruncatingMethodLogger(ml.Header, ml.Message)
|
||||||
}
|
}
|
||||||
if _, ok := l.config.Blacklist[s+"/"+m]; ok {
|
if _, ok := l.config.Blacklist[s+"/"+m]; ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if ml, ok := l.config.Services[s]; ok {
|
if ml, ok := l.config.Services[s]; ok {
|
||||||
return newMethodLogger(ml.Header, ml.Message)
|
return NewTruncatingMethodLogger(ml.Header, ml.Message)
|
||||||
}
|
}
|
||||||
if l.config.All == nil {
|
if l.config.All == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return newMethodLogger(l.config.All.Header, l.config.All.Message)
|
return NewTruncatingMethodLogger(l.config.All.Header, l.config.All.Message)
|
||||||
}
|
}
|
||||||
|
2
vendor/google.golang.org/grpc/internal/binarylog/env_config.go
generated
vendored
2
vendor/google.golang.org/grpc/internal/binarylog/env_config.go
generated
vendored
@ -57,7 +57,7 @@ func NewLoggerFromConfigString(s string) Logger {
|
|||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
// fillMethodLoggerWithConfigString parses config, creates methodLogger and adds
|
// fillMethodLoggerWithConfigString parses config, creates TruncatingMethodLogger and adds
|
||||||
// it to the right map in the logger.
|
// it to the right map in the logger.
|
||||||
func (l *logger) fillMethodLoggerWithConfigString(config string) error {
|
func (l *logger) fillMethodLoggerWithConfigString(config string) error {
|
||||||
// "" is invalid.
|
// "" is invalid.
|
||||||
|
19
vendor/google.golang.org/grpc/internal/binarylog/method_logger.go
generated
vendored
19
vendor/google.golang.org/grpc/internal/binarylog/method_logger.go
generated
vendored
@ -52,7 +52,9 @@ type MethodLogger interface {
|
|||||||
Log(LogEntryConfig)
|
Log(LogEntryConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
type methodLogger struct {
|
// TruncatingMethodLogger is a method logger that truncates headers and messages
|
||||||
|
// based on configured fields.
|
||||||
|
type TruncatingMethodLogger struct {
|
||||||
headerMaxLen, messageMaxLen uint64
|
headerMaxLen, messageMaxLen uint64
|
||||||
|
|
||||||
callID uint64
|
callID uint64
|
||||||
@ -61,8 +63,9 @@ type methodLogger struct {
|
|||||||
sink Sink // TODO(blog): make this plugable.
|
sink Sink // TODO(blog): make this plugable.
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMethodLogger(h, m uint64) *methodLogger {
|
// NewTruncatingMethodLogger returns a new truncating method logger.
|
||||||
return &methodLogger{
|
func NewTruncatingMethodLogger(h, m uint64) *TruncatingMethodLogger {
|
||||||
|
return &TruncatingMethodLogger{
|
||||||
headerMaxLen: h,
|
headerMaxLen: h,
|
||||||
messageMaxLen: m,
|
messageMaxLen: m,
|
||||||
|
|
||||||
@ -75,8 +78,8 @@ func newMethodLogger(h, m uint64) *methodLogger {
|
|||||||
|
|
||||||
// Build is an internal only method for building the proto message out of the
|
// Build is an internal only method for building the proto message out of the
|
||||||
// input event. It's made public to enable other library to reuse as much logic
|
// input event. It's made public to enable other library to reuse as much logic
|
||||||
// in methodLogger as possible.
|
// in TruncatingMethodLogger as possible.
|
||||||
func (ml *methodLogger) Build(c LogEntryConfig) *pb.GrpcLogEntry {
|
func (ml *TruncatingMethodLogger) Build(c LogEntryConfig) *pb.GrpcLogEntry {
|
||||||
m := c.toProto()
|
m := c.toProto()
|
||||||
timestamp, _ := ptypes.TimestampProto(time.Now())
|
timestamp, _ := ptypes.TimestampProto(time.Now())
|
||||||
m.Timestamp = timestamp
|
m.Timestamp = timestamp
|
||||||
@ -95,11 +98,11 @@ func (ml *methodLogger) Build(c LogEntryConfig) *pb.GrpcLogEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Log creates a proto binary log entry, and logs it to the sink.
|
// Log creates a proto binary log entry, and logs it to the sink.
|
||||||
func (ml *methodLogger) Log(c LogEntryConfig) {
|
func (ml *TruncatingMethodLogger) Log(c LogEntryConfig) {
|
||||||
ml.sink.Write(ml.Build(c))
|
ml.sink.Write(ml.Build(c))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ml *methodLogger) truncateMetadata(mdPb *pb.Metadata) (truncated bool) {
|
func (ml *TruncatingMethodLogger) truncateMetadata(mdPb *pb.Metadata) (truncated bool) {
|
||||||
if ml.headerMaxLen == maxUInt {
|
if ml.headerMaxLen == maxUInt {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -129,7 +132,7 @@ func (ml *methodLogger) truncateMetadata(mdPb *pb.Metadata) (truncated bool) {
|
|||||||
return truncated
|
return truncated
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ml *methodLogger) truncateMessage(msgPb *pb.Message) (truncated bool) {
|
func (ml *TruncatingMethodLogger) truncateMessage(msgPb *pb.Message) (truncated bool) {
|
||||||
if ml.messageMaxLen == maxUInt {
|
if ml.messageMaxLen == maxUInt {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
36
vendor/google.golang.org/grpc/internal/envconfig/observability.go
generated
vendored
Normal file
36
vendor/google.golang.org/grpc/internal/envconfig/observability.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2022 gRPC 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 envconfig
|
||||||
|
|
||||||
|
import "os"
|
||||||
|
|
||||||
|
const (
|
||||||
|
envObservabilityConfig = "GRPC_GCP_OBSERVABILITY_CONFIG"
|
||||||
|
envObservabilityConfigFile = "GRPC_GCP_OBSERVABILITY_CONFIG_FILE"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ObservabilityConfig is the json configuration for the gcp/observability
|
||||||
|
// package specified directly in the envObservabilityConfig env var.
|
||||||
|
ObservabilityConfig = os.Getenv(envObservabilityConfig)
|
||||||
|
// ObservabilityConfigFile is the json configuration for the
|
||||||
|
// gcp/observability specified in a file with the location specified in
|
||||||
|
// envObservabilityConfigFile env var.
|
||||||
|
ObservabilityConfigFile = os.Getenv(envObservabilityConfigFile)
|
||||||
|
)
|
8
vendor/google.golang.org/grpc/internal/envconfig/xds.go
generated
vendored
8
vendor/google.golang.org/grpc/internal/envconfig/xds.go
generated
vendored
@ -77,16 +77,16 @@ var (
|
|||||||
// environment variable
|
// environment variable
|
||||||
// "GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER" to
|
// "GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER" to
|
||||||
// "true".
|
// "true".
|
||||||
XDSAggregateAndDNS = strings.EqualFold(os.Getenv(aggregateAndDNSSupportEnv), "true")
|
XDSAggregateAndDNS = !strings.EqualFold(os.Getenv(aggregateAndDNSSupportEnv), "false")
|
||||||
|
|
||||||
// XDSRBAC indicates whether xDS configured RBAC HTTP Filter is enabled,
|
// XDSRBAC indicates whether xDS configured RBAC HTTP Filter is enabled,
|
||||||
// which can be disabled by setting the environment variable
|
// which can be disabled by setting the environment variable
|
||||||
// "GRPC_XDS_EXPERIMENTAL_RBAC" to "false".
|
// "GRPC_XDS_EXPERIMENTAL_RBAC" to "false".
|
||||||
XDSRBAC = !strings.EqualFold(os.Getenv(rbacSupportEnv), "false")
|
XDSRBAC = !strings.EqualFold(os.Getenv(rbacSupportEnv), "false")
|
||||||
// XDSOutlierDetection indicates whether outlier detection support is
|
// XDSOutlierDetection indicates whether outlier detection support is
|
||||||
// enabled, which can be enabled by setting the environment variable
|
// enabled, which can be disabled by setting the environment variable
|
||||||
// "GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION" to "true".
|
// "GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION" to "false".
|
||||||
XDSOutlierDetection = strings.EqualFold(os.Getenv(outlierDetectionSupportEnv), "true")
|
XDSOutlierDetection = !strings.EqualFold(os.Getenv(outlierDetectionSupportEnv), "false")
|
||||||
// XDSFederation indicates whether federation support is enabled.
|
// XDSFederation indicates whether federation support is enabled.
|
||||||
XDSFederation = strings.EqualFold(os.Getenv(federationEnv), "true")
|
XDSFederation = strings.EqualFold(os.Getenv(federationEnv), "true")
|
||||||
|
|
||||||
|
7
vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go
generated
vendored
7
vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go
generated
vendored
@ -52,6 +52,13 @@ func Intn(n int) int {
|
|||||||
return r.Intn(n)
|
return r.Intn(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Int31n implements rand.Int31n on the grpcrand global source.
|
||||||
|
func Int31n(n int32) int32 {
|
||||||
|
mu.Lock()
|
||||||
|
defer mu.Unlock()
|
||||||
|
return r.Int31n(n)
|
||||||
|
}
|
||||||
|
|
||||||
// Float64 implements rand.Float64 on the grpcrand global source.
|
// Float64 implements rand.Float64 on the grpcrand global source.
|
||||||
func Float64() float64 {
|
func Float64() float64 {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
|
5
vendor/google.golang.org/grpc/internal/grpcutil/method.go
generated
vendored
5
vendor/google.golang.org/grpc/internal/grpcutil/method.go
generated
vendored
@ -39,6 +39,11 @@ func ParseMethod(methodName string) (service, method string, _ error) {
|
|||||||
return methodName[:pos], methodName[pos+1:], nil
|
return methodName[:pos], methodName[pos+1:], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// baseContentType is the base content-type for gRPC. This is a valid
|
||||||
|
// content-type on it's own, but can also include a content-subtype such as
|
||||||
|
// "proto" as a suffix after "+" or ";". See
|
||||||
|
// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests
|
||||||
|
// for more details.
|
||||||
const baseContentType = "application/grpc"
|
const baseContentType = "application/grpc"
|
||||||
|
|
||||||
// ContentSubtype returns the content-subtype for the given content-type. The
|
// ContentSubtype returns the content-subtype for the given content-type. The
|
||||||
|
64
vendor/google.golang.org/grpc/internal/internal.go
generated
vendored
64
vendor/google.golang.org/grpc/internal/internal.go
generated
vendored
@ -63,6 +63,70 @@ var (
|
|||||||
// xDS-enabled server invokes this method on a grpc.Server when a particular
|
// xDS-enabled server invokes this method on a grpc.Server when a particular
|
||||||
// listener moves to "not-serving" mode.
|
// listener moves to "not-serving" mode.
|
||||||
DrainServerTransports interface{} // func(*grpc.Server, string)
|
DrainServerTransports interface{} // func(*grpc.Server, string)
|
||||||
|
// AddGlobalServerOptions adds an array of ServerOption that will be
|
||||||
|
// effective globally for newly created servers. The priority will be: 1.
|
||||||
|
// user-provided; 2. this method; 3. default values.
|
||||||
|
AddGlobalServerOptions interface{} // func(opt ...ServerOption)
|
||||||
|
// ClearGlobalServerOptions clears the array of extra ServerOption. This
|
||||||
|
// method is useful in testing and benchmarking.
|
||||||
|
ClearGlobalServerOptions func()
|
||||||
|
// AddGlobalDialOptions adds an array of DialOption that will be effective
|
||||||
|
// globally for newly created client channels. The priority will be: 1.
|
||||||
|
// user-provided; 2. this method; 3. default values.
|
||||||
|
AddGlobalDialOptions interface{} // func(opt ...DialOption)
|
||||||
|
// ClearGlobalDialOptions clears the array of extra DialOption. This
|
||||||
|
// method is useful in testing and benchmarking.
|
||||||
|
ClearGlobalDialOptions func()
|
||||||
|
// JoinServerOptions combines the server options passed as arguments into a
|
||||||
|
// single server option.
|
||||||
|
JoinServerOptions interface{} // func(...grpc.ServerOption) grpc.ServerOption
|
||||||
|
|
||||||
|
// WithBinaryLogger returns a DialOption that specifies the binary logger
|
||||||
|
// for a ClientConn.
|
||||||
|
WithBinaryLogger interface{} // func(binarylog.Logger) grpc.DialOption
|
||||||
|
// BinaryLogger returns a ServerOption that can set the binary logger for a
|
||||||
|
// server.
|
||||||
|
BinaryLogger interface{} // func(binarylog.Logger) grpc.ServerOption
|
||||||
|
|
||||||
|
// NewXDSResolverWithConfigForTesting creates a new xds resolver builder using
|
||||||
|
// the provided xds bootstrap config instead of the global configuration from
|
||||||
|
// the supported environment variables. The resolver.Builder is meant to be
|
||||||
|
// used in conjunction with the grpc.WithResolvers DialOption.
|
||||||
|
//
|
||||||
|
// Testing Only
|
||||||
|
//
|
||||||
|
// This function should ONLY be used for testing and may not work with some
|
||||||
|
// other features, including the CSDS service.
|
||||||
|
NewXDSResolverWithConfigForTesting interface{} // func([]byte) (resolver.Builder, error)
|
||||||
|
|
||||||
|
// RegisterRLSClusterSpecifierPluginForTesting registers the RLS Cluster
|
||||||
|
// Specifier Plugin for testing purposes, regardless of the XDSRLS environment
|
||||||
|
// variable.
|
||||||
|
//
|
||||||
|
// TODO: Remove this function once the RLS env var is removed.
|
||||||
|
RegisterRLSClusterSpecifierPluginForTesting func()
|
||||||
|
|
||||||
|
// UnregisterRLSClusterSpecifierPluginForTesting unregisters the RLS Cluster
|
||||||
|
// Specifier Plugin for testing purposes. This is needed because there is no way
|
||||||
|
// to unregister the RLS Cluster Specifier Plugin after registering it solely
|
||||||
|
// for testing purposes using RegisterRLSClusterSpecifierPluginForTesting().
|
||||||
|
//
|
||||||
|
// TODO: Remove this function once the RLS env var is removed.
|
||||||
|
UnregisterRLSClusterSpecifierPluginForTesting func()
|
||||||
|
|
||||||
|
// RegisterRBACHTTPFilterForTesting registers the RBAC HTTP Filter for testing
|
||||||
|
// purposes, regardless of the RBAC environment variable.
|
||||||
|
//
|
||||||
|
// TODO: Remove this function once the RBAC env var is removed.
|
||||||
|
RegisterRBACHTTPFilterForTesting func()
|
||||||
|
|
||||||
|
// UnregisterRBACHTTPFilterForTesting unregisters the RBAC HTTP Filter for
|
||||||
|
// testing purposes. This is needed because there is no way to unregister the
|
||||||
|
// HTTP Filter after registering it solely for testing purposes using
|
||||||
|
// RegisterRBACHTTPFilterForTesting().
|
||||||
|
//
|
||||||
|
// TODO: Remove this function once the RBAC env var is removed.
|
||||||
|
UnregisterRBACHTTPFilterForTesting func()
|
||||||
)
|
)
|
||||||
|
|
||||||
// HealthChecker defines the signature of the client-side LB channel health checking function.
|
// HealthChecker defines the signature of the client-side LB channel health checking function.
|
||||||
|
5
vendor/google.golang.org/grpc/internal/resolver/unix/unix.go
generated
vendored
5
vendor/google.golang.org/grpc/internal/resolver/unix/unix.go
generated
vendored
@ -49,8 +49,9 @@ func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, _ resolv
|
|||||||
}
|
}
|
||||||
addr := resolver.Address{Addr: endpoint}
|
addr := resolver.Address{Addr: endpoint}
|
||||||
if b.scheme == unixAbstractScheme {
|
if b.scheme == unixAbstractScheme {
|
||||||
// prepend "\x00" to address for unix-abstract
|
// We can not prepend \0 as c++ gRPC does, as in Golang '@' is used to signify we do
|
||||||
addr.Addr = "\x00" + addr.Addr
|
// not want trailing \0 in address.
|
||||||
|
addr.Addr = "@" + addr.Addr
|
||||||
}
|
}
|
||||||
cc.UpdateState(resolver.State{Addresses: []resolver.Address{networktype.Set(addr, "unix")}})
|
cc.UpdateState(resolver.State{Addresses: []resolver.Address{networktype.Set(addr, "unix")}})
|
||||||
return &nopResolver{}, nil
|
return &nopResolver{}, nil
|
||||||
|
4
vendor/google.golang.org/grpc/internal/transport/controlbuf.go
generated
vendored
4
vendor/google.golang.org/grpc/internal/transport/controlbuf.go
generated
vendored
@ -886,9 +886,9 @@ func (l *loopyWriter) processData() (bool, error) {
|
|||||||
dataItem := str.itl.peek().(*dataFrame) // Peek at the first data item this stream.
|
dataItem := str.itl.peek().(*dataFrame) // Peek at the first data item this stream.
|
||||||
// A data item is represented by a dataFrame, since it later translates into
|
// A data item is represented by a dataFrame, since it later translates into
|
||||||
// multiple HTTP2 data frames.
|
// multiple HTTP2 data frames.
|
||||||
// Every dataFrame has two buffers; h that keeps grpc-message header and d that is acutal data.
|
// Every dataFrame has two buffers; h that keeps grpc-message header and d that is actual data.
|
||||||
// As an optimization to keep wire traffic low, data from d is copied to h to make as big as the
|
// As an optimization to keep wire traffic low, data from d is copied to h to make as big as the
|
||||||
// maximum possilbe HTTP2 frame size.
|
// maximum possible HTTP2 frame size.
|
||||||
|
|
||||||
if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // Empty data frame
|
if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // Empty data frame
|
||||||
// Client sends out empty data frame with endStream = true
|
// Client sends out empty data frame with endStream = true
|
||||||
|
18
vendor/google.golang.org/grpc/internal/transport/handler_server.go
generated
vendored
18
vendor/google.golang.org/grpc/internal/transport/handler_server.go
generated
vendored
@ -49,7 +49,7 @@ import (
|
|||||||
// NewServerHandlerTransport returns a ServerTransport handling gRPC
|
// NewServerHandlerTransport returns a ServerTransport handling gRPC
|
||||||
// from inside an http.Handler. It requires that the http Server
|
// from inside an http.Handler. It requires that the http Server
|
||||||
// supports HTTP/2.
|
// supports HTTP/2.
|
||||||
func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats stats.Handler) (ServerTransport, error) {
|
func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []stats.Handler) (ServerTransport, error) {
|
||||||
if r.ProtoMajor != 2 {
|
if r.ProtoMajor != 2 {
|
||||||
return nil, errors.New("gRPC requires HTTP/2")
|
return nil, errors.New("gRPC requires HTTP/2")
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ type serverHandlerTransport struct {
|
|||||||
// TODO make sure this is consistent across handler_server and http2_server
|
// TODO make sure this is consistent across handler_server and http2_server
|
||||||
contentSubtype string
|
contentSubtype string
|
||||||
|
|
||||||
stats stats.Handler
|
stats []stats.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ht *serverHandlerTransport) Close() {
|
func (ht *serverHandlerTransport) Close() {
|
||||||
@ -228,10 +228,10 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro
|
|||||||
})
|
})
|
||||||
|
|
||||||
if err == nil { // transport has not been closed
|
if err == nil { // transport has not been closed
|
||||||
if ht.stats != nil {
|
|
||||||
// Note: The trailer fields are compressed with hpack after this call returns.
|
// Note: The trailer fields are compressed with hpack after this call returns.
|
||||||
// No WireLength field is set here.
|
// No WireLength field is set here.
|
||||||
ht.stats.HandleRPC(s.Context(), &stats.OutTrailer{
|
for _, sh := range ht.stats {
|
||||||
|
sh.HandleRPC(s.Context(), &stats.OutTrailer{
|
||||||
Trailer: s.trailer.Copy(),
|
Trailer: s.trailer.Copy(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -314,10 +314,10 @@ func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if ht.stats != nil {
|
for _, sh := range ht.stats {
|
||||||
// Note: The header fields are compressed with hpack after this call returns.
|
// Note: The header fields are compressed with hpack after this call returns.
|
||||||
// No WireLength field is set here.
|
// No WireLength field is set here.
|
||||||
ht.stats.HandleRPC(s.Context(), &stats.OutHeader{
|
sh.HandleRPC(s.Context(), &stats.OutHeader{
|
||||||
Header: md.Copy(),
|
Header: md.Copy(),
|
||||||
Compression: s.sendCompress,
|
Compression: s.sendCompress,
|
||||||
})
|
})
|
||||||
@ -369,14 +369,14 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace
|
|||||||
}
|
}
|
||||||
ctx = metadata.NewIncomingContext(ctx, ht.headerMD)
|
ctx = metadata.NewIncomingContext(ctx, ht.headerMD)
|
||||||
s.ctx = peer.NewContext(ctx, pr)
|
s.ctx = peer.NewContext(ctx, pr)
|
||||||
if ht.stats != nil {
|
for _, sh := range ht.stats {
|
||||||
s.ctx = ht.stats.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method})
|
s.ctx = sh.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method})
|
||||||
inHeader := &stats.InHeader{
|
inHeader := &stats.InHeader{
|
||||||
FullMethod: s.method,
|
FullMethod: s.method,
|
||||||
RemoteAddr: ht.RemoteAddr(),
|
RemoteAddr: ht.RemoteAddr(),
|
||||||
Compression: s.recvCompress,
|
Compression: s.recvCompress,
|
||||||
}
|
}
|
||||||
ht.stats.HandleRPC(s.ctx, inHeader)
|
sh.HandleRPC(s.ctx, inHeader)
|
||||||
}
|
}
|
||||||
s.trReader = &transportReader{
|
s.trReader = &transportReader{
|
||||||
reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf, freeBuffer: func(*bytes.Buffer) {}},
|
reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf, freeBuffer: func(*bytes.Buffer) {}},
|
||||||
|
76
vendor/google.golang.org/grpc/internal/transport/http2_client.go
generated
vendored
76
vendor/google.golang.org/grpc/internal/transport/http2_client.go
generated
vendored
@ -78,6 +78,7 @@ type http2Client struct {
|
|||||||
framer *framer
|
framer *framer
|
||||||
// controlBuf delivers all the control related tasks (e.g., window
|
// controlBuf delivers all the control related tasks (e.g., window
|
||||||
// updates, reset streams, and various settings) to the controller.
|
// updates, reset streams, and various settings) to the controller.
|
||||||
|
// Do not access controlBuf with mu held.
|
||||||
controlBuf *controlBuffer
|
controlBuf *controlBuffer
|
||||||
fc *trInFlow
|
fc *trInFlow
|
||||||
// The scheme used: https if TLS is on, http otherwise.
|
// The scheme used: https if TLS is on, http otherwise.
|
||||||
@ -90,7 +91,7 @@ type http2Client struct {
|
|||||||
kp keepalive.ClientParameters
|
kp keepalive.ClientParameters
|
||||||
keepaliveEnabled bool
|
keepaliveEnabled bool
|
||||||
|
|
||||||
statsHandler stats.Handler
|
statsHandlers []stats.Handler
|
||||||
|
|
||||||
initialWindowSize int32
|
initialWindowSize int32
|
||||||
|
|
||||||
@ -109,6 +110,7 @@ type http2Client struct {
|
|||||||
waitingStreams uint32
|
waitingStreams uint32
|
||||||
nextID uint32
|
nextID uint32
|
||||||
|
|
||||||
|
// Do not access controlBuf with mu held.
|
||||||
mu sync.Mutex // guard the following variables
|
mu sync.Mutex // guard the following variables
|
||||||
state transportState
|
state transportState
|
||||||
activeStreams map[uint32]*Stream
|
activeStreams map[uint32]*Stream
|
||||||
@ -311,7 +313,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts
|
|||||||
isSecure: isSecure,
|
isSecure: isSecure,
|
||||||
perRPCCreds: perRPCCreds,
|
perRPCCreds: perRPCCreds,
|
||||||
kp: kp,
|
kp: kp,
|
||||||
statsHandler: opts.StatsHandler,
|
statsHandlers: opts.StatsHandlers,
|
||||||
initialWindowSize: initialWindowSize,
|
initialWindowSize: initialWindowSize,
|
||||||
onPrefaceReceipt: onPrefaceReceipt,
|
onPrefaceReceipt: onPrefaceReceipt,
|
||||||
nextID: 1,
|
nextID: 1,
|
||||||
@ -324,6 +326,8 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts
|
|||||||
keepaliveEnabled: keepaliveEnabled,
|
keepaliveEnabled: keepaliveEnabled,
|
||||||
bufferPool: newBufferPool(),
|
bufferPool: newBufferPool(),
|
||||||
}
|
}
|
||||||
|
// Add peer information to the http2client context.
|
||||||
|
t.ctx = peer.NewContext(t.ctx, t.getPeer())
|
||||||
|
|
||||||
if md, ok := addr.Metadata.(*metadata.MD); ok {
|
if md, ok := addr.Metadata.(*metadata.MD); ok {
|
||||||
t.md = *md
|
t.md = *md
|
||||||
@ -341,15 +345,15 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts
|
|||||||
updateFlowControl: t.updateFlowControl,
|
updateFlowControl: t.updateFlowControl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t.statsHandler != nil {
|
for _, sh := range t.statsHandlers {
|
||||||
t.ctx = t.statsHandler.TagConn(t.ctx, &stats.ConnTagInfo{
|
t.ctx = sh.TagConn(t.ctx, &stats.ConnTagInfo{
|
||||||
RemoteAddr: t.remoteAddr,
|
RemoteAddr: t.remoteAddr,
|
||||||
LocalAddr: t.localAddr,
|
LocalAddr: t.localAddr,
|
||||||
})
|
})
|
||||||
connBegin := &stats.ConnBegin{
|
connBegin := &stats.ConnBegin{
|
||||||
Client: true,
|
Client: true,
|
||||||
}
|
}
|
||||||
t.statsHandler.HandleConn(t.ctx, connBegin)
|
sh.HandleConn(t.ctx, connBegin)
|
||||||
}
|
}
|
||||||
t.channelzID, err = channelz.RegisterNormalSocket(t, opts.ChannelzParentID, fmt.Sprintf("%s -> %s", t.localAddr, t.remoteAddr))
|
t.channelzID, err = channelz.RegisterNormalSocket(t, opts.ChannelzParentID, fmt.Sprintf("%s -> %s", t.localAddr, t.remoteAddr))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -467,7 +471,7 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream {
|
|||||||
func (t *http2Client) getPeer() *peer.Peer {
|
func (t *http2Client) getPeer() *peer.Peer {
|
||||||
return &peer.Peer{
|
return &peer.Peer{
|
||||||
Addr: t.remoteAddr,
|
Addr: t.remoteAddr,
|
||||||
AuthInfo: t.authInfo,
|
AuthInfo: t.authInfo, // Can be nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -685,7 +689,6 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream,
|
|||||||
cleanup(err)
|
cleanup(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
t.activeStreams[id] = s
|
|
||||||
if channelz.IsOn() {
|
if channelz.IsOn() {
|
||||||
atomic.AddInt64(&t.czData.streamsStarted, 1)
|
atomic.AddInt64(&t.czData.streamsStarted, 1)
|
||||||
atomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano())
|
atomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano())
|
||||||
@ -719,6 +722,13 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream,
|
|||||||
t.nextID += 2
|
t.nextID += 2
|
||||||
s.id = h.streamID
|
s.id = h.streamID
|
||||||
s.fc = &inFlow{limit: uint32(t.initialWindowSize)}
|
s.fc = &inFlow{limit: uint32(t.initialWindowSize)}
|
||||||
|
t.mu.Lock()
|
||||||
|
if t.activeStreams == nil { // Can be niled from Close().
|
||||||
|
t.mu.Unlock()
|
||||||
|
return false // Don't create a stream if the transport is already closed.
|
||||||
|
}
|
||||||
|
t.activeStreams[s.id] = s
|
||||||
|
t.mu.Unlock()
|
||||||
if t.streamQuota > 0 && t.waitingStreams > 0 {
|
if t.streamQuota > 0 && t.waitingStreams > 0 {
|
||||||
select {
|
select {
|
||||||
case t.streamsQuotaAvailable <- struct{}{}:
|
case t.streamsQuotaAvailable <- struct{}{}:
|
||||||
@ -744,13 +754,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream,
|
|||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
success, err := t.controlBuf.executeAndPut(func(it interface{}) bool {
|
success, err := t.controlBuf.executeAndPut(func(it interface{}) bool {
|
||||||
if !checkForStreamQuota(it) {
|
return checkForHeaderListSize(it) && checkForStreamQuota(it)
|
||||||
return false
|
|
||||||
}
|
|
||||||
if !checkForHeaderListSize(it) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}, hdr)
|
}, hdr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Connection closed.
|
// Connection closed.
|
||||||
@ -773,15 +777,17 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream,
|
|||||||
return nil, &NewStreamError{Err: ErrConnClosing, AllowTransparentRetry: true}
|
return nil, &NewStreamError{Err: ErrConnClosing, AllowTransparentRetry: true}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t.statsHandler != nil {
|
if len(t.statsHandlers) != 0 {
|
||||||
header, ok := metadata.FromOutgoingContext(ctx)
|
header, ok := metadata.FromOutgoingContext(ctx)
|
||||||
if ok {
|
if ok {
|
||||||
header.Set("user-agent", t.userAgent)
|
header.Set("user-agent", t.userAgent)
|
||||||
} else {
|
} else {
|
||||||
header = metadata.Pairs("user-agent", t.userAgent)
|
header = metadata.Pairs("user-agent", t.userAgent)
|
||||||
}
|
}
|
||||||
|
for _, sh := range t.statsHandlers {
|
||||||
// Note: The header fields are compressed with hpack after this call returns.
|
// Note: The header fields are compressed with hpack after this call returns.
|
||||||
// No WireLength field is set here.
|
// No WireLength field is set here.
|
||||||
|
// Note: Creating a new stats object to prevent pollution.
|
||||||
outHeader := &stats.OutHeader{
|
outHeader := &stats.OutHeader{
|
||||||
Client: true,
|
Client: true,
|
||||||
FullMethod: callHdr.Method,
|
FullMethod: callHdr.Method,
|
||||||
@ -790,7 +796,8 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream,
|
|||||||
Compression: callHdr.SendCompress,
|
Compression: callHdr.SendCompress,
|
||||||
Header: header,
|
Header: header,
|
||||||
}
|
}
|
||||||
t.statsHandler.HandleRPC(s.ctx, outHeader)
|
sh.HandleRPC(s.ctx, outHeader)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
@ -916,11 +923,11 @@ func (t *http2Client) Close(err error) {
|
|||||||
for _, s := range streams {
|
for _, s := range streams {
|
||||||
t.closeStream(s, err, false, http2.ErrCodeNo, st, nil, false)
|
t.closeStream(s, err, false, http2.ErrCodeNo, st, nil, false)
|
||||||
}
|
}
|
||||||
if t.statsHandler != nil {
|
for _, sh := range t.statsHandlers {
|
||||||
connEnd := &stats.ConnEnd{
|
connEnd := &stats.ConnEnd{
|
||||||
Client: true,
|
Client: true,
|
||||||
}
|
}
|
||||||
t.statsHandler.HandleConn(t.ctx, connEnd)
|
sh.HandleConn(t.ctx, connEnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1000,13 +1007,13 @@ func (t *http2Client) updateWindow(s *Stream, n uint32) {
|
|||||||
// for the transport and the stream based on the current bdp
|
// for the transport and the stream based on the current bdp
|
||||||
// estimation.
|
// estimation.
|
||||||
func (t *http2Client) updateFlowControl(n uint32) {
|
func (t *http2Client) updateFlowControl(n uint32) {
|
||||||
|
updateIWS := func(interface{}) bool {
|
||||||
|
t.initialWindowSize = int32(n)
|
||||||
t.mu.Lock()
|
t.mu.Lock()
|
||||||
for _, s := range t.activeStreams {
|
for _, s := range t.activeStreams {
|
||||||
s.fc.newLimit(n)
|
s.fc.newLimit(n)
|
||||||
}
|
}
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
updateIWS := func(interface{}) bool {
|
|
||||||
t.initialWindowSize = int32(n)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
t.controlBuf.executeAndPut(updateIWS, &outgoingWindowUpdate{streamID: 0, increment: t.fc.newLimit(n)})
|
t.controlBuf.executeAndPut(updateIWS, &outgoingWindowUpdate{streamID: 0, increment: t.fc.newLimit(n)})
|
||||||
@ -1212,7 +1219,7 @@ func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) {
|
|||||||
default:
|
default:
|
||||||
t.setGoAwayReason(f)
|
t.setGoAwayReason(f)
|
||||||
close(t.goAway)
|
close(t.goAway)
|
||||||
t.controlBuf.put(&incomingGoAway{})
|
defer t.controlBuf.put(&incomingGoAway{}) // Defer as t.mu is currently held.
|
||||||
// Notify the clientconn about the GOAWAY before we set the state to
|
// Notify the clientconn about the GOAWAY before we set the state to
|
||||||
// draining, to allow the client to stop attempting to create streams
|
// draining, to allow the client to stop attempting to create streams
|
||||||
// before disallowing new streams on this connection.
|
// before disallowing new streams on this connection.
|
||||||
@ -1225,18 +1232,29 @@ func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) {
|
|||||||
if upperLimit == 0 { // This is the first GoAway Frame.
|
if upperLimit == 0 { // This is the first GoAway Frame.
|
||||||
upperLimit = math.MaxUint32 // Kill all streams after the GoAway ID.
|
upperLimit = math.MaxUint32 // Kill all streams after the GoAway ID.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.prevGoAwayID = id
|
||||||
|
if len(t.activeStreams) == 0 {
|
||||||
|
t.mu.Unlock()
|
||||||
|
t.Close(connectionErrorf(true, nil, "received goaway and there are no active streams"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
streamsToClose := make([]*Stream, 0)
|
||||||
for streamID, stream := range t.activeStreams {
|
for streamID, stream := range t.activeStreams {
|
||||||
if streamID > id && streamID <= upperLimit {
|
if streamID > id && streamID <= upperLimit {
|
||||||
// The stream was unprocessed by the server.
|
// The stream was unprocessed by the server.
|
||||||
|
if streamID > id && streamID <= upperLimit {
|
||||||
atomic.StoreUint32(&stream.unprocessed, 1)
|
atomic.StoreUint32(&stream.unprocessed, 1)
|
||||||
t.closeStream(stream, errStreamDrain, false, http2.ErrCodeNo, statusGoAway, nil, false)
|
streamsToClose = append(streamsToClose, stream)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.prevGoAwayID = id
|
|
||||||
active := len(t.activeStreams)
|
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
if active == 0 {
|
// Called outside t.mu because closeStream can take controlBuf's mu, which
|
||||||
t.Close(connectionErrorf(true, nil, "received goaway and there are no active streams"))
|
// could induce deadlock and is not allowed.
|
||||||
|
for _, stream := range streamsToClose {
|
||||||
|
t.closeStream(stream, errStreamDrain, false, http2.ErrCodeNo, statusGoAway, nil, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1432,7 +1450,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
|
|||||||
close(s.headerChan)
|
close(s.headerChan)
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.statsHandler != nil {
|
for _, sh := range t.statsHandlers {
|
||||||
if isHeader {
|
if isHeader {
|
||||||
inHeader := &stats.InHeader{
|
inHeader := &stats.InHeader{
|
||||||
Client: true,
|
Client: true,
|
||||||
@ -1440,14 +1458,14 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
|
|||||||
Header: metadata.MD(mdata).Copy(),
|
Header: metadata.MD(mdata).Copy(),
|
||||||
Compression: s.recvCompress,
|
Compression: s.recvCompress,
|
||||||
}
|
}
|
||||||
t.statsHandler.HandleRPC(s.ctx, inHeader)
|
sh.HandleRPC(s.ctx, inHeader)
|
||||||
} else {
|
} else {
|
||||||
inTrailer := &stats.InTrailer{
|
inTrailer := &stats.InTrailer{
|
||||||
Client: true,
|
Client: true,
|
||||||
WireLength: int(frame.Header().Length),
|
WireLength: int(frame.Header().Length),
|
||||||
Trailer: metadata.MD(mdata).Copy(),
|
Trailer: metadata.MD(mdata).Copy(),
|
||||||
}
|
}
|
||||||
t.statsHandler.HandleRPC(s.ctx, inTrailer)
|
sh.HandleRPC(s.ctx, inTrailer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
68
vendor/google.golang.org/grpc/internal/transport/http2_server.go
generated
vendored
68
vendor/google.golang.org/grpc/internal/transport/http2_server.go
generated
vendored
@ -82,7 +82,7 @@ type http2Server struct {
|
|||||||
// updates, reset streams, and various settings) to the controller.
|
// updates, reset streams, and various settings) to the controller.
|
||||||
controlBuf *controlBuffer
|
controlBuf *controlBuffer
|
||||||
fc *trInFlow
|
fc *trInFlow
|
||||||
stats stats.Handler
|
stats []stats.Handler
|
||||||
// Keepalive and max-age parameters for the server.
|
// Keepalive and max-age parameters for the server.
|
||||||
kp keepalive.ServerParameters
|
kp keepalive.ServerParameters
|
||||||
// Keepalive enforcement policy.
|
// Keepalive enforcement policy.
|
||||||
@ -257,7 +257,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||||||
fc: &trInFlow{limit: uint32(icwz)},
|
fc: &trInFlow{limit: uint32(icwz)},
|
||||||
state: reachable,
|
state: reachable,
|
||||||
activeStreams: make(map[uint32]*Stream),
|
activeStreams: make(map[uint32]*Stream),
|
||||||
stats: config.StatsHandler,
|
stats: config.StatsHandlers,
|
||||||
kp: kp,
|
kp: kp,
|
||||||
idle: time.Now(),
|
idle: time.Now(),
|
||||||
kep: kep,
|
kep: kep,
|
||||||
@ -265,6 +265,9 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||||||
czData: new(channelzData),
|
czData: new(channelzData),
|
||||||
bufferPool: newBufferPool(),
|
bufferPool: newBufferPool(),
|
||||||
}
|
}
|
||||||
|
// Add peer information to the http2server context.
|
||||||
|
t.ctx = peer.NewContext(t.ctx, t.getPeer())
|
||||||
|
|
||||||
t.controlBuf = newControlBuffer(t.done)
|
t.controlBuf = newControlBuffer(t.done)
|
||||||
if dynamicWindow {
|
if dynamicWindow {
|
||||||
t.bdpEst = &bdpEstimator{
|
t.bdpEst = &bdpEstimator{
|
||||||
@ -272,13 +275,13 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||||||
updateFlowControl: t.updateFlowControl,
|
updateFlowControl: t.updateFlowControl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t.stats != nil {
|
for _, sh := range t.stats {
|
||||||
t.ctx = t.stats.TagConn(t.ctx, &stats.ConnTagInfo{
|
t.ctx = sh.TagConn(t.ctx, &stats.ConnTagInfo{
|
||||||
RemoteAddr: t.remoteAddr,
|
RemoteAddr: t.remoteAddr,
|
||||||
LocalAddr: t.localAddr,
|
LocalAddr: t.localAddr,
|
||||||
})
|
})
|
||||||
connBegin := &stats.ConnBegin{}
|
connBegin := &stats.ConnBegin{}
|
||||||
t.stats.HandleConn(t.ctx, connBegin)
|
sh.HandleConn(t.ctx, connBegin)
|
||||||
}
|
}
|
||||||
t.channelzID, err = channelz.RegisterNormalSocket(t, config.ChannelzParentID, fmt.Sprintf("%s -> %s", t.remoteAddr, t.localAddr))
|
t.channelzID, err = channelz.RegisterNormalSocket(t, config.ChannelzParentID, fmt.Sprintf("%s -> %s", t.remoteAddr, t.localAddr))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -485,14 +488,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
} else {
|
} else {
|
||||||
s.ctx, s.cancel = context.WithCancel(t.ctx)
|
s.ctx, s.cancel = context.WithCancel(t.ctx)
|
||||||
}
|
}
|
||||||
pr := &peer.Peer{
|
|
||||||
Addr: t.remoteAddr,
|
|
||||||
}
|
|
||||||
// Attach Auth info if there is any.
|
|
||||||
if t.authInfo != nil {
|
|
||||||
pr.AuthInfo = t.authInfo
|
|
||||||
}
|
|
||||||
s.ctx = peer.NewContext(s.ctx, pr)
|
|
||||||
// Attach the received metadata to the context.
|
// Attach the received metadata to the context.
|
||||||
if len(mdata) > 0 {
|
if len(mdata) > 0 {
|
||||||
s.ctx = metadata.NewIncomingContext(s.ctx, mdata)
|
s.ctx = metadata.NewIncomingContext(s.ctx, mdata)
|
||||||
@ -570,8 +566,8 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
t.adjustWindow(s, uint32(n))
|
t.adjustWindow(s, uint32(n))
|
||||||
}
|
}
|
||||||
s.ctx = traceCtx(s.ctx, s.method)
|
s.ctx = traceCtx(s.ctx, s.method)
|
||||||
if t.stats != nil {
|
for _, sh := range t.stats {
|
||||||
s.ctx = t.stats.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method})
|
s.ctx = sh.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method})
|
||||||
inHeader := &stats.InHeader{
|
inHeader := &stats.InHeader{
|
||||||
FullMethod: s.method,
|
FullMethod: s.method,
|
||||||
RemoteAddr: t.remoteAddr,
|
RemoteAddr: t.remoteAddr,
|
||||||
@ -580,7 +576,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
WireLength: int(frame.Header().Length),
|
WireLength: int(frame.Header().Length),
|
||||||
Header: metadata.MD(mdata).Copy(),
|
Header: metadata.MD(mdata).Copy(),
|
||||||
}
|
}
|
||||||
t.stats.HandleRPC(s.ctx, inHeader)
|
sh.HandleRPC(s.ctx, inHeader)
|
||||||
}
|
}
|
||||||
s.ctxDone = s.ctx.Done()
|
s.ctxDone = s.ctx.Done()
|
||||||
s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone)
|
s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone)
|
||||||
@ -945,15 +941,16 @@ func (t *http2Server) streamContextErr(s *Stream) error {
|
|||||||
|
|
||||||
// WriteHeader sends the header metadata md back to the client.
|
// WriteHeader sends the header metadata md back to the client.
|
||||||
func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error {
|
func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error {
|
||||||
if s.updateHeaderSent() {
|
s.hdrMu.Lock()
|
||||||
return ErrIllegalHeaderWrite
|
defer s.hdrMu.Unlock()
|
||||||
}
|
|
||||||
|
|
||||||
if s.getState() == streamDone {
|
if s.getState() == streamDone {
|
||||||
return t.streamContextErr(s)
|
return t.streamContextErr(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.hdrMu.Lock()
|
if s.updateHeaderSent() {
|
||||||
|
return ErrIllegalHeaderWrite
|
||||||
|
}
|
||||||
|
|
||||||
if md.Len() > 0 {
|
if md.Len() > 0 {
|
||||||
if s.header.Len() > 0 {
|
if s.header.Len() > 0 {
|
||||||
s.header = metadata.Join(s.header, md)
|
s.header = metadata.Join(s.header, md)
|
||||||
@ -962,10 +959,8 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := t.writeHeaderLocked(s); err != nil {
|
if err := t.writeHeaderLocked(s); err != nil {
|
||||||
s.hdrMu.Unlock()
|
|
||||||
return status.Convert(err).Err()
|
return status.Convert(err).Err()
|
||||||
}
|
}
|
||||||
s.hdrMu.Unlock()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -996,14 +991,14 @@ func (t *http2Server) writeHeaderLocked(s *Stream) error {
|
|||||||
t.closeStream(s, true, http2.ErrCodeInternal, false)
|
t.closeStream(s, true, http2.ErrCodeInternal, false)
|
||||||
return ErrHeaderListSizeLimitViolation
|
return ErrHeaderListSizeLimitViolation
|
||||||
}
|
}
|
||||||
if t.stats != nil {
|
for _, sh := range t.stats {
|
||||||
// Note: Headers are compressed with hpack after this call returns.
|
// Note: Headers are compressed with hpack after this call returns.
|
||||||
// No WireLength field is set here.
|
// No WireLength field is set here.
|
||||||
outHeader := &stats.OutHeader{
|
outHeader := &stats.OutHeader{
|
||||||
Header: s.header.Copy(),
|
Header: s.header.Copy(),
|
||||||
Compression: s.sendCompress,
|
Compression: s.sendCompress,
|
||||||
}
|
}
|
||||||
t.stats.HandleRPC(s.Context(), outHeader)
|
sh.HandleRPC(s.Context(), outHeader)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1013,17 +1008,19 @@ func (t *http2Server) writeHeaderLocked(s *Stream) error {
|
|||||||
// TODO(zhaoq): Now it indicates the end of entire stream. Revisit if early
|
// TODO(zhaoq): Now it indicates the end of entire stream. Revisit if early
|
||||||
// OK is adopted.
|
// OK is adopted.
|
||||||
func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error {
|
func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error {
|
||||||
|
s.hdrMu.Lock()
|
||||||
|
defer s.hdrMu.Unlock()
|
||||||
|
|
||||||
if s.getState() == streamDone {
|
if s.getState() == streamDone {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
s.hdrMu.Lock()
|
|
||||||
// TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields
|
// TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields
|
||||||
// first and create a slice of that exact size.
|
// first and create a slice of that exact size.
|
||||||
headerFields := make([]hpack.HeaderField, 0, 2) // grpc-status and grpc-message will be there if none else.
|
headerFields := make([]hpack.HeaderField, 0, 2) // grpc-status and grpc-message will be there if none else.
|
||||||
if !s.updateHeaderSent() { // No headers have been sent.
|
if !s.updateHeaderSent() { // No headers have been sent.
|
||||||
if len(s.header) > 0 { // Send a separate header frame.
|
if len(s.header) > 0 { // Send a separate header frame.
|
||||||
if err := t.writeHeaderLocked(s); err != nil {
|
if err := t.writeHeaderLocked(s); err != nil {
|
||||||
s.hdrMu.Unlock()
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else { // Send a trailer only response.
|
} else { // Send a trailer only response.
|
||||||
@ -1052,7 +1049,7 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error {
|
|||||||
endStream: true,
|
endStream: true,
|
||||||
onWrite: t.setResetPingStrikes,
|
onWrite: t.setResetPingStrikes,
|
||||||
}
|
}
|
||||||
s.hdrMu.Unlock()
|
|
||||||
success, err := t.controlBuf.execute(t.checkForHeaderListSize, trailingHeader)
|
success, err := t.controlBuf.execute(t.checkForHeaderListSize, trailingHeader)
|
||||||
if !success {
|
if !success {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1064,10 +1061,10 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error {
|
|||||||
// Send a RST_STREAM after the trailers if the client has not already half-closed.
|
// Send a RST_STREAM after the trailers if the client has not already half-closed.
|
||||||
rst := s.getState() == streamActive
|
rst := s.getState() == streamActive
|
||||||
t.finishStream(s, rst, http2.ErrCodeNo, trailingHeader, true)
|
t.finishStream(s, rst, http2.ErrCodeNo, trailingHeader, true)
|
||||||
if t.stats != nil {
|
for _, sh := range t.stats {
|
||||||
// Note: The trailer fields are compressed with hpack after this call returns.
|
// Note: The trailer fields are compressed with hpack after this call returns.
|
||||||
// No WireLength field is set here.
|
// No WireLength field is set here.
|
||||||
t.stats.HandleRPC(s.Context(), &stats.OutTrailer{
|
sh.HandleRPC(s.Context(), &stats.OutTrailer{
|
||||||
Trailer: s.trailer.Copy(),
|
Trailer: s.trailer.Copy(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1222,9 +1219,9 @@ func (t *http2Server) Close() {
|
|||||||
for _, s := range streams {
|
for _, s := range streams {
|
||||||
s.cancel()
|
s.cancel()
|
||||||
}
|
}
|
||||||
if t.stats != nil {
|
for _, sh := range t.stats {
|
||||||
connEnd := &stats.ConnEnd{}
|
connEnd := &stats.ConnEnd{}
|
||||||
t.stats.HandleConn(t.ctx, connEnd)
|
sh.HandleConn(t.ctx, connEnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1415,6 +1412,13 @@ func (t *http2Server) getOutFlowWindow() int64 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *http2Server) getPeer() *peer.Peer {
|
||||||
|
return &peer.Peer{
|
||||||
|
Addr: t.remoteAddr,
|
||||||
|
AuthInfo: t.authInfo, // Can be nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func getJitter(v time.Duration) time.Duration {
|
func getJitter(v time.Duration) time.Duration {
|
||||||
if v == infinity {
|
if v == infinity {
|
||||||
return 0
|
return 0
|
||||||
|
34
vendor/google.golang.org/grpc/internal/transport/http_util.go
generated
vendored
34
vendor/google.golang.org/grpc/internal/transport/http_util.go
generated
vendored
@ -20,7 +20,6 @@ package transport
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -45,14 +44,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
// http2MaxFrameLen specifies the max length of a HTTP2 frame.
|
// http2MaxFrameLen specifies the max length of a HTTP2 frame.
|
||||||
http2MaxFrameLen = 16384 // 16KB frame
|
http2MaxFrameLen = 16384 // 16KB frame
|
||||||
// http://http2.github.io/http2-spec/#SettingValues
|
// https://httpwg.org/specs/rfc7540.html#SettingValues
|
||||||
http2InitHeaderTableSize = 4096
|
http2InitHeaderTableSize = 4096
|
||||||
// baseContentType is the base content-type for gRPC. This is a valid
|
|
||||||
// content-type on it's own, but can also include a content-subtype such as
|
|
||||||
// "proto" as a suffix after "+" or ";". See
|
|
||||||
// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests
|
|
||||||
// for more details.
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -257,13 +250,13 @@ func encodeGrpcMessage(msg string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func encodeGrpcMessageUnchecked(msg string) string {
|
func encodeGrpcMessageUnchecked(msg string) string {
|
||||||
var buf bytes.Buffer
|
var sb strings.Builder
|
||||||
for len(msg) > 0 {
|
for len(msg) > 0 {
|
||||||
r, size := utf8.DecodeRuneInString(msg)
|
r, size := utf8.DecodeRuneInString(msg)
|
||||||
for _, b := range []byte(string(r)) {
|
for _, b := range []byte(string(r)) {
|
||||||
if size > 1 {
|
if size > 1 {
|
||||||
// If size > 1, r is not ascii. Always do percent encoding.
|
// If size > 1, r is not ascii. Always do percent encoding.
|
||||||
buf.WriteString(fmt.Sprintf("%%%02X", b))
|
fmt.Fprintf(&sb, "%%%02X", b)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,14 +265,14 @@ func encodeGrpcMessageUnchecked(msg string) string {
|
|||||||
//
|
//
|
||||||
// fmt.Sprintf("%%%02X", utf8.RuneError) gives "%FFFD".
|
// fmt.Sprintf("%%%02X", utf8.RuneError) gives "%FFFD".
|
||||||
if b >= spaceByte && b <= tildeByte && b != percentByte {
|
if b >= spaceByte && b <= tildeByte && b != percentByte {
|
||||||
buf.WriteByte(b)
|
sb.WriteByte(b)
|
||||||
} else {
|
} else {
|
||||||
buf.WriteString(fmt.Sprintf("%%%02X", b))
|
fmt.Fprintf(&sb, "%%%02X", b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg = msg[size:]
|
msg = msg[size:]
|
||||||
}
|
}
|
||||||
return buf.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// decodeGrpcMessage decodes the msg encoded by encodeGrpcMessage.
|
// decodeGrpcMessage decodes the msg encoded by encodeGrpcMessage.
|
||||||
@ -297,23 +290,23 @@ func decodeGrpcMessage(msg string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func decodeGrpcMessageUnchecked(msg string) string {
|
func decodeGrpcMessageUnchecked(msg string) string {
|
||||||
var buf bytes.Buffer
|
var sb strings.Builder
|
||||||
lenMsg := len(msg)
|
lenMsg := len(msg)
|
||||||
for i := 0; i < lenMsg; i++ {
|
for i := 0; i < lenMsg; i++ {
|
||||||
c := msg[i]
|
c := msg[i]
|
||||||
if c == percentByte && i+2 < lenMsg {
|
if c == percentByte && i+2 < lenMsg {
|
||||||
parsed, err := strconv.ParseUint(msg[i+1:i+3], 16, 8)
|
parsed, err := strconv.ParseUint(msg[i+1:i+3], 16, 8)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
buf.WriteByte(c)
|
sb.WriteByte(c)
|
||||||
} else {
|
} else {
|
||||||
buf.WriteByte(byte(parsed))
|
sb.WriteByte(byte(parsed))
|
||||||
i += 2
|
i += 2
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buf.WriteByte(c)
|
sb.WriteByte(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buf.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
type bufWriter struct {
|
type bufWriter struct {
|
||||||
@ -322,8 +315,6 @@ type bufWriter struct {
|
|||||||
batchSize int
|
batchSize int
|
||||||
conn net.Conn
|
conn net.Conn
|
||||||
err error
|
err error
|
||||||
|
|
||||||
onFlush func()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func newBufWriter(conn net.Conn, batchSize int) *bufWriter {
|
func newBufWriter(conn net.Conn, batchSize int) *bufWriter {
|
||||||
@ -360,9 +351,6 @@ func (w *bufWriter) Flush() error {
|
|||||||
if w.offset == 0 {
|
if w.offset == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if w.onFlush != nil {
|
|
||||||
w.onFlush()
|
|
||||||
}
|
|
||||||
_, w.err = w.conn.Write(w.buf[:w.offset])
|
_, w.err = w.conn.Write(w.buf[:w.offset])
|
||||||
w.offset = 0
|
w.offset = 0
|
||||||
return w.err
|
return w.err
|
||||||
|
6
vendor/google.golang.org/grpc/internal/transport/transport.go
generated
vendored
6
vendor/google.golang.org/grpc/internal/transport/transport.go
generated
vendored
@ -523,7 +523,7 @@ type ServerConfig struct {
|
|||||||
ConnectionTimeout time.Duration
|
ConnectionTimeout time.Duration
|
||||||
Credentials credentials.TransportCredentials
|
Credentials credentials.TransportCredentials
|
||||||
InTapHandle tap.ServerInHandle
|
InTapHandle tap.ServerInHandle
|
||||||
StatsHandler stats.Handler
|
StatsHandlers []stats.Handler
|
||||||
KeepaliveParams keepalive.ServerParameters
|
KeepaliveParams keepalive.ServerParameters
|
||||||
KeepalivePolicy keepalive.EnforcementPolicy
|
KeepalivePolicy keepalive.EnforcementPolicy
|
||||||
InitialWindowSize int32
|
InitialWindowSize int32
|
||||||
@ -553,8 +553,8 @@ type ConnectOptions struct {
|
|||||||
CredsBundle credentials.Bundle
|
CredsBundle credentials.Bundle
|
||||||
// KeepaliveParams stores the keepalive parameters.
|
// KeepaliveParams stores the keepalive parameters.
|
||||||
KeepaliveParams keepalive.ClientParameters
|
KeepaliveParams keepalive.ClientParameters
|
||||||
// StatsHandler stores the handler for stats.
|
// StatsHandlers stores the handler for stats.
|
||||||
StatsHandler stats.Handler
|
StatsHandlers []stats.Handler
|
||||||
// InitialWindowSize sets the initial window size for a stream.
|
// InitialWindowSize sets the initial window size for a stream.
|
||||||
InitialWindowSize int32
|
InitialWindowSize int32
|
||||||
// InitialConnWindowSize sets the initial window size for a connection.
|
// InitialConnWindowSize sets the initial window size for a connection.
|
||||||
|
55
vendor/google.golang.org/grpc/metadata/metadata.go
generated
vendored
55
vendor/google.golang.org/grpc/metadata/metadata.go
generated
vendored
@ -50,7 +50,7 @@ type MD map[string][]string
|
|||||||
// Keys beginning with "grpc-" are reserved for grpc-internal use only and may
|
// Keys beginning with "grpc-" are reserved for grpc-internal use only and may
|
||||||
// result in errors if set in metadata.
|
// result in errors if set in metadata.
|
||||||
func New(m map[string]string) MD {
|
func New(m map[string]string) MD {
|
||||||
md := MD{}
|
md := make(MD, len(m))
|
||||||
for k, val := range m {
|
for k, val := range m {
|
||||||
key := strings.ToLower(k)
|
key := strings.ToLower(k)
|
||||||
md[key] = append(md[key], val)
|
md[key] = append(md[key], val)
|
||||||
@ -74,7 +74,7 @@ func Pairs(kv ...string) MD {
|
|||||||
if len(kv)%2 == 1 {
|
if len(kv)%2 == 1 {
|
||||||
panic(fmt.Sprintf("metadata: Pairs got the odd number of input pairs for metadata: %d", len(kv)))
|
panic(fmt.Sprintf("metadata: Pairs got the odd number of input pairs for metadata: %d", len(kv)))
|
||||||
}
|
}
|
||||||
md := MD{}
|
md := make(MD, len(kv)/2)
|
||||||
for i := 0; i < len(kv); i += 2 {
|
for i := 0; i < len(kv); i += 2 {
|
||||||
key := strings.ToLower(kv[i])
|
key := strings.ToLower(kv[i])
|
||||||
md[key] = append(md[key], kv[i+1])
|
md[key] = append(md[key], kv[i+1])
|
||||||
@ -182,19 +182,51 @@ func FromIncomingContext(ctx context.Context) (MD, bool) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
out := MD{}
|
out := make(MD, len(md))
|
||||||
for k, v := range md {
|
for k, v := range md {
|
||||||
// We need to manually convert all keys to lower case, because MD is a
|
// We need to manually convert all keys to lower case, because MD is a
|
||||||
// map, and there's no guarantee that the MD attached to the context is
|
// map, and there's no guarantee that the MD attached to the context is
|
||||||
// created using our helper functions.
|
// created using our helper functions.
|
||||||
key := strings.ToLower(k)
|
key := strings.ToLower(k)
|
||||||
s := make([]string, len(v))
|
out[key] = copyOf(v)
|
||||||
copy(s, v)
|
|
||||||
out[key] = s
|
|
||||||
}
|
}
|
||||||
return out, true
|
return out, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ValueFromIncomingContext returns the metadata value corresponding to the metadata
|
||||||
|
// key from the incoming metadata if it exists. Key must be lower-case.
|
||||||
|
//
|
||||||
|
// Experimental
|
||||||
|
//
|
||||||
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
|
// later release.
|
||||||
|
func ValueFromIncomingContext(ctx context.Context, key string) []string {
|
||||||
|
md, ok := ctx.Value(mdIncomingKey{}).(MD)
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if v, ok := md[key]; ok {
|
||||||
|
return copyOf(v)
|
||||||
|
}
|
||||||
|
for k, v := range md {
|
||||||
|
// We need to manually convert all keys to lower case, because MD is a
|
||||||
|
// map, and there's no guarantee that the MD attached to the context is
|
||||||
|
// created using our helper functions.
|
||||||
|
if strings.ToLower(k) == key {
|
||||||
|
return copyOf(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// the returned slice must not be modified in place
|
||||||
|
func copyOf(v []string) []string {
|
||||||
|
vals := make([]string, len(v))
|
||||||
|
copy(vals, v)
|
||||||
|
return vals
|
||||||
|
}
|
||||||
|
|
||||||
// FromOutgoingContextRaw returns the un-merged, intermediary contents of rawMD.
|
// FromOutgoingContextRaw returns the un-merged, intermediary contents of rawMD.
|
||||||
//
|
//
|
||||||
// Remember to perform strings.ToLower on the keys, for both the returned MD (MD
|
// Remember to perform strings.ToLower on the keys, for both the returned MD (MD
|
||||||
@ -222,15 +254,18 @@ func FromOutgoingContext(ctx context.Context) (MD, bool) {
|
|||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
out := MD{}
|
mdSize := len(raw.md)
|
||||||
|
for i := range raw.added {
|
||||||
|
mdSize += len(raw.added[i]) / 2
|
||||||
|
}
|
||||||
|
|
||||||
|
out := make(MD, mdSize)
|
||||||
for k, v := range raw.md {
|
for k, v := range raw.md {
|
||||||
// We need to manually convert all keys to lower case, because MD is a
|
// We need to manually convert all keys to lower case, because MD is a
|
||||||
// map, and there's no guarantee that the MD attached to the context is
|
// map, and there's no guarantee that the MD attached to the context is
|
||||||
// created using our helper functions.
|
// created using our helper functions.
|
||||||
key := strings.ToLower(k)
|
key := strings.ToLower(k)
|
||||||
s := make([]string, len(v))
|
out[key] = copyOf(v)
|
||||||
copy(s, v)
|
|
||||||
out[key] = s
|
|
||||||
}
|
}
|
||||||
for _, added := range raw.added {
|
for _, added := range raw.added {
|
||||||
if len(added)%2 == 1 {
|
if len(added)%2 == 1 {
|
||||||
|
7
vendor/google.golang.org/grpc/regenerate.sh
generated
vendored
7
vendor/google.golang.org/grpc/regenerate.sh
generated
vendored
@ -68,7 +68,6 @@ SOURCES=(
|
|||||||
${WORKDIR}/grpc-proto/grpc/gcp/transport_security_common.proto
|
${WORKDIR}/grpc-proto/grpc/gcp/transport_security_common.proto
|
||||||
${WORKDIR}/grpc-proto/grpc/lookup/v1/rls.proto
|
${WORKDIR}/grpc-proto/grpc/lookup/v1/rls.proto
|
||||||
${WORKDIR}/grpc-proto/grpc/lookup/v1/rls_config.proto
|
${WORKDIR}/grpc-proto/grpc/lookup/v1/rls_config.proto
|
||||||
${WORKDIR}/grpc-proto/grpc/service_config/service_config.proto
|
|
||||||
${WORKDIR}/grpc-proto/grpc/testing/*.proto
|
${WORKDIR}/grpc-proto/grpc/testing/*.proto
|
||||||
${WORKDIR}/grpc-proto/grpc/core/*.proto
|
${WORKDIR}/grpc-proto/grpc/core/*.proto
|
||||||
)
|
)
|
||||||
@ -80,8 +79,7 @@ SOURCES=(
|
|||||||
# Note that the protos listed here are all for testing purposes. All protos to
|
# Note that the protos listed here are all for testing purposes. All protos to
|
||||||
# be used externally should have a go_package option (and they don't need to be
|
# be used externally should have a go_package option (and they don't need to be
|
||||||
# listed here).
|
# listed here).
|
||||||
OPTS=Mgrpc/service_config/service_config.proto=/internal/proto/grpc_service_config,\
|
OPTS=Mgrpc/core/stats.proto=google.golang.org/grpc/interop/grpc_testing/core,\
|
||||||
Mgrpc/core/stats.proto=google.golang.org/grpc/interop/grpc_testing/core,\
|
|
||||||
Mgrpc/testing/benchmark_service.proto=google.golang.org/grpc/interop/grpc_testing,\
|
Mgrpc/testing/benchmark_service.proto=google.golang.org/grpc/interop/grpc_testing,\
|
||||||
Mgrpc/testing/stats.proto=google.golang.org/grpc/interop/grpc_testing,\
|
Mgrpc/testing/stats.proto=google.golang.org/grpc/interop/grpc_testing,\
|
||||||
Mgrpc/testing/report_qps_scenario_service.proto=google.golang.org/grpc/interop/grpc_testing,\
|
Mgrpc/testing/report_qps_scenario_service.proto=google.golang.org/grpc/interop/grpc_testing,\
|
||||||
@ -121,9 +119,6 @@ mv ${WORKDIR}/out/google.golang.org/grpc/lookup/grpc_lookup_v1/* ${WORKDIR}/out/
|
|||||||
# see grpc_testing_not_regenerate/README.md for details.
|
# see grpc_testing_not_regenerate/README.md for details.
|
||||||
rm ${WORKDIR}/out/google.golang.org/grpc/reflection/grpc_testing_not_regenerate/*.pb.go
|
rm ${WORKDIR}/out/google.golang.org/grpc/reflection/grpc_testing_not_regenerate/*.pb.go
|
||||||
|
|
||||||
# grpc/service_config/service_config.proto does not have a go_package option.
|
|
||||||
mv ${WORKDIR}/out/grpc/service_config/service_config.pb.go internal/proto/grpc_service_config
|
|
||||||
|
|
||||||
# grpc/testing does not have a go_package option.
|
# grpc/testing does not have a go_package option.
|
||||||
mv ${WORKDIR}/out/grpc/testing/*.pb.go interop/grpc_testing/
|
mv ${WORKDIR}/out/grpc/testing/*.pb.go interop/grpc_testing/
|
||||||
mv ${WORKDIR}/out/grpc/core/*.pb.go interop/grpc_testing/core/
|
mv ${WORKDIR}/out/grpc/core/*.pb.go interop/grpc_testing/core/
|
||||||
|
55
vendor/google.golang.org/grpc/resolver/map.go
generated
vendored
55
vendor/google.golang.org/grpc/resolver/map.go
generated
vendored
@ -28,25 +28,40 @@ type addressMapEntry struct {
|
|||||||
// Multiple accesses may not be performed concurrently. Must be created via
|
// Multiple accesses may not be performed concurrently. Must be created via
|
||||||
// NewAddressMap; do not construct directly.
|
// NewAddressMap; do not construct directly.
|
||||||
type AddressMap struct {
|
type AddressMap struct {
|
||||||
m map[string]addressMapEntryList
|
// The underlying map is keyed by an Address with fields that we don't care
|
||||||
|
// about being set to their zero values. The only fields that we care about
|
||||||
|
// are `Addr`, `ServerName` and `Attributes`. Since we need to be able to
|
||||||
|
// distinguish between addresses with same `Addr` and `ServerName`, but
|
||||||
|
// different `Attributes`, we cannot store the `Attributes` in the map key.
|
||||||
|
//
|
||||||
|
// The comparison operation for structs work as follows:
|
||||||
|
// Struct values are comparable if all their fields are comparable. Two
|
||||||
|
// struct values are equal if their corresponding non-blank fields are equal.
|
||||||
|
//
|
||||||
|
// The value type of the map contains a slice of addresses which match the key
|
||||||
|
// in their `Addr` and `ServerName` fields and contain the corresponding value
|
||||||
|
// associated with them.
|
||||||
|
m map[Address]addressMapEntryList
|
||||||
|
}
|
||||||
|
|
||||||
|
func toMapKey(addr *Address) Address {
|
||||||
|
return Address{Addr: addr.Addr, ServerName: addr.ServerName}
|
||||||
}
|
}
|
||||||
|
|
||||||
type addressMapEntryList []*addressMapEntry
|
type addressMapEntryList []*addressMapEntry
|
||||||
|
|
||||||
// NewAddressMap creates a new AddressMap.
|
// NewAddressMap creates a new AddressMap.
|
||||||
func NewAddressMap() *AddressMap {
|
func NewAddressMap() *AddressMap {
|
||||||
return &AddressMap{m: make(map[string]addressMapEntryList)}
|
return &AddressMap{m: make(map[Address]addressMapEntryList)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find returns the index of addr in the addressMapEntry slice, or -1 if not
|
// find returns the index of addr in the addressMapEntry slice, or -1 if not
|
||||||
// present.
|
// present.
|
||||||
func (l addressMapEntryList) find(addr Address) int {
|
func (l addressMapEntryList) find(addr Address) int {
|
||||||
if len(l) == 0 {
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
for i, entry := range l {
|
for i, entry := range l {
|
||||||
if entry.addr.ServerName == addr.ServerName &&
|
// Attributes are the only thing to match on here, since `Addr` and
|
||||||
entry.addr.Attributes.Equal(addr.Attributes) {
|
// `ServerName` are already equal.
|
||||||
|
if entry.addr.Attributes.Equal(addr.Attributes) {
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +70,8 @@ func (l addressMapEntryList) find(addr Address) int {
|
|||||||
|
|
||||||
// Get returns the value for the address in the map, if present.
|
// Get returns the value for the address in the map, if present.
|
||||||
func (a *AddressMap) Get(addr Address) (value interface{}, ok bool) {
|
func (a *AddressMap) Get(addr Address) (value interface{}, ok bool) {
|
||||||
entryList := a.m[addr.Addr]
|
addrKey := toMapKey(&addr)
|
||||||
|
entryList := a.m[addrKey]
|
||||||
if entry := entryList.find(addr); entry != -1 {
|
if entry := entryList.find(addr); entry != -1 {
|
||||||
return entryList[entry].value, true
|
return entryList[entry].value, true
|
||||||
}
|
}
|
||||||
@ -64,17 +80,19 @@ func (a *AddressMap) Get(addr Address) (value interface{}, ok bool) {
|
|||||||
|
|
||||||
// Set updates or adds the value to the address in the map.
|
// Set updates or adds the value to the address in the map.
|
||||||
func (a *AddressMap) Set(addr Address, value interface{}) {
|
func (a *AddressMap) Set(addr Address, value interface{}) {
|
||||||
entryList := a.m[addr.Addr]
|
addrKey := toMapKey(&addr)
|
||||||
|
entryList := a.m[addrKey]
|
||||||
if entry := entryList.find(addr); entry != -1 {
|
if entry := entryList.find(addr); entry != -1 {
|
||||||
a.m[addr.Addr][entry].value = value
|
entryList[entry].value = value
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
a.m[addr.Addr] = append(a.m[addr.Addr], &addressMapEntry{addr: addr, value: value})
|
a.m[addrKey] = append(entryList, &addressMapEntry{addr: addr, value: value})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete removes addr from the map.
|
// Delete removes addr from the map.
|
||||||
func (a *AddressMap) Delete(addr Address) {
|
func (a *AddressMap) Delete(addr Address) {
|
||||||
entryList := a.m[addr.Addr]
|
addrKey := toMapKey(&addr)
|
||||||
|
entryList := a.m[addrKey]
|
||||||
entry := entryList.find(addr)
|
entry := entryList.find(addr)
|
||||||
if entry == -1 {
|
if entry == -1 {
|
||||||
return
|
return
|
||||||
@ -85,7 +103,7 @@ func (a *AddressMap) Delete(addr Address) {
|
|||||||
copy(entryList[entry:], entryList[entry+1:])
|
copy(entryList[entry:], entryList[entry+1:])
|
||||||
entryList = entryList[:len(entryList)-1]
|
entryList = entryList[:len(entryList)-1]
|
||||||
}
|
}
|
||||||
a.m[addr.Addr] = entryList
|
a.m[addrKey] = entryList
|
||||||
}
|
}
|
||||||
|
|
||||||
// Len returns the number of entries in the map.
|
// Len returns the number of entries in the map.
|
||||||
@ -107,3 +125,14 @@ func (a *AddressMap) Keys() []Address {
|
|||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Values returns a slice of all current map values.
|
||||||
|
func (a *AddressMap) Values() []interface{} {
|
||||||
|
ret := make([]interface{}, 0, a.Len())
|
||||||
|
for _, entryList := range a.m {
|
||||||
|
for _, entry := range entryList {
|
||||||
|
ret = append(ret, entry.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
215
vendor/google.golang.org/grpc/server.go
generated
vendored
215
vendor/google.golang.org/grpc/server.go
generated
vendored
@ -73,6 +73,14 @@ func init() {
|
|||||||
internal.DrainServerTransports = func(srv *Server, addr string) {
|
internal.DrainServerTransports = func(srv *Server, addr string) {
|
||||||
srv.drainServerTransports(addr)
|
srv.drainServerTransports(addr)
|
||||||
}
|
}
|
||||||
|
internal.AddGlobalServerOptions = func(opt ...ServerOption) {
|
||||||
|
extraServerOptions = append(extraServerOptions, opt...)
|
||||||
|
}
|
||||||
|
internal.ClearGlobalServerOptions = func() {
|
||||||
|
extraServerOptions = nil
|
||||||
|
}
|
||||||
|
internal.BinaryLogger = binaryLogger
|
||||||
|
internal.JoinServerOptions = newJoinServerOption
|
||||||
}
|
}
|
||||||
|
|
||||||
var statusOK = status.New(codes.OK, "")
|
var statusOK = status.New(codes.OK, "")
|
||||||
@ -149,8 +157,9 @@ type serverOptions struct {
|
|||||||
streamInt StreamServerInterceptor
|
streamInt StreamServerInterceptor
|
||||||
chainUnaryInts []UnaryServerInterceptor
|
chainUnaryInts []UnaryServerInterceptor
|
||||||
chainStreamInts []StreamServerInterceptor
|
chainStreamInts []StreamServerInterceptor
|
||||||
|
binaryLogger binarylog.Logger
|
||||||
inTapHandle tap.ServerInHandle
|
inTapHandle tap.ServerInHandle
|
||||||
statsHandler stats.Handler
|
statsHandlers []stats.Handler
|
||||||
maxConcurrentStreams uint32
|
maxConcurrentStreams uint32
|
||||||
maxReceiveMessageSize int
|
maxReceiveMessageSize int
|
||||||
maxSendMessageSize int
|
maxSendMessageSize int
|
||||||
@ -174,6 +183,7 @@ var defaultServerOptions = serverOptions{
|
|||||||
writeBufferSize: defaultWriteBufSize,
|
writeBufferSize: defaultWriteBufSize,
|
||||||
readBufferSize: defaultReadBufSize,
|
readBufferSize: defaultReadBufSize,
|
||||||
}
|
}
|
||||||
|
var extraServerOptions []ServerOption
|
||||||
|
|
||||||
// A ServerOption sets options such as credentials, codec and keepalive parameters, etc.
|
// A ServerOption sets options such as credentials, codec and keepalive parameters, etc.
|
||||||
type ServerOption interface {
|
type ServerOption interface {
|
||||||
@ -183,7 +193,7 @@ type ServerOption interface {
|
|||||||
// EmptyServerOption does not alter the server configuration. It can be embedded
|
// EmptyServerOption does not alter the server configuration. It can be embedded
|
||||||
// in another structure to build custom server options.
|
// in another structure to build custom server options.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -207,6 +217,22 @@ func newFuncServerOption(f func(*serverOptions)) *funcServerOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// joinServerOption provides a way to combine arbitrary number of server
|
||||||
|
// options into one.
|
||||||
|
type joinServerOption struct {
|
||||||
|
opts []ServerOption
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mdo *joinServerOption) apply(do *serverOptions) {
|
||||||
|
for _, opt := range mdo.opts {
|
||||||
|
opt.apply(do)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func newJoinServerOption(opts ...ServerOption) ServerOption {
|
||||||
|
return &joinServerOption{opts: opts}
|
||||||
|
}
|
||||||
|
|
||||||
// WriteBufferSize determines how much data can be batched before doing a write on the wire.
|
// WriteBufferSize determines how much data can be batched before doing a write on the wire.
|
||||||
// The corresponding memory allocation for this buffer will be twice the size to keep syscalls low.
|
// The corresponding memory allocation for this buffer will be twice the size to keep syscalls low.
|
||||||
// The default value for this buffer is 32KB.
|
// The default value for this buffer is 32KB.
|
||||||
@ -298,7 +324,7 @@ func CustomCodec(codec Codec) ServerOption {
|
|||||||
// https://github.com/grpc/grpc-go/blob/master/Documentation/encoding.md#using-a-codec.
|
// https://github.com/grpc/grpc-go/blob/master/Documentation/encoding.md#using-a-codec.
|
||||||
// Will be supported throughout 1.x.
|
// Will be supported throughout 1.x.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -419,7 +445,7 @@ func ChainStreamInterceptor(interceptors ...StreamServerInterceptor) ServerOptio
|
|||||||
// InTapHandle returns a ServerOption that sets the tap handle for all the server
|
// InTapHandle returns a ServerOption that sets the tap handle for all the server
|
||||||
// transport to be created. Only one can be installed.
|
// transport to be created. Only one can be installed.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -435,7 +461,21 @@ func InTapHandle(h tap.ServerInHandle) ServerOption {
|
|||||||
// StatsHandler returns a ServerOption that sets the stats handler for the server.
|
// StatsHandler returns a ServerOption that sets the stats handler for the server.
|
||||||
func StatsHandler(h stats.Handler) ServerOption {
|
func StatsHandler(h stats.Handler) ServerOption {
|
||||||
return newFuncServerOption(func(o *serverOptions) {
|
return newFuncServerOption(func(o *serverOptions) {
|
||||||
o.statsHandler = h
|
if h == nil {
|
||||||
|
logger.Error("ignoring nil parameter in grpc.StatsHandler ServerOption")
|
||||||
|
// Do not allow a nil stats handler, which would otherwise cause
|
||||||
|
// panics.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
o.statsHandlers = append(o.statsHandlers, h)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// binaryLogger returns a ServerOption that can set the binary logger for the
|
||||||
|
// server.
|
||||||
|
func binaryLogger(bl binarylog.Logger) ServerOption {
|
||||||
|
return newFuncServerOption(func(o *serverOptions) {
|
||||||
|
o.binaryLogger = bl
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,7 +502,7 @@ func UnknownServiceHandler(streamHandler StreamHandler) ServerOption {
|
|||||||
// new connections. If this is not set, the default is 120 seconds. A zero or
|
// new connections. If this is not set, the default is 120 seconds. A zero or
|
||||||
// negative value will result in an immediate timeout.
|
// negative value will result in an immediate timeout.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -483,7 +523,7 @@ func MaxHeaderListSize(s uint32) ServerOption {
|
|||||||
// HeaderTableSize returns a ServerOption that sets the size of dynamic
|
// HeaderTableSize returns a ServerOption that sets the size of dynamic
|
||||||
// header table for stream.
|
// header table for stream.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -498,7 +538,7 @@ func HeaderTableSize(s uint32) ServerOption {
|
|||||||
// zero (default) will disable workers and spawn a new goroutine for each
|
// zero (default) will disable workers and spawn a new goroutine for each
|
||||||
// stream.
|
// stream.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -560,6 +600,9 @@ func (s *Server) stopServerWorkers() {
|
|||||||
// started to accept requests yet.
|
// started to accept requests yet.
|
||||||
func NewServer(opt ...ServerOption) *Server {
|
func NewServer(opt ...ServerOption) *Server {
|
||||||
opts := defaultServerOptions
|
opts := defaultServerOptions
|
||||||
|
for _, o := range extraServerOptions {
|
||||||
|
o.apply(&opts)
|
||||||
|
}
|
||||||
for _, o := range opt {
|
for _, o := range opt {
|
||||||
o.apply(&opts)
|
o.apply(&opts)
|
||||||
}
|
}
|
||||||
@ -867,7 +910,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport {
|
|||||||
ConnectionTimeout: s.opts.connectionTimeout,
|
ConnectionTimeout: s.opts.connectionTimeout,
|
||||||
Credentials: s.opts.creds,
|
Credentials: s.opts.creds,
|
||||||
InTapHandle: s.opts.inTapHandle,
|
InTapHandle: s.opts.inTapHandle,
|
||||||
StatsHandler: s.opts.statsHandler,
|
StatsHandlers: s.opts.statsHandlers,
|
||||||
KeepaliveParams: s.opts.keepaliveParams,
|
KeepaliveParams: s.opts.keepaliveParams,
|
||||||
KeepalivePolicy: s.opts.keepalivePolicy,
|
KeepalivePolicy: s.opts.keepalivePolicy,
|
||||||
InitialWindowSize: s.opts.initialWindowSize,
|
InitialWindowSize: s.opts.initialWindowSize,
|
||||||
@ -888,7 +931,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport {
|
|||||||
if err != credentials.ErrConnDispatched {
|
if err != credentials.ErrConnDispatched {
|
||||||
// Don't log on ErrConnDispatched and io.EOF to prevent log spam.
|
// Don't log on ErrConnDispatched and io.EOF to prevent log spam.
|
||||||
if err != io.EOF {
|
if err != io.EOF {
|
||||||
channelz.Warning(logger, s.channelzID, "grpc: Server.Serve failed to create ServerTransport: ", err)
|
channelz.Info(logger, s.channelzID, "grpc: Server.Serve failed to create ServerTransport: ", err)
|
||||||
}
|
}
|
||||||
c.Close()
|
c.Close()
|
||||||
}
|
}
|
||||||
@ -958,12 +1001,12 @@ var _ http.Handler = (*Server)(nil)
|
|||||||
// between the two paths. ServeHTTP does not support some gRPC features
|
// between the two paths. ServeHTTP does not support some gRPC features
|
||||||
// available through grpc-go's HTTP/2 server.
|
// available through grpc-go's HTTP/2 server.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandler)
|
st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandlers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
@ -1076,8 +1119,10 @@ func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Str
|
|||||||
return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(payload), s.opts.maxSendMessageSize)
|
return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(payload), s.opts.maxSendMessageSize)
|
||||||
}
|
}
|
||||||
err = t.Write(stream, hdr, payload, opts)
|
err = t.Write(stream, hdr, payload, opts)
|
||||||
if err == nil && s.opts.statsHandler != nil {
|
if err == nil {
|
||||||
s.opts.statsHandler.HandleRPC(stream.Context(), outPayload(false, msg, data, payload, time.Now()))
|
for _, sh := range s.opts.statsHandlers {
|
||||||
|
sh.HandleRPC(stream.Context(), outPayload(false, msg, data, payload, time.Now()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1124,13 +1169,13 @@ func chainUnaryInterceptors(interceptors []UnaryServerInterceptor) UnaryServerIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, md *MethodDesc, trInfo *traceInfo) (err error) {
|
func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, md *MethodDesc, trInfo *traceInfo) (err error) {
|
||||||
sh := s.opts.statsHandler
|
shs := s.opts.statsHandlers
|
||||||
if sh != nil || trInfo != nil || channelz.IsOn() {
|
if len(shs) != 0 || trInfo != nil || channelz.IsOn() {
|
||||||
if channelz.IsOn() {
|
if channelz.IsOn() {
|
||||||
s.incrCallsStarted()
|
s.incrCallsStarted()
|
||||||
}
|
}
|
||||||
var statsBegin *stats.Begin
|
var statsBegin *stats.Begin
|
||||||
if sh != nil {
|
for _, sh := range shs {
|
||||||
beginTime := time.Now()
|
beginTime := time.Now()
|
||||||
statsBegin = &stats.Begin{
|
statsBegin = &stats.Begin{
|
||||||
BeginTime: beginTime,
|
BeginTime: beginTime,
|
||||||
@ -1161,7 +1206,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
trInfo.tr.Finish()
|
trInfo.tr.Finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
if sh != nil {
|
for _, sh := range shs {
|
||||||
end := &stats.End{
|
end := &stats.End{
|
||||||
BeginTime: statsBegin.BeginTime,
|
BeginTime: statsBegin.BeginTime,
|
||||||
EndTime: time.Now(),
|
EndTime: time.Now(),
|
||||||
@ -1181,9 +1226,16 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
var binlogs []binarylog.MethodLogger
|
||||||
binlog := binarylog.GetMethodLogger(stream.Method())
|
if ml := binarylog.GetMethodLogger(stream.Method()); ml != nil {
|
||||||
if binlog != nil {
|
binlogs = append(binlogs, ml)
|
||||||
|
}
|
||||||
|
if s.opts.binaryLogger != nil {
|
||||||
|
if ml := s.opts.binaryLogger.GetMethodLogger(stream.Method()); ml != nil {
|
||||||
|
binlogs = append(binlogs, ml)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(binlogs) != 0 {
|
||||||
ctx := stream.Context()
|
ctx := stream.Context()
|
||||||
md, _ := metadata.FromIncomingContext(ctx)
|
md, _ := metadata.FromIncomingContext(ctx)
|
||||||
logEntry := &binarylog.ClientHeader{
|
logEntry := &binarylog.ClientHeader{
|
||||||
@ -1203,8 +1255,10 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
if peer, ok := peer.FromContext(ctx); ok {
|
if peer, ok := peer.FromContext(ctx); ok {
|
||||||
logEntry.PeerAddr = peer.Addr
|
logEntry.PeerAddr = peer.Addr
|
||||||
}
|
}
|
||||||
|
for _, binlog := range binlogs {
|
||||||
binlog.Log(logEntry)
|
binlog.Log(logEntry)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// comp and cp are used for compression. decomp and dc are used for
|
// comp and cp are used for compression. decomp and dc are used for
|
||||||
// decompression. If comp and decomp are both set, they are the same;
|
// decompression. If comp and decomp are both set, they are the same;
|
||||||
@ -1243,7 +1297,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
}
|
}
|
||||||
|
|
||||||
var payInfo *payloadInfo
|
var payInfo *payloadInfo
|
||||||
if sh != nil || binlog != nil {
|
if len(shs) != 0 || len(binlogs) != 0 {
|
||||||
payInfo = &payloadInfo{}
|
payInfo = &payloadInfo{}
|
||||||
}
|
}
|
||||||
d, err := recvAndDecompress(&parser{r: stream}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp)
|
d, err := recvAndDecompress(&parser{r: stream}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp)
|
||||||
@ -1260,7 +1314,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
if err := s.getCodec(stream.ContentSubtype()).Unmarshal(d, v); err != nil {
|
if err := s.getCodec(stream.ContentSubtype()).Unmarshal(d, v); err != nil {
|
||||||
return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err)
|
return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err)
|
||||||
}
|
}
|
||||||
if sh != nil {
|
for _, sh := range shs {
|
||||||
sh.HandleRPC(stream.Context(), &stats.InPayload{
|
sh.HandleRPC(stream.Context(), &stats.InPayload{
|
||||||
RecvTime: time.Now(),
|
RecvTime: time.Now(),
|
||||||
Payload: v,
|
Payload: v,
|
||||||
@ -1269,10 +1323,13 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
Length: len(d),
|
Length: len(d),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if binlog != nil {
|
if len(binlogs) != 0 {
|
||||||
binlog.Log(&binarylog.ClientMessage{
|
cm := &binarylog.ClientMessage{
|
||||||
Message: d,
|
Message: d,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range binlogs {
|
||||||
|
binlog.Log(cm)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if trInfo != nil {
|
if trInfo != nil {
|
||||||
trInfo.tr.LazyLog(&payload{sent: false, msg: v}, true)
|
trInfo.tr.LazyLog(&payload{sent: false, msg: v}, true)
|
||||||
@ -1296,18 +1353,24 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
if e := t.WriteStatus(stream, appStatus); e != nil {
|
if e := t.WriteStatus(stream, appStatus); e != nil {
|
||||||
channelz.Warningf(logger, s.channelzID, "grpc: Server.processUnaryRPC failed to write status: %v", e)
|
channelz.Warningf(logger, s.channelzID, "grpc: Server.processUnaryRPC failed to write status: %v", e)
|
||||||
}
|
}
|
||||||
if binlog != nil {
|
if len(binlogs) != 0 {
|
||||||
if h, _ := stream.Header(); h.Len() > 0 {
|
if h, _ := stream.Header(); h.Len() > 0 {
|
||||||
// Only log serverHeader if there was header. Otherwise it can
|
// Only log serverHeader if there was header. Otherwise it can
|
||||||
// be trailer only.
|
// be trailer only.
|
||||||
binlog.Log(&binarylog.ServerHeader{
|
sh := &binarylog.ServerHeader{
|
||||||
Header: h,
|
Header: h,
|
||||||
})
|
|
||||||
}
|
}
|
||||||
binlog.Log(&binarylog.ServerTrailer{
|
for _, binlog := range binlogs {
|
||||||
|
binlog.Log(sh)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
st := &binarylog.ServerTrailer{
|
||||||
Trailer: stream.Trailer(),
|
Trailer: stream.Trailer(),
|
||||||
Err: appErr,
|
Err: appErr,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range binlogs {
|
||||||
|
binlog.Log(st)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return appErr
|
return appErr
|
||||||
}
|
}
|
||||||
@ -1333,26 +1396,34 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
panic(fmt.Sprintf("grpc: Unexpected error (%T) from sendResponse: %v", st, st))
|
panic(fmt.Sprintf("grpc: Unexpected error (%T) from sendResponse: %v", st, st))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if binlog != nil {
|
if len(binlogs) != 0 {
|
||||||
h, _ := stream.Header()
|
h, _ := stream.Header()
|
||||||
binlog.Log(&binarylog.ServerHeader{
|
sh := &binarylog.ServerHeader{
|
||||||
Header: h,
|
Header: h,
|
||||||
})
|
}
|
||||||
binlog.Log(&binarylog.ServerTrailer{
|
st := &binarylog.ServerTrailer{
|
||||||
Trailer: stream.Trailer(),
|
Trailer: stream.Trailer(),
|
||||||
Err: appErr,
|
Err: appErr,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range binlogs {
|
||||||
|
binlog.Log(sh)
|
||||||
|
binlog.Log(st)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if binlog != nil {
|
if len(binlogs) != 0 {
|
||||||
h, _ := stream.Header()
|
h, _ := stream.Header()
|
||||||
binlog.Log(&binarylog.ServerHeader{
|
sh := &binarylog.ServerHeader{
|
||||||
Header: h,
|
Header: h,
|
||||||
})
|
}
|
||||||
binlog.Log(&binarylog.ServerMessage{
|
sm := &binarylog.ServerMessage{
|
||||||
Message: reply,
|
Message: reply,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range binlogs {
|
||||||
|
binlog.Log(sh)
|
||||||
|
binlog.Log(sm)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if channelz.IsOn() {
|
if channelz.IsOn() {
|
||||||
t.IncrMsgSent()
|
t.IncrMsgSent()
|
||||||
@ -1364,11 +1435,14 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
|
|||||||
// Should the logging be in WriteStatus? Should we ignore the WriteStatus
|
// Should the logging be in WriteStatus? Should we ignore the WriteStatus
|
||||||
// error or allow the stats handler to see it?
|
// error or allow the stats handler to see it?
|
||||||
err = t.WriteStatus(stream, statusOK)
|
err = t.WriteStatus(stream, statusOK)
|
||||||
if binlog != nil {
|
if len(binlogs) != 0 {
|
||||||
binlog.Log(&binarylog.ServerTrailer{
|
st := &binarylog.ServerTrailer{
|
||||||
Trailer: stream.Trailer(),
|
Trailer: stream.Trailer(),
|
||||||
Err: appErr,
|
Err: appErr,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range binlogs {
|
||||||
|
binlog.Log(st)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1418,17 +1492,19 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||||||
if channelz.IsOn() {
|
if channelz.IsOn() {
|
||||||
s.incrCallsStarted()
|
s.incrCallsStarted()
|
||||||
}
|
}
|
||||||
sh := s.opts.statsHandler
|
shs := s.opts.statsHandlers
|
||||||
var statsBegin *stats.Begin
|
var statsBegin *stats.Begin
|
||||||
if sh != nil {
|
if len(shs) != 0 {
|
||||||
beginTime := time.Now()
|
beginTime := time.Now()
|
||||||
statsBegin = &stats.Begin{
|
statsBegin = &stats.Begin{
|
||||||
BeginTime: beginTime,
|
BeginTime: beginTime,
|
||||||
IsClientStream: sd.ClientStreams,
|
IsClientStream: sd.ClientStreams,
|
||||||
IsServerStream: sd.ServerStreams,
|
IsServerStream: sd.ServerStreams,
|
||||||
}
|
}
|
||||||
|
for _, sh := range shs {
|
||||||
sh.HandleRPC(stream.Context(), statsBegin)
|
sh.HandleRPC(stream.Context(), statsBegin)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ctx := NewContextWithServerTransportStream(stream.Context(), stream)
|
ctx := NewContextWithServerTransportStream(stream.Context(), stream)
|
||||||
ss := &serverStream{
|
ss := &serverStream{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
@ -1439,10 +1515,10 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||||||
maxReceiveMessageSize: s.opts.maxReceiveMessageSize,
|
maxReceiveMessageSize: s.opts.maxReceiveMessageSize,
|
||||||
maxSendMessageSize: s.opts.maxSendMessageSize,
|
maxSendMessageSize: s.opts.maxSendMessageSize,
|
||||||
trInfo: trInfo,
|
trInfo: trInfo,
|
||||||
statsHandler: sh,
|
statsHandler: shs,
|
||||||
}
|
}
|
||||||
|
|
||||||
if sh != nil || trInfo != nil || channelz.IsOn() {
|
if len(shs) != 0 || trInfo != nil || channelz.IsOn() {
|
||||||
// See comment in processUnaryRPC on defers.
|
// See comment in processUnaryRPC on defers.
|
||||||
defer func() {
|
defer func() {
|
||||||
if trInfo != nil {
|
if trInfo != nil {
|
||||||
@ -1456,7 +1532,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||||||
ss.mu.Unlock()
|
ss.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
if sh != nil {
|
if len(shs) != 0 {
|
||||||
end := &stats.End{
|
end := &stats.End{
|
||||||
BeginTime: statsBegin.BeginTime,
|
BeginTime: statsBegin.BeginTime,
|
||||||
EndTime: time.Now(),
|
EndTime: time.Now(),
|
||||||
@ -1464,8 +1540,10 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
end.Error = toRPCErr(err)
|
end.Error = toRPCErr(err)
|
||||||
}
|
}
|
||||||
|
for _, sh := range shs {
|
||||||
sh.HandleRPC(stream.Context(), end)
|
sh.HandleRPC(stream.Context(), end)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if channelz.IsOn() {
|
if channelz.IsOn() {
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
@ -1477,8 +1555,15 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.binlog = binarylog.GetMethodLogger(stream.Method())
|
if ml := binarylog.GetMethodLogger(stream.Method()); ml != nil {
|
||||||
if ss.binlog != nil {
|
ss.binlogs = append(ss.binlogs, ml)
|
||||||
|
}
|
||||||
|
if s.opts.binaryLogger != nil {
|
||||||
|
if ml := s.opts.binaryLogger.GetMethodLogger(stream.Method()); ml != nil {
|
||||||
|
ss.binlogs = append(ss.binlogs, ml)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(ss.binlogs) != 0 {
|
||||||
md, _ := metadata.FromIncomingContext(ctx)
|
md, _ := metadata.FromIncomingContext(ctx)
|
||||||
logEntry := &binarylog.ClientHeader{
|
logEntry := &binarylog.ClientHeader{
|
||||||
Header: md,
|
Header: md,
|
||||||
@ -1497,7 +1582,9 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||||||
if peer, ok := peer.FromContext(ss.Context()); ok {
|
if peer, ok := peer.FromContext(ss.Context()); ok {
|
||||||
logEntry.PeerAddr = peer.Addr
|
logEntry.PeerAddr = peer.Addr
|
||||||
}
|
}
|
||||||
ss.binlog.Log(logEntry)
|
for _, binlog := range ss.binlogs {
|
||||||
|
binlog.Log(logEntry)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If dc is set and matches the stream's compression, use it. Otherwise, try
|
// If dc is set and matches the stream's compression, use it. Otherwise, try
|
||||||
@ -1563,11 +1650,14 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||||||
ss.mu.Unlock()
|
ss.mu.Unlock()
|
||||||
}
|
}
|
||||||
t.WriteStatus(ss.s, appStatus)
|
t.WriteStatus(ss.s, appStatus)
|
||||||
if ss.binlog != nil {
|
if len(ss.binlogs) != 0 {
|
||||||
ss.binlog.Log(&binarylog.ServerTrailer{
|
st := &binarylog.ServerTrailer{
|
||||||
Trailer: ss.s.Trailer(),
|
Trailer: ss.s.Trailer(),
|
||||||
Err: appErr,
|
Err: appErr,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range ss.binlogs {
|
||||||
|
binlog.Log(st)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO: Should we log an error from WriteStatus here and below?
|
// TODO: Should we log an error from WriteStatus here and below?
|
||||||
return appErr
|
return appErr
|
||||||
@ -1578,11 +1668,14 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
|
|||||||
ss.mu.Unlock()
|
ss.mu.Unlock()
|
||||||
}
|
}
|
||||||
err = t.WriteStatus(ss.s, statusOK)
|
err = t.WriteStatus(ss.s, statusOK)
|
||||||
if ss.binlog != nil {
|
if len(ss.binlogs) != 0 {
|
||||||
ss.binlog.Log(&binarylog.ServerTrailer{
|
st := &binarylog.ServerTrailer{
|
||||||
Trailer: ss.s.Trailer(),
|
Trailer: ss.s.Trailer(),
|
||||||
Err: appErr,
|
Err: appErr,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range ss.binlogs {
|
||||||
|
binlog.Log(st)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1658,7 +1751,7 @@ type streamKey struct{}
|
|||||||
// NewContextWithServerTransportStream creates a new context from ctx and
|
// NewContextWithServerTransportStream creates a new context from ctx and
|
||||||
// attaches stream to it.
|
// attaches stream to it.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -1673,7 +1766,7 @@ func NewContextWithServerTransportStream(ctx context.Context, stream ServerTrans
|
|||||||
//
|
//
|
||||||
// See also NewContextWithServerTransportStream.
|
// See also NewContextWithServerTransportStream.
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This type is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
@ -1688,7 +1781,7 @@ type ServerTransportStream interface {
|
|||||||
// ctx. Returns nil if the given context has no stream associated with it
|
// ctx. Returns nil if the given context has no stream associated with it
|
||||||
// (which implies it is not an RPC invocation context).
|
// (which implies it is not an RPC invocation context).
|
||||||
//
|
//
|
||||||
// Experimental
|
// # Experimental
|
||||||
//
|
//
|
||||||
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
|
||||||
// later release.
|
// later release.
|
||||||
|
7
vendor/google.golang.org/grpc/service_config.go
generated
vendored
7
vendor/google.golang.org/grpc/service_config.go
generated
vendored
@ -57,10 +57,9 @@ type lbConfig struct {
|
|||||||
type ServiceConfig struct {
|
type ServiceConfig struct {
|
||||||
serviceconfig.Config
|
serviceconfig.Config
|
||||||
|
|
||||||
// LB is the load balancer the service providers recommends. The balancer
|
// LB is the load balancer the service providers recommends. This is
|
||||||
// specified via grpc.WithBalancerName will override this. This is deprecated;
|
// deprecated; lbConfigs is preferred. If lbConfig and LB are both present,
|
||||||
// lbConfigs is preferred. If lbConfig and LB are both present, lbConfig
|
// lbConfig will be used.
|
||||||
// will be used.
|
|
||||||
LB *string
|
LB *string
|
||||||
|
|
||||||
// lbConfig is the service config's load balancing configuration. If
|
// lbConfig is the service config's load balancing configuration. If
|
||||||
|
167
vendor/google.golang.org/grpc/stream.go
generated
vendored
167
vendor/google.golang.org/grpc/stream.go
generated
vendored
@ -301,12 +301,13 @@ func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *Client
|
|||||||
if !cc.dopts.disableRetry {
|
if !cc.dopts.disableRetry {
|
||||||
cs.retryThrottler = cc.retryThrottler.Load().(*retryThrottler)
|
cs.retryThrottler = cc.retryThrottler.Load().(*retryThrottler)
|
||||||
}
|
}
|
||||||
cs.binlog = binarylog.GetMethodLogger(method)
|
if ml := binarylog.GetMethodLogger(method); ml != nil {
|
||||||
|
cs.binlogs = append(cs.binlogs, ml)
|
||||||
cs.attempt, err = cs.newAttemptLocked(false /* isTransparent */)
|
}
|
||||||
if err != nil {
|
if cc.dopts.binaryLogger != nil {
|
||||||
cs.finish(err)
|
if ml := cc.dopts.binaryLogger.GetMethodLogger(method); ml != nil {
|
||||||
return nil, err
|
cs.binlogs = append(cs.binlogs, ml)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pick the transport to use and create a new stream on the transport.
|
// Pick the transport to use and create a new stream on the transport.
|
||||||
@ -328,7 +329,7 @@ func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *Client
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if cs.binlog != nil {
|
if len(cs.binlogs) != 0 {
|
||||||
md, _ := metadata.FromOutgoingContext(ctx)
|
md, _ := metadata.FromOutgoingContext(ctx)
|
||||||
logEntry := &binarylog.ClientHeader{
|
logEntry := &binarylog.ClientHeader{
|
||||||
OnClientSide: true,
|
OnClientSide: true,
|
||||||
@ -342,7 +343,9 @@ func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *Client
|
|||||||
logEntry.Timeout = 0
|
logEntry.Timeout = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cs.binlog.Log(logEntry)
|
for _, binlog := range cs.binlogs {
|
||||||
|
binlog.Log(logEntry)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if desc != unaryStreamDesc {
|
if desc != unaryStreamDesc {
|
||||||
@ -374,9 +377,9 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error)
|
|||||||
|
|
||||||
ctx := newContextWithRPCInfo(cs.ctx, cs.callInfo.failFast, cs.callInfo.codec, cs.cp, cs.comp)
|
ctx := newContextWithRPCInfo(cs.ctx, cs.callInfo.failFast, cs.callInfo.codec, cs.cp, cs.comp)
|
||||||
method := cs.callHdr.Method
|
method := cs.callHdr.Method
|
||||||
sh := cs.cc.dopts.copts.StatsHandler
|
|
||||||
var beginTime time.Time
|
var beginTime time.Time
|
||||||
if sh != nil {
|
shs := cs.cc.dopts.copts.StatsHandlers
|
||||||
|
for _, sh := range shs {
|
||||||
ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method, FailFast: cs.callInfo.failFast})
|
ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method, FailFast: cs.callInfo.failFast})
|
||||||
beginTime = time.Now()
|
beginTime = time.Now()
|
||||||
begin := &stats.Begin{
|
begin := &stats.Begin{
|
||||||
@ -418,7 +421,7 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error)
|
|||||||
beginTime: beginTime,
|
beginTime: beginTime,
|
||||||
cs: cs,
|
cs: cs,
|
||||||
dc: cs.cc.dopts.dc,
|
dc: cs.cc.dopts.dc,
|
||||||
statsHandler: sh,
|
statsHandlers: shs,
|
||||||
trInfo: trInfo,
|
trInfo: trInfo,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@ -486,7 +489,7 @@ type clientStream struct {
|
|||||||
|
|
||||||
retryThrottler *retryThrottler // The throttler active when the RPC began.
|
retryThrottler *retryThrottler // The throttler active when the RPC began.
|
||||||
|
|
||||||
binlog binarylog.MethodLogger // Binary logger, can be nil.
|
binlogs []binarylog.MethodLogger
|
||||||
// serverHeaderBinlogged is a boolean for whether server header has been
|
// serverHeaderBinlogged is a boolean for whether server header has been
|
||||||
// logged. Server header will be logged when the first time one of those
|
// logged. Server header will be logged when the first time one of those
|
||||||
// happens: stream.Header(), stream.Recv().
|
// happens: stream.Header(), stream.Recv().
|
||||||
@ -536,7 +539,7 @@ type csAttempt struct {
|
|||||||
// and cleared when the finish method is called.
|
// and cleared when the finish method is called.
|
||||||
trInfo *traceInfo
|
trInfo *traceInfo
|
||||||
|
|
||||||
statsHandler stats.Handler
|
statsHandlers []stats.Handler
|
||||||
beginTime time.Time
|
beginTime time.Time
|
||||||
|
|
||||||
// set for newStream errors that may be transparently retried
|
// set for newStream errors that may be transparently retried
|
||||||
@ -704,6 +707,18 @@ func (cs *clientStream) withRetry(op func(a *csAttempt) error, onSuccess func())
|
|||||||
// already be status errors.
|
// already be status errors.
|
||||||
return toRPCErr(op(cs.attempt))
|
return toRPCErr(op(cs.attempt))
|
||||||
}
|
}
|
||||||
|
if len(cs.buffer) == 0 {
|
||||||
|
// For the first op, which controls creation of the stream and
|
||||||
|
// assigns cs.attempt, we need to create a new attempt inline
|
||||||
|
// before executing the first op. On subsequent ops, the attempt
|
||||||
|
// is created immediately before replaying the ops.
|
||||||
|
var err error
|
||||||
|
if cs.attempt, err = cs.newAttemptLocked(false /* isTransparent */); err != nil {
|
||||||
|
cs.mu.Unlock()
|
||||||
|
cs.finish(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
a := cs.attempt
|
a := cs.attempt
|
||||||
cs.mu.Unlock()
|
cs.mu.Unlock()
|
||||||
err := op(a)
|
err := op(a)
|
||||||
@ -738,7 +753,7 @@ func (cs *clientStream) Header() (metadata.MD, error) {
|
|||||||
cs.finish(err)
|
cs.finish(err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if cs.binlog != nil && !cs.serverHeaderBinlogged {
|
if len(cs.binlogs) != 0 && !cs.serverHeaderBinlogged {
|
||||||
// Only log if binary log is on and header has not been logged.
|
// Only log if binary log is on and header has not been logged.
|
||||||
logEntry := &binarylog.ServerHeader{
|
logEntry := &binarylog.ServerHeader{
|
||||||
OnClientSide: true,
|
OnClientSide: true,
|
||||||
@ -748,8 +763,10 @@ func (cs *clientStream) Header() (metadata.MD, error) {
|
|||||||
if peer, ok := peer.FromContext(cs.Context()); ok {
|
if peer, ok := peer.FromContext(cs.Context()); ok {
|
||||||
logEntry.PeerAddr = peer.Addr
|
logEntry.PeerAddr = peer.Addr
|
||||||
}
|
}
|
||||||
cs.binlog.Log(logEntry)
|
|
||||||
cs.serverHeaderBinlogged = true
|
cs.serverHeaderBinlogged = true
|
||||||
|
for _, binlog := range cs.binlogs {
|
||||||
|
binlog.Log(logEntry)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
@ -823,38 +840,44 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) {
|
|||||||
return a.sendMsg(m, hdr, payload, data)
|
return a.sendMsg(m, hdr, payload, data)
|
||||||
}
|
}
|
||||||
err = cs.withRetry(op, func() { cs.bufferForRetryLocked(len(hdr)+len(payload), op) })
|
err = cs.withRetry(op, func() { cs.bufferForRetryLocked(len(hdr)+len(payload), op) })
|
||||||
if cs.binlog != nil && err == nil {
|
if len(cs.binlogs) != 0 && err == nil {
|
||||||
cs.binlog.Log(&binarylog.ClientMessage{
|
cm := &binarylog.ClientMessage{
|
||||||
OnClientSide: true,
|
OnClientSide: true,
|
||||||
Message: data,
|
Message: data,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range cs.binlogs {
|
||||||
|
binlog.Log(cm)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *clientStream) RecvMsg(m interface{}) error {
|
func (cs *clientStream) RecvMsg(m interface{}) error {
|
||||||
if cs.binlog != nil && !cs.serverHeaderBinlogged {
|
if len(cs.binlogs) != 0 && !cs.serverHeaderBinlogged {
|
||||||
// Call Header() to binary log header if it's not already logged.
|
// Call Header() to binary log header if it's not already logged.
|
||||||
cs.Header()
|
cs.Header()
|
||||||
}
|
}
|
||||||
var recvInfo *payloadInfo
|
var recvInfo *payloadInfo
|
||||||
if cs.binlog != nil {
|
if len(cs.binlogs) != 0 {
|
||||||
recvInfo = &payloadInfo{}
|
recvInfo = &payloadInfo{}
|
||||||
}
|
}
|
||||||
err := cs.withRetry(func(a *csAttempt) error {
|
err := cs.withRetry(func(a *csAttempt) error {
|
||||||
return a.recvMsg(m, recvInfo)
|
return a.recvMsg(m, recvInfo)
|
||||||
}, cs.commitAttemptLocked)
|
}, cs.commitAttemptLocked)
|
||||||
if cs.binlog != nil && err == nil {
|
if len(cs.binlogs) != 0 && err == nil {
|
||||||
cs.binlog.Log(&binarylog.ServerMessage{
|
sm := &binarylog.ServerMessage{
|
||||||
OnClientSide: true,
|
OnClientSide: true,
|
||||||
Message: recvInfo.uncompressedBytes,
|
Message: recvInfo.uncompressedBytes,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range cs.binlogs {
|
||||||
|
binlog.Log(sm)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err != nil || !cs.desc.ServerStreams {
|
if err != nil || !cs.desc.ServerStreams {
|
||||||
// err != nil or non-server-streaming indicates end of stream.
|
// err != nil or non-server-streaming indicates end of stream.
|
||||||
cs.finish(err)
|
cs.finish(err)
|
||||||
|
|
||||||
if cs.binlog != nil {
|
if len(cs.binlogs) != 0 {
|
||||||
// finish will not log Trailer. Log Trailer here.
|
// finish will not log Trailer. Log Trailer here.
|
||||||
logEntry := &binarylog.ServerTrailer{
|
logEntry := &binarylog.ServerTrailer{
|
||||||
OnClientSide: true,
|
OnClientSide: true,
|
||||||
@ -867,7 +890,9 @@ func (cs *clientStream) RecvMsg(m interface{}) error {
|
|||||||
if peer, ok := peer.FromContext(cs.Context()); ok {
|
if peer, ok := peer.FromContext(cs.Context()); ok {
|
||||||
logEntry.PeerAddr = peer.Addr
|
logEntry.PeerAddr = peer.Addr
|
||||||
}
|
}
|
||||||
cs.binlog.Log(logEntry)
|
for _, binlog := range cs.binlogs {
|
||||||
|
binlog.Log(logEntry)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
@ -888,10 +913,13 @@ func (cs *clientStream) CloseSend() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) })
|
cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) })
|
||||||
if cs.binlog != nil {
|
if len(cs.binlogs) != 0 {
|
||||||
cs.binlog.Log(&binarylog.ClientHalfClose{
|
chc := &binarylog.ClientHalfClose{
|
||||||
OnClientSide: true,
|
OnClientSide: true,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range cs.binlogs {
|
||||||
|
binlog.Log(chc)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// We never returned an error here for reasons.
|
// We never returned an error here for reasons.
|
||||||
return nil
|
return nil
|
||||||
@ -924,10 +952,13 @@ func (cs *clientStream) finish(err error) {
|
|||||||
//
|
//
|
||||||
// Only one of cancel or trailer needs to be logged. In the cases where
|
// Only one of cancel or trailer needs to be logged. In the cases where
|
||||||
// users don't call RecvMsg, users must have already canceled the RPC.
|
// users don't call RecvMsg, users must have already canceled the RPC.
|
||||||
if cs.binlog != nil && status.Code(err) == codes.Canceled {
|
if len(cs.binlogs) != 0 && status.Code(err) == codes.Canceled {
|
||||||
cs.binlog.Log(&binarylog.Cancel{
|
c := &binarylog.Cancel{
|
||||||
OnClientSide: true,
|
OnClientSide: true,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range cs.binlogs {
|
||||||
|
binlog.Log(c)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
cs.retryThrottler.successfulRPC()
|
cs.retryThrottler.successfulRPC()
|
||||||
@ -960,8 +991,8 @@ func (a *csAttempt) sendMsg(m interface{}, hdr, payld, data []byte) error {
|
|||||||
}
|
}
|
||||||
return io.EOF
|
return io.EOF
|
||||||
}
|
}
|
||||||
if a.statsHandler != nil {
|
for _, sh := range a.statsHandlers {
|
||||||
a.statsHandler.HandleRPC(a.ctx, outPayload(true, m, data, payld, time.Now()))
|
sh.HandleRPC(a.ctx, outPayload(true, m, data, payld, time.Now()))
|
||||||
}
|
}
|
||||||
if channelz.IsOn() {
|
if channelz.IsOn() {
|
||||||
a.t.IncrMsgSent()
|
a.t.IncrMsgSent()
|
||||||
@ -971,7 +1002,7 @@ func (a *csAttempt) sendMsg(m interface{}, hdr, payld, data []byte) error {
|
|||||||
|
|
||||||
func (a *csAttempt) recvMsg(m interface{}, payInfo *payloadInfo) (err error) {
|
func (a *csAttempt) recvMsg(m interface{}, payInfo *payloadInfo) (err error) {
|
||||||
cs := a.cs
|
cs := a.cs
|
||||||
if a.statsHandler != nil && payInfo == nil {
|
if len(a.statsHandlers) != 0 && payInfo == nil {
|
||||||
payInfo = &payloadInfo{}
|
payInfo = &payloadInfo{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -999,6 +1030,7 @@ func (a *csAttempt) recvMsg(m interface{}, payInfo *payloadInfo) (err error) {
|
|||||||
}
|
}
|
||||||
return io.EOF // indicates successful end of stream.
|
return io.EOF // indicates successful end of stream.
|
||||||
}
|
}
|
||||||
|
|
||||||
return toRPCErr(err)
|
return toRPCErr(err)
|
||||||
}
|
}
|
||||||
if a.trInfo != nil {
|
if a.trInfo != nil {
|
||||||
@ -1008,8 +1040,8 @@ func (a *csAttempt) recvMsg(m interface{}, payInfo *payloadInfo) (err error) {
|
|||||||
}
|
}
|
||||||
a.mu.Unlock()
|
a.mu.Unlock()
|
||||||
}
|
}
|
||||||
if a.statsHandler != nil {
|
for _, sh := range a.statsHandlers {
|
||||||
a.statsHandler.HandleRPC(a.ctx, &stats.InPayload{
|
sh.HandleRPC(a.ctx, &stats.InPayload{
|
||||||
Client: true,
|
Client: true,
|
||||||
RecvTime: time.Now(),
|
RecvTime: time.Now(),
|
||||||
Payload: m,
|
Payload: m,
|
||||||
@ -1068,7 +1100,7 @@ func (a *csAttempt) finish(err error) {
|
|||||||
ServerLoad: balancerload.Parse(tr),
|
ServerLoad: balancerload.Parse(tr),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if a.statsHandler != nil {
|
for _, sh := range a.statsHandlers {
|
||||||
end := &stats.End{
|
end := &stats.End{
|
||||||
Client: true,
|
Client: true,
|
||||||
BeginTime: a.beginTime,
|
BeginTime: a.beginTime,
|
||||||
@ -1076,7 +1108,7 @@ func (a *csAttempt) finish(err error) {
|
|||||||
Trailer: tr,
|
Trailer: tr,
|
||||||
Error: err,
|
Error: err,
|
||||||
}
|
}
|
||||||
a.statsHandler.HandleRPC(a.ctx, end)
|
sh.HandleRPC(a.ctx, end)
|
||||||
}
|
}
|
||||||
if a.trInfo != nil && a.trInfo.tr != nil {
|
if a.trInfo != nil && a.trInfo.tr != nil {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -1445,9 +1477,9 @@ type serverStream struct {
|
|||||||
maxSendMessageSize int
|
maxSendMessageSize int
|
||||||
trInfo *traceInfo
|
trInfo *traceInfo
|
||||||
|
|
||||||
statsHandler stats.Handler
|
statsHandler []stats.Handler
|
||||||
|
|
||||||
binlog binarylog.MethodLogger
|
binlogs []binarylog.MethodLogger
|
||||||
// serverHeaderBinlogged indicates whether server header has been logged. It
|
// serverHeaderBinlogged indicates whether server header has been logged. It
|
||||||
// will happen when one of the following two happens: stream.SendHeader(),
|
// will happen when one of the following two happens: stream.SendHeader(),
|
||||||
// stream.Send().
|
// stream.Send().
|
||||||
@ -1481,12 +1513,15 @@ func (ss *serverStream) SendHeader(md metadata.MD) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = ss.t.WriteHeader(ss.s, md)
|
err = ss.t.WriteHeader(ss.s, md)
|
||||||
if ss.binlog != nil && !ss.serverHeaderBinlogged {
|
if len(ss.binlogs) != 0 && !ss.serverHeaderBinlogged {
|
||||||
h, _ := ss.s.Header()
|
h, _ := ss.s.Header()
|
||||||
ss.binlog.Log(&binarylog.ServerHeader{
|
sh := &binarylog.ServerHeader{
|
||||||
Header: h,
|
Header: h,
|
||||||
})
|
}
|
||||||
ss.serverHeaderBinlogged = true
|
ss.serverHeaderBinlogged = true
|
||||||
|
for _, binlog := range ss.binlogs {
|
||||||
|
binlog.Log(sh)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1543,20 +1578,28 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) {
|
|||||||
if err := ss.t.Write(ss.s, hdr, payload, &transport.Options{Last: false}); err != nil {
|
if err := ss.t.Write(ss.s, hdr, payload, &transport.Options{Last: false}); err != nil {
|
||||||
return toRPCErr(err)
|
return toRPCErr(err)
|
||||||
}
|
}
|
||||||
if ss.binlog != nil {
|
if len(ss.binlogs) != 0 {
|
||||||
if !ss.serverHeaderBinlogged {
|
if !ss.serverHeaderBinlogged {
|
||||||
h, _ := ss.s.Header()
|
h, _ := ss.s.Header()
|
||||||
ss.binlog.Log(&binarylog.ServerHeader{
|
sh := &binarylog.ServerHeader{
|
||||||
Header: h,
|
Header: h,
|
||||||
})
|
}
|
||||||
ss.serverHeaderBinlogged = true
|
ss.serverHeaderBinlogged = true
|
||||||
|
for _, binlog := range ss.binlogs {
|
||||||
|
binlog.Log(sh)
|
||||||
}
|
}
|
||||||
ss.binlog.Log(&binarylog.ServerMessage{
|
}
|
||||||
|
sm := &binarylog.ServerMessage{
|
||||||
Message: data,
|
Message: data,
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if ss.statsHandler != nil {
|
for _, binlog := range ss.binlogs {
|
||||||
ss.statsHandler.HandleRPC(ss.s.Context(), outPayload(false, m, data, payload, time.Now()))
|
binlog.Log(sm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(ss.statsHandler) != 0 {
|
||||||
|
for _, sh := range ss.statsHandler {
|
||||||
|
sh.HandleRPC(ss.s.Context(), outPayload(false, m, data, payload, time.Now()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1590,13 +1633,16 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
var payInfo *payloadInfo
|
var payInfo *payloadInfo
|
||||||
if ss.statsHandler != nil || ss.binlog != nil {
|
if len(ss.statsHandler) != 0 || len(ss.binlogs) != 0 {
|
||||||
payInfo = &payloadInfo{}
|
payInfo = &payloadInfo{}
|
||||||
}
|
}
|
||||||
if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxReceiveMessageSize, payInfo, ss.decomp); err != nil {
|
if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxReceiveMessageSize, payInfo, ss.decomp); err != nil {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
if ss.binlog != nil {
|
if len(ss.binlogs) != 0 {
|
||||||
ss.binlog.Log(&binarylog.ClientHalfClose{})
|
chc := &binarylog.ClientHalfClose{}
|
||||||
|
for _, binlog := range ss.binlogs {
|
||||||
|
binlog.Log(chc)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1605,8 +1651,9 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) {
|
|||||||
}
|
}
|
||||||
return toRPCErr(err)
|
return toRPCErr(err)
|
||||||
}
|
}
|
||||||
if ss.statsHandler != nil {
|
if len(ss.statsHandler) != 0 {
|
||||||
ss.statsHandler.HandleRPC(ss.s.Context(), &stats.InPayload{
|
for _, sh := range ss.statsHandler {
|
||||||
|
sh.HandleRPC(ss.s.Context(), &stats.InPayload{
|
||||||
RecvTime: time.Now(),
|
RecvTime: time.Now(),
|
||||||
Payload: m,
|
Payload: m,
|
||||||
// TODO truncate large payload.
|
// TODO truncate large payload.
|
||||||
@ -1615,10 +1662,14 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) {
|
|||||||
Length: len(payInfo.uncompressedBytes),
|
Length: len(payInfo.uncompressedBytes),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if ss.binlog != nil {
|
}
|
||||||
ss.binlog.Log(&binarylog.ClientMessage{
|
if len(ss.binlogs) != 0 {
|
||||||
|
cm := &binarylog.ClientMessage{
|
||||||
Message: payInfo.uncompressedBytes,
|
Message: payInfo.uncompressedBytes,
|
||||||
})
|
}
|
||||||
|
for _, binlog := range ss.binlogs {
|
||||||
|
binlog.Log(cm)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
2
vendor/google.golang.org/grpc/version.go
generated
vendored
2
vendor/google.golang.org/grpc/version.go
generated
vendored
@ -19,4 +19,4 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
// Version is the current grpc version.
|
// Version is the current grpc version.
|
||||||
const Version = "1.47.0"
|
const Version = "1.50.1"
|
||||||
|
1
vendor/google.golang.org/grpc/vet.sh
generated
vendored
1
vendor/google.golang.org/grpc/vet.sh
generated
vendored
@ -147,7 +147,6 @@ grpc.NewGZIPDecompressor
|
|||||||
grpc.RPCCompressor
|
grpc.RPCCompressor
|
||||||
grpc.RPCDecompressor
|
grpc.RPCDecompressor
|
||||||
grpc.ServiceConfig
|
grpc.ServiceConfig
|
||||||
grpc.WithBalancerName
|
|
||||||
grpc.WithCompressor
|
grpc.WithCompressor
|
||||||
grpc.WithDecompressor
|
grpc.WithDecompressor
|
||||||
grpc.WithDialer
|
grpc.WithDialer
|
||||||
|
3
vendor/google.golang.org/protobuf/AUTHORS
generated
vendored
3
vendor/google.golang.org/protobuf/AUTHORS
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
# This source code refers to The Go Authors for copyright purposes.
|
|
||||||
# The master list of authors is in the main Go distribution,
|
|
||||||
# visible at https://tip.golang.org/AUTHORS.
|
|
3
vendor/google.golang.org/protobuf/CONTRIBUTORS
generated
vendored
3
vendor/google.golang.org/protobuf/CONTRIBUTORS
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
# This source code was written by the Go contributors.
|
|
||||||
# The master list of contributors is in the main Go distribution,
|
|
||||||
# visible at https://tip.golang.org/CONTRIBUTORS.
|
|
2
vendor/google.golang.org/protobuf/compiler/protogen/protogen.go
generated
vendored
2
vendor/google.golang.org/protobuf/compiler/protogen/protogen.go
generated
vendored
@ -472,7 +472,7 @@ func newFile(gen *Plugin, p *descriptorpb.FileDescriptorProto, packageName GoPac
|
|||||||
}
|
}
|
||||||
|
|
||||||
// splitImportPathAndPackageName splits off the optional Go package name
|
// splitImportPathAndPackageName splits off the optional Go package name
|
||||||
// from the Go import path when seperated by a ';' delimiter.
|
// from the Go import path when separated by a ';' delimiter.
|
||||||
func splitImportPathAndPackageName(s string) (GoImportPath, GoPackageName) {
|
func splitImportPathAndPackageName(s string) (GoImportPath, GoPackageName) {
|
||||||
if i := strings.Index(s, ";"); i >= 0 {
|
if i := strings.Index(s, ";"); i >= 0 {
|
||||||
return GoImportPath(s[:i]), GoPackageName(s[i+1:])
|
return GoImportPath(s[:i]), GoPackageName(s[i+1:])
|
||||||
|
174
vendor/google.golang.org/protobuf/encoding/protojson/decode.go
generated
vendored
174
vendor/google.golang.org/protobuf/encoding/protojson/decode.go
generated
vendored
@ -19,7 +19,7 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
"google.golang.org/protobuf/internal/set"
|
"google.golang.org/protobuf/internal/set"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ func (d decoder) syntaxError(pos int, f string, x ...interface{}) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unmarshalMessage unmarshals a message into the given protoreflect.Message.
|
// unmarshalMessage unmarshals a message into the given protoreflect.Message.
|
||||||
func (d decoder) unmarshalMessage(m pref.Message, skipTypeURL bool) error {
|
func (d decoder) unmarshalMessage(m protoreflect.Message, skipTypeURL bool) error {
|
||||||
if unmarshal := wellKnownTypeUnmarshaler(m.Descriptor().FullName()); unmarshal != nil {
|
if unmarshal := wellKnownTypeUnmarshaler(m.Descriptor().FullName()); unmarshal != nil {
|
||||||
return unmarshal(d, m)
|
return unmarshal(d, m)
|
||||||
}
|
}
|
||||||
@ -159,10 +159,10 @@ func (d decoder) unmarshalMessage(m pref.Message, skipTypeURL bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the FieldDescriptor.
|
// Get the FieldDescriptor.
|
||||||
var fd pref.FieldDescriptor
|
var fd protoreflect.FieldDescriptor
|
||||||
if strings.HasPrefix(name, "[") && strings.HasSuffix(name, "]") {
|
if strings.HasPrefix(name, "[") && strings.HasSuffix(name, "]") {
|
||||||
// Only extension names are in [name] format.
|
// Only extension names are in [name] format.
|
||||||
extName := pref.FullName(name[1 : len(name)-1])
|
extName := protoreflect.FullName(name[1 : len(name)-1])
|
||||||
extType, err := d.opts.Resolver.FindExtensionByName(extName)
|
extType, err := d.opts.Resolver.FindExtensionByName(extName)
|
||||||
if err != nil && err != protoregistry.NotFound {
|
if err != nil && err != protoregistry.NotFound {
|
||||||
return d.newError(tok.Pos(), "unable to resolve %s: %v", tok.RawString(), err)
|
return d.newError(tok.Pos(), "unable to resolve %s: %v", tok.RawString(), err)
|
||||||
@ -240,23 +240,23 @@ func (d decoder) unmarshalMessage(m pref.Message, skipTypeURL bool) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func isKnownValue(fd pref.FieldDescriptor) bool {
|
func isKnownValue(fd protoreflect.FieldDescriptor) bool {
|
||||||
md := fd.Message()
|
md := fd.Message()
|
||||||
return md != nil && md.FullName() == genid.Value_message_fullname
|
return md != nil && md.FullName() == genid.Value_message_fullname
|
||||||
}
|
}
|
||||||
|
|
||||||
func isNullValue(fd pref.FieldDescriptor) bool {
|
func isNullValue(fd protoreflect.FieldDescriptor) bool {
|
||||||
ed := fd.Enum()
|
ed := fd.Enum()
|
||||||
return ed != nil && ed.FullName() == genid.NullValue_enum_fullname
|
return ed != nil && ed.FullName() == genid.NullValue_enum_fullname
|
||||||
}
|
}
|
||||||
|
|
||||||
// unmarshalSingular unmarshals to the non-repeated field specified
|
// unmarshalSingular unmarshals to the non-repeated field specified
|
||||||
// by the given FieldDescriptor.
|
// by the given FieldDescriptor.
|
||||||
func (d decoder) unmarshalSingular(m pref.Message, fd pref.FieldDescriptor) error {
|
func (d decoder) unmarshalSingular(m protoreflect.Message, fd protoreflect.FieldDescriptor) error {
|
||||||
var val pref.Value
|
var val protoreflect.Value
|
||||||
var err error
|
var err error
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
val = m.NewField(fd)
|
val = m.NewField(fd)
|
||||||
err = d.unmarshalMessage(val.Message(), false)
|
err = d.unmarshalMessage(val.Message(), false)
|
||||||
default:
|
default:
|
||||||
@ -272,63 +272,63 @@ func (d decoder) unmarshalSingular(m pref.Message, fd pref.FieldDescriptor) erro
|
|||||||
|
|
||||||
// unmarshalScalar unmarshals to a scalar/enum protoreflect.Value specified by
|
// unmarshalScalar unmarshals to a scalar/enum protoreflect.Value specified by
|
||||||
// the given FieldDescriptor.
|
// the given FieldDescriptor.
|
||||||
func (d decoder) unmarshalScalar(fd pref.FieldDescriptor) (pref.Value, error) {
|
func (d decoder) unmarshalScalar(fd protoreflect.FieldDescriptor) (protoreflect.Value, error) {
|
||||||
const b32 int = 32
|
const b32 int = 32
|
||||||
const b64 int = 64
|
const b64 int = 64
|
||||||
|
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, err
|
return protoreflect.Value{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
kind := fd.Kind()
|
kind := fd.Kind()
|
||||||
switch kind {
|
switch kind {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if tok.Kind() == json.Bool {
|
if tok.Kind() == json.Bool {
|
||||||
return pref.ValueOfBool(tok.Bool()), nil
|
return protoreflect.ValueOfBool(tok.Bool()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
if v, ok := unmarshalInt(tok, b32); ok {
|
if v, ok := unmarshalInt(tok, b32); ok {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
if v, ok := unmarshalInt(tok, b64); ok {
|
if v, ok := unmarshalInt(tok, b64); ok {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
if v, ok := unmarshalUint(tok, b32); ok {
|
if v, ok := unmarshalUint(tok, b32); ok {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
if v, ok := unmarshalUint(tok, b64); ok {
|
if v, ok := unmarshalUint(tok, b64); ok {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if v, ok := unmarshalFloat(tok, b32); ok {
|
if v, ok := unmarshalFloat(tok, b32); ok {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if v, ok := unmarshalFloat(tok, b64); ok {
|
if v, ok := unmarshalFloat(tok, b64); ok {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if tok.Kind() == json.String {
|
if tok.Kind() == json.String {
|
||||||
return pref.ValueOfString(tok.ParsedString()), nil
|
return protoreflect.ValueOfString(tok.ParsedString()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if v, ok := unmarshalBytes(tok); ok {
|
if v, ok := unmarshalBytes(tok); ok {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if v, ok := unmarshalEnum(tok, fd); ok {
|
if v, ok := unmarshalEnum(tok, fd); ok {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
@ -337,10 +337,10 @@ func (d decoder) unmarshalScalar(fd pref.FieldDescriptor) (pref.Value, error) {
|
|||||||
panic(fmt.Sprintf("unmarshalScalar: invalid scalar kind %v", kind))
|
panic(fmt.Sprintf("unmarshalScalar: invalid scalar kind %v", kind))
|
||||||
}
|
}
|
||||||
|
|
||||||
return pref.Value{}, d.newError(tok.Pos(), "invalid value for %v type: %v", kind, tok.RawString())
|
return protoreflect.Value{}, d.newError(tok.Pos(), "invalid value for %v type: %v", kind, tok.RawString())
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalInt(tok json.Token, bitSize int) (pref.Value, bool) {
|
func unmarshalInt(tok json.Token, bitSize int) (protoreflect.Value, bool) {
|
||||||
switch tok.Kind() {
|
switch tok.Kind() {
|
||||||
case json.Number:
|
case json.Number:
|
||||||
return getInt(tok, bitSize)
|
return getInt(tok, bitSize)
|
||||||
@ -349,30 +349,30 @@ func unmarshalInt(tok json.Token, bitSize int) (pref.Value, bool) {
|
|||||||
// Decode number from string.
|
// Decode number from string.
|
||||||
s := strings.TrimSpace(tok.ParsedString())
|
s := strings.TrimSpace(tok.ParsedString())
|
||||||
if len(s) != len(tok.ParsedString()) {
|
if len(s) != len(tok.ParsedString()) {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
dec := json.NewDecoder([]byte(s))
|
dec := json.NewDecoder([]byte(s))
|
||||||
tok, err := dec.Read()
|
tok, err := dec.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
return getInt(tok, bitSize)
|
return getInt(tok, bitSize)
|
||||||
}
|
}
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func getInt(tok json.Token, bitSize int) (pref.Value, bool) {
|
func getInt(tok json.Token, bitSize int) (protoreflect.Value, bool) {
|
||||||
n, ok := tok.Int(bitSize)
|
n, ok := tok.Int(bitSize)
|
||||||
if !ok {
|
if !ok {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
if bitSize == 32 {
|
if bitSize == 32 {
|
||||||
return pref.ValueOfInt32(int32(n)), true
|
return protoreflect.ValueOfInt32(int32(n)), true
|
||||||
}
|
}
|
||||||
return pref.ValueOfInt64(n), true
|
return protoreflect.ValueOfInt64(n), true
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalUint(tok json.Token, bitSize int) (pref.Value, bool) {
|
func unmarshalUint(tok json.Token, bitSize int) (protoreflect.Value, bool) {
|
||||||
switch tok.Kind() {
|
switch tok.Kind() {
|
||||||
case json.Number:
|
case json.Number:
|
||||||
return getUint(tok, bitSize)
|
return getUint(tok, bitSize)
|
||||||
@ -381,30 +381,30 @@ func unmarshalUint(tok json.Token, bitSize int) (pref.Value, bool) {
|
|||||||
// Decode number from string.
|
// Decode number from string.
|
||||||
s := strings.TrimSpace(tok.ParsedString())
|
s := strings.TrimSpace(tok.ParsedString())
|
||||||
if len(s) != len(tok.ParsedString()) {
|
if len(s) != len(tok.ParsedString()) {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
dec := json.NewDecoder([]byte(s))
|
dec := json.NewDecoder([]byte(s))
|
||||||
tok, err := dec.Read()
|
tok, err := dec.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
return getUint(tok, bitSize)
|
return getUint(tok, bitSize)
|
||||||
}
|
}
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUint(tok json.Token, bitSize int) (pref.Value, bool) {
|
func getUint(tok json.Token, bitSize int) (protoreflect.Value, bool) {
|
||||||
n, ok := tok.Uint(bitSize)
|
n, ok := tok.Uint(bitSize)
|
||||||
if !ok {
|
if !ok {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
if bitSize == 32 {
|
if bitSize == 32 {
|
||||||
return pref.ValueOfUint32(uint32(n)), true
|
return protoreflect.ValueOfUint32(uint32(n)), true
|
||||||
}
|
}
|
||||||
return pref.ValueOfUint64(n), true
|
return protoreflect.ValueOfUint64(n), true
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalFloat(tok json.Token, bitSize int) (pref.Value, bool) {
|
func unmarshalFloat(tok json.Token, bitSize int) (protoreflect.Value, bool) {
|
||||||
switch tok.Kind() {
|
switch tok.Kind() {
|
||||||
case json.Number:
|
case json.Number:
|
||||||
return getFloat(tok, bitSize)
|
return getFloat(tok, bitSize)
|
||||||
@ -414,49 +414,49 @@ func unmarshalFloat(tok json.Token, bitSize int) (pref.Value, bool) {
|
|||||||
switch s {
|
switch s {
|
||||||
case "NaN":
|
case "NaN":
|
||||||
if bitSize == 32 {
|
if bitSize == 32 {
|
||||||
return pref.ValueOfFloat32(float32(math.NaN())), true
|
return protoreflect.ValueOfFloat32(float32(math.NaN())), true
|
||||||
}
|
}
|
||||||
return pref.ValueOfFloat64(math.NaN()), true
|
return protoreflect.ValueOfFloat64(math.NaN()), true
|
||||||
case "Infinity":
|
case "Infinity":
|
||||||
if bitSize == 32 {
|
if bitSize == 32 {
|
||||||
return pref.ValueOfFloat32(float32(math.Inf(+1))), true
|
return protoreflect.ValueOfFloat32(float32(math.Inf(+1))), true
|
||||||
}
|
}
|
||||||
return pref.ValueOfFloat64(math.Inf(+1)), true
|
return protoreflect.ValueOfFloat64(math.Inf(+1)), true
|
||||||
case "-Infinity":
|
case "-Infinity":
|
||||||
if bitSize == 32 {
|
if bitSize == 32 {
|
||||||
return pref.ValueOfFloat32(float32(math.Inf(-1))), true
|
return protoreflect.ValueOfFloat32(float32(math.Inf(-1))), true
|
||||||
}
|
}
|
||||||
return pref.ValueOfFloat64(math.Inf(-1)), true
|
return protoreflect.ValueOfFloat64(math.Inf(-1)), true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode number from string.
|
// Decode number from string.
|
||||||
if len(s) != len(strings.TrimSpace(s)) {
|
if len(s) != len(strings.TrimSpace(s)) {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
dec := json.NewDecoder([]byte(s))
|
dec := json.NewDecoder([]byte(s))
|
||||||
tok, err := dec.Read()
|
tok, err := dec.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
return getFloat(tok, bitSize)
|
return getFloat(tok, bitSize)
|
||||||
}
|
}
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func getFloat(tok json.Token, bitSize int) (pref.Value, bool) {
|
func getFloat(tok json.Token, bitSize int) (protoreflect.Value, bool) {
|
||||||
n, ok := tok.Float(bitSize)
|
n, ok := tok.Float(bitSize)
|
||||||
if !ok {
|
if !ok {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
if bitSize == 32 {
|
if bitSize == 32 {
|
||||||
return pref.ValueOfFloat32(float32(n)), true
|
return protoreflect.ValueOfFloat32(float32(n)), true
|
||||||
}
|
}
|
||||||
return pref.ValueOfFloat64(n), true
|
return protoreflect.ValueOfFloat64(n), true
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalBytes(tok json.Token) (pref.Value, bool) {
|
func unmarshalBytes(tok json.Token) (protoreflect.Value, bool) {
|
||||||
if tok.Kind() != json.String {
|
if tok.Kind() != json.String {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
s := tok.ParsedString()
|
s := tok.ParsedString()
|
||||||
@ -469,36 +469,36 @@ func unmarshalBytes(tok json.Token) (pref.Value, bool) {
|
|||||||
}
|
}
|
||||||
b, err := enc.DecodeString(s)
|
b, err := enc.DecodeString(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
return pref.ValueOfBytes(b), true
|
return protoreflect.ValueOfBytes(b), true
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalEnum(tok json.Token, fd pref.FieldDescriptor) (pref.Value, bool) {
|
func unmarshalEnum(tok json.Token, fd protoreflect.FieldDescriptor) (protoreflect.Value, bool) {
|
||||||
switch tok.Kind() {
|
switch tok.Kind() {
|
||||||
case json.String:
|
case json.String:
|
||||||
// Lookup EnumNumber based on name.
|
// Lookup EnumNumber based on name.
|
||||||
s := tok.ParsedString()
|
s := tok.ParsedString()
|
||||||
if enumVal := fd.Enum().Values().ByName(pref.Name(s)); enumVal != nil {
|
if enumVal := fd.Enum().Values().ByName(protoreflect.Name(s)); enumVal != nil {
|
||||||
return pref.ValueOfEnum(enumVal.Number()), true
|
return protoreflect.ValueOfEnum(enumVal.Number()), true
|
||||||
}
|
}
|
||||||
|
|
||||||
case json.Number:
|
case json.Number:
|
||||||
if n, ok := tok.Int(32); ok {
|
if n, ok := tok.Int(32); ok {
|
||||||
return pref.ValueOfEnum(pref.EnumNumber(n)), true
|
return protoreflect.ValueOfEnum(protoreflect.EnumNumber(n)), true
|
||||||
}
|
}
|
||||||
|
|
||||||
case json.Null:
|
case json.Null:
|
||||||
// This is only valid for google.protobuf.NullValue.
|
// This is only valid for google.protobuf.NullValue.
|
||||||
if isNullValue(fd) {
|
if isNullValue(fd) {
|
||||||
return pref.ValueOfEnum(0), true
|
return protoreflect.ValueOfEnum(0), true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pref.Value{}, false
|
return protoreflect.Value{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalList(list pref.List, fd pref.FieldDescriptor) error {
|
func (d decoder) unmarshalList(list protoreflect.List, fd protoreflect.FieldDescriptor) error {
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -508,7 +508,7 @@ func (d decoder) unmarshalList(list pref.List, fd pref.FieldDescriptor) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
for {
|
for {
|
||||||
tok, err := d.Peek()
|
tok, err := d.Peek()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -549,7 +549,7 @@ func (d decoder) unmarshalList(list pref.List, fd pref.FieldDescriptor) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalMap(mmap pref.Map, fd pref.FieldDescriptor) error {
|
func (d decoder) unmarshalMap(mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error {
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -561,18 +561,18 @@ func (d decoder) unmarshalMap(mmap pref.Map, fd pref.FieldDescriptor) error {
|
|||||||
// Determine ahead whether map entry is a scalar type or a message type in
|
// Determine ahead whether map entry is a scalar type or a message type in
|
||||||
// order to call the appropriate unmarshalMapValue func inside the for loop
|
// order to call the appropriate unmarshalMapValue func inside the for loop
|
||||||
// below.
|
// below.
|
||||||
var unmarshalMapValue func() (pref.Value, error)
|
var unmarshalMapValue func() (protoreflect.Value, error)
|
||||||
switch fd.MapValue().Kind() {
|
switch fd.MapValue().Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
unmarshalMapValue = func() (pref.Value, error) {
|
unmarshalMapValue = func() (protoreflect.Value, error) {
|
||||||
val := mmap.NewValue()
|
val := mmap.NewValue()
|
||||||
if err := d.unmarshalMessage(val.Message(), false); err != nil {
|
if err := d.unmarshalMessage(val.Message(), false); err != nil {
|
||||||
return pref.Value{}, err
|
return protoreflect.Value{}, err
|
||||||
}
|
}
|
||||||
return val, nil
|
return val, nil
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
unmarshalMapValue = func() (pref.Value, error) {
|
unmarshalMapValue = func() (protoreflect.Value, error) {
|
||||||
return d.unmarshalScalar(fd.MapValue())
|
return d.unmarshalScalar(fd.MapValue())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -618,7 +618,7 @@ Loop:
|
|||||||
|
|
||||||
// unmarshalMapKey converts given token of Name kind into a protoreflect.MapKey.
|
// unmarshalMapKey converts given token of Name kind into a protoreflect.MapKey.
|
||||||
// A map key type is any integral or string type.
|
// A map key type is any integral or string type.
|
||||||
func (d decoder) unmarshalMapKey(tok json.Token, fd pref.FieldDescriptor) (pref.MapKey, error) {
|
func (d decoder) unmarshalMapKey(tok json.Token, fd protoreflect.FieldDescriptor) (protoreflect.MapKey, error) {
|
||||||
const b32 = 32
|
const b32 = 32
|
||||||
const b64 = 64
|
const b64 = 64
|
||||||
const base10 = 10
|
const base10 = 10
|
||||||
@ -626,40 +626,40 @@ func (d decoder) unmarshalMapKey(tok json.Token, fd pref.FieldDescriptor) (pref.
|
|||||||
name := tok.Name()
|
name := tok.Name()
|
||||||
kind := fd.Kind()
|
kind := fd.Kind()
|
||||||
switch kind {
|
switch kind {
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
return pref.ValueOfString(name).MapKey(), nil
|
return protoreflect.ValueOfString(name).MapKey(), nil
|
||||||
|
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
switch name {
|
switch name {
|
||||||
case "true":
|
case "true":
|
||||||
return pref.ValueOfBool(true).MapKey(), nil
|
return protoreflect.ValueOfBool(true).MapKey(), nil
|
||||||
case "false":
|
case "false":
|
||||||
return pref.ValueOfBool(false).MapKey(), nil
|
return protoreflect.ValueOfBool(false).MapKey(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
if n, err := strconv.ParseInt(name, base10, b32); err == nil {
|
if n, err := strconv.ParseInt(name, base10, b32); err == nil {
|
||||||
return pref.ValueOfInt32(int32(n)).MapKey(), nil
|
return protoreflect.ValueOfInt32(int32(n)).MapKey(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
if n, err := strconv.ParseInt(name, base10, b64); err == nil {
|
if n, err := strconv.ParseInt(name, base10, b64); err == nil {
|
||||||
return pref.ValueOfInt64(int64(n)).MapKey(), nil
|
return protoreflect.ValueOfInt64(int64(n)).MapKey(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
if n, err := strconv.ParseUint(name, base10, b32); err == nil {
|
if n, err := strconv.ParseUint(name, base10, b32); err == nil {
|
||||||
return pref.ValueOfUint32(uint32(n)).MapKey(), nil
|
return protoreflect.ValueOfUint32(uint32(n)).MapKey(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
if n, err := strconv.ParseUint(name, base10, b64); err == nil {
|
if n, err := strconv.ParseUint(name, base10, b64); err == nil {
|
||||||
return pref.ValueOfUint64(uint64(n)).MapKey(), nil
|
return protoreflect.ValueOfUint64(uint64(n)).MapKey(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("invalid kind for map key: %v", kind))
|
panic(fmt.Sprintf("invalid kind for map key: %v", kind))
|
||||||
}
|
}
|
||||||
|
|
||||||
return pref.MapKey{}, d.newError(tok.Pos(), "invalid value for %v key: %s", kind, tok.RawString())
|
return protoreflect.MapKey{}, d.newError(tok.Pos(), "invalid value for %v key: %s", kind, tok.RawString())
|
||||||
}
|
}
|
||||||
|
51
vendor/google.golang.org/protobuf/encoding/protojson/encode.go
generated
vendored
51
vendor/google.golang.org/protobuf/encoding/protojson/encode.go
generated
vendored
@ -18,7 +18,6 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -164,8 +163,8 @@ type typeURLFieldRanger struct {
|
|||||||
typeURL string
|
typeURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m typeURLFieldRanger) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
func (m typeURLFieldRanger) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
if !f(typeFieldDesc, pref.ValueOfString(m.typeURL)) {
|
if !f(typeFieldDesc, protoreflect.ValueOfString(m.typeURL)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.FieldRanger.Range(f)
|
m.FieldRanger.Range(f)
|
||||||
@ -173,9 +172,9 @@ func (m typeURLFieldRanger) Range(f func(pref.FieldDescriptor, pref.Value) bool)
|
|||||||
|
|
||||||
// unpopulatedFieldRanger wraps a protoreflect.Message and modifies its Range
|
// unpopulatedFieldRanger wraps a protoreflect.Message and modifies its Range
|
||||||
// method to additionally iterate over unpopulated fields.
|
// method to additionally iterate over unpopulated fields.
|
||||||
type unpopulatedFieldRanger struct{ pref.Message }
|
type unpopulatedFieldRanger struct{ protoreflect.Message }
|
||||||
|
|
||||||
func (m unpopulatedFieldRanger) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
func (m unpopulatedFieldRanger) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
fds := m.Descriptor().Fields()
|
fds := m.Descriptor().Fields()
|
||||||
for i := 0; i < fds.Len(); i++ {
|
for i := 0; i < fds.Len(); i++ {
|
||||||
fd := fds.Get(i)
|
fd := fds.Get(i)
|
||||||
@ -184,10 +183,10 @@ func (m unpopulatedFieldRanger) Range(f func(pref.FieldDescriptor, pref.Value) b
|
|||||||
}
|
}
|
||||||
|
|
||||||
v := m.Get(fd)
|
v := m.Get(fd)
|
||||||
isProto2Scalar := fd.Syntax() == pref.Proto2 && fd.Default().IsValid()
|
isProto2Scalar := fd.Syntax() == protoreflect.Proto2 && fd.Default().IsValid()
|
||||||
isSingularMessage := fd.Cardinality() != pref.Repeated && fd.Message() != nil
|
isSingularMessage := fd.Cardinality() != protoreflect.Repeated && fd.Message() != nil
|
||||||
if isProto2Scalar || isSingularMessage {
|
if isProto2Scalar || isSingularMessage {
|
||||||
v = pref.Value{} // use invalid value to emit null
|
v = protoreflect.Value{} // use invalid value to emit null
|
||||||
}
|
}
|
||||||
if !f(fd, v) {
|
if !f(fd, v) {
|
||||||
return
|
return
|
||||||
@ -199,7 +198,7 @@ func (m unpopulatedFieldRanger) Range(f func(pref.FieldDescriptor, pref.Value) b
|
|||||||
// marshalMessage marshals the fields in the given protoreflect.Message.
|
// marshalMessage marshals the fields in the given protoreflect.Message.
|
||||||
// If the typeURL is non-empty, then a synthetic "@type" field is injected
|
// If the typeURL is non-empty, then a synthetic "@type" field is injected
|
||||||
// containing the URL as the value.
|
// containing the URL as the value.
|
||||||
func (e encoder) marshalMessage(m pref.Message, typeURL string) error {
|
func (e encoder) marshalMessage(m protoreflect.Message, typeURL string) error {
|
||||||
if !flags.ProtoLegacy && messageset.IsMessageSet(m.Descriptor()) {
|
if !flags.ProtoLegacy && messageset.IsMessageSet(m.Descriptor()) {
|
||||||
return errors.New("no support for proto1 MessageSets")
|
return errors.New("no support for proto1 MessageSets")
|
||||||
}
|
}
|
||||||
@ -220,7 +219,7 @@ func (e encoder) marshalMessage(m pref.Message, typeURL string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
order.RangeFields(fields, order.IndexNameFieldOrder, func(fd pref.FieldDescriptor, v pref.Value) bool {
|
order.RangeFields(fields, order.IndexNameFieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
|
||||||
name := fd.JSONName()
|
name := fd.JSONName()
|
||||||
if e.opts.UseProtoNames {
|
if e.opts.UseProtoNames {
|
||||||
name = fd.TextName()
|
name = fd.TextName()
|
||||||
@ -238,7 +237,7 @@ func (e encoder) marshalMessage(m pref.Message, typeURL string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// marshalValue marshals the given protoreflect.Value.
|
// marshalValue marshals the given protoreflect.Value.
|
||||||
func (e encoder) marshalValue(val pref.Value, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalValue(val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
|
||||||
switch {
|
switch {
|
||||||
case fd.IsList():
|
case fd.IsList():
|
||||||
return e.marshalList(val.List(), fd)
|
return e.marshalList(val.List(), fd)
|
||||||
@ -251,44 +250,44 @@ func (e encoder) marshalValue(val pref.Value, fd pref.FieldDescriptor) error {
|
|||||||
|
|
||||||
// marshalSingular marshals the given non-repeated field value. This includes
|
// marshalSingular marshals the given non-repeated field value. This includes
|
||||||
// all scalar types, enums, messages, and groups.
|
// all scalar types, enums, messages, and groups.
|
||||||
func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalSingular(val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
|
||||||
if !val.IsValid() {
|
if !val.IsValid() {
|
||||||
e.WriteNull()
|
e.WriteNull()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
switch kind := fd.Kind(); kind {
|
switch kind := fd.Kind(); kind {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
e.WriteBool(val.Bool())
|
e.WriteBool(val.Bool())
|
||||||
|
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if e.WriteString(val.String()) != nil {
|
if e.WriteString(val.String()) != nil {
|
||||||
return errors.InvalidUTF8(string(fd.FullName()))
|
return errors.InvalidUTF8(string(fd.FullName()))
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
e.WriteInt(val.Int())
|
e.WriteInt(val.Int())
|
||||||
|
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
e.WriteUint(val.Uint())
|
e.WriteUint(val.Uint())
|
||||||
|
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Uint64Kind,
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Uint64Kind,
|
||||||
pref.Sfixed64Kind, pref.Fixed64Kind:
|
protoreflect.Sfixed64Kind, protoreflect.Fixed64Kind:
|
||||||
// 64-bit integers are written out as JSON string.
|
// 64-bit integers are written out as JSON string.
|
||||||
e.WriteString(val.String())
|
e.WriteString(val.String())
|
||||||
|
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
||||||
e.WriteFloat(val.Float(), 32)
|
e.WriteFloat(val.Float(), 32)
|
||||||
|
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
||||||
e.WriteFloat(val.Float(), 64)
|
e.WriteFloat(val.Float(), 64)
|
||||||
|
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
e.WriteString(base64.StdEncoding.EncodeToString(val.Bytes()))
|
e.WriteString(base64.StdEncoding.EncodeToString(val.Bytes()))
|
||||||
|
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if fd.Enum().FullName() == genid.NullValue_enum_fullname {
|
if fd.Enum().FullName() == genid.NullValue_enum_fullname {
|
||||||
e.WriteNull()
|
e.WriteNull()
|
||||||
} else {
|
} else {
|
||||||
@ -300,7 +299,7 @@ func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
if err := e.marshalMessage(val.Message(), ""); err != nil {
|
if err := e.marshalMessage(val.Message(), ""); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -312,7 +311,7 @@ func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
// marshalList marshals the given protoreflect.List.
|
// marshalList marshals the given protoreflect.List.
|
||||||
func (e encoder) marshalList(list pref.List, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalList(list protoreflect.List, fd protoreflect.FieldDescriptor) error {
|
||||||
e.StartArray()
|
e.StartArray()
|
||||||
defer e.EndArray()
|
defer e.EndArray()
|
||||||
|
|
||||||
@ -326,12 +325,12 @@ func (e encoder) marshalList(list pref.List, fd pref.FieldDescriptor) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// marshalMap marshals given protoreflect.Map.
|
// marshalMap marshals given protoreflect.Map.
|
||||||
func (e encoder) marshalMap(mmap pref.Map, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalMap(mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error {
|
||||||
e.StartObject()
|
e.StartObject()
|
||||||
defer e.EndObject()
|
defer e.EndObject()
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
order.RangeEntries(mmap, order.GenericKeyOrder, func(k pref.MapKey, v pref.Value) bool {
|
order.RangeEntries(mmap, order.GenericKeyOrder, func(k protoreflect.MapKey, v protoreflect.Value) bool {
|
||||||
if err = e.WriteName(k.String()); err != nil {
|
if err = e.WriteName(k.String()); err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
76
vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go
generated
vendored
76
vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go
generated
vendored
@ -17,14 +17,14 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type marshalFunc func(encoder, pref.Message) error
|
type marshalFunc func(encoder, protoreflect.Message) error
|
||||||
|
|
||||||
// wellKnownTypeMarshaler returns a marshal function if the message type
|
// wellKnownTypeMarshaler returns a marshal function if the message type
|
||||||
// has specialized serialization behavior. It returns nil otherwise.
|
// has specialized serialization behavior. It returns nil otherwise.
|
||||||
func wellKnownTypeMarshaler(name pref.FullName) marshalFunc {
|
func wellKnownTypeMarshaler(name protoreflect.FullName) marshalFunc {
|
||||||
if name.Parent() == genid.GoogleProtobuf_package {
|
if name.Parent() == genid.GoogleProtobuf_package {
|
||||||
switch name.Name() {
|
switch name.Name() {
|
||||||
case genid.Any_message_name:
|
case genid.Any_message_name:
|
||||||
@ -58,11 +58,11 @@ func wellKnownTypeMarshaler(name pref.FullName) marshalFunc {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type unmarshalFunc func(decoder, pref.Message) error
|
type unmarshalFunc func(decoder, protoreflect.Message) error
|
||||||
|
|
||||||
// wellKnownTypeUnmarshaler returns a unmarshal function if the message type
|
// wellKnownTypeUnmarshaler returns a unmarshal function if the message type
|
||||||
// has specialized serialization behavior. It returns nil otherwise.
|
// has specialized serialization behavior. It returns nil otherwise.
|
||||||
func wellKnownTypeUnmarshaler(name pref.FullName) unmarshalFunc {
|
func wellKnownTypeUnmarshaler(name protoreflect.FullName) unmarshalFunc {
|
||||||
if name.Parent() == genid.GoogleProtobuf_package {
|
if name.Parent() == genid.GoogleProtobuf_package {
|
||||||
switch name.Name() {
|
switch name.Name() {
|
||||||
case genid.Any_message_name:
|
case genid.Any_message_name:
|
||||||
@ -102,7 +102,7 @@ func wellKnownTypeUnmarshaler(name pref.FullName) unmarshalFunc {
|
|||||||
// custom JSON representation, that representation will be embedded adding a
|
// custom JSON representation, that representation will be embedded adding a
|
||||||
// field `value` which holds the custom JSON in addition to the `@type` field.
|
// field `value` which holds the custom JSON in addition to the `@type` field.
|
||||||
|
|
||||||
func (e encoder) marshalAny(m pref.Message) error {
|
func (e encoder) marshalAny(m protoreflect.Message) error {
|
||||||
fds := m.Descriptor().Fields()
|
fds := m.Descriptor().Fields()
|
||||||
fdType := fds.ByNumber(genid.Any_TypeUrl_field_number)
|
fdType := fds.ByNumber(genid.Any_TypeUrl_field_number)
|
||||||
fdValue := fds.ByNumber(genid.Any_Value_field_number)
|
fdValue := fds.ByNumber(genid.Any_Value_field_number)
|
||||||
@ -163,7 +163,7 @@ func (e encoder) marshalAny(m pref.Message) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalAny(m pref.Message) error {
|
func (d decoder) unmarshalAny(m protoreflect.Message) error {
|
||||||
// Peek to check for json.ObjectOpen to avoid advancing a read.
|
// Peek to check for json.ObjectOpen to avoid advancing a read.
|
||||||
start, err := d.Peek()
|
start, err := d.Peek()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -233,8 +233,8 @@ func (d decoder) unmarshalAny(m pref.Message) error {
|
|||||||
fdType := fds.ByNumber(genid.Any_TypeUrl_field_number)
|
fdType := fds.ByNumber(genid.Any_TypeUrl_field_number)
|
||||||
fdValue := fds.ByNumber(genid.Any_Value_field_number)
|
fdValue := fds.ByNumber(genid.Any_Value_field_number)
|
||||||
|
|
||||||
m.Set(fdType, pref.ValueOfString(typeURL))
|
m.Set(fdType, protoreflect.ValueOfString(typeURL))
|
||||||
m.Set(fdValue, pref.ValueOfBytes(b))
|
m.Set(fdValue, protoreflect.ValueOfBytes(b))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ func (d decoder) skipJSONValue() error {
|
|||||||
|
|
||||||
// unmarshalAnyValue unmarshals the given custom-type message from the JSON
|
// unmarshalAnyValue unmarshals the given custom-type message from the JSON
|
||||||
// object's "value" field.
|
// object's "value" field.
|
||||||
func (d decoder) unmarshalAnyValue(unmarshal unmarshalFunc, m pref.Message) error {
|
func (d decoder) unmarshalAnyValue(unmarshal unmarshalFunc, m protoreflect.Message) error {
|
||||||
// Skip ObjectOpen, and start reading the fields.
|
// Skip ObjectOpen, and start reading the fields.
|
||||||
d.Read()
|
d.Read()
|
||||||
|
|
||||||
@ -402,13 +402,13 @@ func (d decoder) unmarshalAnyValue(unmarshal unmarshalFunc, m pref.Message) erro
|
|||||||
|
|
||||||
// Wrapper types are encoded as JSON primitives like string, number or boolean.
|
// Wrapper types are encoded as JSON primitives like string, number or boolean.
|
||||||
|
|
||||||
func (e encoder) marshalWrapperType(m pref.Message) error {
|
func (e encoder) marshalWrapperType(m protoreflect.Message) error {
|
||||||
fd := m.Descriptor().Fields().ByNumber(genid.WrapperValue_Value_field_number)
|
fd := m.Descriptor().Fields().ByNumber(genid.WrapperValue_Value_field_number)
|
||||||
val := m.Get(fd)
|
val := m.Get(fd)
|
||||||
return e.marshalSingular(val, fd)
|
return e.marshalSingular(val, fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalWrapperType(m pref.Message) error {
|
func (d decoder) unmarshalWrapperType(m protoreflect.Message) error {
|
||||||
fd := m.Descriptor().Fields().ByNumber(genid.WrapperValue_Value_field_number)
|
fd := m.Descriptor().Fields().ByNumber(genid.WrapperValue_Value_field_number)
|
||||||
val, err := d.unmarshalScalar(fd)
|
val, err := d.unmarshalScalar(fd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -420,13 +420,13 @@ func (d decoder) unmarshalWrapperType(m pref.Message) error {
|
|||||||
|
|
||||||
// The JSON representation for Empty is an empty JSON object.
|
// The JSON representation for Empty is an empty JSON object.
|
||||||
|
|
||||||
func (e encoder) marshalEmpty(pref.Message) error {
|
func (e encoder) marshalEmpty(protoreflect.Message) error {
|
||||||
e.StartObject()
|
e.StartObject()
|
||||||
e.EndObject()
|
e.EndObject()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalEmpty(pref.Message) error {
|
func (d decoder) unmarshalEmpty(protoreflect.Message) error {
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -462,12 +462,12 @@ func (d decoder) unmarshalEmpty(pref.Message) error {
|
|||||||
// The JSON representation for Struct is a JSON object that contains the encoded
|
// The JSON representation for Struct is a JSON object that contains the encoded
|
||||||
// Struct.fields map and follows the serialization rules for a map.
|
// Struct.fields map and follows the serialization rules for a map.
|
||||||
|
|
||||||
func (e encoder) marshalStruct(m pref.Message) error {
|
func (e encoder) marshalStruct(m protoreflect.Message) error {
|
||||||
fd := m.Descriptor().Fields().ByNumber(genid.Struct_Fields_field_number)
|
fd := m.Descriptor().Fields().ByNumber(genid.Struct_Fields_field_number)
|
||||||
return e.marshalMap(m.Get(fd).Map(), fd)
|
return e.marshalMap(m.Get(fd).Map(), fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalStruct(m pref.Message) error {
|
func (d decoder) unmarshalStruct(m protoreflect.Message) error {
|
||||||
fd := m.Descriptor().Fields().ByNumber(genid.Struct_Fields_field_number)
|
fd := m.Descriptor().Fields().ByNumber(genid.Struct_Fields_field_number)
|
||||||
return d.unmarshalMap(m.Mutable(fd).Map(), fd)
|
return d.unmarshalMap(m.Mutable(fd).Map(), fd)
|
||||||
}
|
}
|
||||||
@ -476,12 +476,12 @@ func (d decoder) unmarshalStruct(m pref.Message) error {
|
|||||||
// ListValue.values repeated field and follows the serialization rules for a
|
// ListValue.values repeated field and follows the serialization rules for a
|
||||||
// repeated field.
|
// repeated field.
|
||||||
|
|
||||||
func (e encoder) marshalListValue(m pref.Message) error {
|
func (e encoder) marshalListValue(m protoreflect.Message) error {
|
||||||
fd := m.Descriptor().Fields().ByNumber(genid.ListValue_Values_field_number)
|
fd := m.Descriptor().Fields().ByNumber(genid.ListValue_Values_field_number)
|
||||||
return e.marshalList(m.Get(fd).List(), fd)
|
return e.marshalList(m.Get(fd).List(), fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalListValue(m pref.Message) error {
|
func (d decoder) unmarshalListValue(m protoreflect.Message) error {
|
||||||
fd := m.Descriptor().Fields().ByNumber(genid.ListValue_Values_field_number)
|
fd := m.Descriptor().Fields().ByNumber(genid.ListValue_Values_field_number)
|
||||||
return d.unmarshalList(m.Mutable(fd).List(), fd)
|
return d.unmarshalList(m.Mutable(fd).List(), fd)
|
||||||
}
|
}
|
||||||
@ -490,7 +490,7 @@ func (d decoder) unmarshalListValue(m pref.Message) error {
|
|||||||
// set. Each of the field in the oneof has its own custom serialization rule. A
|
// set. Each of the field in the oneof has its own custom serialization rule. A
|
||||||
// Value message needs to be a oneof field set, else it is an error.
|
// Value message needs to be a oneof field set, else it is an error.
|
||||||
|
|
||||||
func (e encoder) marshalKnownValue(m pref.Message) error {
|
func (e encoder) marshalKnownValue(m protoreflect.Message) error {
|
||||||
od := m.Descriptor().Oneofs().ByName(genid.Value_Kind_oneof_name)
|
od := m.Descriptor().Oneofs().ByName(genid.Value_Kind_oneof_name)
|
||||||
fd := m.WhichOneof(od)
|
fd := m.WhichOneof(od)
|
||||||
if fd == nil {
|
if fd == nil {
|
||||||
@ -504,19 +504,19 @@ func (e encoder) marshalKnownValue(m pref.Message) error {
|
|||||||
return e.marshalSingular(m.Get(fd), fd)
|
return e.marshalSingular(m.Get(fd), fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalKnownValue(m pref.Message) error {
|
func (d decoder) unmarshalKnownValue(m protoreflect.Message) error {
|
||||||
tok, err := d.Peek()
|
tok, err := d.Peek()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var fd pref.FieldDescriptor
|
var fd protoreflect.FieldDescriptor
|
||||||
var val pref.Value
|
var val protoreflect.Value
|
||||||
switch tok.Kind() {
|
switch tok.Kind() {
|
||||||
case json.Null:
|
case json.Null:
|
||||||
d.Read()
|
d.Read()
|
||||||
fd = m.Descriptor().Fields().ByNumber(genid.Value_NullValue_field_number)
|
fd = m.Descriptor().Fields().ByNumber(genid.Value_NullValue_field_number)
|
||||||
val = pref.ValueOfEnum(0)
|
val = protoreflect.ValueOfEnum(0)
|
||||||
|
|
||||||
case json.Bool:
|
case json.Bool:
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
@ -524,7 +524,7 @@ func (d decoder) unmarshalKnownValue(m pref.Message) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fd = m.Descriptor().Fields().ByNumber(genid.Value_BoolValue_field_number)
|
fd = m.Descriptor().Fields().ByNumber(genid.Value_BoolValue_field_number)
|
||||||
val = pref.ValueOfBool(tok.Bool())
|
val = protoreflect.ValueOfBool(tok.Bool())
|
||||||
|
|
||||||
case json.Number:
|
case json.Number:
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
@ -550,7 +550,7 @@ func (d decoder) unmarshalKnownValue(m pref.Message) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fd = m.Descriptor().Fields().ByNumber(genid.Value_StringValue_field_number)
|
fd = m.Descriptor().Fields().ByNumber(genid.Value_StringValue_field_number)
|
||||||
val = pref.ValueOfString(tok.ParsedString())
|
val = protoreflect.ValueOfString(tok.ParsedString())
|
||||||
|
|
||||||
case json.ObjectOpen:
|
case json.ObjectOpen:
|
||||||
fd = m.Descriptor().Fields().ByNumber(genid.Value_StructValue_field_number)
|
fd = m.Descriptor().Fields().ByNumber(genid.Value_StructValue_field_number)
|
||||||
@ -591,7 +591,7 @@ const (
|
|||||||
maxSecondsInDuration = 315576000000
|
maxSecondsInDuration = 315576000000
|
||||||
)
|
)
|
||||||
|
|
||||||
func (e encoder) marshalDuration(m pref.Message) error {
|
func (e encoder) marshalDuration(m protoreflect.Message) error {
|
||||||
fds := m.Descriptor().Fields()
|
fds := m.Descriptor().Fields()
|
||||||
fdSeconds := fds.ByNumber(genid.Duration_Seconds_field_number)
|
fdSeconds := fds.ByNumber(genid.Duration_Seconds_field_number)
|
||||||
fdNanos := fds.ByNumber(genid.Duration_Nanos_field_number)
|
fdNanos := fds.ByNumber(genid.Duration_Nanos_field_number)
|
||||||
@ -623,7 +623,7 @@ func (e encoder) marshalDuration(m pref.Message) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalDuration(m pref.Message) error {
|
func (d decoder) unmarshalDuration(m protoreflect.Message) error {
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -646,8 +646,8 @@ func (d decoder) unmarshalDuration(m pref.Message) error {
|
|||||||
fdSeconds := fds.ByNumber(genid.Duration_Seconds_field_number)
|
fdSeconds := fds.ByNumber(genid.Duration_Seconds_field_number)
|
||||||
fdNanos := fds.ByNumber(genid.Duration_Nanos_field_number)
|
fdNanos := fds.ByNumber(genid.Duration_Nanos_field_number)
|
||||||
|
|
||||||
m.Set(fdSeconds, pref.ValueOfInt64(secs))
|
m.Set(fdSeconds, protoreflect.ValueOfInt64(secs))
|
||||||
m.Set(fdNanos, pref.ValueOfInt32(nanos))
|
m.Set(fdNanos, protoreflect.ValueOfInt32(nanos))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,7 +779,7 @@ const (
|
|||||||
minTimestampSeconds = -62135596800
|
minTimestampSeconds = -62135596800
|
||||||
)
|
)
|
||||||
|
|
||||||
func (e encoder) marshalTimestamp(m pref.Message) error {
|
func (e encoder) marshalTimestamp(m protoreflect.Message) error {
|
||||||
fds := m.Descriptor().Fields()
|
fds := m.Descriptor().Fields()
|
||||||
fdSeconds := fds.ByNumber(genid.Timestamp_Seconds_field_number)
|
fdSeconds := fds.ByNumber(genid.Timestamp_Seconds_field_number)
|
||||||
fdNanos := fds.ByNumber(genid.Timestamp_Nanos_field_number)
|
fdNanos := fds.ByNumber(genid.Timestamp_Nanos_field_number)
|
||||||
@ -805,7 +805,7 @@ func (e encoder) marshalTimestamp(m pref.Message) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalTimestamp(m pref.Message) error {
|
func (d decoder) unmarshalTimestamp(m protoreflect.Message) error {
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -829,8 +829,8 @@ func (d decoder) unmarshalTimestamp(m pref.Message) error {
|
|||||||
fdSeconds := fds.ByNumber(genid.Timestamp_Seconds_field_number)
|
fdSeconds := fds.ByNumber(genid.Timestamp_Seconds_field_number)
|
||||||
fdNanos := fds.ByNumber(genid.Timestamp_Nanos_field_number)
|
fdNanos := fds.ByNumber(genid.Timestamp_Nanos_field_number)
|
||||||
|
|
||||||
m.Set(fdSeconds, pref.ValueOfInt64(secs))
|
m.Set(fdSeconds, protoreflect.ValueOfInt64(secs))
|
||||||
m.Set(fdNanos, pref.ValueOfInt32(int32(t.Nanosecond())))
|
m.Set(fdNanos, protoreflect.ValueOfInt32(int32(t.Nanosecond())))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -839,14 +839,14 @@ func (d decoder) unmarshalTimestamp(m pref.Message) error {
|
|||||||
// lower-camel naming conventions. Encoding should fail if the path name would
|
// lower-camel naming conventions. Encoding should fail if the path name would
|
||||||
// end up differently after a round-trip.
|
// end up differently after a round-trip.
|
||||||
|
|
||||||
func (e encoder) marshalFieldMask(m pref.Message) error {
|
func (e encoder) marshalFieldMask(m protoreflect.Message) error {
|
||||||
fd := m.Descriptor().Fields().ByNumber(genid.FieldMask_Paths_field_number)
|
fd := m.Descriptor().Fields().ByNumber(genid.FieldMask_Paths_field_number)
|
||||||
list := m.Get(fd).List()
|
list := m.Get(fd).List()
|
||||||
paths := make([]string, 0, list.Len())
|
paths := make([]string, 0, list.Len())
|
||||||
|
|
||||||
for i := 0; i < list.Len(); i++ {
|
for i := 0; i < list.Len(); i++ {
|
||||||
s := list.Get(i).String()
|
s := list.Get(i).String()
|
||||||
if !pref.FullName(s).IsValid() {
|
if !protoreflect.FullName(s).IsValid() {
|
||||||
return errors.New("%s contains invalid path: %q", genid.FieldMask_Paths_field_fullname, s)
|
return errors.New("%s contains invalid path: %q", genid.FieldMask_Paths_field_fullname, s)
|
||||||
}
|
}
|
||||||
// Return error if conversion to camelCase is not reversible.
|
// Return error if conversion to camelCase is not reversible.
|
||||||
@ -861,7 +861,7 @@ func (e encoder) marshalFieldMask(m pref.Message) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d decoder) unmarshalFieldMask(m pref.Message) error {
|
func (d decoder) unmarshalFieldMask(m protoreflect.Message) error {
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -880,10 +880,10 @@ func (d decoder) unmarshalFieldMask(m pref.Message) error {
|
|||||||
|
|
||||||
for _, s0 := range paths {
|
for _, s0 := range paths {
|
||||||
s := strs.JSONSnakeCase(s0)
|
s := strs.JSONSnakeCase(s0)
|
||||||
if strings.Contains(s0, "_") || !pref.FullName(s).IsValid() {
|
if strings.Contains(s0, "_") || !protoreflect.FullName(s).IsValid() {
|
||||||
return d.newError(tok.Pos(), "%v contains invalid path: %q", genid.FieldMask_Paths_field_fullname, s0)
|
return d.newError(tok.Pos(), "%v contains invalid path: %q", genid.FieldMask_Paths_field_fullname, s0)
|
||||||
}
|
}
|
||||||
list.Append(pref.ValueOfString(s))
|
list.Append(protoreflect.ValueOfString(s))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
116
vendor/google.golang.org/protobuf/encoding/prototext/decode.go
generated
vendored
116
vendor/google.golang.org/protobuf/encoding/prototext/decode.go
generated
vendored
@ -17,7 +17,7 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/set"
|
"google.golang.org/protobuf/internal/set"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ func (d decoder) syntaxError(pos int, f string, x ...interface{}) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unmarshalMessage unmarshals into the given protoreflect.Message.
|
// unmarshalMessage unmarshals into the given protoreflect.Message.
|
||||||
func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {
|
func (d decoder) unmarshalMessage(m protoreflect.Message, checkDelims bool) error {
|
||||||
messageDesc := m.Descriptor()
|
messageDesc := m.Descriptor()
|
||||||
if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
|
if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
|
||||||
return errors.New("no support for proto1 MessageSets")
|
return errors.New("no support for proto1 MessageSets")
|
||||||
@ -150,24 +150,24 @@ func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the field descriptor.
|
// Resolve the field descriptor.
|
||||||
var name pref.Name
|
var name protoreflect.Name
|
||||||
var fd pref.FieldDescriptor
|
var fd protoreflect.FieldDescriptor
|
||||||
var xt pref.ExtensionType
|
var xt protoreflect.ExtensionType
|
||||||
var xtErr error
|
var xtErr error
|
||||||
var isFieldNumberName bool
|
var isFieldNumberName bool
|
||||||
|
|
||||||
switch tok.NameKind() {
|
switch tok.NameKind() {
|
||||||
case text.IdentName:
|
case text.IdentName:
|
||||||
name = pref.Name(tok.IdentName())
|
name = protoreflect.Name(tok.IdentName())
|
||||||
fd = fieldDescs.ByTextName(string(name))
|
fd = fieldDescs.ByTextName(string(name))
|
||||||
|
|
||||||
case text.TypeName:
|
case text.TypeName:
|
||||||
// Handle extensions only. This code path is not for Any.
|
// Handle extensions only. This code path is not for Any.
|
||||||
xt, xtErr = d.opts.Resolver.FindExtensionByName(pref.FullName(tok.TypeName()))
|
xt, xtErr = d.opts.Resolver.FindExtensionByName(protoreflect.FullName(tok.TypeName()))
|
||||||
|
|
||||||
case text.FieldNumber:
|
case text.FieldNumber:
|
||||||
isFieldNumberName = true
|
isFieldNumberName = true
|
||||||
num := pref.FieldNumber(tok.FieldNumber())
|
num := protoreflect.FieldNumber(tok.FieldNumber())
|
||||||
if !num.IsValid() {
|
if !num.IsValid() {
|
||||||
return d.newError(tok.Pos(), "invalid field number: %d", num)
|
return d.newError(tok.Pos(), "invalid field number: %d", num)
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {
|
|||||||
switch {
|
switch {
|
||||||
case fd.IsList():
|
case fd.IsList():
|
||||||
kind := fd.Kind()
|
kind := fd.Kind()
|
||||||
if kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() {
|
if kind != protoreflect.MessageKind && kind != protoreflect.GroupKind && !tok.HasSeparator() {
|
||||||
return d.syntaxError(tok.Pos(), "missing field separator :")
|
return d.syntaxError(tok.Pos(), "missing field separator :")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
kind := fd.Kind()
|
kind := fd.Kind()
|
||||||
if kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() {
|
if kind != protoreflect.MessageKind && kind != protoreflect.GroupKind && !tok.HasSeparator() {
|
||||||
return d.syntaxError(tok.Pos(), "missing field separator :")
|
return d.syntaxError(tok.Pos(), "missing field separator :")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,11 +262,11 @@ func (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {
|
|||||||
|
|
||||||
// unmarshalSingular unmarshals a non-repeated field value specified by the
|
// unmarshalSingular unmarshals a non-repeated field value specified by the
|
||||||
// given FieldDescriptor.
|
// given FieldDescriptor.
|
||||||
func (d decoder) unmarshalSingular(fd pref.FieldDescriptor, m pref.Message) error {
|
func (d decoder) unmarshalSingular(fd protoreflect.FieldDescriptor, m protoreflect.Message) error {
|
||||||
var val pref.Value
|
var val protoreflect.Value
|
||||||
var err error
|
var err error
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
val = m.NewField(fd)
|
val = m.NewField(fd)
|
||||||
err = d.unmarshalMessage(val.Message(), true)
|
err = d.unmarshalMessage(val.Message(), true)
|
||||||
default:
|
default:
|
||||||
@ -280,94 +280,94 @@ func (d decoder) unmarshalSingular(fd pref.FieldDescriptor, m pref.Message) erro
|
|||||||
|
|
||||||
// unmarshalScalar unmarshals a scalar/enum protoreflect.Value specified by the
|
// unmarshalScalar unmarshals a scalar/enum protoreflect.Value specified by the
|
||||||
// given FieldDescriptor.
|
// given FieldDescriptor.
|
||||||
func (d decoder) unmarshalScalar(fd pref.FieldDescriptor) (pref.Value, error) {
|
func (d decoder) unmarshalScalar(fd protoreflect.FieldDescriptor) (protoreflect.Value, error) {
|
||||||
tok, err := d.Read()
|
tok, err := d.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, err
|
return protoreflect.Value{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if tok.Kind() != text.Scalar {
|
if tok.Kind() != text.Scalar {
|
||||||
return pref.Value{}, d.unexpectedTokenError(tok)
|
return protoreflect.Value{}, d.unexpectedTokenError(tok)
|
||||||
}
|
}
|
||||||
|
|
||||||
kind := fd.Kind()
|
kind := fd.Kind()
|
||||||
switch kind {
|
switch kind {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if b, ok := tok.Bool(); ok {
|
if b, ok := tok.Bool(); ok {
|
||||||
return pref.ValueOfBool(b), nil
|
return protoreflect.ValueOfBool(b), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
if n, ok := tok.Int32(); ok {
|
if n, ok := tok.Int32(); ok {
|
||||||
return pref.ValueOfInt32(n), nil
|
return protoreflect.ValueOfInt32(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
if n, ok := tok.Int64(); ok {
|
if n, ok := tok.Int64(); ok {
|
||||||
return pref.ValueOfInt64(n), nil
|
return protoreflect.ValueOfInt64(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
if n, ok := tok.Uint32(); ok {
|
if n, ok := tok.Uint32(); ok {
|
||||||
return pref.ValueOfUint32(n), nil
|
return protoreflect.ValueOfUint32(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
if n, ok := tok.Uint64(); ok {
|
if n, ok := tok.Uint64(); ok {
|
||||||
return pref.ValueOfUint64(n), nil
|
return protoreflect.ValueOfUint64(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if n, ok := tok.Float32(); ok {
|
if n, ok := tok.Float32(); ok {
|
||||||
return pref.ValueOfFloat32(n), nil
|
return protoreflect.ValueOfFloat32(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if n, ok := tok.Float64(); ok {
|
if n, ok := tok.Float64(); ok {
|
||||||
return pref.ValueOfFloat64(n), nil
|
return protoreflect.ValueOfFloat64(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if s, ok := tok.String(); ok {
|
if s, ok := tok.String(); ok {
|
||||||
if strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
|
if strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
|
||||||
return pref.Value{}, d.newError(tok.Pos(), "contains invalid UTF-8")
|
return protoreflect.Value{}, d.newError(tok.Pos(), "contains invalid UTF-8")
|
||||||
}
|
}
|
||||||
return pref.ValueOfString(s), nil
|
return protoreflect.ValueOfString(s), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if b, ok := tok.String(); ok {
|
if b, ok := tok.String(); ok {
|
||||||
return pref.ValueOfBytes([]byte(b)), nil
|
return protoreflect.ValueOfBytes([]byte(b)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if lit, ok := tok.Enum(); ok {
|
if lit, ok := tok.Enum(); ok {
|
||||||
// Lookup EnumNumber based on name.
|
// Lookup EnumNumber based on name.
|
||||||
if enumVal := fd.Enum().Values().ByName(pref.Name(lit)); enumVal != nil {
|
if enumVal := fd.Enum().Values().ByName(protoreflect.Name(lit)); enumVal != nil {
|
||||||
return pref.ValueOfEnum(enumVal.Number()), nil
|
return protoreflect.ValueOfEnum(enumVal.Number()), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if num, ok := tok.Int32(); ok {
|
if num, ok := tok.Int32(); ok {
|
||||||
return pref.ValueOfEnum(pref.EnumNumber(num)), nil
|
return protoreflect.ValueOfEnum(protoreflect.EnumNumber(num)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("invalid scalar kind %v", kind))
|
panic(fmt.Sprintf("invalid scalar kind %v", kind))
|
||||||
}
|
}
|
||||||
|
|
||||||
return pref.Value{}, d.newError(tok.Pos(), "invalid value for %v type: %v", kind, tok.RawString())
|
return protoreflect.Value{}, d.newError(tok.Pos(), "invalid value for %v type: %v", kind, tok.RawString())
|
||||||
}
|
}
|
||||||
|
|
||||||
// unmarshalList unmarshals into given protoreflect.List. A list value can
|
// unmarshalList unmarshals into given protoreflect.List. A list value can
|
||||||
// either be in [] syntax or simply just a single scalar/message value.
|
// either be in [] syntax or simply just a single scalar/message value.
|
||||||
func (d decoder) unmarshalList(fd pref.FieldDescriptor, list pref.List) error {
|
func (d decoder) unmarshalList(fd protoreflect.FieldDescriptor, list protoreflect.List) error {
|
||||||
tok, err := d.Peek()
|
tok, err := d.Peek()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
switch tok.Kind() {
|
switch tok.Kind() {
|
||||||
case text.ListOpen:
|
case text.ListOpen:
|
||||||
d.Read()
|
d.Read()
|
||||||
@ -441,22 +441,22 @@ func (d decoder) unmarshalList(fd pref.FieldDescriptor, list pref.List) error {
|
|||||||
|
|
||||||
// unmarshalMap unmarshals into given protoreflect.Map. A map value is a
|
// unmarshalMap unmarshals into given protoreflect.Map. A map value is a
|
||||||
// textproto message containing {key: <kvalue>, value: <mvalue>}.
|
// textproto message containing {key: <kvalue>, value: <mvalue>}.
|
||||||
func (d decoder) unmarshalMap(fd pref.FieldDescriptor, mmap pref.Map) error {
|
func (d decoder) unmarshalMap(fd protoreflect.FieldDescriptor, mmap protoreflect.Map) error {
|
||||||
// Determine ahead whether map entry is a scalar type or a message type in
|
// Determine ahead whether map entry is a scalar type or a message type in
|
||||||
// order to call the appropriate unmarshalMapValue func inside
|
// order to call the appropriate unmarshalMapValue func inside
|
||||||
// unmarshalMapEntry.
|
// unmarshalMapEntry.
|
||||||
var unmarshalMapValue func() (pref.Value, error)
|
var unmarshalMapValue func() (protoreflect.Value, error)
|
||||||
switch fd.MapValue().Kind() {
|
switch fd.MapValue().Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
unmarshalMapValue = func() (pref.Value, error) {
|
unmarshalMapValue = func() (protoreflect.Value, error) {
|
||||||
pval := mmap.NewValue()
|
pval := mmap.NewValue()
|
||||||
if err := d.unmarshalMessage(pval.Message(), true); err != nil {
|
if err := d.unmarshalMessage(pval.Message(), true); err != nil {
|
||||||
return pref.Value{}, err
|
return protoreflect.Value{}, err
|
||||||
}
|
}
|
||||||
return pval, nil
|
return pval, nil
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
unmarshalMapValue = func() (pref.Value, error) {
|
unmarshalMapValue = func() (protoreflect.Value, error) {
|
||||||
return d.unmarshalScalar(fd.MapValue())
|
return d.unmarshalScalar(fd.MapValue())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -494,9 +494,9 @@ func (d decoder) unmarshalMap(fd pref.FieldDescriptor, mmap pref.Map) error {
|
|||||||
|
|
||||||
// unmarshalMap unmarshals into given protoreflect.Map. A map value is a
|
// unmarshalMap unmarshals into given protoreflect.Map. A map value is a
|
||||||
// textproto message containing {key: <kvalue>, value: <mvalue>}.
|
// textproto message containing {key: <kvalue>, value: <mvalue>}.
|
||||||
func (d decoder) unmarshalMapEntry(fd pref.FieldDescriptor, mmap pref.Map, unmarshalMapValue func() (pref.Value, error)) error {
|
func (d decoder) unmarshalMapEntry(fd protoreflect.FieldDescriptor, mmap protoreflect.Map, unmarshalMapValue func() (protoreflect.Value, error)) error {
|
||||||
var key pref.MapKey
|
var key protoreflect.MapKey
|
||||||
var pval pref.Value
|
var pval protoreflect.Value
|
||||||
Loop:
|
Loop:
|
||||||
for {
|
for {
|
||||||
// Read field name.
|
// Read field name.
|
||||||
@ -520,7 +520,7 @@ Loop:
|
|||||||
return d.unexpectedTokenError(tok)
|
return d.unexpectedTokenError(tok)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch name := pref.Name(tok.IdentName()); name {
|
switch name := protoreflect.Name(tok.IdentName()); name {
|
||||||
case genid.MapEntry_Key_field_name:
|
case genid.MapEntry_Key_field_name:
|
||||||
if !tok.HasSeparator() {
|
if !tok.HasSeparator() {
|
||||||
return d.syntaxError(tok.Pos(), "missing field separator :")
|
return d.syntaxError(tok.Pos(), "missing field separator :")
|
||||||
@ -535,7 +535,7 @@ Loop:
|
|||||||
key = val.MapKey()
|
key = val.MapKey()
|
||||||
|
|
||||||
case genid.MapEntry_Value_field_name:
|
case genid.MapEntry_Value_field_name:
|
||||||
if kind := fd.MapValue().Kind(); (kind != pref.MessageKind) && (kind != pref.GroupKind) {
|
if kind := fd.MapValue().Kind(); (kind != protoreflect.MessageKind) && (kind != protoreflect.GroupKind) {
|
||||||
if !tok.HasSeparator() {
|
if !tok.HasSeparator() {
|
||||||
return d.syntaxError(tok.Pos(), "missing field separator :")
|
return d.syntaxError(tok.Pos(), "missing field separator :")
|
||||||
}
|
}
|
||||||
@ -561,7 +561,7 @@ Loop:
|
|||||||
}
|
}
|
||||||
if !pval.IsValid() {
|
if !pval.IsValid() {
|
||||||
switch fd.MapValue().Kind() {
|
switch fd.MapValue().Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
// If value field is not set for message/group types, construct an
|
// If value field is not set for message/group types, construct an
|
||||||
// empty one as default.
|
// empty one as default.
|
||||||
pval = mmap.NewValue()
|
pval = mmap.NewValue()
|
||||||
@ -575,7 +575,7 @@ Loop:
|
|||||||
|
|
||||||
// unmarshalAny unmarshals an Any textproto. It can either be in expanded form
|
// unmarshalAny unmarshals an Any textproto. It can either be in expanded form
|
||||||
// or non-expanded form.
|
// or non-expanded form.
|
||||||
func (d decoder) unmarshalAny(m pref.Message, checkDelims bool) error {
|
func (d decoder) unmarshalAny(m protoreflect.Message, checkDelims bool) error {
|
||||||
var typeURL string
|
var typeURL string
|
||||||
var bValue []byte
|
var bValue []byte
|
||||||
var seenTypeUrl bool
|
var seenTypeUrl bool
|
||||||
@ -619,7 +619,7 @@ Loop:
|
|||||||
return d.syntaxError(tok.Pos(), "missing field separator :")
|
return d.syntaxError(tok.Pos(), "missing field separator :")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch name := pref.Name(tok.IdentName()); name {
|
switch name := protoreflect.Name(tok.IdentName()); name {
|
||||||
case genid.Any_TypeUrl_field_name:
|
case genid.Any_TypeUrl_field_name:
|
||||||
if seenTypeUrl {
|
if seenTypeUrl {
|
||||||
return d.newError(tok.Pos(), "duplicate %v field", genid.Any_TypeUrl_field_fullname)
|
return d.newError(tok.Pos(), "duplicate %v field", genid.Any_TypeUrl_field_fullname)
|
||||||
@ -686,10 +686,10 @@ Loop:
|
|||||||
|
|
||||||
fds := m.Descriptor().Fields()
|
fds := m.Descriptor().Fields()
|
||||||
if len(typeURL) > 0 {
|
if len(typeURL) > 0 {
|
||||||
m.Set(fds.ByNumber(genid.Any_TypeUrl_field_number), pref.ValueOfString(typeURL))
|
m.Set(fds.ByNumber(genid.Any_TypeUrl_field_number), protoreflect.ValueOfString(typeURL))
|
||||||
}
|
}
|
||||||
if len(bValue) > 0 {
|
if len(bValue) > 0 {
|
||||||
m.Set(fds.ByNumber(genid.Any_Value_field_number), pref.ValueOfBytes(bValue))
|
m.Set(fds.ByNumber(genid.Any_Value_field_number), protoreflect.ValueOfBytes(bValue))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
39
vendor/google.golang.org/protobuf/encoding/prototext/encode.go
generated
vendored
39
vendor/google.golang.org/protobuf/encoding/prototext/encode.go
generated
vendored
@ -20,7 +20,6 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -150,7 +149,7 @@ type encoder struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// marshalMessage marshals the given protoreflect.Message.
|
// marshalMessage marshals the given protoreflect.Message.
|
||||||
func (e encoder) marshalMessage(m pref.Message, inclDelims bool) error {
|
func (e encoder) marshalMessage(m protoreflect.Message, inclDelims bool) error {
|
||||||
messageDesc := m.Descriptor()
|
messageDesc := m.Descriptor()
|
||||||
if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
|
if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
|
||||||
return errors.New("no support for proto1 MessageSets")
|
return errors.New("no support for proto1 MessageSets")
|
||||||
@ -190,7 +189,7 @@ func (e encoder) marshalMessage(m pref.Message, inclDelims bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// marshalField marshals the given field with protoreflect.Value.
|
// marshalField marshals the given field with protoreflect.Value.
|
||||||
func (e encoder) marshalField(name string, val pref.Value, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalField(name string, val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
|
||||||
switch {
|
switch {
|
||||||
case fd.IsList():
|
case fd.IsList():
|
||||||
return e.marshalList(name, val.List(), fd)
|
return e.marshalList(name, val.List(), fd)
|
||||||
@ -204,40 +203,40 @@ func (e encoder) marshalField(name string, val pref.Value, fd pref.FieldDescript
|
|||||||
|
|
||||||
// marshalSingular marshals the given non-repeated field value. This includes
|
// marshalSingular marshals the given non-repeated field value. This includes
|
||||||
// all scalar types, enums, messages, and groups.
|
// all scalar types, enums, messages, and groups.
|
||||||
func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalSingular(val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
|
||||||
kind := fd.Kind()
|
kind := fd.Kind()
|
||||||
switch kind {
|
switch kind {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
e.WriteBool(val.Bool())
|
e.WriteBool(val.Bool())
|
||||||
|
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
s := val.String()
|
s := val.String()
|
||||||
if !e.opts.allowInvalidUTF8 && strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
|
if !e.opts.allowInvalidUTF8 && strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
|
||||||
return errors.InvalidUTF8(string(fd.FullName()))
|
return errors.InvalidUTF8(string(fd.FullName()))
|
||||||
}
|
}
|
||||||
e.WriteString(s)
|
e.WriteString(s)
|
||||||
|
|
||||||
case pref.Int32Kind, pref.Int64Kind,
|
case protoreflect.Int32Kind, protoreflect.Int64Kind,
|
||||||
pref.Sint32Kind, pref.Sint64Kind,
|
protoreflect.Sint32Kind, protoreflect.Sint64Kind,
|
||||||
pref.Sfixed32Kind, pref.Sfixed64Kind:
|
protoreflect.Sfixed32Kind, protoreflect.Sfixed64Kind:
|
||||||
e.WriteInt(val.Int())
|
e.WriteInt(val.Int())
|
||||||
|
|
||||||
case pref.Uint32Kind, pref.Uint64Kind,
|
case protoreflect.Uint32Kind, protoreflect.Uint64Kind,
|
||||||
pref.Fixed32Kind, pref.Fixed64Kind:
|
protoreflect.Fixed32Kind, protoreflect.Fixed64Kind:
|
||||||
e.WriteUint(val.Uint())
|
e.WriteUint(val.Uint())
|
||||||
|
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
||||||
e.WriteFloat(val.Float(), 32)
|
e.WriteFloat(val.Float(), 32)
|
||||||
|
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
// Encoder.WriteFloat handles the special numbers NaN and infinites.
|
||||||
e.WriteFloat(val.Float(), 64)
|
e.WriteFloat(val.Float(), 64)
|
||||||
|
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
e.WriteString(string(val.Bytes()))
|
e.WriteString(string(val.Bytes()))
|
||||||
|
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
num := val.Enum()
|
num := val.Enum()
|
||||||
if desc := fd.Enum().Values().ByNumber(num); desc != nil {
|
if desc := fd.Enum().Values().ByNumber(num); desc != nil {
|
||||||
e.WriteLiteral(string(desc.Name()))
|
e.WriteLiteral(string(desc.Name()))
|
||||||
@ -246,7 +245,7 @@ func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error
|
|||||||
e.WriteInt(int64(num))
|
e.WriteInt(int64(num))
|
||||||
}
|
}
|
||||||
|
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
return e.marshalMessage(val.Message(), true)
|
return e.marshalMessage(val.Message(), true)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -256,7 +255,7 @@ func (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
// marshalList marshals the given protoreflect.List as multiple name-value fields.
|
// marshalList marshals the given protoreflect.List as multiple name-value fields.
|
||||||
func (e encoder) marshalList(name string, list pref.List, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalList(name string, list protoreflect.List, fd protoreflect.FieldDescriptor) error {
|
||||||
size := list.Len()
|
size := list.Len()
|
||||||
for i := 0; i < size; i++ {
|
for i := 0; i < size; i++ {
|
||||||
e.WriteName(name)
|
e.WriteName(name)
|
||||||
@ -268,9 +267,9 @@ func (e encoder) marshalList(name string, list pref.List, fd pref.FieldDescripto
|
|||||||
}
|
}
|
||||||
|
|
||||||
// marshalMap marshals the given protoreflect.Map as multiple name-value fields.
|
// marshalMap marshals the given protoreflect.Map as multiple name-value fields.
|
||||||
func (e encoder) marshalMap(name string, mmap pref.Map, fd pref.FieldDescriptor) error {
|
func (e encoder) marshalMap(name string, mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error {
|
||||||
var err error
|
var err error
|
||||||
order.RangeEntries(mmap, order.GenericKeyOrder, func(key pref.MapKey, val pref.Value) bool {
|
order.RangeEntries(mmap, order.GenericKeyOrder, func(key protoreflect.MapKey, val protoreflect.Value) bool {
|
||||||
e.WriteName(name)
|
e.WriteName(name)
|
||||||
e.StartMessage()
|
e.StartMessage()
|
||||||
defer e.EndMessage()
|
defer e.EndMessage()
|
||||||
@ -334,7 +333,7 @@ func (e encoder) marshalUnknown(b []byte) {
|
|||||||
|
|
||||||
// marshalAny marshals the given google.protobuf.Any message in expanded form.
|
// marshalAny marshals the given google.protobuf.Any message in expanded form.
|
||||||
// It returns true if it was able to marshal, else false.
|
// It returns true if it was able to marshal, else false.
|
||||||
func (e encoder) marshalAny(any pref.Message) bool {
|
func (e encoder) marshalAny(any protoreflect.Message) bool {
|
||||||
// Construct the embedded message.
|
// Construct the embedded message.
|
||||||
fds := any.Descriptor().Fields()
|
fds := any.Descriptor().Fields()
|
||||||
fdType := fds.ByNumber(genid.Any_TypeUrl_field_number)
|
fdType := fds.ByNumber(genid.Any_TypeUrl_field_number)
|
||||||
|
4
vendor/google.golang.org/protobuf/encoding/protowire/wire.go
generated
vendored
4
vendor/google.golang.org/protobuf/encoding/protowire/wire.go
generated
vendored
@ -516,6 +516,7 @@ func EncodeTag(num Number, typ Type) uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DecodeZigZag decodes a zig-zag-encoded uint64 as an int64.
|
// DecodeZigZag decodes a zig-zag-encoded uint64 as an int64.
|
||||||
|
//
|
||||||
// Input: {…, 5, 3, 1, 0, 2, 4, 6, …}
|
// Input: {…, 5, 3, 1, 0, 2, 4, 6, …}
|
||||||
// Output: {…, -3, -2, -1, 0, +1, +2, +3, …}
|
// Output: {…, -3, -2, -1, 0, +1, +2, +3, …}
|
||||||
func DecodeZigZag(x uint64) int64 {
|
func DecodeZigZag(x uint64) int64 {
|
||||||
@ -523,6 +524,7 @@ func DecodeZigZag(x uint64) int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EncodeZigZag encodes an int64 as a zig-zag-encoded uint64.
|
// EncodeZigZag encodes an int64 as a zig-zag-encoded uint64.
|
||||||
|
//
|
||||||
// Input: {…, -3, -2, -1, 0, +1, +2, +3, …}
|
// Input: {…, -3, -2, -1, 0, +1, +2, +3, …}
|
||||||
// Output: {…, 5, 3, 1, 0, 2, 4, 6, …}
|
// Output: {…, 5, 3, 1, 0, 2, 4, 6, …}
|
||||||
func EncodeZigZag(x int64) uint64 {
|
func EncodeZigZag(x int64) uint64 {
|
||||||
@ -530,6 +532,7 @@ func EncodeZigZag(x int64) uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DecodeBool decodes a uint64 as a bool.
|
// DecodeBool decodes a uint64 as a bool.
|
||||||
|
//
|
||||||
// Input: { 0, 1, 2, …}
|
// Input: { 0, 1, 2, …}
|
||||||
// Output: {false, true, true, …}
|
// Output: {false, true, true, …}
|
||||||
func DecodeBool(x uint64) bool {
|
func DecodeBool(x uint64) bool {
|
||||||
@ -537,6 +540,7 @@ func DecodeBool(x uint64) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EncodeBool encodes a bool as a uint64.
|
// EncodeBool encodes a bool as a uint64.
|
||||||
|
//
|
||||||
// Input: {false, true}
|
// Input: {false, true}
|
||||||
// Output: { 0, 1}
|
// Output: { 0, 1}
|
||||||
func EncodeBool(x bool) uint64 {
|
func EncodeBool(x bool) uint64 {
|
||||||
|
66
vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
generated
vendored
66
vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
generated
vendored
@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/protobuf/internal/detrand"
|
"google.golang.org/protobuf/internal/detrand"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type list interface {
|
type list interface {
|
||||||
@ -30,17 +30,17 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
|||||||
if isRoot {
|
if isRoot {
|
||||||
var name string
|
var name string
|
||||||
switch vs.(type) {
|
switch vs.(type) {
|
||||||
case pref.Names:
|
case protoreflect.Names:
|
||||||
name = "Names"
|
name = "Names"
|
||||||
case pref.FieldNumbers:
|
case protoreflect.FieldNumbers:
|
||||||
name = "FieldNumbers"
|
name = "FieldNumbers"
|
||||||
case pref.FieldRanges:
|
case protoreflect.FieldRanges:
|
||||||
name = "FieldRanges"
|
name = "FieldRanges"
|
||||||
case pref.EnumRanges:
|
case protoreflect.EnumRanges:
|
||||||
name = "EnumRanges"
|
name = "EnumRanges"
|
||||||
case pref.FileImports:
|
case protoreflect.FileImports:
|
||||||
name = "FileImports"
|
name = "FileImports"
|
||||||
case pref.Descriptor:
|
case protoreflect.Descriptor:
|
||||||
name = reflect.ValueOf(vs).MethodByName("Get").Type().Out(0).Name() + "s"
|
name = reflect.ValueOf(vs).MethodByName("Get").Type().Out(0).Name() + "s"
|
||||||
default:
|
default:
|
||||||
name = reflect.ValueOf(vs).Elem().Type().Name()
|
name = reflect.ValueOf(vs).Elem().Type().Name()
|
||||||
@ -50,17 +50,17 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
|||||||
|
|
||||||
var ss []string
|
var ss []string
|
||||||
switch vs := vs.(type) {
|
switch vs := vs.(type) {
|
||||||
case pref.Names:
|
case protoreflect.Names:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
ss = append(ss, fmt.Sprint(vs.Get(i)))
|
ss = append(ss, fmt.Sprint(vs.Get(i)))
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, false) + end
|
return start + joinStrings(ss, false) + end
|
||||||
case pref.FieldNumbers:
|
case protoreflect.FieldNumbers:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
ss = append(ss, fmt.Sprint(vs.Get(i)))
|
ss = append(ss, fmt.Sprint(vs.Get(i)))
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, false) + end
|
return start + joinStrings(ss, false) + end
|
||||||
case pref.FieldRanges:
|
case protoreflect.FieldRanges:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
r := vs.Get(i)
|
r := vs.Get(i)
|
||||||
if r[0]+1 == r[1] {
|
if r[0]+1 == r[1] {
|
||||||
@ -70,7 +70,7 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, false) + end
|
return start + joinStrings(ss, false) + end
|
||||||
case pref.EnumRanges:
|
case protoreflect.EnumRanges:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
r := vs.Get(i)
|
r := vs.Get(i)
|
||||||
if r[0] == r[1] {
|
if r[0] == r[1] {
|
||||||
@ -80,7 +80,7 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, false) + end
|
return start + joinStrings(ss, false) + end
|
||||||
case pref.FileImports:
|
case protoreflect.FileImports:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
var rs records
|
var rs records
|
||||||
rs.Append(reflect.ValueOf(vs.Get(i)), "Path", "Package", "IsPublic", "IsWeak")
|
rs.Append(reflect.ValueOf(vs.Get(i)), "Path", "Package", "IsPublic", "IsWeak")
|
||||||
@ -88,11 +88,11 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
|||||||
}
|
}
|
||||||
return start + joinStrings(ss, allowMulti) + end
|
return start + joinStrings(ss, allowMulti) + end
|
||||||
default:
|
default:
|
||||||
_, isEnumValue := vs.(pref.EnumValueDescriptors)
|
_, isEnumValue := vs.(protoreflect.EnumValueDescriptors)
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
m := reflect.ValueOf(vs).MethodByName("Get")
|
m := reflect.ValueOf(vs).MethodByName("Get")
|
||||||
v := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface()
|
v := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface()
|
||||||
ss = append(ss, formatDescOpt(v.(pref.Descriptor), false, allowMulti && !isEnumValue))
|
ss = append(ss, formatDescOpt(v.(protoreflect.Descriptor), false, allowMulti && !isEnumValue))
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, allowMulti && isEnumValue) + end
|
return start + joinStrings(ss, allowMulti && isEnumValue) + end
|
||||||
}
|
}
|
||||||
@ -106,20 +106,20 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
|||||||
//
|
//
|
||||||
// Using a list allows us to print the accessors in a sensible order.
|
// Using a list allows us to print the accessors in a sensible order.
|
||||||
var descriptorAccessors = map[reflect.Type][]string{
|
var descriptorAccessors = map[reflect.Type][]string{
|
||||||
reflect.TypeOf((*pref.FileDescriptor)(nil)).Elem(): {"Path", "Package", "Imports", "Messages", "Enums", "Extensions", "Services"},
|
reflect.TypeOf((*protoreflect.FileDescriptor)(nil)).Elem(): {"Path", "Package", "Imports", "Messages", "Enums", "Extensions", "Services"},
|
||||||
reflect.TypeOf((*pref.MessageDescriptor)(nil)).Elem(): {"IsMapEntry", "Fields", "Oneofs", "ReservedNames", "ReservedRanges", "RequiredNumbers", "ExtensionRanges", "Messages", "Enums", "Extensions"},
|
reflect.TypeOf((*protoreflect.MessageDescriptor)(nil)).Elem(): {"IsMapEntry", "Fields", "Oneofs", "ReservedNames", "ReservedRanges", "RequiredNumbers", "ExtensionRanges", "Messages", "Enums", "Extensions"},
|
||||||
reflect.TypeOf((*pref.FieldDescriptor)(nil)).Elem(): {"Number", "Cardinality", "Kind", "HasJSONName", "JSONName", "HasPresence", "IsExtension", "IsPacked", "IsWeak", "IsList", "IsMap", "MapKey", "MapValue", "HasDefault", "Default", "ContainingOneof", "ContainingMessage", "Message", "Enum"},
|
reflect.TypeOf((*protoreflect.FieldDescriptor)(nil)).Elem(): {"Number", "Cardinality", "Kind", "HasJSONName", "JSONName", "HasPresence", "IsExtension", "IsPacked", "IsWeak", "IsList", "IsMap", "MapKey", "MapValue", "HasDefault", "Default", "ContainingOneof", "ContainingMessage", "Message", "Enum"},
|
||||||
reflect.TypeOf((*pref.OneofDescriptor)(nil)).Elem(): {"Fields"}, // not directly used; must keep in sync with formatDescOpt
|
reflect.TypeOf((*protoreflect.OneofDescriptor)(nil)).Elem(): {"Fields"}, // not directly used; must keep in sync with formatDescOpt
|
||||||
reflect.TypeOf((*pref.EnumDescriptor)(nil)).Elem(): {"Values", "ReservedNames", "ReservedRanges"},
|
reflect.TypeOf((*protoreflect.EnumDescriptor)(nil)).Elem(): {"Values", "ReservedNames", "ReservedRanges"},
|
||||||
reflect.TypeOf((*pref.EnumValueDescriptor)(nil)).Elem(): {"Number"},
|
reflect.TypeOf((*protoreflect.EnumValueDescriptor)(nil)).Elem(): {"Number"},
|
||||||
reflect.TypeOf((*pref.ServiceDescriptor)(nil)).Elem(): {"Methods"},
|
reflect.TypeOf((*protoreflect.ServiceDescriptor)(nil)).Elem(): {"Methods"},
|
||||||
reflect.TypeOf((*pref.MethodDescriptor)(nil)).Elem(): {"Input", "Output", "IsStreamingClient", "IsStreamingServer"},
|
reflect.TypeOf((*protoreflect.MethodDescriptor)(nil)).Elem(): {"Input", "Output", "IsStreamingClient", "IsStreamingServer"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func FormatDesc(s fmt.State, r rune, t pref.Descriptor) {
|
func FormatDesc(s fmt.State, r rune, t protoreflect.Descriptor) {
|
||||||
io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#'))))
|
io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#'))))
|
||||||
}
|
}
|
||||||
func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string {
|
||||||
rv := reflect.ValueOf(t)
|
rv := reflect.ValueOf(t)
|
||||||
rt := rv.MethodByName("ProtoType").Type().In(0)
|
rt := rv.MethodByName("ProtoType").Type().In(0)
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
|||||||
start = rt.Name() + "{"
|
start = rt.Name() + "{"
|
||||||
}
|
}
|
||||||
|
|
||||||
_, isFile := t.(pref.FileDescriptor)
|
_, isFile := t.(protoreflect.FileDescriptor)
|
||||||
rs := records{allowMulti: allowMulti}
|
rs := records{allowMulti: allowMulti}
|
||||||
if t.IsPlaceholder() {
|
if t.IsPlaceholder() {
|
||||||
if isFile {
|
if isFile {
|
||||||
@ -146,7 +146,7 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
|||||||
rs.Append(rv, "Name")
|
rs.Append(rv, "Name")
|
||||||
}
|
}
|
||||||
switch t := t.(type) {
|
switch t := t.(type) {
|
||||||
case pref.FieldDescriptor:
|
case protoreflect.FieldDescriptor:
|
||||||
for _, s := range descriptorAccessors[rt] {
|
for _, s := range descriptorAccessors[rt] {
|
||||||
switch s {
|
switch s {
|
||||||
case "MapKey":
|
case "MapKey":
|
||||||
@ -156,9 +156,9 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
|||||||
case "MapValue":
|
case "MapValue":
|
||||||
if v := t.MapValue(); v != nil {
|
if v := t.MapValue(); v != nil {
|
||||||
switch v.Kind() {
|
switch v.Kind() {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Enum().FullName())})
|
rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Enum().FullName())})
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Message().FullName())})
|
rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Message().FullName())})
|
||||||
default:
|
default:
|
||||||
rs.recs = append(rs.recs, [2]string{"MapValue", v.Kind().String()})
|
rs.recs = append(rs.recs, [2]string{"MapValue", v.Kind().String()})
|
||||||
@ -180,7 +180,7 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
|||||||
rs.Append(rv, s)
|
rs.Append(rv, s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.OneofDescriptor:
|
case protoreflect.OneofDescriptor:
|
||||||
var ss []string
|
var ss []string
|
||||||
fs := t.Fields()
|
fs := t.Fields()
|
||||||
for i := 0; i < fs.Len(); i++ {
|
for i := 0; i < fs.Len(); i++ {
|
||||||
@ -216,7 +216,7 @@ func (rs *records) Append(v reflect.Value, accessors ...string) {
|
|||||||
if !rv.IsValid() {
|
if !rv.IsValid() {
|
||||||
panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a))
|
panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a))
|
||||||
}
|
}
|
||||||
if _, ok := rv.Interface().(pref.Value); ok {
|
if _, ok := rv.Interface().(protoreflect.Value); ok {
|
||||||
rv = rv.MethodByName("Interface").Call(nil)[0]
|
rv = rv.MethodByName("Interface").Call(nil)[0]
|
||||||
if !rv.IsNil() {
|
if !rv.IsNil() {
|
||||||
rv = rv.Elem()
|
rv = rv.Elem()
|
||||||
@ -250,9 +250,9 @@ func (rs *records) Append(v reflect.Value, accessors ...string) {
|
|||||||
switch v := v.(type) {
|
switch v := v.(type) {
|
||||||
case list:
|
case list:
|
||||||
s = formatListOpt(v, false, rs.allowMulti)
|
s = formatListOpt(v, false, rs.allowMulti)
|
||||||
case pref.FieldDescriptor, pref.OneofDescriptor, pref.EnumValueDescriptor, pref.MethodDescriptor:
|
case protoreflect.FieldDescriptor, protoreflect.OneofDescriptor, protoreflect.EnumValueDescriptor, protoreflect.MethodDescriptor:
|
||||||
s = string(v.(pref.Descriptor).Name())
|
s = string(v.(protoreflect.Descriptor).Name())
|
||||||
case pref.Descriptor:
|
case protoreflect.Descriptor:
|
||||||
s = string(v.FullName())
|
s = string(v.FullName())
|
||||||
case string:
|
case string:
|
||||||
s = strconv.Quote(v)
|
s = strconv.Quote(v)
|
||||||
|
78
vendor/google.golang.org/protobuf/internal/encoding/defval/default.go
generated
vendored
78
vendor/google.golang.org/protobuf/internal/encoding/defval/default.go
generated
vendored
@ -15,8 +15,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
ptext "google.golang.org/protobuf/internal/encoding/text"
|
ptext "google.golang.org/protobuf/internal/encoding/text"
|
||||||
errors "google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Format is the serialization format used to represent the default value.
|
// Format is the serialization format used to represent the default value.
|
||||||
@ -35,56 +35,56 @@ const (
|
|||||||
|
|
||||||
// Unmarshal deserializes the default string s according to the given kind k.
|
// Unmarshal deserializes the default string s according to the given kind k.
|
||||||
// When k is an enum, a list of enum value descriptors must be provided.
|
// When k is an enum, a list of enum value descriptors must be provided.
|
||||||
func Unmarshal(s string, k pref.Kind, evs pref.EnumValueDescriptors, f Format) (pref.Value, pref.EnumValueDescriptor, error) {
|
func Unmarshal(s string, k protoreflect.Kind, evs protoreflect.EnumValueDescriptors, f Format) (protoreflect.Value, protoreflect.EnumValueDescriptor, error) {
|
||||||
switch k {
|
switch k {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if f == GoTag {
|
if f == GoTag {
|
||||||
switch s {
|
switch s {
|
||||||
case "1":
|
case "1":
|
||||||
return pref.ValueOfBool(true), nil, nil
|
return protoreflect.ValueOfBool(true), nil, nil
|
||||||
case "0":
|
case "0":
|
||||||
return pref.ValueOfBool(false), nil, nil
|
return protoreflect.ValueOfBool(false), nil, nil
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch s {
|
switch s {
|
||||||
case "true":
|
case "true":
|
||||||
return pref.ValueOfBool(true), nil, nil
|
return protoreflect.ValueOfBool(true), nil, nil
|
||||||
case "false":
|
case "false":
|
||||||
return pref.ValueOfBool(false), nil, nil
|
return protoreflect.ValueOfBool(false), nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if f == GoTag {
|
if f == GoTag {
|
||||||
// Go tags use the numeric form of the enum value.
|
// Go tags use the numeric form of the enum value.
|
||||||
if n, err := strconv.ParseInt(s, 10, 32); err == nil {
|
if n, err := strconv.ParseInt(s, 10, 32); err == nil {
|
||||||
if ev := evs.ByNumber(pref.EnumNumber(n)); ev != nil {
|
if ev := evs.ByNumber(protoreflect.EnumNumber(n)); ev != nil {
|
||||||
return pref.ValueOfEnum(ev.Number()), ev, nil
|
return protoreflect.ValueOfEnum(ev.Number()), ev, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Descriptor default_value use the enum identifier.
|
// Descriptor default_value use the enum identifier.
|
||||||
ev := evs.ByName(pref.Name(s))
|
ev := evs.ByName(protoreflect.Name(s))
|
||||||
if ev != nil {
|
if ev != nil {
|
||||||
return pref.ValueOfEnum(ev.Number()), ev, nil
|
return protoreflect.ValueOfEnum(ev.Number()), ev, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
if v, err := strconv.ParseInt(s, 10, 32); err == nil {
|
if v, err := strconv.ParseInt(s, 10, 32); err == nil {
|
||||||
return pref.ValueOfInt32(int32(v)), nil, nil
|
return protoreflect.ValueOfInt32(int32(v)), nil, nil
|
||||||
}
|
}
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
if v, err := strconv.ParseInt(s, 10, 64); err == nil {
|
if v, err := strconv.ParseInt(s, 10, 64); err == nil {
|
||||||
return pref.ValueOfInt64(int64(v)), nil, nil
|
return protoreflect.ValueOfInt64(int64(v)), nil, nil
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
if v, err := strconv.ParseUint(s, 10, 32); err == nil {
|
if v, err := strconv.ParseUint(s, 10, 32); err == nil {
|
||||||
return pref.ValueOfUint32(uint32(v)), nil, nil
|
return protoreflect.ValueOfUint32(uint32(v)), nil, nil
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
if v, err := strconv.ParseUint(s, 10, 64); err == nil {
|
if v, err := strconv.ParseUint(s, 10, 64); err == nil {
|
||||||
return pref.ValueOfUint64(uint64(v)), nil, nil
|
return protoreflect.ValueOfUint64(uint64(v)), nil, nil
|
||||||
}
|
}
|
||||||
case pref.FloatKind, pref.DoubleKind:
|
case protoreflect.FloatKind, protoreflect.DoubleKind:
|
||||||
var v float64
|
var v float64
|
||||||
var err error
|
var err error
|
||||||
switch s {
|
switch s {
|
||||||
@ -98,29 +98,29 @@ func Unmarshal(s string, k pref.Kind, evs pref.EnumValueDescriptors, f Format) (
|
|||||||
v, err = strconv.ParseFloat(s, 64)
|
v, err = strconv.ParseFloat(s, 64)
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if k == pref.FloatKind {
|
if k == protoreflect.FloatKind {
|
||||||
return pref.ValueOfFloat32(float32(v)), nil, nil
|
return protoreflect.ValueOfFloat32(float32(v)), nil, nil
|
||||||
} else {
|
} else {
|
||||||
return pref.ValueOfFloat64(float64(v)), nil, nil
|
return protoreflect.ValueOfFloat64(float64(v)), nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
// String values are already unescaped and can be used as is.
|
// String values are already unescaped and can be used as is.
|
||||||
return pref.ValueOfString(s), nil, nil
|
return protoreflect.ValueOfString(s), nil, nil
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if b, ok := unmarshalBytes(s); ok {
|
if b, ok := unmarshalBytes(s); ok {
|
||||||
return pref.ValueOfBytes(b), nil, nil
|
return protoreflect.ValueOfBytes(b), nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pref.Value{}, nil, errors.New("could not parse value for %v: %q", k, s)
|
return protoreflect.Value{}, nil, errors.New("could not parse value for %v: %q", k, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal serializes v as the default string according to the given kind k.
|
// Marshal serializes v as the default string according to the given kind k.
|
||||||
// When specifying the Descriptor format for an enum kind, the associated
|
// When specifying the Descriptor format for an enum kind, the associated
|
||||||
// enum value descriptor must be provided.
|
// enum value descriptor must be provided.
|
||||||
func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (string, error) {
|
func Marshal(v protoreflect.Value, ev protoreflect.EnumValueDescriptor, k protoreflect.Kind, f Format) (string, error) {
|
||||||
switch k {
|
switch k {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if f == GoTag {
|
if f == GoTag {
|
||||||
if v.Bool() {
|
if v.Bool() {
|
||||||
return "1", nil
|
return "1", nil
|
||||||
@ -134,17 +134,17 @@ func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (
|
|||||||
return "false", nil
|
return "false", nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if f == GoTag {
|
if f == GoTag {
|
||||||
return strconv.FormatInt(int64(v.Enum()), 10), nil
|
return strconv.FormatInt(int64(v.Enum()), 10), nil
|
||||||
} else {
|
} else {
|
||||||
return string(ev.Name()), nil
|
return string(ev.Name()), nil
|
||||||
}
|
}
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind, pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
return strconv.FormatInt(v.Int(), 10), nil
|
return strconv.FormatInt(v.Int(), 10), nil
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind, pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
return strconv.FormatUint(v.Uint(), 10), nil
|
return strconv.FormatUint(v.Uint(), 10), nil
|
||||||
case pref.FloatKind, pref.DoubleKind:
|
case protoreflect.FloatKind, protoreflect.DoubleKind:
|
||||||
f := v.Float()
|
f := v.Float()
|
||||||
switch {
|
switch {
|
||||||
case math.IsInf(f, -1):
|
case math.IsInf(f, -1):
|
||||||
@ -154,16 +154,16 @@ func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (
|
|||||||
case math.IsNaN(f):
|
case math.IsNaN(f):
|
||||||
return "nan", nil
|
return "nan", nil
|
||||||
default:
|
default:
|
||||||
if k == pref.FloatKind {
|
if k == protoreflect.FloatKind {
|
||||||
return strconv.FormatFloat(f, 'g', -1, 32), nil
|
return strconv.FormatFloat(f, 'g', -1, 32), nil
|
||||||
} else {
|
} else {
|
||||||
return strconv.FormatFloat(f, 'g', -1, 64), nil
|
return strconv.FormatFloat(f, 'g', -1, 64), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
// String values are serialized as is without any escaping.
|
// String values are serialized as is without any escaping.
|
||||||
return v.String(), nil
|
return v.String(), nil
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if s, ok := marshalBytes(v.Bytes()); ok {
|
if s, ok := marshalBytes(v.Bytes()); ok {
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
|
7
vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
generated
vendored
7
vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
generated
vendored
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The MessageSet wire format is equivalent to a message defined as follows,
|
// The MessageSet wire format is equivalent to a message defined as follows,
|
||||||
@ -33,6 +33,7 @@ const (
|
|||||||
// ExtensionName is the field name for extensions of MessageSet.
|
// ExtensionName is the field name for extensions of MessageSet.
|
||||||
//
|
//
|
||||||
// A valid MessageSet extension must be of the form:
|
// A valid MessageSet extension must be of the form:
|
||||||
|
//
|
||||||
// message MyMessage {
|
// message MyMessage {
|
||||||
// extend proto2.bridge.MessageSet {
|
// extend proto2.bridge.MessageSet {
|
||||||
// optional MyMessage message_set_extension = 1234;
|
// optional MyMessage message_set_extension = 1234;
|
||||||
@ -42,13 +43,13 @@ const (
|
|||||||
const ExtensionName = "message_set_extension"
|
const ExtensionName = "message_set_extension"
|
||||||
|
|
||||||
// IsMessageSet returns whether the message uses the MessageSet wire format.
|
// IsMessageSet returns whether the message uses the MessageSet wire format.
|
||||||
func IsMessageSet(md pref.MessageDescriptor) bool {
|
func IsMessageSet(md protoreflect.MessageDescriptor) bool {
|
||||||
xmd, ok := md.(interface{ IsMessageSet() bool })
|
xmd, ok := md.(interface{ IsMessageSet() bool })
|
||||||
return ok && xmd.IsMessageSet()
|
return ok && xmd.IsMessageSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsMessageSetExtension reports this field properly extends a MessageSet.
|
// IsMessageSetExtension reports this field properly extends a MessageSet.
|
||||||
func IsMessageSetExtension(fd pref.FieldDescriptor) bool {
|
func IsMessageSetExtension(fd protoreflect.FieldDescriptor) bool {
|
||||||
switch {
|
switch {
|
||||||
case fd.Name() != ExtensionName:
|
case fd.Name() != ExtensionName:
|
||||||
return false
|
return false
|
||||||
|
96
vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
generated
vendored
96
vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
generated
vendored
@ -11,10 +11,10 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
defval "google.golang.org/protobuf/internal/encoding/defval"
|
"google.golang.org/protobuf/internal/encoding/defval"
|
||||||
fdesc "google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
var byteType = reflect.TypeOf(byte(0))
|
var byteType = reflect.TypeOf(byte(0))
|
||||||
@ -29,9 +29,9 @@ var byteType = reflect.TypeOf(byte(0))
|
|||||||
// This does not populate the Enum or Message (except for weak message).
|
// This does not populate the Enum or Message (except for weak message).
|
||||||
//
|
//
|
||||||
// This function is a best effort attempt; parsing errors are ignored.
|
// This function is a best effort attempt; parsing errors are ignored.
|
||||||
func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) pref.FieldDescriptor {
|
func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescriptors) protoreflect.FieldDescriptor {
|
||||||
f := new(fdesc.Field)
|
f := new(filedesc.Field)
|
||||||
f.L0.ParentFile = fdesc.SurrogateProto2
|
f.L0.ParentFile = filedesc.SurrogateProto2
|
||||||
for len(tag) > 0 {
|
for len(tag) > 0 {
|
||||||
i := strings.IndexByte(tag, ',')
|
i := strings.IndexByte(tag, ',')
|
||||||
if i < 0 {
|
if i < 0 {
|
||||||
@ -39,68 +39,68 @@ func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) p
|
|||||||
}
|
}
|
||||||
switch s := tag[:i]; {
|
switch s := tag[:i]; {
|
||||||
case strings.HasPrefix(s, "name="):
|
case strings.HasPrefix(s, "name="):
|
||||||
f.L0.FullName = pref.FullName(s[len("name="):])
|
f.L0.FullName = protoreflect.FullName(s[len("name="):])
|
||||||
case strings.Trim(s, "0123456789") == "":
|
case strings.Trim(s, "0123456789") == "":
|
||||||
n, _ := strconv.ParseUint(s, 10, 32)
|
n, _ := strconv.ParseUint(s, 10, 32)
|
||||||
f.L1.Number = pref.FieldNumber(n)
|
f.L1.Number = protoreflect.FieldNumber(n)
|
||||||
case s == "opt":
|
case s == "opt":
|
||||||
f.L1.Cardinality = pref.Optional
|
f.L1.Cardinality = protoreflect.Optional
|
||||||
case s == "req":
|
case s == "req":
|
||||||
f.L1.Cardinality = pref.Required
|
f.L1.Cardinality = protoreflect.Required
|
||||||
case s == "rep":
|
case s == "rep":
|
||||||
f.L1.Cardinality = pref.Repeated
|
f.L1.Cardinality = protoreflect.Repeated
|
||||||
case s == "varint":
|
case s == "varint":
|
||||||
switch goType.Kind() {
|
switch goType.Kind() {
|
||||||
case reflect.Bool:
|
case reflect.Bool:
|
||||||
f.L1.Kind = pref.BoolKind
|
f.L1.Kind = protoreflect.BoolKind
|
||||||
case reflect.Int32:
|
case reflect.Int32:
|
||||||
f.L1.Kind = pref.Int32Kind
|
f.L1.Kind = protoreflect.Int32Kind
|
||||||
case reflect.Int64:
|
case reflect.Int64:
|
||||||
f.L1.Kind = pref.Int64Kind
|
f.L1.Kind = protoreflect.Int64Kind
|
||||||
case reflect.Uint32:
|
case reflect.Uint32:
|
||||||
f.L1.Kind = pref.Uint32Kind
|
f.L1.Kind = protoreflect.Uint32Kind
|
||||||
case reflect.Uint64:
|
case reflect.Uint64:
|
||||||
f.L1.Kind = pref.Uint64Kind
|
f.L1.Kind = protoreflect.Uint64Kind
|
||||||
}
|
}
|
||||||
case s == "zigzag32":
|
case s == "zigzag32":
|
||||||
if goType.Kind() == reflect.Int32 {
|
if goType.Kind() == reflect.Int32 {
|
||||||
f.L1.Kind = pref.Sint32Kind
|
f.L1.Kind = protoreflect.Sint32Kind
|
||||||
}
|
}
|
||||||
case s == "zigzag64":
|
case s == "zigzag64":
|
||||||
if goType.Kind() == reflect.Int64 {
|
if goType.Kind() == reflect.Int64 {
|
||||||
f.L1.Kind = pref.Sint64Kind
|
f.L1.Kind = protoreflect.Sint64Kind
|
||||||
}
|
}
|
||||||
case s == "fixed32":
|
case s == "fixed32":
|
||||||
switch goType.Kind() {
|
switch goType.Kind() {
|
||||||
case reflect.Int32:
|
case reflect.Int32:
|
||||||
f.L1.Kind = pref.Sfixed32Kind
|
f.L1.Kind = protoreflect.Sfixed32Kind
|
||||||
case reflect.Uint32:
|
case reflect.Uint32:
|
||||||
f.L1.Kind = pref.Fixed32Kind
|
f.L1.Kind = protoreflect.Fixed32Kind
|
||||||
case reflect.Float32:
|
case reflect.Float32:
|
||||||
f.L1.Kind = pref.FloatKind
|
f.L1.Kind = protoreflect.FloatKind
|
||||||
}
|
}
|
||||||
case s == "fixed64":
|
case s == "fixed64":
|
||||||
switch goType.Kind() {
|
switch goType.Kind() {
|
||||||
case reflect.Int64:
|
case reflect.Int64:
|
||||||
f.L1.Kind = pref.Sfixed64Kind
|
f.L1.Kind = protoreflect.Sfixed64Kind
|
||||||
case reflect.Uint64:
|
case reflect.Uint64:
|
||||||
f.L1.Kind = pref.Fixed64Kind
|
f.L1.Kind = protoreflect.Fixed64Kind
|
||||||
case reflect.Float64:
|
case reflect.Float64:
|
||||||
f.L1.Kind = pref.DoubleKind
|
f.L1.Kind = protoreflect.DoubleKind
|
||||||
}
|
}
|
||||||
case s == "bytes":
|
case s == "bytes":
|
||||||
switch {
|
switch {
|
||||||
case goType.Kind() == reflect.String:
|
case goType.Kind() == reflect.String:
|
||||||
f.L1.Kind = pref.StringKind
|
f.L1.Kind = protoreflect.StringKind
|
||||||
case goType.Kind() == reflect.Slice && goType.Elem() == byteType:
|
case goType.Kind() == reflect.Slice && goType.Elem() == byteType:
|
||||||
f.L1.Kind = pref.BytesKind
|
f.L1.Kind = protoreflect.BytesKind
|
||||||
default:
|
default:
|
||||||
f.L1.Kind = pref.MessageKind
|
f.L1.Kind = protoreflect.MessageKind
|
||||||
}
|
}
|
||||||
case s == "group":
|
case s == "group":
|
||||||
f.L1.Kind = pref.GroupKind
|
f.L1.Kind = protoreflect.GroupKind
|
||||||
case strings.HasPrefix(s, "enum="):
|
case strings.HasPrefix(s, "enum="):
|
||||||
f.L1.Kind = pref.EnumKind
|
f.L1.Kind = protoreflect.EnumKind
|
||||||
case strings.HasPrefix(s, "json="):
|
case strings.HasPrefix(s, "json="):
|
||||||
jsonName := s[len("json="):]
|
jsonName := s[len("json="):]
|
||||||
if jsonName != strs.JSONCamelCase(string(f.L0.FullName.Name())) {
|
if jsonName != strs.JSONCamelCase(string(f.L0.FullName.Name())) {
|
||||||
@ -111,23 +111,23 @@ func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) p
|
|||||||
f.L1.IsPacked = true
|
f.L1.IsPacked = true
|
||||||
case strings.HasPrefix(s, "weak="):
|
case strings.HasPrefix(s, "weak="):
|
||||||
f.L1.IsWeak = true
|
f.L1.IsWeak = true
|
||||||
f.L1.Message = fdesc.PlaceholderMessage(pref.FullName(s[len("weak="):]))
|
f.L1.Message = filedesc.PlaceholderMessage(protoreflect.FullName(s[len("weak="):]))
|
||||||
case strings.HasPrefix(s, "def="):
|
case strings.HasPrefix(s, "def="):
|
||||||
// The default tag is special in that everything afterwards is the
|
// The default tag is special in that everything afterwards is the
|
||||||
// default regardless of the presence of commas.
|
// default regardless of the presence of commas.
|
||||||
s, i = tag[len("def="):], len(tag)
|
s, i = tag[len("def="):], len(tag)
|
||||||
v, ev, _ := defval.Unmarshal(s, f.L1.Kind, evs, defval.GoTag)
|
v, ev, _ := defval.Unmarshal(s, f.L1.Kind, evs, defval.GoTag)
|
||||||
f.L1.Default = fdesc.DefaultValue(v, ev)
|
f.L1.Default = filedesc.DefaultValue(v, ev)
|
||||||
case s == "proto3":
|
case s == "proto3":
|
||||||
f.L0.ParentFile = fdesc.SurrogateProto3
|
f.L0.ParentFile = filedesc.SurrogateProto3
|
||||||
}
|
}
|
||||||
tag = strings.TrimPrefix(tag[i:], ",")
|
tag = strings.TrimPrefix(tag[i:], ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
// The generator uses the group message name instead of the field name.
|
// The generator uses the group message name instead of the field name.
|
||||||
// We obtain the real field name by lowercasing the group name.
|
// We obtain the real field name by lowercasing the group name.
|
||||||
if f.L1.Kind == pref.GroupKind {
|
if f.L1.Kind == protoreflect.GroupKind {
|
||||||
f.L0.FullName = pref.FullName(strings.ToLower(string(f.L0.FullName)))
|
f.L0.FullName = protoreflect.FullName(strings.ToLower(string(f.L0.FullName)))
|
||||||
}
|
}
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
@ -140,38 +140,38 @@ func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) p
|
|||||||
// Depending on the context on how Marshal is called, there are different ways
|
// Depending on the context on how Marshal is called, there are different ways
|
||||||
// through which that information is determined. As such it is the caller's
|
// through which that information is determined. As such it is the caller's
|
||||||
// responsibility to provide a function to obtain that information.
|
// responsibility to provide a function to obtain that information.
|
||||||
func Marshal(fd pref.FieldDescriptor, enumName string) string {
|
func Marshal(fd protoreflect.FieldDescriptor, enumName string) string {
|
||||||
var tag []string
|
var tag []string
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind, pref.EnumKind, pref.Int32Kind, pref.Uint32Kind, pref.Int64Kind, pref.Uint64Kind:
|
case protoreflect.BoolKind, protoreflect.EnumKind, protoreflect.Int32Kind, protoreflect.Uint32Kind, protoreflect.Int64Kind, protoreflect.Uint64Kind:
|
||||||
tag = append(tag, "varint")
|
tag = append(tag, "varint")
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
tag = append(tag, "zigzag32")
|
tag = append(tag, "zigzag32")
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
tag = append(tag, "zigzag64")
|
tag = append(tag, "zigzag64")
|
||||||
case pref.Sfixed32Kind, pref.Fixed32Kind, pref.FloatKind:
|
case protoreflect.Sfixed32Kind, protoreflect.Fixed32Kind, protoreflect.FloatKind:
|
||||||
tag = append(tag, "fixed32")
|
tag = append(tag, "fixed32")
|
||||||
case pref.Sfixed64Kind, pref.Fixed64Kind, pref.DoubleKind:
|
case protoreflect.Sfixed64Kind, protoreflect.Fixed64Kind, protoreflect.DoubleKind:
|
||||||
tag = append(tag, "fixed64")
|
tag = append(tag, "fixed64")
|
||||||
case pref.StringKind, pref.BytesKind, pref.MessageKind:
|
case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind:
|
||||||
tag = append(tag, "bytes")
|
tag = append(tag, "bytes")
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
tag = append(tag, "group")
|
tag = append(tag, "group")
|
||||||
}
|
}
|
||||||
tag = append(tag, strconv.Itoa(int(fd.Number())))
|
tag = append(tag, strconv.Itoa(int(fd.Number())))
|
||||||
switch fd.Cardinality() {
|
switch fd.Cardinality() {
|
||||||
case pref.Optional:
|
case protoreflect.Optional:
|
||||||
tag = append(tag, "opt")
|
tag = append(tag, "opt")
|
||||||
case pref.Required:
|
case protoreflect.Required:
|
||||||
tag = append(tag, "req")
|
tag = append(tag, "req")
|
||||||
case pref.Repeated:
|
case protoreflect.Repeated:
|
||||||
tag = append(tag, "rep")
|
tag = append(tag, "rep")
|
||||||
}
|
}
|
||||||
if fd.IsPacked() {
|
if fd.IsPacked() {
|
||||||
tag = append(tag, "packed")
|
tag = append(tag, "packed")
|
||||||
}
|
}
|
||||||
name := string(fd.Name())
|
name := string(fd.Name())
|
||||||
if fd.Kind() == pref.GroupKind {
|
if fd.Kind() == protoreflect.GroupKind {
|
||||||
// The name of the FieldDescriptor for a group field is
|
// The name of the FieldDescriptor for a group field is
|
||||||
// lowercased. To find the original capitalization, we
|
// lowercased. To find the original capitalization, we
|
||||||
// look in the field's MessageType.
|
// look in the field's MessageType.
|
||||||
@ -189,10 +189,10 @@ func Marshal(fd pref.FieldDescriptor, enumName string) string {
|
|||||||
// The previous implementation does not tag extension fields as proto3,
|
// The previous implementation does not tag extension fields as proto3,
|
||||||
// even when the field is defined in a proto3 file. Match that behavior
|
// even when the field is defined in a proto3 file. Match that behavior
|
||||||
// for consistency.
|
// for consistency.
|
||||||
if fd.Syntax() == pref.Proto3 && !fd.IsExtension() {
|
if fd.Syntax() == protoreflect.Proto3 && !fd.IsExtension() {
|
||||||
tag = append(tag, "proto3")
|
tag = append(tag, "proto3")
|
||||||
}
|
}
|
||||||
if fd.Kind() == pref.EnumKind && enumName != "" {
|
if fd.Kind() == protoreflect.EnumKind && enumName != "" {
|
||||||
tag = append(tag, "enum="+enumName)
|
tag = append(tag, "enum="+enumName)
|
||||||
}
|
}
|
||||||
if fd.ContainingOneof() != nil {
|
if fd.ContainingOneof() != nil {
|
||||||
|
30
vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
generated
vendored
30
vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
generated
vendored
@ -8,7 +8,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"regexp"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
@ -421,7 +420,7 @@ func (d *Decoder) parseFieldName() (tok Token, err error) {
|
|||||||
return Token{}, d.newSyntaxError("invalid field number: %s", d.in[:num.size])
|
return Token{}, d.newSyntaxError("invalid field number: %s", d.in[:num.size])
|
||||||
}
|
}
|
||||||
|
|
||||||
return Token{}, d.newSyntaxError("invalid field name: %s", errRegexp.Find(d.in))
|
return Token{}, d.newSyntaxError("invalid field name: %s", errId(d.in))
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseTypeName parses Any type URL or extension field name. The name is
|
// parseTypeName parses Any type URL or extension field name. The name is
|
||||||
@ -571,7 +570,7 @@ func (d *Decoder) parseScalar() (Token, error) {
|
|||||||
return tok, nil
|
return tok, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return Token{}, d.newSyntaxError("invalid scalar value: %s", errRegexp.Find(d.in))
|
return Token{}, d.newSyntaxError("invalid scalar value: %s", errId(d.in))
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseLiteralValue parses a literal value. A literal value is used for
|
// parseLiteralValue parses a literal value. A literal value is used for
|
||||||
@ -653,8 +652,29 @@ func consume(b []byte, n int) []byte {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Any sequence that looks like a non-delimiter (for error reporting).
|
// errId extracts a byte sequence that looks like an invalid ID
|
||||||
var errRegexp = regexp.MustCompile(`^([-+._a-zA-Z0-9\/]+|.)`)
|
// (for the purposes of error reporting).
|
||||||
|
func errId(seq []byte) []byte {
|
||||||
|
const maxLen = 32
|
||||||
|
for i := 0; i < len(seq); {
|
||||||
|
if i > maxLen {
|
||||||
|
return append(seq[:i:i], "…"...)
|
||||||
|
}
|
||||||
|
r, size := utf8.DecodeRune(seq[i:])
|
||||||
|
if r > utf8.RuneSelf || (r != '/' && isDelim(byte(r))) {
|
||||||
|
if i == 0 {
|
||||||
|
// Either the first byte is invalid UTF-8 or a
|
||||||
|
// delimiter, or the first rune is non-ASCII.
|
||||||
|
// Return it as-is.
|
||||||
|
i = size
|
||||||
|
}
|
||||||
|
return seq[:i:i]
|
||||||
|
}
|
||||||
|
i += size
|
||||||
|
}
|
||||||
|
// No delimiter found.
|
||||||
|
return seq
|
||||||
|
}
|
||||||
|
|
||||||
// isDelim returns true if given byte is a delimiter character.
|
// isDelim returns true if given byte is a delimiter character.
|
||||||
func isDelim(c byte) bool {
|
func isDelim(c byte) bool {
|
||||||
|
2
vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go
generated
vendored
2
vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go
generated
vendored
@ -50,8 +50,10 @@ type number struct {
|
|||||||
|
|
||||||
// parseNumber constructs a number object from given input. It allows for the
|
// parseNumber constructs a number object from given input. It allows for the
|
||||||
// following patterns:
|
// following patterns:
|
||||||
|
//
|
||||||
// integer: ^-?([1-9][0-9]*|0[xX][0-9a-fA-F]+|0[0-7]*)
|
// integer: ^-?([1-9][0-9]*|0[xX][0-9a-fA-F]+|0[0-7]*)
|
||||||
// float: ^-?((0|[1-9][0-9]*)?([.][0-9]*)?([eE][+-]?[0-9]+)?[fF]?)
|
// float: ^-?((0|[1-9][0-9]*)?([.][0-9]*)?([eE][+-]?[0-9]+)?[fF]?)
|
||||||
|
//
|
||||||
// It also returns the number of parsed bytes for the given number, 0 if it is
|
// It also returns the number of parsed bytes for the given number, 0 if it is
|
||||||
// not a number.
|
// not a number.
|
||||||
func parseNumber(input []byte) number {
|
func parseNumber(input []byte) number {
|
||||||
|
4
vendor/google.golang.org/protobuf/internal/encoding/text/doc.go
generated
vendored
4
vendor/google.golang.org/protobuf/internal/encoding/text/doc.go
generated
vendored
@ -24,6 +24,6 @@
|
|||||||
// the Go implementation should as well.
|
// the Go implementation should as well.
|
||||||
//
|
//
|
||||||
// The text format is almost a superset of JSON except:
|
// The text format is almost a superset of JSON except:
|
||||||
// * message keys are not quoted strings, but identifiers
|
// - message keys are not quoted strings, but identifiers
|
||||||
// * the top-level value must be a message without the delimiters
|
// - the top-level value must be a message without the delimiters
|
||||||
package text
|
package text
|
||||||
|
19
vendor/google.golang.org/protobuf/internal/filedesc/build.go
generated
vendored
19
vendor/google.golang.org/protobuf/internal/filedesc/build.go
generated
vendored
@ -12,8 +12,7 @@ import (
|
|||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder construct a protoreflect.FileDescriptor from the raw descriptor.
|
// Builder construct a protoreflect.FileDescriptor from the raw descriptor.
|
||||||
@ -38,7 +37,7 @@ type Builder struct {
|
|||||||
// TypeResolver resolves extension field types for descriptor options.
|
// TypeResolver resolves extension field types for descriptor options.
|
||||||
// If nil, it uses protoregistry.GlobalTypes.
|
// If nil, it uses protoregistry.GlobalTypes.
|
||||||
TypeResolver interface {
|
TypeResolver interface {
|
||||||
preg.ExtensionTypeResolver
|
protoregistry.ExtensionTypeResolver
|
||||||
}
|
}
|
||||||
|
|
||||||
// FileRegistry is use to lookup file, enum, and message dependencies.
|
// FileRegistry is use to lookup file, enum, and message dependencies.
|
||||||
@ -46,8 +45,8 @@ type Builder struct {
|
|||||||
// If nil, it uses protoregistry.GlobalFiles.
|
// If nil, it uses protoregistry.GlobalFiles.
|
||||||
FileRegistry interface {
|
FileRegistry interface {
|
||||||
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
||||||
FindDescriptorByName(pref.FullName) (pref.Descriptor, error)
|
FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
|
||||||
RegisterFile(pref.FileDescriptor) error
|
RegisterFile(protoreflect.FileDescriptor) error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,8 +54,8 @@ type Builder struct {
|
|||||||
// If so, it permits looking up an enum or message dependency based on the
|
// If so, it permits looking up an enum or message dependency based on the
|
||||||
// sub-list and element index into filetype.Builder.DependencyIndexes.
|
// sub-list and element index into filetype.Builder.DependencyIndexes.
|
||||||
type resolverByIndex interface {
|
type resolverByIndex interface {
|
||||||
FindEnumByIndex(int32, int32, []Enum, []Message) pref.EnumDescriptor
|
FindEnumByIndex(int32, int32, []Enum, []Message) protoreflect.EnumDescriptor
|
||||||
FindMessageByIndex(int32, int32, []Enum, []Message) pref.MessageDescriptor
|
FindMessageByIndex(int32, int32, []Enum, []Message) protoreflect.MessageDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indexes of each sub-list in filetype.Builder.DependencyIndexes.
|
// Indexes of each sub-list in filetype.Builder.DependencyIndexes.
|
||||||
@ -70,7 +69,7 @@ const (
|
|||||||
|
|
||||||
// Out is the output of the Builder.
|
// Out is the output of the Builder.
|
||||||
type Out struct {
|
type Out struct {
|
||||||
File pref.FileDescriptor
|
File protoreflect.FileDescriptor
|
||||||
|
|
||||||
// Enums is all enum descriptors in "flattened ordering".
|
// Enums is all enum descriptors in "flattened ordering".
|
||||||
Enums []Enum
|
Enums []Enum
|
||||||
@ -97,10 +96,10 @@ func (db Builder) Build() (out Out) {
|
|||||||
|
|
||||||
// Initialize resolvers and registries if unpopulated.
|
// Initialize resolvers and registries if unpopulated.
|
||||||
if db.TypeResolver == nil {
|
if db.TypeResolver == nil {
|
||||||
db.TypeResolver = preg.GlobalTypes
|
db.TypeResolver = protoregistry.GlobalTypes
|
||||||
}
|
}
|
||||||
if db.FileRegistry == nil {
|
if db.FileRegistry == nil {
|
||||||
db.FileRegistry = preg.GlobalFiles
|
db.FileRegistry = protoregistry.GlobalFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
fd := newRawFile(db)
|
fd := newRawFile(db)
|
||||||
|
314
vendor/google.golang.org/protobuf/internal/filedesc/desc.go
generated
vendored
314
vendor/google.golang.org/protobuf/internal/filedesc/desc.go
generated
vendored
@ -17,7 +17,7 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -43,9 +43,9 @@ type (
|
|||||||
L2 *FileL2
|
L2 *FileL2
|
||||||
}
|
}
|
||||||
FileL1 struct {
|
FileL1 struct {
|
||||||
Syntax pref.Syntax
|
Syntax protoreflect.Syntax
|
||||||
Path string
|
Path string
|
||||||
Package pref.FullName
|
Package protoreflect.FullName
|
||||||
|
|
||||||
Enums Enums
|
Enums Enums
|
||||||
Messages Messages
|
Messages Messages
|
||||||
@ -53,35 +53,35 @@ type (
|
|||||||
Services Services
|
Services Services
|
||||||
}
|
}
|
||||||
FileL2 struct {
|
FileL2 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Imports FileImports
|
Imports FileImports
|
||||||
Locations SourceLocations
|
Locations SourceLocations
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (fd *File) ParentFile() pref.FileDescriptor { return fd }
|
func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd }
|
||||||
func (fd *File) Parent() pref.Descriptor { return nil }
|
func (fd *File) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (fd *File) Index() int { return 0 }
|
func (fd *File) Index() int { return 0 }
|
||||||
func (fd *File) Syntax() pref.Syntax { return fd.L1.Syntax }
|
func (fd *File) Syntax() protoreflect.Syntax { return fd.L1.Syntax }
|
||||||
func (fd *File) Name() pref.Name { return fd.L1.Package.Name() }
|
func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() }
|
||||||
func (fd *File) FullName() pref.FullName { return fd.L1.Package }
|
func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package }
|
||||||
func (fd *File) IsPlaceholder() bool { return false }
|
func (fd *File) IsPlaceholder() bool { return false }
|
||||||
func (fd *File) Options() pref.ProtoMessage {
|
func (fd *File) Options() protoreflect.ProtoMessage {
|
||||||
if f := fd.lazyInit().Options; f != nil {
|
if f := fd.lazyInit().Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.File
|
return descopts.File
|
||||||
}
|
}
|
||||||
func (fd *File) Path() string { return fd.L1.Path }
|
func (fd *File) Path() string { return fd.L1.Path }
|
||||||
func (fd *File) Package() pref.FullName { return fd.L1.Package }
|
func (fd *File) Package() protoreflect.FullName { return fd.L1.Package }
|
||||||
func (fd *File) Imports() pref.FileImports { return &fd.lazyInit().Imports }
|
func (fd *File) Imports() protoreflect.FileImports { return &fd.lazyInit().Imports }
|
||||||
func (fd *File) Enums() pref.EnumDescriptors { return &fd.L1.Enums }
|
func (fd *File) Enums() protoreflect.EnumDescriptors { return &fd.L1.Enums }
|
||||||
func (fd *File) Messages() pref.MessageDescriptors { return &fd.L1.Messages }
|
func (fd *File) Messages() protoreflect.MessageDescriptors { return &fd.L1.Messages }
|
||||||
func (fd *File) Extensions() pref.ExtensionDescriptors { return &fd.L1.Extensions }
|
func (fd *File) Extensions() protoreflect.ExtensionDescriptors { return &fd.L1.Extensions }
|
||||||
func (fd *File) Services() pref.ServiceDescriptors { return &fd.L1.Services }
|
func (fd *File) Services() protoreflect.ServiceDescriptors { return &fd.L1.Services }
|
||||||
func (fd *File) SourceLocations() pref.SourceLocations { return &fd.lazyInit().Locations }
|
func (fd *File) SourceLocations() protoreflect.SourceLocations { return &fd.lazyInit().Locations }
|
||||||
func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
||||||
func (fd *File) ProtoType(pref.FileDescriptor) {}
|
func (fd *File) ProtoType(protoreflect.FileDescriptor) {}
|
||||||
func (fd *File) ProtoInternal(pragma.DoNotImplement) {}
|
func (fd *File) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
func (fd *File) lazyInit() *FileL2 {
|
func (fd *File) lazyInit() *FileL2 {
|
||||||
@ -119,7 +119,7 @@ type (
|
|||||||
eagerValues bool // controls whether EnumL2.Values is already populated
|
eagerValues bool // controls whether EnumL2.Values is already populated
|
||||||
}
|
}
|
||||||
EnumL2 struct {
|
EnumL2 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Values EnumValues
|
Values EnumValues
|
||||||
ReservedNames Names
|
ReservedNames Names
|
||||||
ReservedRanges EnumRanges
|
ReservedRanges EnumRanges
|
||||||
@ -130,41 +130,41 @@ type (
|
|||||||
L1 EnumValueL1
|
L1 EnumValueL1
|
||||||
}
|
}
|
||||||
EnumValueL1 struct {
|
EnumValueL1 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Number pref.EnumNumber
|
Number protoreflect.EnumNumber
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (ed *Enum) Options() pref.ProtoMessage {
|
func (ed *Enum) Options() protoreflect.ProtoMessage {
|
||||||
if f := ed.lazyInit().Options; f != nil {
|
if f := ed.lazyInit().Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Enum
|
return descopts.Enum
|
||||||
}
|
}
|
||||||
func (ed *Enum) Values() pref.EnumValueDescriptors {
|
func (ed *Enum) Values() protoreflect.EnumValueDescriptors {
|
||||||
if ed.L1.eagerValues {
|
if ed.L1.eagerValues {
|
||||||
return &ed.L2.Values
|
return &ed.L2.Values
|
||||||
}
|
}
|
||||||
return &ed.lazyInit().Values
|
return &ed.lazyInit().Values
|
||||||
}
|
}
|
||||||
func (ed *Enum) ReservedNames() pref.Names { return &ed.lazyInit().ReservedNames }
|
func (ed *Enum) ReservedNames() protoreflect.Names { return &ed.lazyInit().ReservedNames }
|
||||||
func (ed *Enum) ReservedRanges() pref.EnumRanges { return &ed.lazyInit().ReservedRanges }
|
func (ed *Enum) ReservedRanges() protoreflect.EnumRanges { return &ed.lazyInit().ReservedRanges }
|
||||||
func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
||||||
func (ed *Enum) ProtoType(pref.EnumDescriptor) {}
|
func (ed *Enum) ProtoType(protoreflect.EnumDescriptor) {}
|
||||||
func (ed *Enum) lazyInit() *EnumL2 {
|
func (ed *Enum) lazyInit() *EnumL2 {
|
||||||
ed.L0.ParentFile.lazyInit() // implicitly initializes L2
|
ed.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||||
return ed.L2
|
return ed.L2
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ed *EnumValue) Options() pref.ProtoMessage {
|
func (ed *EnumValue) Options() protoreflect.ProtoMessage {
|
||||||
if f := ed.L1.Options; f != nil {
|
if f := ed.L1.Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.EnumValue
|
return descopts.EnumValue
|
||||||
}
|
}
|
||||||
func (ed *EnumValue) Number() pref.EnumNumber { return ed.L1.Number }
|
func (ed *EnumValue) Number() protoreflect.EnumNumber { return ed.L1.Number }
|
||||||
func (ed *EnumValue) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
func (ed *EnumValue) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
||||||
func (ed *EnumValue) ProtoType(pref.EnumValueDescriptor) {}
|
func (ed *EnumValue) ProtoType(protoreflect.EnumValueDescriptor) {}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Message struct {
|
Message struct {
|
||||||
@ -180,14 +180,14 @@ type (
|
|||||||
IsMessageSet bool // promoted from google.protobuf.MessageOptions
|
IsMessageSet bool // promoted from google.protobuf.MessageOptions
|
||||||
}
|
}
|
||||||
MessageL2 struct {
|
MessageL2 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Fields Fields
|
Fields Fields
|
||||||
Oneofs Oneofs
|
Oneofs Oneofs
|
||||||
ReservedNames Names
|
ReservedNames Names
|
||||||
ReservedRanges FieldRanges
|
ReservedRanges FieldRanges
|
||||||
RequiredNumbers FieldNumbers // must be consistent with Fields.Cardinality
|
RequiredNumbers FieldNumbers // must be consistent with Fields.Cardinality
|
||||||
ExtensionRanges FieldRanges
|
ExtensionRanges FieldRanges
|
||||||
ExtensionRangeOptions []func() pref.ProtoMessage // must be same length as ExtensionRanges
|
ExtensionRangeOptions []func() protoreflect.ProtoMessage // must be same length as ExtensionRanges
|
||||||
}
|
}
|
||||||
|
|
||||||
Field struct {
|
Field struct {
|
||||||
@ -195,10 +195,10 @@ type (
|
|||||||
L1 FieldL1
|
L1 FieldL1
|
||||||
}
|
}
|
||||||
FieldL1 struct {
|
FieldL1 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Number pref.FieldNumber
|
Number protoreflect.FieldNumber
|
||||||
Cardinality pref.Cardinality // must be consistent with Message.RequiredNumbers
|
Cardinality protoreflect.Cardinality // must be consistent with Message.RequiredNumbers
|
||||||
Kind pref.Kind
|
Kind protoreflect.Kind
|
||||||
StringName stringName
|
StringName stringName
|
||||||
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
||||||
IsWeak bool // promoted from google.protobuf.FieldOptions
|
IsWeak bool // promoted from google.protobuf.FieldOptions
|
||||||
@ -207,9 +207,9 @@ type (
|
|||||||
HasEnforceUTF8 bool // promoted from google.protobuf.FieldOptions
|
HasEnforceUTF8 bool // promoted from google.protobuf.FieldOptions
|
||||||
EnforceUTF8 bool // promoted from google.protobuf.FieldOptions
|
EnforceUTF8 bool // promoted from google.protobuf.FieldOptions
|
||||||
Default defaultValue
|
Default defaultValue
|
||||||
ContainingOneof pref.OneofDescriptor // must be consistent with Message.Oneofs.Fields
|
ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields
|
||||||
Enum pref.EnumDescriptor
|
Enum protoreflect.EnumDescriptor
|
||||||
Message pref.MessageDescriptor
|
Message protoreflect.MessageDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
Oneof struct {
|
Oneof struct {
|
||||||
@ -217,34 +217,34 @@ type (
|
|||||||
L1 OneofL1
|
L1 OneofL1
|
||||||
}
|
}
|
||||||
OneofL1 struct {
|
OneofL1 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Fields OneofFields // must be consistent with Message.Fields.ContainingOneof
|
Fields OneofFields // must be consistent with Message.Fields.ContainingOneof
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (md *Message) Options() pref.ProtoMessage {
|
func (md *Message) Options() protoreflect.ProtoMessage {
|
||||||
if f := md.lazyInit().Options; f != nil {
|
if f := md.lazyInit().Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Message
|
return descopts.Message
|
||||||
}
|
}
|
||||||
func (md *Message) IsMapEntry() bool { return md.L1.IsMapEntry }
|
func (md *Message) IsMapEntry() bool { return md.L1.IsMapEntry }
|
||||||
func (md *Message) Fields() pref.FieldDescriptors { return &md.lazyInit().Fields }
|
func (md *Message) Fields() protoreflect.FieldDescriptors { return &md.lazyInit().Fields }
|
||||||
func (md *Message) Oneofs() pref.OneofDescriptors { return &md.lazyInit().Oneofs }
|
func (md *Message) Oneofs() protoreflect.OneofDescriptors { return &md.lazyInit().Oneofs }
|
||||||
func (md *Message) ReservedNames() pref.Names { return &md.lazyInit().ReservedNames }
|
func (md *Message) ReservedNames() protoreflect.Names { return &md.lazyInit().ReservedNames }
|
||||||
func (md *Message) ReservedRanges() pref.FieldRanges { return &md.lazyInit().ReservedRanges }
|
func (md *Message) ReservedRanges() protoreflect.FieldRanges { return &md.lazyInit().ReservedRanges }
|
||||||
func (md *Message) RequiredNumbers() pref.FieldNumbers { return &md.lazyInit().RequiredNumbers }
|
func (md *Message) RequiredNumbers() protoreflect.FieldNumbers { return &md.lazyInit().RequiredNumbers }
|
||||||
func (md *Message) ExtensionRanges() pref.FieldRanges { return &md.lazyInit().ExtensionRanges }
|
func (md *Message) ExtensionRanges() protoreflect.FieldRanges { return &md.lazyInit().ExtensionRanges }
|
||||||
func (md *Message) ExtensionRangeOptions(i int) pref.ProtoMessage {
|
func (md *Message) ExtensionRangeOptions(i int) protoreflect.ProtoMessage {
|
||||||
if f := md.lazyInit().ExtensionRangeOptions[i]; f != nil {
|
if f := md.lazyInit().ExtensionRangeOptions[i]; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.ExtensionRange
|
return descopts.ExtensionRange
|
||||||
}
|
}
|
||||||
func (md *Message) Enums() pref.EnumDescriptors { return &md.L1.Enums }
|
func (md *Message) Enums() protoreflect.EnumDescriptors { return &md.L1.Enums }
|
||||||
func (md *Message) Messages() pref.MessageDescriptors { return &md.L1.Messages }
|
func (md *Message) Messages() protoreflect.MessageDescriptors { return &md.L1.Messages }
|
||||||
func (md *Message) Extensions() pref.ExtensionDescriptors { return &md.L1.Extensions }
|
func (md *Message) Extensions() protoreflect.ExtensionDescriptors { return &md.L1.Extensions }
|
||||||
func (md *Message) ProtoType(pref.MessageDescriptor) {}
|
func (md *Message) ProtoType(protoreflect.MessageDescriptor) {}
|
||||||
func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
||||||
func (md *Message) lazyInit() *MessageL2 {
|
func (md *Message) lazyInit() *MessageL2 {
|
||||||
md.L0.ParentFile.lazyInit() // implicitly initializes L2
|
md.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||||
@ -260,28 +260,28 @@ func (md *Message) IsMessageSet() bool {
|
|||||||
return md.L1.IsMessageSet
|
return md.L1.IsMessageSet
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fd *Field) Options() pref.ProtoMessage {
|
func (fd *Field) Options() protoreflect.ProtoMessage {
|
||||||
if f := fd.L1.Options; f != nil {
|
if f := fd.L1.Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Field
|
return descopts.Field
|
||||||
}
|
}
|
||||||
func (fd *Field) Number() pref.FieldNumber { return fd.L1.Number }
|
func (fd *Field) Number() protoreflect.FieldNumber { return fd.L1.Number }
|
||||||
func (fd *Field) Cardinality() pref.Cardinality { return fd.L1.Cardinality }
|
func (fd *Field) Cardinality() protoreflect.Cardinality { return fd.L1.Cardinality }
|
||||||
func (fd *Field) Kind() pref.Kind { return fd.L1.Kind }
|
func (fd *Field) Kind() protoreflect.Kind { return fd.L1.Kind }
|
||||||
func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON }
|
func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON }
|
||||||
func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) }
|
func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) }
|
||||||
func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) }
|
func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) }
|
||||||
func (fd *Field) HasPresence() bool {
|
func (fd *Field) HasPresence() bool {
|
||||||
return fd.L1.Cardinality != pref.Repeated && (fd.L0.ParentFile.L1.Syntax == pref.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil)
|
return fd.L1.Cardinality != protoreflect.Repeated && (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil)
|
||||||
}
|
}
|
||||||
func (fd *Field) HasOptionalKeyword() bool {
|
func (fd *Field) HasOptionalKeyword() bool {
|
||||||
return (fd.L0.ParentFile.L1.Syntax == pref.Proto2 && fd.L1.Cardinality == pref.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
|
return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
|
||||||
}
|
}
|
||||||
func (fd *Field) IsPacked() bool {
|
func (fd *Field) IsPacked() bool {
|
||||||
if !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != pref.Proto2 && fd.L1.Cardinality == pref.Repeated {
|
if !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Repeated {
|
||||||
switch fd.L1.Kind {
|
switch fd.L1.Kind {
|
||||||
case pref.StringKind, pref.BytesKind, pref.MessageKind, pref.GroupKind:
|
case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
default:
|
default:
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -290,40 +290,40 @@ func (fd *Field) IsPacked() bool {
|
|||||||
}
|
}
|
||||||
func (fd *Field) IsExtension() bool { return false }
|
func (fd *Field) IsExtension() bool { return false }
|
||||||
func (fd *Field) IsWeak() bool { return fd.L1.IsWeak }
|
func (fd *Field) IsWeak() bool { return fd.L1.IsWeak }
|
||||||
func (fd *Field) IsList() bool { return fd.Cardinality() == pref.Repeated && !fd.IsMap() }
|
func (fd *Field) IsList() bool { return fd.Cardinality() == protoreflect.Repeated && !fd.IsMap() }
|
||||||
func (fd *Field) IsMap() bool { return fd.Message() != nil && fd.Message().IsMapEntry() }
|
func (fd *Field) IsMap() bool { return fd.Message() != nil && fd.Message().IsMapEntry() }
|
||||||
func (fd *Field) MapKey() pref.FieldDescriptor {
|
func (fd *Field) MapKey() protoreflect.FieldDescriptor {
|
||||||
if !fd.IsMap() {
|
if !fd.IsMap() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return fd.Message().Fields().ByNumber(genid.MapEntry_Key_field_number)
|
return fd.Message().Fields().ByNumber(genid.MapEntry_Key_field_number)
|
||||||
}
|
}
|
||||||
func (fd *Field) MapValue() pref.FieldDescriptor {
|
func (fd *Field) MapValue() protoreflect.FieldDescriptor {
|
||||||
if !fd.IsMap() {
|
if !fd.IsMap() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return fd.Message().Fields().ByNumber(genid.MapEntry_Value_field_number)
|
return fd.Message().Fields().ByNumber(genid.MapEntry_Value_field_number)
|
||||||
}
|
}
|
||||||
func (fd *Field) HasDefault() bool { return fd.L1.Default.has }
|
func (fd *Field) HasDefault() bool { return fd.L1.Default.has }
|
||||||
func (fd *Field) Default() pref.Value { return fd.L1.Default.get(fd) }
|
func (fd *Field) Default() protoreflect.Value { return fd.L1.Default.get(fd) }
|
||||||
func (fd *Field) DefaultEnumValue() pref.EnumValueDescriptor { return fd.L1.Default.enum }
|
func (fd *Field) DefaultEnumValue() protoreflect.EnumValueDescriptor { return fd.L1.Default.enum }
|
||||||
func (fd *Field) ContainingOneof() pref.OneofDescriptor { return fd.L1.ContainingOneof }
|
func (fd *Field) ContainingOneof() protoreflect.OneofDescriptor { return fd.L1.ContainingOneof }
|
||||||
func (fd *Field) ContainingMessage() pref.MessageDescriptor {
|
func (fd *Field) ContainingMessage() protoreflect.MessageDescriptor {
|
||||||
return fd.L0.Parent.(pref.MessageDescriptor)
|
return fd.L0.Parent.(protoreflect.MessageDescriptor)
|
||||||
}
|
}
|
||||||
func (fd *Field) Enum() pref.EnumDescriptor {
|
func (fd *Field) Enum() protoreflect.EnumDescriptor {
|
||||||
return fd.L1.Enum
|
return fd.L1.Enum
|
||||||
}
|
}
|
||||||
func (fd *Field) Message() pref.MessageDescriptor {
|
func (fd *Field) Message() protoreflect.MessageDescriptor {
|
||||||
if fd.L1.IsWeak {
|
if fd.L1.IsWeak {
|
||||||
if d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil {
|
if d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil {
|
||||||
return d.(pref.MessageDescriptor)
|
return d.(protoreflect.MessageDescriptor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fd.L1.Message
|
return fd.L1.Message
|
||||||
}
|
}
|
||||||
func (fd *Field) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
func (fd *Field) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
||||||
func (fd *Field) ProtoType(pref.FieldDescriptor) {}
|
func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {}
|
||||||
|
|
||||||
// EnforceUTF8 is a pseudo-internal API to determine whether to enforce UTF-8
|
// EnforceUTF8 is a pseudo-internal API to determine whether to enforce UTF-8
|
||||||
// validation for the string field. This exists for Google-internal use only
|
// validation for the string field. This exists for Google-internal use only
|
||||||
@ -336,21 +336,21 @@ func (fd *Field) EnforceUTF8() bool {
|
|||||||
if fd.L1.HasEnforceUTF8 {
|
if fd.L1.HasEnforceUTF8 {
|
||||||
return fd.L1.EnforceUTF8
|
return fd.L1.EnforceUTF8
|
||||||
}
|
}
|
||||||
return fd.L0.ParentFile.L1.Syntax == pref.Proto3
|
return fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3
|
||||||
}
|
}
|
||||||
|
|
||||||
func (od *Oneof) IsSynthetic() bool {
|
func (od *Oneof) IsSynthetic() bool {
|
||||||
return od.L0.ParentFile.L1.Syntax == pref.Proto3 && len(od.L1.Fields.List) == 1 && od.L1.Fields.List[0].HasOptionalKeyword()
|
return od.L0.ParentFile.L1.Syntax == protoreflect.Proto3 && len(od.L1.Fields.List) == 1 && od.L1.Fields.List[0].HasOptionalKeyword()
|
||||||
}
|
}
|
||||||
func (od *Oneof) Options() pref.ProtoMessage {
|
func (od *Oneof) Options() protoreflect.ProtoMessage {
|
||||||
if f := od.L1.Options; f != nil {
|
if f := od.L1.Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Oneof
|
return descopts.Oneof
|
||||||
}
|
}
|
||||||
func (od *Oneof) Fields() pref.FieldDescriptors { return &od.L1.Fields }
|
func (od *Oneof) Fields() protoreflect.FieldDescriptors { return &od.L1.Fields }
|
||||||
func (od *Oneof) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, od) }
|
func (od *Oneof) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, od) }
|
||||||
func (od *Oneof) ProtoType(pref.OneofDescriptor) {}
|
func (od *Oneof) ProtoType(protoreflect.OneofDescriptor) {}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Extension struct {
|
Extension struct {
|
||||||
@ -359,54 +359,56 @@ type (
|
|||||||
L2 *ExtensionL2 // protected by fileDesc.once
|
L2 *ExtensionL2 // protected by fileDesc.once
|
||||||
}
|
}
|
||||||
ExtensionL1 struct {
|
ExtensionL1 struct {
|
||||||
Number pref.FieldNumber
|
Number protoreflect.FieldNumber
|
||||||
Extendee pref.MessageDescriptor
|
Extendee protoreflect.MessageDescriptor
|
||||||
Cardinality pref.Cardinality
|
Cardinality protoreflect.Cardinality
|
||||||
Kind pref.Kind
|
Kind protoreflect.Kind
|
||||||
}
|
}
|
||||||
ExtensionL2 struct {
|
ExtensionL2 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
StringName stringName
|
StringName stringName
|
||||||
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
||||||
IsPacked bool // promoted from google.protobuf.FieldOptions
|
IsPacked bool // promoted from google.protobuf.FieldOptions
|
||||||
Default defaultValue
|
Default defaultValue
|
||||||
Enum pref.EnumDescriptor
|
Enum protoreflect.EnumDescriptor
|
||||||
Message pref.MessageDescriptor
|
Message protoreflect.MessageDescriptor
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (xd *Extension) Options() pref.ProtoMessage {
|
func (xd *Extension) Options() protoreflect.ProtoMessage {
|
||||||
if f := xd.lazyInit().Options; f != nil {
|
if f := xd.lazyInit().Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Field
|
return descopts.Field
|
||||||
}
|
}
|
||||||
func (xd *Extension) Number() pref.FieldNumber { return xd.L1.Number }
|
func (xd *Extension) Number() protoreflect.FieldNumber { return xd.L1.Number }
|
||||||
func (xd *Extension) Cardinality() pref.Cardinality { return xd.L1.Cardinality }
|
func (xd *Extension) Cardinality() protoreflect.Cardinality { return xd.L1.Cardinality }
|
||||||
func (xd *Extension) Kind() pref.Kind { return xd.L1.Kind }
|
func (xd *Extension) Kind() protoreflect.Kind { return xd.L1.Kind }
|
||||||
func (xd *Extension) HasJSONName() bool { return xd.lazyInit().StringName.hasJSON }
|
func (xd *Extension) HasJSONName() bool { return xd.lazyInit().StringName.hasJSON }
|
||||||
func (xd *Extension) JSONName() string { return xd.lazyInit().StringName.getJSON(xd) }
|
func (xd *Extension) JSONName() string { return xd.lazyInit().StringName.getJSON(xd) }
|
||||||
func (xd *Extension) TextName() string { return xd.lazyInit().StringName.getText(xd) }
|
func (xd *Extension) TextName() string { return xd.lazyInit().StringName.getText(xd) }
|
||||||
func (xd *Extension) HasPresence() bool { return xd.L1.Cardinality != pref.Repeated }
|
func (xd *Extension) HasPresence() bool { return xd.L1.Cardinality != protoreflect.Repeated }
|
||||||
func (xd *Extension) HasOptionalKeyword() bool {
|
func (xd *Extension) HasOptionalKeyword() bool {
|
||||||
return (xd.L0.ParentFile.L1.Syntax == pref.Proto2 && xd.L1.Cardinality == pref.Optional) || xd.lazyInit().IsProto3Optional
|
return (xd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && xd.L1.Cardinality == protoreflect.Optional) || xd.lazyInit().IsProto3Optional
|
||||||
}
|
}
|
||||||
func (xd *Extension) IsPacked() bool { return xd.lazyInit().IsPacked }
|
func (xd *Extension) IsPacked() bool { return xd.lazyInit().IsPacked }
|
||||||
func (xd *Extension) IsExtension() bool { return true }
|
func (xd *Extension) IsExtension() bool { return true }
|
||||||
func (xd *Extension) IsWeak() bool { return false }
|
func (xd *Extension) IsWeak() bool { return false }
|
||||||
func (xd *Extension) IsList() bool { return xd.Cardinality() == pref.Repeated }
|
func (xd *Extension) IsList() bool { return xd.Cardinality() == protoreflect.Repeated }
|
||||||
func (xd *Extension) IsMap() bool { return false }
|
func (xd *Extension) IsMap() bool { return false }
|
||||||
func (xd *Extension) MapKey() pref.FieldDescriptor { return nil }
|
func (xd *Extension) MapKey() protoreflect.FieldDescriptor { return nil }
|
||||||
func (xd *Extension) MapValue() pref.FieldDescriptor { return nil }
|
func (xd *Extension) MapValue() protoreflect.FieldDescriptor { return nil }
|
||||||
func (xd *Extension) HasDefault() bool { return xd.lazyInit().Default.has }
|
func (xd *Extension) HasDefault() bool { return xd.lazyInit().Default.has }
|
||||||
func (xd *Extension) Default() pref.Value { return xd.lazyInit().Default.get(xd) }
|
func (xd *Extension) Default() protoreflect.Value { return xd.lazyInit().Default.get(xd) }
|
||||||
func (xd *Extension) DefaultEnumValue() pref.EnumValueDescriptor { return xd.lazyInit().Default.enum }
|
func (xd *Extension) DefaultEnumValue() protoreflect.EnumValueDescriptor {
|
||||||
func (xd *Extension) ContainingOneof() pref.OneofDescriptor { return nil }
|
return xd.lazyInit().Default.enum
|
||||||
func (xd *Extension) ContainingMessage() pref.MessageDescriptor { return xd.L1.Extendee }
|
}
|
||||||
func (xd *Extension) Enum() pref.EnumDescriptor { return xd.lazyInit().Enum }
|
func (xd *Extension) ContainingOneof() protoreflect.OneofDescriptor { return nil }
|
||||||
func (xd *Extension) Message() pref.MessageDescriptor { return xd.lazyInit().Message }
|
func (xd *Extension) ContainingMessage() protoreflect.MessageDescriptor { return xd.L1.Extendee }
|
||||||
|
func (xd *Extension) Enum() protoreflect.EnumDescriptor { return xd.lazyInit().Enum }
|
||||||
|
func (xd *Extension) Message() protoreflect.MessageDescriptor { return xd.lazyInit().Message }
|
||||||
func (xd *Extension) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, xd) }
|
func (xd *Extension) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, xd) }
|
||||||
func (xd *Extension) ProtoType(pref.FieldDescriptor) {}
|
func (xd *Extension) ProtoType(protoreflect.FieldDescriptor) {}
|
||||||
func (xd *Extension) ProtoInternal(pragma.DoNotImplement) {}
|
func (xd *Extension) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
func (xd *Extension) lazyInit() *ExtensionL2 {
|
func (xd *Extension) lazyInit() *ExtensionL2 {
|
||||||
xd.L0.ParentFile.lazyInit() // implicitly initializes L2
|
xd.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||||
@ -421,7 +423,7 @@ type (
|
|||||||
}
|
}
|
||||||
ServiceL1 struct{}
|
ServiceL1 struct{}
|
||||||
ServiceL2 struct {
|
ServiceL2 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Methods Methods
|
Methods Methods
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,48 +432,48 @@ type (
|
|||||||
L1 MethodL1
|
L1 MethodL1
|
||||||
}
|
}
|
||||||
MethodL1 struct {
|
MethodL1 struct {
|
||||||
Options func() pref.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Input pref.MessageDescriptor
|
Input protoreflect.MessageDescriptor
|
||||||
Output pref.MessageDescriptor
|
Output protoreflect.MessageDescriptor
|
||||||
IsStreamingClient bool
|
IsStreamingClient bool
|
||||||
IsStreamingServer bool
|
IsStreamingServer bool
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (sd *Service) Options() pref.ProtoMessage {
|
func (sd *Service) Options() protoreflect.ProtoMessage {
|
||||||
if f := sd.lazyInit().Options; f != nil {
|
if f := sd.lazyInit().Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Service
|
return descopts.Service
|
||||||
}
|
}
|
||||||
func (sd *Service) Methods() pref.MethodDescriptors { return &sd.lazyInit().Methods }
|
func (sd *Service) Methods() protoreflect.MethodDescriptors { return &sd.lazyInit().Methods }
|
||||||
func (sd *Service) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, sd) }
|
func (sd *Service) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, sd) }
|
||||||
func (sd *Service) ProtoType(pref.ServiceDescriptor) {}
|
func (sd *Service) ProtoType(protoreflect.ServiceDescriptor) {}
|
||||||
func (sd *Service) ProtoInternal(pragma.DoNotImplement) {}
|
func (sd *Service) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
func (sd *Service) lazyInit() *ServiceL2 {
|
func (sd *Service) lazyInit() *ServiceL2 {
|
||||||
sd.L0.ParentFile.lazyInit() // implicitly initializes L2
|
sd.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||||
return sd.L2
|
return sd.L2
|
||||||
}
|
}
|
||||||
|
|
||||||
func (md *Method) Options() pref.ProtoMessage {
|
func (md *Method) Options() protoreflect.ProtoMessage {
|
||||||
if f := md.L1.Options; f != nil {
|
if f := md.L1.Options; f != nil {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
return descopts.Method
|
return descopts.Method
|
||||||
}
|
}
|
||||||
func (md *Method) Input() pref.MessageDescriptor { return md.L1.Input }
|
func (md *Method) Input() protoreflect.MessageDescriptor { return md.L1.Input }
|
||||||
func (md *Method) Output() pref.MessageDescriptor { return md.L1.Output }
|
func (md *Method) Output() protoreflect.MessageDescriptor { return md.L1.Output }
|
||||||
func (md *Method) IsStreamingClient() bool { return md.L1.IsStreamingClient }
|
func (md *Method) IsStreamingClient() bool { return md.L1.IsStreamingClient }
|
||||||
func (md *Method) IsStreamingServer() bool { return md.L1.IsStreamingServer }
|
func (md *Method) IsStreamingServer() bool { return md.L1.IsStreamingServer }
|
||||||
func (md *Method) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
func (md *Method) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
||||||
func (md *Method) ProtoType(pref.MethodDescriptor) {}
|
func (md *Method) ProtoType(protoreflect.MethodDescriptor) {}
|
||||||
func (md *Method) ProtoInternal(pragma.DoNotImplement) {}
|
func (md *Method) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
// Surrogate files are can be used to create standalone descriptors
|
// Surrogate files are can be used to create standalone descriptors
|
||||||
// where the syntax is only information derived from the parent file.
|
// where the syntax is only information derived from the parent file.
|
||||||
var (
|
var (
|
||||||
SurrogateProto2 = &File{L1: FileL1{Syntax: pref.Proto2}, L2: &FileL2{}}
|
SurrogateProto2 = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}}
|
||||||
SurrogateProto3 = &File{L1: FileL1{Syntax: pref.Proto3}, L2: &FileL2{}}
|
SurrogateProto3 = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}}
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -479,24 +481,24 @@ type (
|
|||||||
L0 BaseL0
|
L0 BaseL0
|
||||||
}
|
}
|
||||||
BaseL0 struct {
|
BaseL0 struct {
|
||||||
FullName pref.FullName // must be populated
|
FullName protoreflect.FullName // must be populated
|
||||||
ParentFile *File // must be populated
|
ParentFile *File // must be populated
|
||||||
Parent pref.Descriptor
|
Parent protoreflect.Descriptor
|
||||||
Index int
|
Index int
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (d *Base) Name() pref.Name { return d.L0.FullName.Name() }
|
func (d *Base) Name() protoreflect.Name { return d.L0.FullName.Name() }
|
||||||
func (d *Base) FullName() pref.FullName { return d.L0.FullName }
|
func (d *Base) FullName() protoreflect.FullName { return d.L0.FullName }
|
||||||
func (d *Base) ParentFile() pref.FileDescriptor {
|
func (d *Base) ParentFile() protoreflect.FileDescriptor {
|
||||||
if d.L0.ParentFile == SurrogateProto2 || d.L0.ParentFile == SurrogateProto3 {
|
if d.L0.ParentFile == SurrogateProto2 || d.L0.ParentFile == SurrogateProto3 {
|
||||||
return nil // surrogate files are not real parents
|
return nil // surrogate files are not real parents
|
||||||
}
|
}
|
||||||
return d.L0.ParentFile
|
return d.L0.ParentFile
|
||||||
}
|
}
|
||||||
func (d *Base) Parent() pref.Descriptor { return d.L0.Parent }
|
func (d *Base) Parent() protoreflect.Descriptor { return d.L0.Parent }
|
||||||
func (d *Base) Index() int { return d.L0.Index }
|
func (d *Base) Index() int { return d.L0.Index }
|
||||||
func (d *Base) Syntax() pref.Syntax { return d.L0.ParentFile.Syntax() }
|
func (d *Base) Syntax() protoreflect.Syntax { return d.L0.ParentFile.Syntax() }
|
||||||
func (d *Base) IsPlaceholder() bool { return false }
|
func (d *Base) IsPlaceholder() bool { return false }
|
||||||
func (d *Base) ProtoInternal(pragma.DoNotImplement) {}
|
func (d *Base) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
@ -513,7 +515,7 @@ func (s *stringName) InitJSON(name string) {
|
|||||||
s.nameJSON = name
|
s.nameJSON = name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stringName) lazyInit(fd pref.FieldDescriptor) *stringName {
|
func (s *stringName) lazyInit(fd protoreflect.FieldDescriptor) *stringName {
|
||||||
s.once.Do(func() {
|
s.once.Do(func() {
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
// For extensions, JSON and text are formatted the same way.
|
// For extensions, JSON and text are formatted the same way.
|
||||||
@ -533,7 +535,7 @@ func (s *stringName) lazyInit(fd pref.FieldDescriptor) *stringName {
|
|||||||
|
|
||||||
// Format the text name.
|
// Format the text name.
|
||||||
s.nameText = string(fd.Name())
|
s.nameText = string(fd.Name())
|
||||||
if fd.Kind() == pref.GroupKind {
|
if fd.Kind() == protoreflect.GroupKind {
|
||||||
s.nameText = string(fd.Message().Name())
|
s.nameText = string(fd.Message().Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -541,10 +543,10 @@ func (s *stringName) lazyInit(fd pref.FieldDescriptor) *stringName {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stringName) getJSON(fd pref.FieldDescriptor) string { return s.lazyInit(fd).nameJSON }
|
func (s *stringName) getJSON(fd protoreflect.FieldDescriptor) string { return s.lazyInit(fd).nameJSON }
|
||||||
func (s *stringName) getText(fd pref.FieldDescriptor) string { return s.lazyInit(fd).nameText }
|
func (s *stringName) getText(fd protoreflect.FieldDescriptor) string { return s.lazyInit(fd).nameText }
|
||||||
|
|
||||||
func DefaultValue(v pref.Value, ev pref.EnumValueDescriptor) defaultValue {
|
func DefaultValue(v protoreflect.Value, ev protoreflect.EnumValueDescriptor) defaultValue {
|
||||||
dv := defaultValue{has: v.IsValid(), val: v, enum: ev}
|
dv := defaultValue{has: v.IsValid(), val: v, enum: ev}
|
||||||
if b, ok := v.Interface().([]byte); ok {
|
if b, ok := v.Interface().([]byte); ok {
|
||||||
// Store a copy of the default bytes, so that we can detect
|
// Store a copy of the default bytes, so that we can detect
|
||||||
@ -554,9 +556,9 @@ func DefaultValue(v pref.Value, ev pref.EnumValueDescriptor) defaultValue {
|
|||||||
return dv
|
return dv
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) defaultValue {
|
func unmarshalDefault(b []byte, k protoreflect.Kind, pf *File, ed protoreflect.EnumDescriptor) defaultValue {
|
||||||
var evs pref.EnumValueDescriptors
|
var evs protoreflect.EnumValueDescriptors
|
||||||
if k == pref.EnumKind {
|
if k == protoreflect.EnumKind {
|
||||||
// If the enum is declared within the same file, be careful not to
|
// If the enum is declared within the same file, be careful not to
|
||||||
// blindly call the Values method, lest we bind ourselves in a deadlock.
|
// blindly call the Values method, lest we bind ourselves in a deadlock.
|
||||||
if e, ok := ed.(*Enum); ok && e.L0.ParentFile == pf {
|
if e, ok := ed.(*Enum); ok && e.L0.ParentFile == pf {
|
||||||
@ -567,9 +569,9 @@ func unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) d
|
|||||||
|
|
||||||
// If we are unable to resolve the enum dependency, use a placeholder
|
// If we are unable to resolve the enum dependency, use a placeholder
|
||||||
// enum value since we will not be able to parse the default value.
|
// enum value since we will not be able to parse the default value.
|
||||||
if ed.IsPlaceholder() && pref.Name(b).IsValid() {
|
if ed.IsPlaceholder() && protoreflect.Name(b).IsValid() {
|
||||||
v := pref.ValueOfEnum(0)
|
v := protoreflect.ValueOfEnum(0)
|
||||||
ev := PlaceholderEnumValue(ed.FullName().Parent().Append(pref.Name(b)))
|
ev := PlaceholderEnumValue(ed.FullName().Parent().Append(protoreflect.Name(b)))
|
||||||
return DefaultValue(v, ev)
|
return DefaultValue(v, ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -583,41 +585,41 @@ func unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) d
|
|||||||
|
|
||||||
type defaultValue struct {
|
type defaultValue struct {
|
||||||
has bool
|
has bool
|
||||||
val pref.Value
|
val protoreflect.Value
|
||||||
enum pref.EnumValueDescriptor
|
enum protoreflect.EnumValueDescriptor
|
||||||
bytes []byte
|
bytes []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dv *defaultValue) get(fd pref.FieldDescriptor) pref.Value {
|
func (dv *defaultValue) get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
// Return the zero value as the default if unpopulated.
|
// Return the zero value as the default if unpopulated.
|
||||||
if !dv.has {
|
if !dv.has {
|
||||||
if fd.Cardinality() == pref.Repeated {
|
if fd.Cardinality() == protoreflect.Repeated {
|
||||||
return pref.Value{}
|
return protoreflect.Value{}
|
||||||
}
|
}
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
return pref.ValueOfBool(false)
|
return protoreflect.ValueOfBool(false)
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
return pref.ValueOfInt32(0)
|
return protoreflect.ValueOfInt32(0)
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
return pref.ValueOfInt64(0)
|
return protoreflect.ValueOfInt64(0)
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
return pref.ValueOfUint32(0)
|
return protoreflect.ValueOfUint32(0)
|
||||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
return pref.ValueOfUint64(0)
|
return protoreflect.ValueOfUint64(0)
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
return pref.ValueOfFloat32(0)
|
return protoreflect.ValueOfFloat32(0)
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
return pref.ValueOfFloat64(0)
|
return protoreflect.ValueOfFloat64(0)
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
return pref.ValueOfString("")
|
return protoreflect.ValueOfString("")
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
return pref.ValueOfBytes(nil)
|
return protoreflect.ValueOfBytes(nil)
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if evs := fd.Enum().Values(); evs.Len() > 0 {
|
if evs := fd.Enum().Values(); evs.Len() > 0 {
|
||||||
return pref.ValueOfEnum(evs.Get(0).Number())
|
return protoreflect.ValueOfEnum(evs.Get(0).Number())
|
||||||
}
|
}
|
||||||
return pref.ValueOfEnum(0)
|
return protoreflect.ValueOfEnum(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
36
vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
generated
vendored
36
vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
generated
vendored
@ -10,7 +10,7 @@ import (
|
|||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fileRaw is a data struct used when initializing a file descriptor from
|
// fileRaw is a data struct used when initializing a file descriptor from
|
||||||
@ -95,7 +95,7 @@ func (fd *File) unmarshalSeed(b []byte) {
|
|||||||
sb := getBuilder()
|
sb := getBuilder()
|
||||||
defer putBuilder(sb)
|
defer putBuilder(sb)
|
||||||
|
|
||||||
var prevField pref.FieldNumber
|
var prevField protoreflect.FieldNumber
|
||||||
var numEnums, numMessages, numExtensions, numServices int
|
var numEnums, numMessages, numExtensions, numServices int
|
||||||
var posEnums, posMessages, posExtensions, posServices int
|
var posEnums, posMessages, posExtensions, posServices int
|
||||||
b0 := b
|
b0 := b
|
||||||
@ -110,16 +110,16 @@ func (fd *File) unmarshalSeed(b []byte) {
|
|||||||
case genid.FileDescriptorProto_Syntax_field_number:
|
case genid.FileDescriptorProto_Syntax_field_number:
|
||||||
switch string(v) {
|
switch string(v) {
|
||||||
case "proto2":
|
case "proto2":
|
||||||
fd.L1.Syntax = pref.Proto2
|
fd.L1.Syntax = protoreflect.Proto2
|
||||||
case "proto3":
|
case "proto3":
|
||||||
fd.L1.Syntax = pref.Proto3
|
fd.L1.Syntax = protoreflect.Proto3
|
||||||
default:
|
default:
|
||||||
panic("invalid syntax")
|
panic("invalid syntax")
|
||||||
}
|
}
|
||||||
case genid.FileDescriptorProto_Name_field_number:
|
case genid.FileDescriptorProto_Name_field_number:
|
||||||
fd.L1.Path = sb.MakeString(v)
|
fd.L1.Path = sb.MakeString(v)
|
||||||
case genid.FileDescriptorProto_Package_field_number:
|
case genid.FileDescriptorProto_Package_field_number:
|
||||||
fd.L1.Package = pref.FullName(sb.MakeString(v))
|
fd.L1.Package = protoreflect.FullName(sb.MakeString(v))
|
||||||
case genid.FileDescriptorProto_EnumType_field_number:
|
case genid.FileDescriptorProto_EnumType_field_number:
|
||||||
if prevField != genid.FileDescriptorProto_EnumType_field_number {
|
if prevField != genid.FileDescriptorProto_EnumType_field_number {
|
||||||
if numEnums > 0 {
|
if numEnums > 0 {
|
||||||
@ -163,7 +163,7 @@ func (fd *File) unmarshalSeed(b []byte) {
|
|||||||
|
|
||||||
// If syntax is missing, it is assumed to be proto2.
|
// If syntax is missing, it is assumed to be proto2.
|
||||||
if fd.L1.Syntax == 0 {
|
if fd.L1.Syntax == 0 {
|
||||||
fd.L1.Syntax = pref.Proto2
|
fd.L1.Syntax = protoreflect.Proto2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must allocate all declarations before parsing each descriptor type
|
// Must allocate all declarations before parsing each descriptor type
|
||||||
@ -219,7 +219,7 @@ func (fd *File) unmarshalSeed(b []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
ed.L0.ParentFile = pf
|
ed.L0.ParentFile = pf
|
||||||
ed.L0.Parent = pd
|
ed.L0.Parent = pd
|
||||||
ed.L0.Index = i
|
ed.L0.Index = i
|
||||||
@ -271,12 +271,12 @@ func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Desc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
md.L0.ParentFile = pf
|
md.L0.ParentFile = pf
|
||||||
md.L0.Parent = pd
|
md.L0.Parent = pd
|
||||||
md.L0.Index = i
|
md.L0.Index = i
|
||||||
|
|
||||||
var prevField pref.FieldNumber
|
var prevField protoreflect.FieldNumber
|
||||||
var numEnums, numMessages, numExtensions int
|
var numEnums, numMessages, numExtensions int
|
||||||
var posEnums, posMessages, posExtensions int
|
var posEnums, posMessages, posExtensions int
|
||||||
b0 := b
|
b0 := b
|
||||||
@ -387,7 +387,7 @@ func (md *Message) unmarshalSeedOptions(b []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
xd.L0.ParentFile = pf
|
xd.L0.ParentFile = pf
|
||||||
xd.L0.Parent = pd
|
xd.L0.Parent = pd
|
||||||
xd.L0.Index = i
|
xd.L0.Index = i
|
||||||
@ -401,11 +401,11 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref
|
|||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.FieldDescriptorProto_Number_field_number:
|
case genid.FieldDescriptorProto_Number_field_number:
|
||||||
xd.L1.Number = pref.FieldNumber(v)
|
xd.L1.Number = protoreflect.FieldNumber(v)
|
||||||
case genid.FieldDescriptorProto_Label_field_number:
|
case genid.FieldDescriptorProto_Label_field_number:
|
||||||
xd.L1.Cardinality = pref.Cardinality(v)
|
xd.L1.Cardinality = protoreflect.Cardinality(v)
|
||||||
case genid.FieldDescriptorProto_Type_field_number:
|
case genid.FieldDescriptorProto_Type_field_number:
|
||||||
xd.L1.Kind = pref.Kind(v)
|
xd.L1.Kind = protoreflect.Kind(v)
|
||||||
}
|
}
|
||||||
case protowire.BytesType:
|
case protowire.BytesType:
|
||||||
v, m := protowire.ConsumeBytes(b)
|
v, m := protowire.ConsumeBytes(b)
|
||||||
@ -423,7 +423,7 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
sd.L0.ParentFile = pf
|
sd.L0.ParentFile = pf
|
||||||
sd.L0.Parent = pd
|
sd.L0.Parent = pd
|
||||||
sd.L0.Index = i
|
sd.L0.Index = i
|
||||||
@ -459,13 +459,13 @@ func putBuilder(b *strs.Builder) {
|
|||||||
|
|
||||||
// makeFullName converts b to a protoreflect.FullName,
|
// makeFullName converts b to a protoreflect.FullName,
|
||||||
// where b must start with a leading dot.
|
// where b must start with a leading dot.
|
||||||
func makeFullName(sb *strs.Builder, b []byte) pref.FullName {
|
func makeFullName(sb *strs.Builder, b []byte) protoreflect.FullName {
|
||||||
if len(b) == 0 || b[0] != '.' {
|
if len(b) == 0 || b[0] != '.' {
|
||||||
panic("name reference must be fully qualified")
|
panic("name reference must be fully qualified")
|
||||||
}
|
}
|
||||||
return pref.FullName(sb.MakeString(b[1:]))
|
return protoreflect.FullName(sb.MakeString(b[1:]))
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendFullName(sb *strs.Builder, prefix pref.FullName, suffix []byte) pref.FullName {
|
func appendFullName(sb *strs.Builder, prefix protoreflect.FullName, suffix []byte) protoreflect.FullName {
|
||||||
return sb.AppendFullName(prefix, pref.Name(strs.UnsafeString(suffix)))
|
return sb.AppendFullName(prefix, protoreflect.Name(strs.UnsafeString(suffix)))
|
||||||
}
|
}
|
||||||
|
80
vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
generated
vendored
80
vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
generated
vendored
@ -13,7 +13,7 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (fd *File) lazyRawInit() {
|
func (fd *File) lazyRawInit() {
|
||||||
@ -39,10 +39,10 @@ func (file *File) resolveMessages() {
|
|||||||
|
|
||||||
// Resolve message field dependency.
|
// Resolve message field dependency.
|
||||||
switch fd.L1.Kind {
|
switch fd.L1.Kind {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
fd.L1.Enum = file.resolveEnumDependency(fd.L1.Enum, listFieldDeps, depIdx)
|
fd.L1.Enum = file.resolveEnumDependency(fd.L1.Enum, listFieldDeps, depIdx)
|
||||||
depIdx++
|
depIdx++
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
fd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx)
|
fd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx)
|
||||||
depIdx++
|
depIdx++
|
||||||
}
|
}
|
||||||
@ -62,10 +62,10 @@ func (file *File) resolveExtensions() {
|
|||||||
|
|
||||||
// Resolve extension field dependency.
|
// Resolve extension field dependency.
|
||||||
switch xd.L1.Kind {
|
switch xd.L1.Kind {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
xd.L2.Enum = file.resolveEnumDependency(xd.L2.Enum, listExtDeps, depIdx)
|
xd.L2.Enum = file.resolveEnumDependency(xd.L2.Enum, listExtDeps, depIdx)
|
||||||
depIdx++
|
depIdx++
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
xd.L2.Message = file.resolveMessageDependency(xd.L2.Message, listExtDeps, depIdx)
|
xd.L2.Message = file.resolveMessageDependency(xd.L2.Message, listExtDeps, depIdx)
|
||||||
depIdx++
|
depIdx++
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ func (file *File) resolveServices() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (file *File) resolveEnumDependency(ed pref.EnumDescriptor, i, j int32) pref.EnumDescriptor {
|
func (file *File) resolveEnumDependency(ed protoreflect.EnumDescriptor, i, j int32) protoreflect.EnumDescriptor {
|
||||||
r := file.builder.FileRegistry
|
r := file.builder.FileRegistry
|
||||||
if r, ok := r.(resolverByIndex); ok {
|
if r, ok := r.(resolverByIndex); ok {
|
||||||
if ed2 := r.FindEnumByIndex(i, j, file.allEnums, file.allMessages); ed2 != nil {
|
if ed2 := r.FindEnumByIndex(i, j, file.allEnums, file.allMessages); ed2 != nil {
|
||||||
@ -105,12 +105,12 @@ func (file *File) resolveEnumDependency(ed pref.EnumDescriptor, i, j int32) pref
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if d, _ := r.FindDescriptorByName(ed.FullName()); d != nil {
|
if d, _ := r.FindDescriptorByName(ed.FullName()); d != nil {
|
||||||
return d.(pref.EnumDescriptor)
|
return d.(protoreflect.EnumDescriptor)
|
||||||
}
|
}
|
||||||
return ed
|
return ed
|
||||||
}
|
}
|
||||||
|
|
||||||
func (file *File) resolveMessageDependency(md pref.MessageDescriptor, i, j int32) pref.MessageDescriptor {
|
func (file *File) resolveMessageDependency(md protoreflect.MessageDescriptor, i, j int32) protoreflect.MessageDescriptor {
|
||||||
r := file.builder.FileRegistry
|
r := file.builder.FileRegistry
|
||||||
if r, ok := r.(resolverByIndex); ok {
|
if r, ok := r.(resolverByIndex); ok {
|
||||||
if md2 := r.FindMessageByIndex(i, j, file.allEnums, file.allMessages); md2 != nil {
|
if md2 := r.FindMessageByIndex(i, j, file.allEnums, file.allMessages); md2 != nil {
|
||||||
@ -123,7 +123,7 @@ func (file *File) resolveMessageDependency(md pref.MessageDescriptor, i, j int32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if d, _ := r.FindDescriptorByName(md.FullName()); d != nil {
|
if d, _ := r.FindDescriptorByName(md.FullName()); d != nil {
|
||||||
return d.(pref.MessageDescriptor)
|
return d.(protoreflect.MessageDescriptor)
|
||||||
}
|
}
|
||||||
return md
|
return md
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ func (fd *File) unmarshalFull(b []byte) {
|
|||||||
if imp == nil {
|
if imp == nil {
|
||||||
imp = PlaceholderFile(path)
|
imp = PlaceholderFile(path)
|
||||||
}
|
}
|
||||||
fd.L2.Imports = append(fd.L2.Imports, pref.FileImport{FileDescriptor: imp})
|
fd.L2.Imports = append(fd.L2.Imports, protoreflect.FileImport{FileDescriptor: imp})
|
||||||
case genid.FileDescriptorProto_EnumType_field_number:
|
case genid.FileDescriptorProto_EnumType_field_number:
|
||||||
fd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)
|
fd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)
|
||||||
enumIdx++
|
enumIdx++
|
||||||
@ -199,7 +199,7 @@ func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {
|
|||||||
case genid.EnumDescriptorProto_Value_field_number:
|
case genid.EnumDescriptorProto_Value_field_number:
|
||||||
rawValues = append(rawValues, v)
|
rawValues = append(rawValues, v)
|
||||||
case genid.EnumDescriptorProto_ReservedName_field_number:
|
case genid.EnumDescriptorProto_ReservedName_field_number:
|
||||||
ed.L2.ReservedNames.List = append(ed.L2.ReservedNames.List, pref.Name(sb.MakeString(v)))
|
ed.L2.ReservedNames.List = append(ed.L2.ReservedNames.List, protoreflect.Name(sb.MakeString(v)))
|
||||||
case genid.EnumDescriptorProto_ReservedRange_field_number:
|
case genid.EnumDescriptorProto_ReservedRange_field_number:
|
||||||
ed.L2.ReservedRanges.List = append(ed.L2.ReservedRanges.List, unmarshalEnumReservedRange(v))
|
ed.L2.ReservedRanges.List = append(ed.L2.ReservedRanges.List, unmarshalEnumReservedRange(v))
|
||||||
case genid.EnumDescriptorProto_Options_field_number:
|
case genid.EnumDescriptorProto_Options_field_number:
|
||||||
@ -219,7 +219,7 @@ func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {
|
|||||||
ed.L2.Options = ed.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Enum, rawOptions)
|
ed.L2.Options = ed.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Enum, rawOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
|
func unmarshalEnumReservedRange(b []byte) (r [2]protoreflect.EnumNumber) {
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
b = b[n:]
|
b = b[n:]
|
||||||
@ -229,9 +229,9 @@ func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
|
|||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.EnumDescriptorProto_EnumReservedRange_Start_field_number:
|
case genid.EnumDescriptorProto_EnumReservedRange_Start_field_number:
|
||||||
r[0] = pref.EnumNumber(v)
|
r[0] = protoreflect.EnumNumber(v)
|
||||||
case genid.EnumDescriptorProto_EnumReservedRange_End_field_number:
|
case genid.EnumDescriptorProto_EnumReservedRange_End_field_number:
|
||||||
r[1] = pref.EnumNumber(v)
|
r[1] = protoreflect.EnumNumber(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
@ -241,7 +241,7 @@ func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
|
|||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
vd.L0.ParentFile = pf
|
vd.L0.ParentFile = pf
|
||||||
vd.L0.Parent = pd
|
vd.L0.Parent = pd
|
||||||
vd.L0.Index = i
|
vd.L0.Index = i
|
||||||
@ -256,7 +256,7 @@ func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref
|
|||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.EnumValueDescriptorProto_Number_field_number:
|
case genid.EnumValueDescriptorProto_Number_field_number:
|
||||||
vd.L1.Number = pref.EnumNumber(v)
|
vd.L1.Number = protoreflect.EnumNumber(v)
|
||||||
}
|
}
|
||||||
case protowire.BytesType:
|
case protowire.BytesType:
|
||||||
v, m := protowire.ConsumeBytes(b)
|
v, m := protowire.ConsumeBytes(b)
|
||||||
@ -294,7 +294,7 @@ func (md *Message) unmarshalFull(b []byte, sb *strs.Builder) {
|
|||||||
case genid.DescriptorProto_OneofDecl_field_number:
|
case genid.DescriptorProto_OneofDecl_field_number:
|
||||||
rawOneofs = append(rawOneofs, v)
|
rawOneofs = append(rawOneofs, v)
|
||||||
case genid.DescriptorProto_ReservedName_field_number:
|
case genid.DescriptorProto_ReservedName_field_number:
|
||||||
md.L2.ReservedNames.List = append(md.L2.ReservedNames.List, pref.Name(sb.MakeString(v)))
|
md.L2.ReservedNames.List = append(md.L2.ReservedNames.List, protoreflect.Name(sb.MakeString(v)))
|
||||||
case genid.DescriptorProto_ReservedRange_field_number:
|
case genid.DescriptorProto_ReservedRange_field_number:
|
||||||
md.L2.ReservedRanges.List = append(md.L2.ReservedRanges.List, unmarshalMessageReservedRange(v))
|
md.L2.ReservedRanges.List = append(md.L2.ReservedRanges.List, unmarshalMessageReservedRange(v))
|
||||||
case genid.DescriptorProto_ExtensionRange_field_number:
|
case genid.DescriptorProto_ExtensionRange_field_number:
|
||||||
@ -326,7 +326,7 @@ func (md *Message) unmarshalFull(b []byte, sb *strs.Builder) {
|
|||||||
for i, b := range rawFields {
|
for i, b := range rawFields {
|
||||||
fd := &md.L2.Fields.List[i]
|
fd := &md.L2.Fields.List[i]
|
||||||
fd.unmarshalFull(b, sb, md.L0.ParentFile, md, i)
|
fd.unmarshalFull(b, sb, md.L0.ParentFile, md, i)
|
||||||
if fd.L1.Cardinality == pref.Required {
|
if fd.L1.Cardinality == protoreflect.Required {
|
||||||
md.L2.RequiredNumbers.List = append(md.L2.RequiredNumbers.List, fd.L1.Number)
|
md.L2.RequiredNumbers.List = append(md.L2.RequiredNumbers.List, fd.L1.Number)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -359,7 +359,7 @@ func (md *Message) unmarshalOptions(b []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
|
func unmarshalMessageReservedRange(b []byte) (r [2]protoreflect.FieldNumber) {
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
b = b[n:]
|
b = b[n:]
|
||||||
@ -369,9 +369,9 @@ func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
|
|||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.DescriptorProto_ReservedRange_Start_field_number:
|
case genid.DescriptorProto_ReservedRange_Start_field_number:
|
||||||
r[0] = pref.FieldNumber(v)
|
r[0] = protoreflect.FieldNumber(v)
|
||||||
case genid.DescriptorProto_ReservedRange_End_field_number:
|
case genid.DescriptorProto_ReservedRange_End_field_number:
|
||||||
r[1] = pref.FieldNumber(v)
|
r[1] = protoreflect.FieldNumber(v)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
@ -381,7 +381,7 @@ func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
|
|||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions []byte) {
|
func unmarshalMessageExtensionRange(b []byte) (r [2]protoreflect.FieldNumber, rawOptions []byte) {
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
b = b[n:]
|
b = b[n:]
|
||||||
@ -391,9 +391,9 @@ func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions
|
|||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.DescriptorProto_ExtensionRange_Start_field_number:
|
case genid.DescriptorProto_ExtensionRange_Start_field_number:
|
||||||
r[0] = pref.FieldNumber(v)
|
r[0] = protoreflect.FieldNumber(v)
|
||||||
case genid.DescriptorProto_ExtensionRange_End_field_number:
|
case genid.DescriptorProto_ExtensionRange_End_field_number:
|
||||||
r[1] = pref.FieldNumber(v)
|
r[1] = protoreflect.FieldNumber(v)
|
||||||
}
|
}
|
||||||
case protowire.BytesType:
|
case protowire.BytesType:
|
||||||
v, m := protowire.ConsumeBytes(b)
|
v, m := protowire.ConsumeBytes(b)
|
||||||
@ -410,7 +410,7 @@ func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions
|
|||||||
return r, rawOptions
|
return r, rawOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
fd.L0.ParentFile = pf
|
fd.L0.ParentFile = pf
|
||||||
fd.L0.Parent = pd
|
fd.L0.Parent = pd
|
||||||
fd.L0.Index = i
|
fd.L0.Index = i
|
||||||
@ -426,11 +426,11 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Des
|
|||||||
b = b[m:]
|
b = b[m:]
|
||||||
switch num {
|
switch num {
|
||||||
case genid.FieldDescriptorProto_Number_field_number:
|
case genid.FieldDescriptorProto_Number_field_number:
|
||||||
fd.L1.Number = pref.FieldNumber(v)
|
fd.L1.Number = protoreflect.FieldNumber(v)
|
||||||
case genid.FieldDescriptorProto_Label_field_number:
|
case genid.FieldDescriptorProto_Label_field_number:
|
||||||
fd.L1.Cardinality = pref.Cardinality(v)
|
fd.L1.Cardinality = protoreflect.Cardinality(v)
|
||||||
case genid.FieldDescriptorProto_Type_field_number:
|
case genid.FieldDescriptorProto_Type_field_number:
|
||||||
fd.L1.Kind = pref.Kind(v)
|
fd.L1.Kind = protoreflect.Kind(v)
|
||||||
case genid.FieldDescriptorProto_OneofIndex_field_number:
|
case genid.FieldDescriptorProto_OneofIndex_field_number:
|
||||||
// In Message.unmarshalFull, we allocate slices for both
|
// In Message.unmarshalFull, we allocate slices for both
|
||||||
// the field and oneof descriptors before unmarshaling either
|
// the field and oneof descriptors before unmarshaling either
|
||||||
@ -453,7 +453,7 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Des
|
|||||||
case genid.FieldDescriptorProto_JsonName_field_number:
|
case genid.FieldDescriptorProto_JsonName_field_number:
|
||||||
fd.L1.StringName.InitJSON(sb.MakeString(v))
|
fd.L1.StringName.InitJSON(sb.MakeString(v))
|
||||||
case genid.FieldDescriptorProto_DefaultValue_field_number:
|
case genid.FieldDescriptorProto_DefaultValue_field_number:
|
||||||
fd.L1.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages
|
fd.L1.Default.val = protoreflect.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages
|
||||||
case genid.FieldDescriptorProto_TypeName_field_number:
|
case genid.FieldDescriptorProto_TypeName_field_number:
|
||||||
rawTypeName = v
|
rawTypeName = v
|
||||||
case genid.FieldDescriptorProto_Options_field_number:
|
case genid.FieldDescriptorProto_Options_field_number:
|
||||||
@ -468,9 +468,9 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Des
|
|||||||
if rawTypeName != nil {
|
if rawTypeName != nil {
|
||||||
name := makeFullName(sb, rawTypeName)
|
name := makeFullName(sb, rawTypeName)
|
||||||
switch fd.L1.Kind {
|
switch fd.L1.Kind {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
fd.L1.Enum = PlaceholderEnum(name)
|
fd.L1.Enum = PlaceholderEnum(name)
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
fd.L1.Message = PlaceholderMessage(name)
|
fd.L1.Message = PlaceholderMessage(name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -504,7 +504,7 @@ func (fd *Field) unmarshalOptions(b []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
od.L0.ParentFile = pf
|
od.L0.ParentFile = pf
|
||||||
od.L0.Parent = pd
|
od.L0.Parent = pd
|
||||||
od.L0.Index = i
|
od.L0.Index = i
|
||||||
@ -553,7 +553,7 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
|
|||||||
case genid.FieldDescriptorProto_JsonName_field_number:
|
case genid.FieldDescriptorProto_JsonName_field_number:
|
||||||
xd.L2.StringName.InitJSON(sb.MakeString(v))
|
xd.L2.StringName.InitJSON(sb.MakeString(v))
|
||||||
case genid.FieldDescriptorProto_DefaultValue_field_number:
|
case genid.FieldDescriptorProto_DefaultValue_field_number:
|
||||||
xd.L2.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions
|
xd.L2.Default.val = protoreflect.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions
|
||||||
case genid.FieldDescriptorProto_TypeName_field_number:
|
case genid.FieldDescriptorProto_TypeName_field_number:
|
||||||
rawTypeName = v
|
rawTypeName = v
|
||||||
case genid.FieldDescriptorProto_Options_field_number:
|
case genid.FieldDescriptorProto_Options_field_number:
|
||||||
@ -568,9 +568,9 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
|
|||||||
if rawTypeName != nil {
|
if rawTypeName != nil {
|
||||||
name := makeFullName(sb, rawTypeName)
|
name := makeFullName(sb, rawTypeName)
|
||||||
switch xd.L1.Kind {
|
switch xd.L1.Kind {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
xd.L2.Enum = PlaceholderEnum(name)
|
xd.L2.Enum = PlaceholderEnum(name)
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
xd.L2.Message = PlaceholderMessage(name)
|
xd.L2.Message = PlaceholderMessage(name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -627,7 +627,7 @@ func (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) {
|
|||||||
sd.L2.Options = sd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Service, rawOptions)
|
sd.L2.Options = sd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Service, rawOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (md *Method) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
func (md *Method) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
md.L0.ParentFile = pf
|
md.L0.ParentFile = pf
|
||||||
md.L0.Parent = pd
|
md.L0.Parent = pd
|
||||||
md.L0.Index = i
|
md.L0.Index = i
|
||||||
@ -680,18 +680,18 @@ func appendOptions(dst, src []byte) []byte {
|
|||||||
//
|
//
|
||||||
// The type of message to unmarshal to is passed as a pointer since the
|
// The type of message to unmarshal to is passed as a pointer since the
|
||||||
// vars in descopts may not yet be populated at the time this function is called.
|
// vars in descopts may not yet be populated at the time this function is called.
|
||||||
func (db *Builder) optionsUnmarshaler(p *pref.ProtoMessage, b []byte) func() pref.ProtoMessage {
|
func (db *Builder) optionsUnmarshaler(p *protoreflect.ProtoMessage, b []byte) func() protoreflect.ProtoMessage {
|
||||||
if b == nil {
|
if b == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var opts pref.ProtoMessage
|
var opts protoreflect.ProtoMessage
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
return func() pref.ProtoMessage {
|
return func() protoreflect.ProtoMessage {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
if *p == nil {
|
if *p == nil {
|
||||||
panic("Descriptor.Options called without importing the descriptor package")
|
panic("Descriptor.Options called without importing the descriptor package")
|
||||||
}
|
}
|
||||||
opts = reflect.New(reflect.TypeOf(*p).Elem()).Interface().(pref.ProtoMessage)
|
opts = reflect.New(reflect.TypeOf(*p).Elem()).Interface().(protoreflect.ProtoMessage)
|
||||||
if err := (proto.UnmarshalOptions{
|
if err := (proto.UnmarshalOptions{
|
||||||
AllowPartial: true,
|
AllowPartial: true,
|
||||||
Resolver: db.TypeResolver,
|
Resolver: db.TypeResolver,
|
||||||
|
153
vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go
generated
vendored
153
vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go
generated
vendored
@ -17,31 +17,30 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type FileImports []pref.FileImport
|
type FileImports []protoreflect.FileImport
|
||||||
|
|
||||||
func (p *FileImports) Len() int { return len(*p) }
|
func (p *FileImports) Len() int { return len(*p) }
|
||||||
func (p *FileImports) Get(i int) pref.FileImport { return (*p)[i] }
|
func (p *FileImports) Get(i int) protoreflect.FileImport { return (*p)[i] }
|
||||||
func (p *FileImports) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
func (p *FileImports) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
||||||
func (p *FileImports) ProtoInternal(pragma.DoNotImplement) {}
|
func (p *FileImports) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
type Names struct {
|
type Names struct {
|
||||||
List []pref.Name
|
List []protoreflect.Name
|
||||||
once sync.Once
|
once sync.Once
|
||||||
has map[pref.Name]int // protected by once
|
has map[protoreflect.Name]int // protected by once
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Names) Len() int { return len(p.List) }
|
func (p *Names) Len() int { return len(p.List) }
|
||||||
func (p *Names) Get(i int) pref.Name { return p.List[i] }
|
func (p *Names) Get(i int) protoreflect.Name { return p.List[i] }
|
||||||
func (p *Names) Has(s pref.Name) bool { return p.lazyInit().has[s] > 0 }
|
func (p *Names) Has(s protoreflect.Name) bool { return p.lazyInit().has[s] > 0 }
|
||||||
func (p *Names) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
func (p *Names) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
||||||
func (p *Names) ProtoInternal(pragma.DoNotImplement) {}
|
func (p *Names) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
func (p *Names) lazyInit() *Names {
|
func (p *Names) lazyInit() *Names {
|
||||||
p.once.Do(func() {
|
p.once.Do(func() {
|
||||||
if len(p.List) > 0 {
|
if len(p.List) > 0 {
|
||||||
p.has = make(map[pref.Name]int, len(p.List))
|
p.has = make(map[protoreflect.Name]int, len(p.List))
|
||||||
for _, s := range p.List {
|
for _, s := range p.List {
|
||||||
p.has[s] = p.has[s] + 1
|
p.has[s] = p.has[s] + 1
|
||||||
}
|
}
|
||||||
@ -67,14 +66,14 @@ func (p *Names) CheckValid() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type EnumRanges struct {
|
type EnumRanges struct {
|
||||||
List [][2]pref.EnumNumber // start inclusive; end inclusive
|
List [][2]protoreflect.EnumNumber // start inclusive; end inclusive
|
||||||
once sync.Once
|
once sync.Once
|
||||||
sorted [][2]pref.EnumNumber // protected by once
|
sorted [][2]protoreflect.EnumNumber // protected by once
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *EnumRanges) Len() int { return len(p.List) }
|
func (p *EnumRanges) Len() int { return len(p.List) }
|
||||||
func (p *EnumRanges) Get(i int) [2]pref.EnumNumber { return p.List[i] }
|
func (p *EnumRanges) Get(i int) [2]protoreflect.EnumNumber { return p.List[i] }
|
||||||
func (p *EnumRanges) Has(n pref.EnumNumber) bool {
|
func (p *EnumRanges) Has(n protoreflect.EnumNumber) bool {
|
||||||
for ls := p.lazyInit().sorted; len(ls) > 0; {
|
for ls := p.lazyInit().sorted; len(ls) > 0; {
|
||||||
i := len(ls) / 2
|
i := len(ls) / 2
|
||||||
switch r := enumRange(ls[i]); {
|
switch r := enumRange(ls[i]); {
|
||||||
@ -129,14 +128,14 @@ func (r enumRange) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FieldRanges struct {
|
type FieldRanges struct {
|
||||||
List [][2]pref.FieldNumber // start inclusive; end exclusive
|
List [][2]protoreflect.FieldNumber // start inclusive; end exclusive
|
||||||
once sync.Once
|
once sync.Once
|
||||||
sorted [][2]pref.FieldNumber // protected by once
|
sorted [][2]protoreflect.FieldNumber // protected by once
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *FieldRanges) Len() int { return len(p.List) }
|
func (p *FieldRanges) Len() int { return len(p.List) }
|
||||||
func (p *FieldRanges) Get(i int) [2]pref.FieldNumber { return p.List[i] }
|
func (p *FieldRanges) Get(i int) [2]protoreflect.FieldNumber { return p.List[i] }
|
||||||
func (p *FieldRanges) Has(n pref.FieldNumber) bool {
|
func (p *FieldRanges) Has(n protoreflect.FieldNumber) bool {
|
||||||
for ls := p.lazyInit().sorted; len(ls) > 0; {
|
for ls := p.lazyInit().sorted; len(ls) > 0; {
|
||||||
i := len(ls) / 2
|
i := len(ls) / 2
|
||||||
switch r := fieldRange(ls[i]); {
|
switch r := fieldRange(ls[i]); {
|
||||||
@ -221,17 +220,17 @@ func (r fieldRange) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FieldNumbers struct {
|
type FieldNumbers struct {
|
||||||
List []pref.FieldNumber
|
List []protoreflect.FieldNumber
|
||||||
once sync.Once
|
once sync.Once
|
||||||
has map[pref.FieldNumber]struct{} // protected by once
|
has map[protoreflect.FieldNumber]struct{} // protected by once
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *FieldNumbers) Len() int { return len(p.List) }
|
func (p *FieldNumbers) Len() int { return len(p.List) }
|
||||||
func (p *FieldNumbers) Get(i int) pref.FieldNumber { return p.List[i] }
|
func (p *FieldNumbers) Get(i int) protoreflect.FieldNumber { return p.List[i] }
|
||||||
func (p *FieldNumbers) Has(n pref.FieldNumber) bool {
|
func (p *FieldNumbers) Has(n protoreflect.FieldNumber) bool {
|
||||||
p.once.Do(func() {
|
p.once.Do(func() {
|
||||||
if len(p.List) > 0 {
|
if len(p.List) > 0 {
|
||||||
p.has = make(map[pref.FieldNumber]struct{}, len(p.List))
|
p.has = make(map[protoreflect.FieldNumber]struct{}, len(p.List))
|
||||||
for _, n := range p.List {
|
for _, n := range p.List {
|
||||||
p.has[n] = struct{}{}
|
p.has[n] = struct{}{}
|
||||||
}
|
}
|
||||||
@ -244,30 +243,38 @@ func (p *FieldNumbers) Format(s fmt.State, r rune) { descfmt.FormatList
|
|||||||
func (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement) {}
|
func (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
type OneofFields struct {
|
type OneofFields struct {
|
||||||
List []pref.FieldDescriptor
|
List []protoreflect.FieldDescriptor
|
||||||
once sync.Once
|
once sync.Once
|
||||||
byName map[pref.Name]pref.FieldDescriptor // protected by once
|
byName map[protoreflect.Name]protoreflect.FieldDescriptor // protected by once
|
||||||
byJSON map[string]pref.FieldDescriptor // protected by once
|
byJSON map[string]protoreflect.FieldDescriptor // protected by once
|
||||||
byText map[string]pref.FieldDescriptor // protected by once
|
byText map[string]protoreflect.FieldDescriptor // protected by once
|
||||||
byNum map[pref.FieldNumber]pref.FieldDescriptor // protected by once
|
byNum map[protoreflect.FieldNumber]protoreflect.FieldDescriptor // protected by once
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *OneofFields) Len() int { return len(p.List) }
|
func (p *OneofFields) Len() int { return len(p.List) }
|
||||||
func (p *OneofFields) Get(i int) pref.FieldDescriptor { return p.List[i] }
|
func (p *OneofFields) Get(i int) protoreflect.FieldDescriptor { return p.List[i] }
|
||||||
func (p *OneofFields) ByName(s pref.Name) pref.FieldDescriptor { return p.lazyInit().byName[s] }
|
func (p *OneofFields) ByName(s protoreflect.Name) protoreflect.FieldDescriptor {
|
||||||
func (p *OneofFields) ByJSONName(s string) pref.FieldDescriptor { return p.lazyInit().byJSON[s] }
|
return p.lazyInit().byName[s]
|
||||||
func (p *OneofFields) ByTextName(s string) pref.FieldDescriptor { return p.lazyInit().byText[s] }
|
}
|
||||||
func (p *OneofFields) ByNumber(n pref.FieldNumber) pref.FieldDescriptor { return p.lazyInit().byNum[n] }
|
func (p *OneofFields) ByJSONName(s string) protoreflect.FieldDescriptor {
|
||||||
|
return p.lazyInit().byJSON[s]
|
||||||
|
}
|
||||||
|
func (p *OneofFields) ByTextName(s string) protoreflect.FieldDescriptor {
|
||||||
|
return p.lazyInit().byText[s]
|
||||||
|
}
|
||||||
|
func (p *OneofFields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor {
|
||||||
|
return p.lazyInit().byNum[n]
|
||||||
|
}
|
||||||
func (p *OneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
func (p *OneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
||||||
func (p *OneofFields) ProtoInternal(pragma.DoNotImplement) {}
|
func (p *OneofFields) ProtoInternal(pragma.DoNotImplement) {}
|
||||||
|
|
||||||
func (p *OneofFields) lazyInit() *OneofFields {
|
func (p *OneofFields) lazyInit() *OneofFields {
|
||||||
p.once.Do(func() {
|
p.once.Do(func() {
|
||||||
if len(p.List) > 0 {
|
if len(p.List) > 0 {
|
||||||
p.byName = make(map[pref.Name]pref.FieldDescriptor, len(p.List))
|
p.byName = make(map[protoreflect.Name]protoreflect.FieldDescriptor, len(p.List))
|
||||||
p.byJSON = make(map[string]pref.FieldDescriptor, len(p.List))
|
p.byJSON = make(map[string]protoreflect.FieldDescriptor, len(p.List))
|
||||||
p.byText = make(map[string]pref.FieldDescriptor, len(p.List))
|
p.byText = make(map[string]protoreflect.FieldDescriptor, len(p.List))
|
||||||
p.byNum = make(map[pref.FieldNumber]pref.FieldDescriptor, len(p.List))
|
p.byNum = make(map[protoreflect.FieldNumber]protoreflect.FieldDescriptor, len(p.List))
|
||||||
for _, f := range p.List {
|
for _, f := range p.List {
|
||||||
// Field names and numbers are guaranteed to be unique.
|
// Field names and numbers are guaranteed to be unique.
|
||||||
p.byName[f.Name()] = f
|
p.byName[f.Name()] = f
|
||||||
@ -284,123 +291,123 @@ type SourceLocations struct {
|
|||||||
// List is a list of SourceLocations.
|
// List is a list of SourceLocations.
|
||||||
// The SourceLocation.Next field does not need to be populated
|
// The SourceLocation.Next field does not need to be populated
|
||||||
// as it will be lazily populated upon first need.
|
// as it will be lazily populated upon first need.
|
||||||
List []pref.SourceLocation
|
List []protoreflect.SourceLocation
|
||||||
|
|
||||||
// File is the parent file descriptor that these locations are relative to.
|
// File is the parent file descriptor that these locations are relative to.
|
||||||
// If non-nil, ByDescriptor verifies that the provided descriptor
|
// If non-nil, ByDescriptor verifies that the provided descriptor
|
||||||
// is a child of this file descriptor.
|
// is a child of this file descriptor.
|
||||||
File pref.FileDescriptor
|
File protoreflect.FileDescriptor
|
||||||
|
|
||||||
once sync.Once
|
once sync.Once
|
||||||
byPath map[pathKey]int
|
byPath map[pathKey]int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *SourceLocations) Len() int { return len(p.List) }
|
func (p *SourceLocations) Len() int { return len(p.List) }
|
||||||
func (p *SourceLocations) Get(i int) pref.SourceLocation { return p.lazyInit().List[i] }
|
func (p *SourceLocations) Get(i int) protoreflect.SourceLocation { return p.lazyInit().List[i] }
|
||||||
func (p *SourceLocations) byKey(k pathKey) pref.SourceLocation {
|
func (p *SourceLocations) byKey(k pathKey) protoreflect.SourceLocation {
|
||||||
if i, ok := p.lazyInit().byPath[k]; ok {
|
if i, ok := p.lazyInit().byPath[k]; ok {
|
||||||
return p.List[i]
|
return p.List[i]
|
||||||
}
|
}
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
func (p *SourceLocations) ByPath(path pref.SourcePath) pref.SourceLocation {
|
func (p *SourceLocations) ByPath(path protoreflect.SourcePath) protoreflect.SourceLocation {
|
||||||
return p.byKey(newPathKey(path))
|
return p.byKey(newPathKey(path))
|
||||||
}
|
}
|
||||||
func (p *SourceLocations) ByDescriptor(desc pref.Descriptor) pref.SourceLocation {
|
func (p *SourceLocations) ByDescriptor(desc protoreflect.Descriptor) protoreflect.SourceLocation {
|
||||||
if p.File != nil && desc != nil && p.File != desc.ParentFile() {
|
if p.File != nil && desc != nil && p.File != desc.ParentFile() {
|
||||||
return pref.SourceLocation{} // mismatching parent files
|
return protoreflect.SourceLocation{} // mismatching parent files
|
||||||
}
|
}
|
||||||
var pathArr [16]int32
|
var pathArr [16]int32
|
||||||
path := pathArr[:0]
|
path := pathArr[:0]
|
||||||
for {
|
for {
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.FileDescriptor:
|
case protoreflect.FileDescriptor:
|
||||||
// Reverse the path since it was constructed in reverse.
|
// Reverse the path since it was constructed in reverse.
|
||||||
for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {
|
for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {
|
||||||
path[i], path[j] = path[j], path[i]
|
path[i], path[j] = path[j], path[i]
|
||||||
}
|
}
|
||||||
return p.byKey(newPathKey(path))
|
return p.byKey(newPathKey(path))
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.FileDescriptor:
|
case protoreflect.FileDescriptor:
|
||||||
path = append(path, int32(genid.FileDescriptorProto_MessageType_field_number))
|
path = append(path, int32(genid.FileDescriptorProto_MessageType_field_number))
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(genid.DescriptorProto_NestedType_field_number))
|
path = append(path, int32(genid.DescriptorProto_NestedType_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
case pref.FieldDescriptor:
|
case protoreflect.FieldDescriptor:
|
||||||
isExtension := desc.(pref.FieldDescriptor).IsExtension()
|
isExtension := desc.(protoreflect.FieldDescriptor).IsExtension()
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
if isExtension {
|
if isExtension {
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.FileDescriptor:
|
case protoreflect.FileDescriptor:
|
||||||
path = append(path, int32(genid.FileDescriptorProto_Extension_field_number))
|
path = append(path, int32(genid.FileDescriptorProto_Extension_field_number))
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(genid.DescriptorProto_Extension_field_number))
|
path = append(path, int32(genid.DescriptorProto_Extension_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(genid.DescriptorProto_Field_field_number))
|
path = append(path, int32(genid.DescriptorProto_Field_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case pref.OneofDescriptor:
|
case protoreflect.OneofDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(genid.DescriptorProto_OneofDecl_field_number))
|
path = append(path, int32(genid.DescriptorProto_OneofDecl_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
case pref.EnumDescriptor:
|
case protoreflect.EnumDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.FileDescriptor:
|
case protoreflect.FileDescriptor:
|
||||||
path = append(path, int32(genid.FileDescriptorProto_EnumType_field_number))
|
path = append(path, int32(genid.FileDescriptorProto_EnumType_field_number))
|
||||||
case pref.MessageDescriptor:
|
case protoreflect.MessageDescriptor:
|
||||||
path = append(path, int32(genid.DescriptorProto_EnumType_field_number))
|
path = append(path, int32(genid.DescriptorProto_EnumType_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
case pref.EnumValueDescriptor:
|
case protoreflect.EnumValueDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.EnumDescriptor:
|
case protoreflect.EnumDescriptor:
|
||||||
path = append(path, int32(genid.EnumDescriptorProto_Value_field_number))
|
path = append(path, int32(genid.EnumDescriptorProto_Value_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
case pref.ServiceDescriptor:
|
case protoreflect.ServiceDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.FileDescriptor:
|
case protoreflect.FileDescriptor:
|
||||||
path = append(path, int32(genid.FileDescriptorProto_Service_field_number))
|
path = append(path, int32(genid.FileDescriptorProto_Service_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
case pref.MethodDescriptor:
|
case protoreflect.MethodDescriptor:
|
||||||
path = append(path, int32(desc.Index()))
|
path = append(path, int32(desc.Index()))
|
||||||
desc = desc.Parent()
|
desc = desc.Parent()
|
||||||
switch desc.(type) {
|
switch desc.(type) {
|
||||||
case pref.ServiceDescriptor:
|
case protoreflect.ServiceDescriptor:
|
||||||
path = append(path, int32(genid.ServiceDescriptorProto_Method_field_number))
|
path = append(path, int32(genid.ServiceDescriptorProto_Method_field_number))
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return pref.SourceLocation{}
|
return protoreflect.SourceLocation{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -435,7 +442,7 @@ type pathKey struct {
|
|||||||
str string // used if the path does not fit in arr
|
str string // used if the path does not fit in arr
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPathKey(p pref.SourcePath) (k pathKey) {
|
func newPathKey(p protoreflect.SourcePath) (k pathKey) {
|
||||||
if len(p) < len(k.arr) {
|
if len(p) < len(k.arr) {
|
||||||
for i, ps := range p {
|
for i, ps := range p {
|
||||||
if ps < 0 || math.MaxUint8 <= ps {
|
if ps < 0 || math.MaxUint8 <= ps {
|
||||||
|
108
vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
generated
vendored
108
vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
generated
vendored
@ -7,7 +7,7 @@ package filedesc
|
|||||||
import (
|
import (
|
||||||
"google.golang.org/protobuf/internal/descopts"
|
"google.golang.org/protobuf/internal/descopts"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -30,78 +30,80 @@ var (
|
|||||||
// PlaceholderFile is a placeholder, representing only the file path.
|
// PlaceholderFile is a placeholder, representing only the file path.
|
||||||
type PlaceholderFile string
|
type PlaceholderFile string
|
||||||
|
|
||||||
func (f PlaceholderFile) ParentFile() pref.FileDescriptor { return f }
|
func (f PlaceholderFile) ParentFile() protoreflect.FileDescriptor { return f }
|
||||||
func (f PlaceholderFile) Parent() pref.Descriptor { return nil }
|
func (f PlaceholderFile) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (f PlaceholderFile) Index() int { return 0 }
|
func (f PlaceholderFile) Index() int { return 0 }
|
||||||
func (f PlaceholderFile) Syntax() pref.Syntax { return 0 }
|
func (f PlaceholderFile) Syntax() protoreflect.Syntax { return 0 }
|
||||||
func (f PlaceholderFile) Name() pref.Name { return "" }
|
func (f PlaceholderFile) Name() protoreflect.Name { return "" }
|
||||||
func (f PlaceholderFile) FullName() pref.FullName { return "" }
|
func (f PlaceholderFile) FullName() protoreflect.FullName { return "" }
|
||||||
func (f PlaceholderFile) IsPlaceholder() bool { return true }
|
func (f PlaceholderFile) IsPlaceholder() bool { return true }
|
||||||
func (f PlaceholderFile) Options() pref.ProtoMessage { return descopts.File }
|
func (f PlaceholderFile) Options() protoreflect.ProtoMessage { return descopts.File }
|
||||||
func (f PlaceholderFile) Path() string { return string(f) }
|
func (f PlaceholderFile) Path() string { return string(f) }
|
||||||
func (f PlaceholderFile) Package() pref.FullName { return "" }
|
func (f PlaceholderFile) Package() protoreflect.FullName { return "" }
|
||||||
func (f PlaceholderFile) Imports() pref.FileImports { return emptyFiles }
|
func (f PlaceholderFile) Imports() protoreflect.FileImports { return emptyFiles }
|
||||||
func (f PlaceholderFile) Messages() pref.MessageDescriptors { return emptyMessages }
|
func (f PlaceholderFile) Messages() protoreflect.MessageDescriptors { return emptyMessages }
|
||||||
func (f PlaceholderFile) Enums() pref.EnumDescriptors { return emptyEnums }
|
func (f PlaceholderFile) Enums() protoreflect.EnumDescriptors { return emptyEnums }
|
||||||
func (f PlaceholderFile) Extensions() pref.ExtensionDescriptors { return emptyExtensions }
|
func (f PlaceholderFile) Extensions() protoreflect.ExtensionDescriptors { return emptyExtensions }
|
||||||
func (f PlaceholderFile) Services() pref.ServiceDescriptors { return emptyServices }
|
func (f PlaceholderFile) Services() protoreflect.ServiceDescriptors { return emptyServices }
|
||||||
func (f PlaceholderFile) SourceLocations() pref.SourceLocations { return emptySourceLocations }
|
func (f PlaceholderFile) SourceLocations() protoreflect.SourceLocations { return emptySourceLocations }
|
||||||
func (f PlaceholderFile) ProtoType(pref.FileDescriptor) { return }
|
func (f PlaceholderFile) ProtoType(protoreflect.FileDescriptor) { return }
|
||||||
func (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement) { return }
|
func (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement) { return }
|
||||||
|
|
||||||
// PlaceholderEnum is a placeholder, representing only the full name.
|
// PlaceholderEnum is a placeholder, representing only the full name.
|
||||||
type PlaceholderEnum pref.FullName
|
type PlaceholderEnum protoreflect.FullName
|
||||||
|
|
||||||
func (e PlaceholderEnum) ParentFile() pref.FileDescriptor { return nil }
|
func (e PlaceholderEnum) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||||
func (e PlaceholderEnum) Parent() pref.Descriptor { return nil }
|
func (e PlaceholderEnum) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (e PlaceholderEnum) Index() int { return 0 }
|
func (e PlaceholderEnum) Index() int { return 0 }
|
||||||
func (e PlaceholderEnum) Syntax() pref.Syntax { return 0 }
|
func (e PlaceholderEnum) Syntax() protoreflect.Syntax { return 0 }
|
||||||
func (e PlaceholderEnum) Name() pref.Name { return pref.FullName(e).Name() }
|
func (e PlaceholderEnum) Name() protoreflect.Name { return protoreflect.FullName(e).Name() }
|
||||||
func (e PlaceholderEnum) FullName() pref.FullName { return pref.FullName(e) }
|
func (e PlaceholderEnum) FullName() protoreflect.FullName { return protoreflect.FullName(e) }
|
||||||
func (e PlaceholderEnum) IsPlaceholder() bool { return true }
|
func (e PlaceholderEnum) IsPlaceholder() bool { return true }
|
||||||
func (e PlaceholderEnum) Options() pref.ProtoMessage { return descopts.Enum }
|
func (e PlaceholderEnum) Options() protoreflect.ProtoMessage { return descopts.Enum }
|
||||||
func (e PlaceholderEnum) Values() pref.EnumValueDescriptors { return emptyEnumValues }
|
func (e PlaceholderEnum) Values() protoreflect.EnumValueDescriptors { return emptyEnumValues }
|
||||||
func (e PlaceholderEnum) ReservedNames() pref.Names { return emptyNames }
|
func (e PlaceholderEnum) ReservedNames() protoreflect.Names { return emptyNames }
|
||||||
func (e PlaceholderEnum) ReservedRanges() pref.EnumRanges { return emptyEnumRanges }
|
func (e PlaceholderEnum) ReservedRanges() protoreflect.EnumRanges { return emptyEnumRanges }
|
||||||
func (e PlaceholderEnum) ProtoType(pref.EnumDescriptor) { return }
|
func (e PlaceholderEnum) ProtoType(protoreflect.EnumDescriptor) { return }
|
||||||
func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return }
|
func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return }
|
||||||
|
|
||||||
// PlaceholderEnumValue is a placeholder, representing only the full name.
|
// PlaceholderEnumValue is a placeholder, representing only the full name.
|
||||||
type PlaceholderEnumValue pref.FullName
|
type PlaceholderEnumValue protoreflect.FullName
|
||||||
|
|
||||||
func (e PlaceholderEnumValue) ParentFile() pref.FileDescriptor { return nil }
|
func (e PlaceholderEnumValue) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||||
func (e PlaceholderEnumValue) Parent() pref.Descriptor { return nil }
|
func (e PlaceholderEnumValue) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (e PlaceholderEnumValue) Index() int { return 0 }
|
func (e PlaceholderEnumValue) Index() int { return 0 }
|
||||||
func (e PlaceholderEnumValue) Syntax() pref.Syntax { return 0 }
|
func (e PlaceholderEnumValue) Syntax() protoreflect.Syntax { return 0 }
|
||||||
func (e PlaceholderEnumValue) Name() pref.Name { return pref.FullName(e).Name() }
|
func (e PlaceholderEnumValue) Name() protoreflect.Name { return protoreflect.FullName(e).Name() }
|
||||||
func (e PlaceholderEnumValue) FullName() pref.FullName { return pref.FullName(e) }
|
func (e PlaceholderEnumValue) FullName() protoreflect.FullName { return protoreflect.FullName(e) }
|
||||||
func (e PlaceholderEnumValue) IsPlaceholder() bool { return true }
|
func (e PlaceholderEnumValue) IsPlaceholder() bool { return true }
|
||||||
func (e PlaceholderEnumValue) Options() pref.ProtoMessage { return descopts.EnumValue }
|
func (e PlaceholderEnumValue) Options() protoreflect.ProtoMessage { return descopts.EnumValue }
|
||||||
func (e PlaceholderEnumValue) Number() pref.EnumNumber { return 0 }
|
func (e PlaceholderEnumValue) Number() protoreflect.EnumNumber { return 0 }
|
||||||
func (e PlaceholderEnumValue) ProtoType(pref.EnumValueDescriptor) { return }
|
func (e PlaceholderEnumValue) ProtoType(protoreflect.EnumValueDescriptor) { return }
|
||||||
func (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement) { return }
|
func (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement) { return }
|
||||||
|
|
||||||
// PlaceholderMessage is a placeholder, representing only the full name.
|
// PlaceholderMessage is a placeholder, representing only the full name.
|
||||||
type PlaceholderMessage pref.FullName
|
type PlaceholderMessage protoreflect.FullName
|
||||||
|
|
||||||
func (m PlaceholderMessage) ParentFile() pref.FileDescriptor { return nil }
|
func (m PlaceholderMessage) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||||
func (m PlaceholderMessage) Parent() pref.Descriptor { return nil }
|
func (m PlaceholderMessage) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (m PlaceholderMessage) Index() int { return 0 }
|
func (m PlaceholderMessage) Index() int { return 0 }
|
||||||
func (m PlaceholderMessage) Syntax() pref.Syntax { return 0 }
|
func (m PlaceholderMessage) Syntax() protoreflect.Syntax { return 0 }
|
||||||
func (m PlaceholderMessage) Name() pref.Name { return pref.FullName(m).Name() }
|
func (m PlaceholderMessage) Name() protoreflect.Name { return protoreflect.FullName(m).Name() }
|
||||||
func (m PlaceholderMessage) FullName() pref.FullName { return pref.FullName(m) }
|
func (m PlaceholderMessage) FullName() protoreflect.FullName { return protoreflect.FullName(m) }
|
||||||
func (m PlaceholderMessage) IsPlaceholder() bool { return true }
|
func (m PlaceholderMessage) IsPlaceholder() bool { return true }
|
||||||
func (m PlaceholderMessage) Options() pref.ProtoMessage { return descopts.Message }
|
func (m PlaceholderMessage) Options() protoreflect.ProtoMessage { return descopts.Message }
|
||||||
func (m PlaceholderMessage) IsMapEntry() bool { return false }
|
func (m PlaceholderMessage) IsMapEntry() bool { return false }
|
||||||
func (m PlaceholderMessage) Fields() pref.FieldDescriptors { return emptyFields }
|
func (m PlaceholderMessage) Fields() protoreflect.FieldDescriptors { return emptyFields }
|
||||||
func (m PlaceholderMessage) Oneofs() pref.OneofDescriptors { return emptyOneofs }
|
func (m PlaceholderMessage) Oneofs() protoreflect.OneofDescriptors { return emptyOneofs }
|
||||||
func (m PlaceholderMessage) ReservedNames() pref.Names { return emptyNames }
|
func (m PlaceholderMessage) ReservedNames() protoreflect.Names { return emptyNames }
|
||||||
func (m PlaceholderMessage) ReservedRanges() pref.FieldRanges { return emptyFieldRanges }
|
func (m PlaceholderMessage) ReservedRanges() protoreflect.FieldRanges { return emptyFieldRanges }
|
||||||
func (m PlaceholderMessage) RequiredNumbers() pref.FieldNumbers { return emptyFieldNumbers }
|
func (m PlaceholderMessage) RequiredNumbers() protoreflect.FieldNumbers { return emptyFieldNumbers }
|
||||||
func (m PlaceholderMessage) ExtensionRanges() pref.FieldRanges { return emptyFieldRanges }
|
func (m PlaceholderMessage) ExtensionRanges() protoreflect.FieldRanges { return emptyFieldRanges }
|
||||||
func (m PlaceholderMessage) ExtensionRangeOptions(int) pref.ProtoMessage { panic("index out of range") }
|
func (m PlaceholderMessage) ExtensionRangeOptions(int) protoreflect.ProtoMessage {
|
||||||
func (m PlaceholderMessage) Messages() pref.MessageDescriptors { return emptyMessages }
|
panic("index out of range")
|
||||||
func (m PlaceholderMessage) Enums() pref.EnumDescriptors { return emptyEnums }
|
}
|
||||||
func (m PlaceholderMessage) Extensions() pref.ExtensionDescriptors { return emptyExtensions }
|
func (m PlaceholderMessage) Messages() protoreflect.MessageDescriptors { return emptyMessages }
|
||||||
func (m PlaceholderMessage) ProtoType(pref.MessageDescriptor) { return }
|
func (m PlaceholderMessage) Enums() protoreflect.EnumDescriptors { return emptyEnums }
|
||||||
|
func (m PlaceholderMessage) Extensions() protoreflect.ExtensionDescriptors { return emptyExtensions }
|
||||||
|
func (m PlaceholderMessage) ProtoType(protoreflect.MessageDescriptor) { return }
|
||||||
func (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement) { return }
|
func (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement) { return }
|
||||||
|
87
vendor/google.golang.org/protobuf/internal/filetype/build.go
generated
vendored
87
vendor/google.golang.org/protobuf/internal/filetype/build.go
generated
vendored
@ -10,17 +10,16 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/descopts"
|
"google.golang.org/protobuf/internal/descopts"
|
||||||
fdesc "google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
pimpl "google.golang.org/protobuf/internal/impl"
|
pimpl "google.golang.org/protobuf/internal/impl"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder constructs type descriptors from a raw file descriptor
|
// Builder constructs type descriptors from a raw file descriptor
|
||||||
// and associated Go types for each enum and message declaration.
|
// and associated Go types for each enum and message declaration.
|
||||||
//
|
//
|
||||||
//
|
// # Flattened Ordering
|
||||||
// Flattened Ordering
|
|
||||||
//
|
//
|
||||||
// The protobuf type system represents declarations as a tree. Certain nodes in
|
// The protobuf type system represents declarations as a tree. Certain nodes in
|
||||||
// the tree require us to either associate it with a concrete Go type or to
|
// the tree require us to either associate it with a concrete Go type or to
|
||||||
@ -52,7 +51,7 @@ import (
|
|||||||
// that children themselves may have.
|
// that children themselves may have.
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
// File is the underlying file descriptor builder.
|
// File is the underlying file descriptor builder.
|
||||||
File fdesc.Builder
|
File filedesc.Builder
|
||||||
|
|
||||||
// GoTypes is a unique set of the Go types for all declarations and
|
// GoTypes is a unique set of the Go types for all declarations and
|
||||||
// dependencies. Each type is represented as a zero value of the Go type.
|
// dependencies. Each type is represented as a zero value of the Go type.
|
||||||
@ -108,22 +107,22 @@ type Builder struct {
|
|||||||
// TypeRegistry is the registry to register each type descriptor.
|
// TypeRegistry is the registry to register each type descriptor.
|
||||||
// If nil, it uses protoregistry.GlobalTypes.
|
// If nil, it uses protoregistry.GlobalTypes.
|
||||||
TypeRegistry interface {
|
TypeRegistry interface {
|
||||||
RegisterMessage(pref.MessageType) error
|
RegisterMessage(protoreflect.MessageType) error
|
||||||
RegisterEnum(pref.EnumType) error
|
RegisterEnum(protoreflect.EnumType) error
|
||||||
RegisterExtension(pref.ExtensionType) error
|
RegisterExtension(protoreflect.ExtensionType) error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Out is the output of the builder.
|
// Out is the output of the builder.
|
||||||
type Out struct {
|
type Out struct {
|
||||||
File pref.FileDescriptor
|
File protoreflect.FileDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tb Builder) Build() (out Out) {
|
func (tb Builder) Build() (out Out) {
|
||||||
// Replace the resolver with one that resolves dependencies by index,
|
// Replace the resolver with one that resolves dependencies by index,
|
||||||
// which is faster and more reliable than relying on the global registry.
|
// which is faster and more reliable than relying on the global registry.
|
||||||
if tb.File.FileRegistry == nil {
|
if tb.File.FileRegistry == nil {
|
||||||
tb.File.FileRegistry = preg.GlobalFiles
|
tb.File.FileRegistry = protoregistry.GlobalFiles
|
||||||
}
|
}
|
||||||
tb.File.FileRegistry = &resolverByIndex{
|
tb.File.FileRegistry = &resolverByIndex{
|
||||||
goTypes: tb.GoTypes,
|
goTypes: tb.GoTypes,
|
||||||
@ -133,7 +132,7 @@ func (tb Builder) Build() (out Out) {
|
|||||||
|
|
||||||
// Initialize registry if unpopulated.
|
// Initialize registry if unpopulated.
|
||||||
if tb.TypeRegistry == nil {
|
if tb.TypeRegistry == nil {
|
||||||
tb.TypeRegistry = preg.GlobalTypes
|
tb.TypeRegistry = protoregistry.GlobalTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
fbOut := tb.File.Build()
|
fbOut := tb.File.Build()
|
||||||
@ -183,23 +182,23 @@ func (tb Builder) Build() (out Out) {
|
|||||||
for i := range fbOut.Messages {
|
for i := range fbOut.Messages {
|
||||||
switch fbOut.Messages[i].Name() {
|
switch fbOut.Messages[i].Name() {
|
||||||
case "FileOptions":
|
case "FileOptions":
|
||||||
descopts.File = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.File = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "EnumOptions":
|
case "EnumOptions":
|
||||||
descopts.Enum = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Enum = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "EnumValueOptions":
|
case "EnumValueOptions":
|
||||||
descopts.EnumValue = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.EnumValue = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "MessageOptions":
|
case "MessageOptions":
|
||||||
descopts.Message = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Message = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "FieldOptions":
|
case "FieldOptions":
|
||||||
descopts.Field = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Field = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "OneofOptions":
|
case "OneofOptions":
|
||||||
descopts.Oneof = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Oneof = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "ExtensionRangeOptions":
|
case "ExtensionRangeOptions":
|
||||||
descopts.ExtensionRange = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.ExtensionRange = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "ServiceOptions":
|
case "ServiceOptions":
|
||||||
descopts.Service = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Service = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
case "MethodOptions":
|
case "MethodOptions":
|
||||||
descopts.Method = messageGoTypes[i].(pref.ProtoMessage)
|
descopts.Method = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,11 +215,11 @@ func (tb Builder) Build() (out Out) {
|
|||||||
const listExtDeps = 2
|
const listExtDeps = 2
|
||||||
var goType reflect.Type
|
var goType reflect.Type
|
||||||
switch fbOut.Extensions[i].L1.Kind {
|
switch fbOut.Extensions[i].L1.Kind {
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
|
j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
|
||||||
goType = reflect.TypeOf(tb.GoTypes[j])
|
goType = reflect.TypeOf(tb.GoTypes[j])
|
||||||
depIdx++
|
depIdx++
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
|
j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
|
||||||
goType = reflect.TypeOf(tb.GoTypes[j])
|
goType = reflect.TypeOf(tb.GoTypes[j])
|
||||||
depIdx++
|
depIdx++
|
||||||
@ -242,22 +241,22 @@ func (tb Builder) Build() (out Out) {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
var goTypeForPBKind = map[pref.Kind]reflect.Type{
|
var goTypeForPBKind = map[protoreflect.Kind]reflect.Type{
|
||||||
pref.BoolKind: reflect.TypeOf(bool(false)),
|
protoreflect.BoolKind: reflect.TypeOf(bool(false)),
|
||||||
pref.Int32Kind: reflect.TypeOf(int32(0)),
|
protoreflect.Int32Kind: reflect.TypeOf(int32(0)),
|
||||||
pref.Sint32Kind: reflect.TypeOf(int32(0)),
|
protoreflect.Sint32Kind: reflect.TypeOf(int32(0)),
|
||||||
pref.Sfixed32Kind: reflect.TypeOf(int32(0)),
|
protoreflect.Sfixed32Kind: reflect.TypeOf(int32(0)),
|
||||||
pref.Int64Kind: reflect.TypeOf(int64(0)),
|
protoreflect.Int64Kind: reflect.TypeOf(int64(0)),
|
||||||
pref.Sint64Kind: reflect.TypeOf(int64(0)),
|
protoreflect.Sint64Kind: reflect.TypeOf(int64(0)),
|
||||||
pref.Sfixed64Kind: reflect.TypeOf(int64(0)),
|
protoreflect.Sfixed64Kind: reflect.TypeOf(int64(0)),
|
||||||
pref.Uint32Kind: reflect.TypeOf(uint32(0)),
|
protoreflect.Uint32Kind: reflect.TypeOf(uint32(0)),
|
||||||
pref.Fixed32Kind: reflect.TypeOf(uint32(0)),
|
protoreflect.Fixed32Kind: reflect.TypeOf(uint32(0)),
|
||||||
pref.Uint64Kind: reflect.TypeOf(uint64(0)),
|
protoreflect.Uint64Kind: reflect.TypeOf(uint64(0)),
|
||||||
pref.Fixed64Kind: reflect.TypeOf(uint64(0)),
|
protoreflect.Fixed64Kind: reflect.TypeOf(uint64(0)),
|
||||||
pref.FloatKind: reflect.TypeOf(float32(0)),
|
protoreflect.FloatKind: reflect.TypeOf(float32(0)),
|
||||||
pref.DoubleKind: reflect.TypeOf(float64(0)),
|
protoreflect.DoubleKind: reflect.TypeOf(float64(0)),
|
||||||
pref.StringKind: reflect.TypeOf(string("")),
|
protoreflect.StringKind: reflect.TypeOf(string("")),
|
||||||
pref.BytesKind: reflect.TypeOf([]byte(nil)),
|
protoreflect.BytesKind: reflect.TypeOf([]byte(nil)),
|
||||||
}
|
}
|
||||||
|
|
||||||
type depIdxs []int32
|
type depIdxs []int32
|
||||||
@ -274,13 +273,13 @@ type (
|
|||||||
fileRegistry
|
fileRegistry
|
||||||
}
|
}
|
||||||
fileRegistry interface {
|
fileRegistry interface {
|
||||||
FindFileByPath(string) (pref.FileDescriptor, error)
|
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
||||||
FindDescriptorByName(pref.FullName) (pref.Descriptor, error)
|
FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
|
||||||
RegisterFile(pref.FileDescriptor) error
|
RegisterFile(protoreflect.FileDescriptor) error
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.EnumDescriptor {
|
func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []filedesc.Enum, ms []filedesc.Message) protoreflect.EnumDescriptor {
|
||||||
if depIdx := int(r.depIdxs.Get(i, j)); int(depIdx) < len(es)+len(ms) {
|
if depIdx := int(r.depIdxs.Get(i, j)); int(depIdx) < len(es)+len(ms) {
|
||||||
return &es[depIdx]
|
return &es[depIdx]
|
||||||
} else {
|
} else {
|
||||||
@ -288,7 +287,7 @@ func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []fdesc.Enum, ms []fdes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *resolverByIndex) FindMessageByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.MessageDescriptor {
|
func (r *resolverByIndex) FindMessageByIndex(i, j int32, es []filedesc.Enum, ms []filedesc.Message) protoreflect.MessageDescriptor {
|
||||||
if depIdx := int(r.depIdxs.Get(i, j)); depIdx < len(es)+len(ms) {
|
if depIdx := int(r.depIdxs.Get(i, j)); depIdx < len(es)+len(ms) {
|
||||||
return &ms[depIdx-len(es)]
|
return &ms[depIdx-len(es)]
|
||||||
} else {
|
} else {
|
||||||
|
42
vendor/google.golang.org/protobuf/internal/impl/api_export.go
generated
vendored
42
vendor/google.golang.org/protobuf/internal/impl/api_export.go
generated
vendored
@ -12,8 +12,8 @@ import (
|
|||||||
"google.golang.org/protobuf/encoding/prototext"
|
"google.golang.org/protobuf/encoding/prototext"
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Export is a zero-length named type that exists only to export a set of
|
// Export is a zero-length named type that exists only to export a set of
|
||||||
@ -32,11 +32,11 @@ type enum = interface{}
|
|||||||
|
|
||||||
// EnumOf returns the protoreflect.Enum interface over e.
|
// EnumOf returns the protoreflect.Enum interface over e.
|
||||||
// It returns nil if e is nil.
|
// It returns nil if e is nil.
|
||||||
func (Export) EnumOf(e enum) pref.Enum {
|
func (Export) EnumOf(e enum) protoreflect.Enum {
|
||||||
switch e := e.(type) {
|
switch e := e.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return nil
|
return nil
|
||||||
case pref.Enum:
|
case protoreflect.Enum:
|
||||||
return e
|
return e
|
||||||
default:
|
default:
|
||||||
return legacyWrapEnum(reflect.ValueOf(e))
|
return legacyWrapEnum(reflect.ValueOf(e))
|
||||||
@ -45,11 +45,11 @@ func (Export) EnumOf(e enum) pref.Enum {
|
|||||||
|
|
||||||
// EnumDescriptorOf returns the protoreflect.EnumDescriptor for e.
|
// EnumDescriptorOf returns the protoreflect.EnumDescriptor for e.
|
||||||
// It returns nil if e is nil.
|
// It returns nil if e is nil.
|
||||||
func (Export) EnumDescriptorOf(e enum) pref.EnumDescriptor {
|
func (Export) EnumDescriptorOf(e enum) protoreflect.EnumDescriptor {
|
||||||
switch e := e.(type) {
|
switch e := e.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return nil
|
return nil
|
||||||
case pref.Enum:
|
case protoreflect.Enum:
|
||||||
return e.Descriptor()
|
return e.Descriptor()
|
||||||
default:
|
default:
|
||||||
return LegacyLoadEnumDesc(reflect.TypeOf(e))
|
return LegacyLoadEnumDesc(reflect.TypeOf(e))
|
||||||
@ -58,11 +58,11 @@ func (Export) EnumDescriptorOf(e enum) pref.EnumDescriptor {
|
|||||||
|
|
||||||
// EnumTypeOf returns the protoreflect.EnumType for e.
|
// EnumTypeOf returns the protoreflect.EnumType for e.
|
||||||
// It returns nil if e is nil.
|
// It returns nil if e is nil.
|
||||||
func (Export) EnumTypeOf(e enum) pref.EnumType {
|
func (Export) EnumTypeOf(e enum) protoreflect.EnumType {
|
||||||
switch e := e.(type) {
|
switch e := e.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return nil
|
return nil
|
||||||
case pref.Enum:
|
case protoreflect.Enum:
|
||||||
return e.Type()
|
return e.Type()
|
||||||
default:
|
default:
|
||||||
return legacyLoadEnumType(reflect.TypeOf(e))
|
return legacyLoadEnumType(reflect.TypeOf(e))
|
||||||
@ -71,7 +71,7 @@ func (Export) EnumTypeOf(e enum) pref.EnumType {
|
|||||||
|
|
||||||
// EnumStringOf returns the enum value as a string, either as the name if
|
// EnumStringOf returns the enum value as a string, either as the name if
|
||||||
// the number is resolvable, or the number formatted as a string.
|
// the number is resolvable, or the number formatted as a string.
|
||||||
func (Export) EnumStringOf(ed pref.EnumDescriptor, n pref.EnumNumber) string {
|
func (Export) EnumStringOf(ed protoreflect.EnumDescriptor, n protoreflect.EnumNumber) string {
|
||||||
ev := ed.Values().ByNumber(n)
|
ev := ed.Values().ByNumber(n)
|
||||||
if ev != nil {
|
if ev != nil {
|
||||||
return string(ev.Name())
|
return string(ev.Name())
|
||||||
@ -84,7 +84,7 @@ func (Export) EnumStringOf(ed pref.EnumDescriptor, n pref.EnumNumber) string {
|
|||||||
type message = interface{}
|
type message = interface{}
|
||||||
|
|
||||||
// legacyMessageWrapper wraps a v2 message as a v1 message.
|
// legacyMessageWrapper wraps a v2 message as a v1 message.
|
||||||
type legacyMessageWrapper struct{ m pref.ProtoMessage }
|
type legacyMessageWrapper struct{ m protoreflect.ProtoMessage }
|
||||||
|
|
||||||
func (m legacyMessageWrapper) Reset() { proto.Reset(m.m) }
|
func (m legacyMessageWrapper) Reset() { proto.Reset(m.m) }
|
||||||
func (m legacyMessageWrapper) String() string { return Export{}.MessageStringOf(m.m) }
|
func (m legacyMessageWrapper) String() string { return Export{}.MessageStringOf(m.m) }
|
||||||
@ -92,30 +92,30 @@ func (m legacyMessageWrapper) ProtoMessage() {}
|
|||||||
|
|
||||||
// ProtoMessageV1Of converts either a v1 or v2 message to a v1 message.
|
// ProtoMessageV1Of converts either a v1 or v2 message to a v1 message.
|
||||||
// It returns nil if m is nil.
|
// It returns nil if m is nil.
|
||||||
func (Export) ProtoMessageV1Of(m message) piface.MessageV1 {
|
func (Export) ProtoMessageV1Of(m message) protoiface.MessageV1 {
|
||||||
switch mv := m.(type) {
|
switch mv := m.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return nil
|
return nil
|
||||||
case piface.MessageV1:
|
case protoiface.MessageV1:
|
||||||
return mv
|
return mv
|
||||||
case unwrapper:
|
case unwrapper:
|
||||||
return Export{}.ProtoMessageV1Of(mv.protoUnwrap())
|
return Export{}.ProtoMessageV1Of(mv.protoUnwrap())
|
||||||
case pref.ProtoMessage:
|
case protoreflect.ProtoMessage:
|
||||||
return legacyMessageWrapper{mv}
|
return legacyMessageWrapper{mv}
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
|
panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Export) protoMessageV2Of(m message) pref.ProtoMessage {
|
func (Export) protoMessageV2Of(m message) protoreflect.ProtoMessage {
|
||||||
switch mv := m.(type) {
|
switch mv := m.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
return nil
|
return nil
|
||||||
case pref.ProtoMessage:
|
case protoreflect.ProtoMessage:
|
||||||
return mv
|
return mv
|
||||||
case legacyMessageWrapper:
|
case legacyMessageWrapper:
|
||||||
return mv.m
|
return mv.m
|
||||||
case piface.MessageV1:
|
case protoiface.MessageV1:
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
|
panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
|
||||||
@ -124,7 +124,7 @@ func (Export) protoMessageV2Of(m message) pref.ProtoMessage {
|
|||||||
|
|
||||||
// ProtoMessageV2Of converts either a v1 or v2 message to a v2 message.
|
// ProtoMessageV2Of converts either a v1 or v2 message to a v2 message.
|
||||||
// It returns nil if m is nil.
|
// It returns nil if m is nil.
|
||||||
func (Export) ProtoMessageV2Of(m message) pref.ProtoMessage {
|
func (Export) ProtoMessageV2Of(m message) protoreflect.ProtoMessage {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ func (Export) ProtoMessageV2Of(m message) pref.ProtoMessage {
|
|||||||
|
|
||||||
// MessageOf returns the protoreflect.Message interface over m.
|
// MessageOf returns the protoreflect.Message interface over m.
|
||||||
// It returns nil if m is nil.
|
// It returns nil if m is nil.
|
||||||
func (Export) MessageOf(m message) pref.Message {
|
func (Export) MessageOf(m message) protoreflect.Message {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ func (Export) MessageOf(m message) pref.Message {
|
|||||||
|
|
||||||
// MessageDescriptorOf returns the protoreflect.MessageDescriptor for m.
|
// MessageDescriptorOf returns the protoreflect.MessageDescriptor for m.
|
||||||
// It returns nil if m is nil.
|
// It returns nil if m is nil.
|
||||||
func (Export) MessageDescriptorOf(m message) pref.MessageDescriptor {
|
func (Export) MessageDescriptorOf(m message) protoreflect.MessageDescriptor {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ func (Export) MessageDescriptorOf(m message) pref.MessageDescriptor {
|
|||||||
|
|
||||||
// MessageTypeOf returns the protoreflect.MessageType for m.
|
// MessageTypeOf returns the protoreflect.MessageType for m.
|
||||||
// It returns nil if m is nil.
|
// It returns nil if m is nil.
|
||||||
func (Export) MessageTypeOf(m message) pref.MessageType {
|
func (Export) MessageTypeOf(m message) protoreflect.MessageType {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -172,6 +172,6 @@ func (Export) MessageTypeOf(m message) pref.MessageType {
|
|||||||
|
|
||||||
// MessageStringOf returns the message value as a string,
|
// MessageStringOf returns the message value as a string,
|
||||||
// which is the message serialized in the protobuf text format.
|
// which is the message serialized in the protobuf text format.
|
||||||
func (Export) MessageStringOf(m pref.ProtoMessage) string {
|
func (Export) MessageStringOf(m protoreflect.ProtoMessage) string {
|
||||||
return prototext.MarshalOptions{Multiline: false}.Format(m)
|
return prototext.MarshalOptions{Multiline: false}.Format(m)
|
||||||
}
|
}
|
||||||
|
12
vendor/google.golang.org/protobuf/internal/impl/checkinit.go
generated
vendored
12
vendor/google.golang.org/protobuf/internal/impl/checkinit.go
generated
vendored
@ -8,18 +8,18 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (mi *MessageInfo) checkInitialized(in piface.CheckInitializedInput) (piface.CheckInitializedOutput, error) {
|
func (mi *MessageInfo) checkInitialized(in protoiface.CheckInitializedInput) (protoiface.CheckInitializedOutput, error) {
|
||||||
var p pointer
|
var p pointer
|
||||||
if ms, ok := in.Message.(*messageState); ok {
|
if ms, ok := in.Message.(*messageState); ok {
|
||||||
p = ms.pointer()
|
p = ms.pointer()
|
||||||
} else {
|
} else {
|
||||||
p = in.Message.(*messageReflectWrapper).pointer()
|
p = in.Message.(*messageReflectWrapper).pointer()
|
||||||
}
|
}
|
||||||
return piface.CheckInitializedOutput{}, mi.checkInitializedPointer(p)
|
return protoiface.CheckInitializedOutput{}, mi.checkInitializedPointer(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mi *MessageInfo) checkInitializedPointer(p pointer) error {
|
func (mi *MessageInfo) checkInitializedPointer(p pointer) error {
|
||||||
@ -90,7 +90,7 @@ var (
|
|||||||
// needsInitCheck reports whether a message needs to be checked for partial initialization.
|
// needsInitCheck reports whether a message needs to be checked for partial initialization.
|
||||||
//
|
//
|
||||||
// It returns true if the message transitively includes any required or extension fields.
|
// It returns true if the message transitively includes any required or extension fields.
|
||||||
func needsInitCheck(md pref.MessageDescriptor) bool {
|
func needsInitCheck(md protoreflect.MessageDescriptor) bool {
|
||||||
if v, ok := needsInitCheckMap.Load(md); ok {
|
if v, ok := needsInitCheckMap.Load(md); ok {
|
||||||
if has, ok := v.(bool); ok {
|
if has, ok := v.(bool); ok {
|
||||||
return has
|
return has
|
||||||
@ -101,7 +101,7 @@ func needsInitCheck(md pref.MessageDescriptor) bool {
|
|||||||
return needsInitCheckLocked(md)
|
return needsInitCheckLocked(md)
|
||||||
}
|
}
|
||||||
|
|
||||||
func needsInitCheckLocked(md pref.MessageDescriptor) (has bool) {
|
func needsInitCheckLocked(md protoreflect.MessageDescriptor) (has bool) {
|
||||||
if v, ok := needsInitCheckMap.Load(md); ok {
|
if v, ok := needsInitCheckMap.Load(md); ok {
|
||||||
// If has is true, we've previously determined that this message
|
// If has is true, we've previously determined that this message
|
||||||
// needs init checks.
|
// needs init checks.
|
||||||
|
36
vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
generated
vendored
36
vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
generated
vendored
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type extensionFieldInfo struct {
|
type extensionFieldInfo struct {
|
||||||
@ -23,7 +23,7 @@ type extensionFieldInfo struct {
|
|||||||
|
|
||||||
var legacyExtensionFieldInfoCache sync.Map // map[protoreflect.ExtensionType]*extensionFieldInfo
|
var legacyExtensionFieldInfoCache sync.Map // map[protoreflect.ExtensionType]*extensionFieldInfo
|
||||||
|
|
||||||
func getExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {
|
func getExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {
|
||||||
if xi, ok := xt.(*ExtensionInfo); ok {
|
if xi, ok := xt.(*ExtensionInfo); ok {
|
||||||
xi.lazyInit()
|
xi.lazyInit()
|
||||||
return xi.info
|
return xi.info
|
||||||
@ -32,7 +32,7 @@ func getExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// legacyLoadExtensionFieldInfo dynamically loads a *ExtensionInfo for xt.
|
// legacyLoadExtensionFieldInfo dynamically loads a *ExtensionInfo for xt.
|
||||||
func legacyLoadExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {
|
func legacyLoadExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {
|
||||||
if xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok {
|
if xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok {
|
||||||
return xi.(*extensionFieldInfo)
|
return xi.(*extensionFieldInfo)
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ func legacyLoadExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {
|
|||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeExtensionFieldInfo(xd pref.ExtensionDescriptor) *extensionFieldInfo {
|
func makeExtensionFieldInfo(xd protoreflect.ExtensionDescriptor) *extensionFieldInfo {
|
||||||
var wiretag uint64
|
var wiretag uint64
|
||||||
if !xd.IsPacked() {
|
if !xd.IsPacked() {
|
||||||
wiretag = protowire.EncodeTag(xd.Number(), wireTypes[xd.Kind()])
|
wiretag = protowire.EncodeTag(xd.Number(), wireTypes[xd.Kind()])
|
||||||
@ -59,10 +59,10 @@ func makeExtensionFieldInfo(xd pref.ExtensionDescriptor) *extensionFieldInfo {
|
|||||||
// This is true for composite types, where we pass in a message, list, or map to fill in,
|
// This is true for composite types, where we pass in a message, list, or map to fill in,
|
||||||
// and for enums, where we pass in a prototype value to specify the concrete enum type.
|
// and for enums, where we pass in a prototype value to specify the concrete enum type.
|
||||||
switch xd.Kind() {
|
switch xd.Kind() {
|
||||||
case pref.MessageKind, pref.GroupKind, pref.EnumKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind, protoreflect.EnumKind:
|
||||||
e.unmarshalNeedsValue = true
|
e.unmarshalNeedsValue = true
|
||||||
default:
|
default:
|
||||||
if xd.Cardinality() == pref.Repeated {
|
if xd.Cardinality() == protoreflect.Repeated {
|
||||||
e.unmarshalNeedsValue = true
|
e.unmarshalNeedsValue = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,21 +73,21 @@ type lazyExtensionValue struct {
|
|||||||
atomicOnce uint32 // atomically set if value is valid
|
atomicOnce uint32 // atomically set if value is valid
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
xi *extensionFieldInfo
|
xi *extensionFieldInfo
|
||||||
value pref.Value
|
value protoreflect.Value
|
||||||
b []byte
|
b []byte
|
||||||
fn func() pref.Value
|
fn func() protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExtensionField struct {
|
type ExtensionField struct {
|
||||||
typ pref.ExtensionType
|
typ protoreflect.ExtensionType
|
||||||
|
|
||||||
// value is either the value of GetValue,
|
// value is either the value of GetValue,
|
||||||
// or a *lazyExtensionValue that then returns the value of GetValue.
|
// or a *lazyExtensionValue that then returns the value of GetValue.
|
||||||
value pref.Value
|
value protoreflect.Value
|
||||||
lazy *lazyExtensionValue
|
lazy *lazyExtensionValue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) {
|
func (f *ExtensionField) appendLazyBytes(xt protoreflect.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) {
|
||||||
if f.lazy == nil {
|
if f.lazy == nil {
|
||||||
f.lazy = &lazyExtensionValue{xi: xi}
|
f.lazy = &lazyExtensionValue{xi: xi}
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ func (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFie
|
|||||||
f.lazy.b = append(f.lazy.b, b...)
|
f.lazy.b = append(f.lazy.b, b...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *ExtensionField) canLazy(xt pref.ExtensionType) bool {
|
func (f *ExtensionField) canLazy(xt protoreflect.ExtensionType) bool {
|
||||||
if f.typ == nil {
|
if f.typ == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ func (f *ExtensionField) lazyInit() {
|
|||||||
|
|
||||||
// Set sets the type and value of the extension field.
|
// Set sets the type and value of the extension field.
|
||||||
// This must not be called concurrently.
|
// This must not be called concurrently.
|
||||||
func (f *ExtensionField) Set(t pref.ExtensionType, v pref.Value) {
|
func (f *ExtensionField) Set(t protoreflect.ExtensionType, v protoreflect.Value) {
|
||||||
f.typ = t
|
f.typ = t
|
||||||
f.value = v
|
f.value = v
|
||||||
f.lazy = nil
|
f.lazy = nil
|
||||||
@ -162,14 +162,14 @@ func (f *ExtensionField) Set(t pref.ExtensionType, v pref.Value) {
|
|||||||
|
|
||||||
// SetLazy sets the type and a value that is to be lazily evaluated upon first use.
|
// SetLazy sets the type and a value that is to be lazily evaluated upon first use.
|
||||||
// This must not be called concurrently.
|
// This must not be called concurrently.
|
||||||
func (f *ExtensionField) SetLazy(t pref.ExtensionType, fn func() pref.Value) {
|
func (f *ExtensionField) SetLazy(t protoreflect.ExtensionType, fn func() protoreflect.Value) {
|
||||||
f.typ = t
|
f.typ = t
|
||||||
f.lazy = &lazyExtensionValue{fn: fn}
|
f.lazy = &lazyExtensionValue{fn: fn}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Value returns the value of the extension field.
|
// Value returns the value of the extension field.
|
||||||
// This may be called concurrently.
|
// This may be called concurrently.
|
||||||
func (f *ExtensionField) Value() pref.Value {
|
func (f *ExtensionField) Value() protoreflect.Value {
|
||||||
if f.lazy != nil {
|
if f.lazy != nil {
|
||||||
if atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {
|
if atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {
|
||||||
f.lazyInit()
|
f.lazyInit()
|
||||||
@ -181,7 +181,7 @@ func (f *ExtensionField) Value() pref.Value {
|
|||||||
|
|
||||||
// Type returns the type of the extension field.
|
// Type returns the type of the extension field.
|
||||||
// This may be called concurrently.
|
// This may be called concurrently.
|
||||||
func (f ExtensionField) Type() pref.ExtensionType {
|
func (f ExtensionField) Type() protoreflect.ExtensionType {
|
||||||
return f.typ
|
return f.typ
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ func (f ExtensionField) IsSet() bool {
|
|||||||
|
|
||||||
// IsLazy reports whether a field is lazily encoded.
|
// IsLazy reports whether a field is lazily encoded.
|
||||||
// It is exported for testing.
|
// It is exported for testing.
|
||||||
func IsLazy(m pref.Message, fd pref.FieldDescriptor) bool {
|
func IsLazy(m protoreflect.Message, fd protoreflect.FieldDescriptor) bool {
|
||||||
var mi *MessageInfo
|
var mi *MessageInfo
|
||||||
var p pointer
|
var p pointer
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
@ -206,7 +206,7 @@ func IsLazy(m pref.Message, fd pref.FieldDescriptor) bool {
|
|||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
xd, ok := fd.(pref.ExtensionTypeDescriptor)
|
xd, ok := fd.(protoreflect.ExtensionTypeDescriptor)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
90
vendor/google.golang.org/protobuf/internal/impl/codec_field.go
generated
vendored
90
vendor/google.golang.org/protobuf/internal/impl/codec_field.go
generated
vendored
@ -12,9 +12,9 @@ import (
|
|||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
type errInvalidUTF8 struct{}
|
type errInvalidUTF8 struct{}
|
||||||
@ -30,7 +30,7 @@ func (errInvalidUTF8) Unwrap() error { return errors.Error }
|
|||||||
// to the appropriate field-specific function as necessary.
|
// to the appropriate field-specific function as necessary.
|
||||||
//
|
//
|
||||||
// The unmarshal function is set on each field individually as usual.
|
// The unmarshal function is set on each field individually as usual.
|
||||||
func (mi *MessageInfo) initOneofFieldCoders(od pref.OneofDescriptor, si structInfo) {
|
func (mi *MessageInfo) initOneofFieldCoders(od protoreflect.OneofDescriptor, si structInfo) {
|
||||||
fs := si.oneofsByName[od.Name()]
|
fs := si.oneofsByName[od.Name()]
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
oneofFields := make(map[reflect.Type]*coderFieldInfo)
|
oneofFields := make(map[reflect.Type]*coderFieldInfo)
|
||||||
@ -118,13 +118,13 @@ func (mi *MessageInfo) initOneofFieldCoders(od pref.OneofDescriptor, si structIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeWeakMessageFieldCoder(fd pref.FieldDescriptor) pointerCoderFuncs {
|
func makeWeakMessageFieldCoder(fd protoreflect.FieldDescriptor) pointerCoderFuncs {
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
var messageType pref.MessageType
|
var messageType protoreflect.MessageType
|
||||||
lazyInit := func() {
|
lazyInit := func() {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
messageName := fd.Message().FullName()
|
messageName := fd.Message().FullName()
|
||||||
messageType, _ = preg.GlobalTypes.FindMessageByName(messageName)
|
messageType, _ = protoregistry.GlobalTypes.FindMessageByName(messageName)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ func makeWeakMessageFieldCoder(fd pref.FieldDescriptor) pointerCoderFuncs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeMessageFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
func makeMessageFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||||
if mi := getMessageInfo(ft); mi != nil {
|
if mi := getMessageInfo(ft); mi != nil {
|
||||||
funcs := pointerCoderFuncs{
|
funcs := pointerCoderFuncs{
|
||||||
size: sizeMessageInfo,
|
size: sizeMessageInfo,
|
||||||
@ -280,7 +280,7 @@ func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarsh
|
|||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: v,
|
Buf: v,
|
||||||
Message: m.ProtoReflect(),
|
Message: m.ProtoReflect(),
|
||||||
})
|
})
|
||||||
@ -288,27 +288,27 @@ func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarsh
|
|||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeMessageValue(v pref.Value, tagsize int, opts marshalOptions) int {
|
func sizeMessageValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
return sizeMessage(m, tagsize, opts)
|
return sizeMessage(m, tagsize, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendMessageValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
func appendMessageValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
return appendMessage(b, m, wiretag, opts)
|
return appendMessage(b, m, wiretag, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func consumeMessageValue(b []byte, v pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {
|
func consumeMessageValue(b []byte, v protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error) {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
out, err := consumeMessage(b, m, wtyp, opts)
|
out, err := consumeMessage(b, m, wtyp, opts)
|
||||||
return v, out, err
|
return v, out, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func isInitMessageValue(v pref.Value) error {
|
func isInitMessageValue(v protoreflect.Value) error {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
return proto.CheckInitialized(m)
|
return proto.CheckInitialized(m)
|
||||||
}
|
}
|
||||||
@ -321,17 +321,17 @@ var coderMessageValue = valueCoderFuncs{
|
|||||||
merge: mergeMessageValue,
|
merge: mergeMessageValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeGroupValue(v pref.Value, tagsize int, opts marshalOptions) int {
|
func sizeGroupValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
return sizeGroup(m, tagsize, opts)
|
return sizeGroup(m, tagsize, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendGroupValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
func appendGroupValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
return appendGroup(b, m, wiretag, opts)
|
return appendGroup(b, m, wiretag, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func consumeGroupValue(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {
|
func consumeGroupValue(b []byte, v protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error) {
|
||||||
m := v.Message().Interface()
|
m := v.Message().Interface()
|
||||||
out, err := consumeGroup(b, m, num, wtyp, opts)
|
out, err := consumeGroup(b, m, num, wtyp, opts)
|
||||||
return v, out, err
|
return v, out, err
|
||||||
@ -345,7 +345,7 @@ var coderGroupValue = valueCoderFuncs{
|
|||||||
merge: mergeMessageValue,
|
merge: mergeMessageValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeGroupFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
func makeGroupFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||||
num := fd.Number()
|
num := fd.Number()
|
||||||
if mi := getMessageInfo(ft); mi != nil {
|
if mi := getMessageInfo(ft); mi != nil {
|
||||||
funcs := pointerCoderFuncs{
|
funcs := pointerCoderFuncs{
|
||||||
@ -424,7 +424,7 @@ func consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowir
|
|||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: b,
|
Buf: b,
|
||||||
Message: m.ProtoReflect(),
|
Message: m.ProtoReflect(),
|
||||||
})
|
})
|
||||||
@ -432,11 +432,11 @@ func consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowir
|
|||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeMessageSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
func makeMessageSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||||
if mi := getMessageInfo(ft); mi != nil {
|
if mi := getMessageInfo(ft); mi != nil {
|
||||||
funcs := pointerCoderFuncs{
|
funcs := pointerCoderFuncs{
|
||||||
size: sizeMessageSliceInfo,
|
size: sizeMessageSliceInfo,
|
||||||
@ -555,7 +555,7 @@ func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowir
|
|||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
mp := reflect.New(goType.Elem())
|
mp := reflect.New(goType.Elem())
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: v,
|
Buf: v,
|
||||||
Message: asMessage(mp).ProtoReflect(),
|
Message: asMessage(mp).ProtoReflect(),
|
||||||
})
|
})
|
||||||
@ -564,7 +564,7 @@ func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowir
|
|||||||
}
|
}
|
||||||
p.AppendPointerSlice(pointerOfValue(mp))
|
p.AppendPointerSlice(pointerOfValue(mp))
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,7 +581,7 @@ func isInitMessageSlice(p pointer, goType reflect.Type) error {
|
|||||||
|
|
||||||
// Slices of messages
|
// Slices of messages
|
||||||
|
|
||||||
func sizeMessageSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int {
|
func sizeMessageSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
n := 0
|
n := 0
|
||||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||||
@ -591,7 +591,7 @@ func sizeMessageSliceValue(listv pref.Value, tagsize int, opts marshalOptions) i
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendMessageSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
func appendMessageSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
mopts := opts.Options()
|
mopts := opts.Options()
|
||||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||||
@ -608,30 +608,30 @@ func appendMessageSliceValue(b []byte, listv pref.Value, wiretag uint64, opts ma
|
|||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func consumeMessageSliceValue(b []byte, listv pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {
|
func consumeMessageSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
if wtyp != protowire.BytesType {
|
if wtyp != protowire.BytesType {
|
||||||
return pref.Value{}, out, errUnknown
|
return protoreflect.Value{}, out, errUnknown
|
||||||
}
|
}
|
||||||
v, n := protowire.ConsumeBytes(b)
|
v, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return pref.Value{}, out, errDecode
|
return protoreflect.Value{}, out, errDecode
|
||||||
}
|
}
|
||||||
m := list.NewElement()
|
m := list.NewElement()
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: v,
|
Buf: v,
|
||||||
Message: m.Message(),
|
Message: m.Message(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, out, err
|
return protoreflect.Value{}, out, err
|
||||||
}
|
}
|
||||||
list.Append(m)
|
list.Append(m)
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return listv, out, nil
|
return listv, out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func isInitMessageSliceValue(listv pref.Value) error {
|
func isInitMessageSliceValue(listv protoreflect.Value) error {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||||
m := list.Get(i).Message().Interface()
|
m := list.Get(i).Message().Interface()
|
||||||
@ -650,7 +650,7 @@ var coderMessageSliceValue = valueCoderFuncs{
|
|||||||
merge: mergeMessageListValue,
|
merge: mergeMessageListValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
func sizeGroupSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int {
|
func sizeGroupSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
n := 0
|
n := 0
|
||||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||||
@ -660,7 +660,7 @@ func sizeGroupSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func appendGroupSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
func appendGroupSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
mopts := opts.Options()
|
mopts := opts.Options()
|
||||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||||
@ -676,26 +676,26 @@ func appendGroupSliceValue(b []byte, listv pref.Value, wiretag uint64, opts mars
|
|||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func consumeGroupSliceValue(b []byte, listv pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {
|
func consumeGroupSliceValue(b []byte, listv protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
|
||||||
list := listv.List()
|
list := listv.List()
|
||||||
if wtyp != protowire.StartGroupType {
|
if wtyp != protowire.StartGroupType {
|
||||||
return pref.Value{}, out, errUnknown
|
return protoreflect.Value{}, out, errUnknown
|
||||||
}
|
}
|
||||||
b, n := protowire.ConsumeGroup(num, b)
|
b, n := protowire.ConsumeGroup(num, b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return pref.Value{}, out, errDecode
|
return protoreflect.Value{}, out, errDecode
|
||||||
}
|
}
|
||||||
m := list.NewElement()
|
m := list.NewElement()
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: b,
|
Buf: b,
|
||||||
Message: m.Message(),
|
Message: m.Message(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pref.Value{}, out, err
|
return protoreflect.Value{}, out, err
|
||||||
}
|
}
|
||||||
list.Append(m)
|
list.Append(m)
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return listv, out, nil
|
return listv, out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,7 +707,7 @@ var coderGroupSliceValue = valueCoderFuncs{
|
|||||||
merge: mergeMessageListValue,
|
merge: mergeMessageListValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeGroupSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
func makeGroupSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||||
num := fd.Number()
|
num := fd.Number()
|
||||||
if mi := getMessageInfo(ft); mi != nil {
|
if mi := getMessageInfo(ft); mi != nil {
|
||||||
funcs := pointerCoderFuncs{
|
funcs := pointerCoderFuncs{
|
||||||
@ -772,7 +772,7 @@ func consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire
|
|||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
mp := reflect.New(goType.Elem())
|
mp := reflect.New(goType.Elem())
|
||||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||||
Buf: b,
|
Buf: b,
|
||||||
Message: asMessage(mp).ProtoReflect(),
|
Message: asMessage(mp).ProtoReflect(),
|
||||||
})
|
})
|
||||||
@ -781,7 +781,7 @@ func consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire
|
|||||||
}
|
}
|
||||||
p.AppendPointerSlice(pointerOfValue(mp))
|
p.AppendPointerSlice(pointerOfValue(mp))
|
||||||
out.n = n
|
out.n = n
|
||||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -822,8 +822,8 @@ func consumeGroupSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFie
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func asMessage(v reflect.Value) pref.ProtoMessage {
|
func asMessage(v reflect.Value) protoreflect.ProtoMessage {
|
||||||
if m, ok := v.Interface().(pref.ProtoMessage); ok {
|
if m, ok := v.Interface().(protoreflect.ProtoMessage); ok {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
return legacyWrapMessage(v).Interface()
|
return legacyWrapMessage(v).Interface()
|
||||||
|
20
vendor/google.golang.org/protobuf/internal/impl/codec_map.go
generated
vendored
20
vendor/google.golang.org/protobuf/internal/impl/codec_map.go
generated
vendored
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mapInfo struct {
|
type mapInfo struct {
|
||||||
@ -19,12 +19,12 @@ type mapInfo struct {
|
|||||||
valWiretag uint64
|
valWiretag uint64
|
||||||
keyFuncs valueCoderFuncs
|
keyFuncs valueCoderFuncs
|
||||||
valFuncs valueCoderFuncs
|
valFuncs valueCoderFuncs
|
||||||
keyZero pref.Value
|
keyZero protoreflect.Value
|
||||||
keyKind pref.Kind
|
keyKind protoreflect.Kind
|
||||||
conv *mapConverter
|
conv *mapConverter
|
||||||
}
|
}
|
||||||
|
|
||||||
func encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage *MessageInfo, funcs pointerCoderFuncs) {
|
func encoderFuncsForMap(fd protoreflect.FieldDescriptor, ft reflect.Type) (valueMessage *MessageInfo, funcs pointerCoderFuncs) {
|
||||||
// TODO: Consider generating specialized map coders.
|
// TODO: Consider generating specialized map coders.
|
||||||
keyField := fd.MapKey()
|
keyField := fd.MapKey()
|
||||||
valField := fd.MapValue()
|
valField := fd.MapValue()
|
||||||
@ -44,7 +44,7 @@ func encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage
|
|||||||
keyKind: keyField.Kind(),
|
keyKind: keyField.Kind(),
|
||||||
conv: conv,
|
conv: conv,
|
||||||
}
|
}
|
||||||
if valField.Kind() == pref.MessageKind {
|
if valField.Kind() == protoreflect.MessageKind {
|
||||||
valueMessage = getMessageInfo(ft.Elem())
|
valueMessage = getMessageInfo(ft.Elem())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,9 +68,9 @@ func encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
switch valField.Kind() {
|
switch valField.Kind() {
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
funcs.merge = mergeMapOfMessage
|
funcs.merge = mergeMapOfMessage
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
funcs.merge = mergeMapOfBytes
|
funcs.merge = mergeMapOfBytes
|
||||||
default:
|
default:
|
||||||
funcs.merge = mergeMap
|
funcs.merge = mergeMap
|
||||||
@ -135,7 +135,7 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo
|
|||||||
err := errUnknown
|
err := errUnknown
|
||||||
switch num {
|
switch num {
|
||||||
case genid.MapEntry_Key_field_number:
|
case genid.MapEntry_Key_field_number:
|
||||||
var v pref.Value
|
var v protoreflect.Value
|
||||||
var o unmarshalOutput
|
var o unmarshalOutput
|
||||||
v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
|
v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -144,7 +144,7 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo
|
|||||||
key = v
|
key = v
|
||||||
n = o.n
|
n = o.n
|
||||||
case genid.MapEntry_Value_field_number:
|
case genid.MapEntry_Value_field_number:
|
||||||
var v pref.Value
|
var v protoreflect.Value
|
||||||
var o unmarshalOutput
|
var o unmarshalOutput
|
||||||
v, o, err = mapi.valFuncs.unmarshal(b, val, num, wtyp, opts)
|
v, o, err = mapi.valFuncs.unmarshal(b, val, num, wtyp, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -192,7 +192,7 @@ func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi
|
|||||||
err := errUnknown
|
err := errUnknown
|
||||||
switch num {
|
switch num {
|
||||||
case 1:
|
case 1:
|
||||||
var v pref.Value
|
var v protoreflect.Value
|
||||||
var o unmarshalOutput
|
var o unmarshalOutput
|
||||||
v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
|
v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
18
vendor/google.golang.org/protobuf/internal/impl/codec_message.go
generated
vendored
18
vendor/google.golang.org/protobuf/internal/impl/codec_message.go
generated
vendored
@ -12,15 +12,15 @@ import (
|
|||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||||
"google.golang.org/protobuf/internal/order"
|
"google.golang.org/protobuf/internal/order"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// coderMessageInfo contains per-message information used by the fast-path functions.
|
// coderMessageInfo contains per-message information used by the fast-path functions.
|
||||||
// This is a different type from MessageInfo to keep MessageInfo as general-purpose as
|
// This is a different type from MessageInfo to keep MessageInfo as general-purpose as
|
||||||
// possible.
|
// possible.
|
||||||
type coderMessageInfo struct {
|
type coderMessageInfo struct {
|
||||||
methods piface.Methods
|
methods protoiface.Methods
|
||||||
|
|
||||||
orderedCoderFields []*coderFieldInfo
|
orderedCoderFields []*coderFieldInfo
|
||||||
denseCoderFields []*coderFieldInfo
|
denseCoderFields []*coderFieldInfo
|
||||||
@ -39,7 +39,7 @@ type coderFieldInfo struct {
|
|||||||
mi *MessageInfo // field's message
|
mi *MessageInfo // field's message
|
||||||
ft reflect.Type
|
ft reflect.Type
|
||||||
validation validationInfo // information used by message validation
|
validation validationInfo // information used by message validation
|
||||||
num pref.FieldNumber // field number
|
num protoreflect.FieldNumber // field number
|
||||||
offset offset // struct field offset
|
offset offset // struct field offset
|
||||||
wiretag uint64 // field tag (number + wire type)
|
wiretag uint64 // field tag (number + wire type)
|
||||||
tagsize int // size of the varint-encoded tag
|
tagsize int // size of the varint-encoded tag
|
||||||
@ -125,8 +125,8 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
|||||||
funcs: funcs,
|
funcs: funcs,
|
||||||
mi: childMessage,
|
mi: childMessage,
|
||||||
validation: newFieldValidationInfo(mi, si, fd, ft),
|
validation: newFieldValidationInfo(mi, si, fd, ft),
|
||||||
isPointer: fd.Cardinality() == pref.Repeated || fd.HasPresence(),
|
isPointer: fd.Cardinality() == protoreflect.Repeated || fd.HasPresence(),
|
||||||
isRequired: fd.Cardinality() == pref.Required,
|
isRequired: fd.Cardinality() == protoreflect.Required,
|
||||||
}
|
}
|
||||||
mi.orderedCoderFields = append(mi.orderedCoderFields, cf)
|
mi.orderedCoderFields = append(mi.orderedCoderFields, cf)
|
||||||
mi.coderFields[cf.num] = cf
|
mi.coderFields[cf.num] = cf
|
||||||
@ -149,7 +149,7 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
|||||||
return mi.orderedCoderFields[i].num < mi.orderedCoderFields[j].num
|
return mi.orderedCoderFields[i].num < mi.orderedCoderFields[j].num
|
||||||
})
|
})
|
||||||
|
|
||||||
var maxDense pref.FieldNumber
|
var maxDense protoreflect.FieldNumber
|
||||||
for _, cf := range mi.orderedCoderFields {
|
for _, cf := range mi.orderedCoderFields {
|
||||||
if cf.num >= 16 && cf.num >= 2*maxDense {
|
if cf.num >= 16 && cf.num >= 2*maxDense {
|
||||||
break
|
break
|
||||||
@ -175,12 +175,12 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
|||||||
|
|
||||||
mi.needsInitCheck = needsInitCheck(mi.Desc)
|
mi.needsInitCheck = needsInitCheck(mi.Desc)
|
||||||
if mi.methods.Marshal == nil && mi.methods.Size == nil {
|
if mi.methods.Marshal == nil && mi.methods.Size == nil {
|
||||||
mi.methods.Flags |= piface.SupportMarshalDeterministic
|
mi.methods.Flags |= protoiface.SupportMarshalDeterministic
|
||||||
mi.methods.Marshal = mi.marshal
|
mi.methods.Marshal = mi.marshal
|
||||||
mi.methods.Size = mi.size
|
mi.methods.Size = mi.size
|
||||||
}
|
}
|
||||||
if mi.methods.Unmarshal == nil {
|
if mi.methods.Unmarshal == nil {
|
||||||
mi.methods.Flags |= piface.SupportUnmarshalDiscardUnknown
|
mi.methods.Flags |= protoiface.SupportUnmarshalDiscardUnknown
|
||||||
mi.methods.Unmarshal = mi.unmarshal
|
mi.methods.Unmarshal = mi.unmarshal
|
||||||
}
|
}
|
||||||
if mi.methods.CheckInitialized == nil {
|
if mi.methods.CheckInitialized == nil {
|
||||||
|
290
vendor/google.golang.org/protobuf/internal/impl/codec_tables.go
generated
vendored
290
vendor/google.golang.org/protobuf/internal/impl/codec_tables.go
generated
vendored
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// pointerCoderFuncs is a set of pointer encoding functions.
|
// pointerCoderFuncs is a set of pointer encoding functions.
|
||||||
@ -25,83 +25,83 @@ type pointerCoderFuncs struct {
|
|||||||
|
|
||||||
// valueCoderFuncs is a set of protoreflect.Value encoding functions.
|
// valueCoderFuncs is a set of protoreflect.Value encoding functions.
|
||||||
type valueCoderFuncs struct {
|
type valueCoderFuncs struct {
|
||||||
size func(v pref.Value, tagsize int, opts marshalOptions) int
|
size func(v protoreflect.Value, tagsize int, opts marshalOptions) int
|
||||||
marshal func(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error)
|
marshal func(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error)
|
||||||
unmarshal func(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error)
|
unmarshal func(b []byte, v protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error)
|
||||||
isInit func(v pref.Value) error
|
isInit func(v protoreflect.Value) error
|
||||||
merge func(dst, src pref.Value, opts mergeOptions) pref.Value
|
merge func(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
// fieldCoder returns pointer functions for a field, used for operating on
|
// fieldCoder returns pointer functions for a field, used for operating on
|
||||||
// struct fields.
|
// struct fields.
|
||||||
func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) {
|
func fieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) {
|
||||||
switch {
|
switch {
|
||||||
case fd.IsMap():
|
case fd.IsMap():
|
||||||
return encoderFuncsForMap(fd, ft)
|
return encoderFuncsForMap(fd, ft)
|
||||||
case fd.Cardinality() == pref.Repeated && !fd.IsPacked():
|
case fd.Cardinality() == protoreflect.Repeated && !fd.IsPacked():
|
||||||
// Repeated fields (not packed).
|
// Repeated fields (not packed).
|
||||||
if ft.Kind() != reflect.Slice {
|
if ft.Kind() != reflect.Slice {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
ft := ft.Elem()
|
ft := ft.Elem()
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if ft.Kind() == reflect.Bool {
|
if ft.Kind() == reflect.Bool {
|
||||||
return nil, coderBoolSlice
|
return nil, coderBoolSlice
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderEnumSlice
|
return nil, coderEnumSlice
|
||||||
}
|
}
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderInt32Slice
|
return nil, coderInt32Slice
|
||||||
}
|
}
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSint32Slice
|
return nil, coderSint32Slice
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderUint32Slice
|
return nil, coderUint32Slice
|
||||||
}
|
}
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderInt64Slice
|
return nil, coderInt64Slice
|
||||||
}
|
}
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSint64Slice
|
return nil, coderSint64Slice
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderUint64Slice
|
return nil, coderUint64Slice
|
||||||
}
|
}
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSfixed32Slice
|
return nil, coderSfixed32Slice
|
||||||
}
|
}
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderFixed32Slice
|
return nil, coderFixed32Slice
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if ft.Kind() == reflect.Float32 {
|
if ft.Kind() == reflect.Float32 {
|
||||||
return nil, coderFloatSlice
|
return nil, coderFloatSlice
|
||||||
}
|
}
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSfixed64Slice
|
return nil, coderSfixed64Slice
|
||||||
}
|
}
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderFixed64Slice
|
return nil, coderFixed64Slice
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if ft.Kind() == reflect.Float64 {
|
if ft.Kind() == reflect.Float64 {
|
||||||
return nil, coderDoubleSlice
|
return nil, coderDoubleSlice
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||||
return nil, coderStringSliceValidateUTF8
|
return nil, coderStringSliceValidateUTF8
|
||||||
}
|
}
|
||||||
@ -114,19 +114,19 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
|||||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||||
return nil, coderBytesSlice
|
return nil, coderBytesSlice
|
||||||
}
|
}
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if ft.Kind() == reflect.String {
|
if ft.Kind() == reflect.String {
|
||||||
return nil, coderStringSlice
|
return nil, coderStringSlice
|
||||||
}
|
}
|
||||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||||
return nil, coderBytesSlice
|
return nil, coderBytesSlice
|
||||||
}
|
}
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
return getMessageInfo(ft), makeMessageSliceFieldCoder(fd, ft)
|
return getMessageInfo(ft), makeMessageSliceFieldCoder(fd, ft)
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
return getMessageInfo(ft), makeGroupSliceFieldCoder(fd, ft)
|
return getMessageInfo(ft), makeGroupSliceFieldCoder(fd, ft)
|
||||||
}
|
}
|
||||||
case fd.Cardinality() == pref.Repeated && fd.IsPacked():
|
case fd.Cardinality() == protoreflect.Repeated && fd.IsPacked():
|
||||||
// Packed repeated fields.
|
// Packed repeated fields.
|
||||||
//
|
//
|
||||||
// Only repeated fields of primitive numeric types
|
// Only repeated fields of primitive numeric types
|
||||||
@ -136,128 +136,128 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
|||||||
}
|
}
|
||||||
ft := ft.Elem()
|
ft := ft.Elem()
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if ft.Kind() == reflect.Bool {
|
if ft.Kind() == reflect.Bool {
|
||||||
return nil, coderBoolPackedSlice
|
return nil, coderBoolPackedSlice
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderEnumPackedSlice
|
return nil, coderEnumPackedSlice
|
||||||
}
|
}
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderInt32PackedSlice
|
return nil, coderInt32PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSint32PackedSlice
|
return nil, coderSint32PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderUint32PackedSlice
|
return nil, coderUint32PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderInt64PackedSlice
|
return nil, coderInt64PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSint64PackedSlice
|
return nil, coderSint64PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderUint64PackedSlice
|
return nil, coderUint64PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSfixed32PackedSlice
|
return nil, coderSfixed32PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderFixed32PackedSlice
|
return nil, coderFixed32PackedSlice
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if ft.Kind() == reflect.Float32 {
|
if ft.Kind() == reflect.Float32 {
|
||||||
return nil, coderFloatPackedSlice
|
return nil, coderFloatPackedSlice
|
||||||
}
|
}
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSfixed64PackedSlice
|
return nil, coderSfixed64PackedSlice
|
||||||
}
|
}
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderFixed64PackedSlice
|
return nil, coderFixed64PackedSlice
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if ft.Kind() == reflect.Float64 {
|
if ft.Kind() == reflect.Float64 {
|
||||||
return nil, coderDoublePackedSlice
|
return nil, coderDoublePackedSlice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case fd.Kind() == pref.MessageKind:
|
case fd.Kind() == protoreflect.MessageKind:
|
||||||
return getMessageInfo(ft), makeMessageFieldCoder(fd, ft)
|
return getMessageInfo(ft), makeMessageFieldCoder(fd, ft)
|
||||||
case fd.Kind() == pref.GroupKind:
|
case fd.Kind() == protoreflect.GroupKind:
|
||||||
return getMessageInfo(ft), makeGroupFieldCoder(fd, ft)
|
return getMessageInfo(ft), makeGroupFieldCoder(fd, ft)
|
||||||
case fd.Syntax() == pref.Proto3 && fd.ContainingOneof() == nil:
|
case fd.Syntax() == protoreflect.Proto3 && fd.ContainingOneof() == nil:
|
||||||
// Populated oneof fields always encode even if set to the zero value,
|
// Populated oneof fields always encode even if set to the zero value,
|
||||||
// which normally are not encoded in proto3.
|
// which normally are not encoded in proto3.
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if ft.Kind() == reflect.Bool {
|
if ft.Kind() == reflect.Bool {
|
||||||
return nil, coderBoolNoZero
|
return nil, coderBoolNoZero
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderEnumNoZero
|
return nil, coderEnumNoZero
|
||||||
}
|
}
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderInt32NoZero
|
return nil, coderInt32NoZero
|
||||||
}
|
}
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSint32NoZero
|
return nil, coderSint32NoZero
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderUint32NoZero
|
return nil, coderUint32NoZero
|
||||||
}
|
}
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderInt64NoZero
|
return nil, coderInt64NoZero
|
||||||
}
|
}
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSint64NoZero
|
return nil, coderSint64NoZero
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderUint64NoZero
|
return nil, coderUint64NoZero
|
||||||
}
|
}
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSfixed32NoZero
|
return nil, coderSfixed32NoZero
|
||||||
}
|
}
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderFixed32NoZero
|
return nil, coderFixed32NoZero
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if ft.Kind() == reflect.Float32 {
|
if ft.Kind() == reflect.Float32 {
|
||||||
return nil, coderFloatNoZero
|
return nil, coderFloatNoZero
|
||||||
}
|
}
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSfixed64NoZero
|
return nil, coderSfixed64NoZero
|
||||||
}
|
}
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderFixed64NoZero
|
return nil, coderFixed64NoZero
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if ft.Kind() == reflect.Float64 {
|
if ft.Kind() == reflect.Float64 {
|
||||||
return nil, coderDoubleNoZero
|
return nil, coderDoubleNoZero
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||||
return nil, coderStringNoZeroValidateUTF8
|
return nil, coderStringNoZeroValidateUTF8
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
|||||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||||
return nil, coderBytesNoZero
|
return nil, coderBytesNoZero
|
||||||
}
|
}
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if ft.Kind() == reflect.String {
|
if ft.Kind() == reflect.String {
|
||||||
return nil, coderStringNoZero
|
return nil, coderStringNoZero
|
||||||
}
|
}
|
||||||
@ -281,133 +281,133 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
|||||||
case ft.Kind() == reflect.Ptr:
|
case ft.Kind() == reflect.Ptr:
|
||||||
ft := ft.Elem()
|
ft := ft.Elem()
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if ft.Kind() == reflect.Bool {
|
if ft.Kind() == reflect.Bool {
|
||||||
return nil, coderBoolPtr
|
return nil, coderBoolPtr
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderEnumPtr
|
return nil, coderEnumPtr
|
||||||
}
|
}
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderInt32Ptr
|
return nil, coderInt32Ptr
|
||||||
}
|
}
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSint32Ptr
|
return nil, coderSint32Ptr
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderUint32Ptr
|
return nil, coderUint32Ptr
|
||||||
}
|
}
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderInt64Ptr
|
return nil, coderInt64Ptr
|
||||||
}
|
}
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSint64Ptr
|
return nil, coderSint64Ptr
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderUint64Ptr
|
return nil, coderUint64Ptr
|
||||||
}
|
}
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSfixed32Ptr
|
return nil, coderSfixed32Ptr
|
||||||
}
|
}
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderFixed32Ptr
|
return nil, coderFixed32Ptr
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if ft.Kind() == reflect.Float32 {
|
if ft.Kind() == reflect.Float32 {
|
||||||
return nil, coderFloatPtr
|
return nil, coderFloatPtr
|
||||||
}
|
}
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSfixed64Ptr
|
return nil, coderSfixed64Ptr
|
||||||
}
|
}
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderFixed64Ptr
|
return nil, coderFixed64Ptr
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if ft.Kind() == reflect.Float64 {
|
if ft.Kind() == reflect.Float64 {
|
||||||
return nil, coderDoublePtr
|
return nil, coderDoublePtr
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||||
return nil, coderStringPtrValidateUTF8
|
return nil, coderStringPtrValidateUTF8
|
||||||
}
|
}
|
||||||
if ft.Kind() == reflect.String {
|
if ft.Kind() == reflect.String {
|
||||||
return nil, coderStringPtr
|
return nil, coderStringPtr
|
||||||
}
|
}
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if ft.Kind() == reflect.String {
|
if ft.Kind() == reflect.String {
|
||||||
return nil, coderStringPtr
|
return nil, coderStringPtr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if ft.Kind() == reflect.Bool {
|
if ft.Kind() == reflect.Bool {
|
||||||
return nil, coderBool
|
return nil, coderBool
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderEnum
|
return nil, coderEnum
|
||||||
}
|
}
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderInt32
|
return nil, coderInt32
|
||||||
}
|
}
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSint32
|
return nil, coderSint32
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderUint32
|
return nil, coderUint32
|
||||||
}
|
}
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderInt64
|
return nil, coderInt64
|
||||||
}
|
}
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSint64
|
return nil, coderSint64
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderUint64
|
return nil, coderUint64
|
||||||
}
|
}
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
if ft.Kind() == reflect.Int32 {
|
if ft.Kind() == reflect.Int32 {
|
||||||
return nil, coderSfixed32
|
return nil, coderSfixed32
|
||||||
}
|
}
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
if ft.Kind() == reflect.Uint32 {
|
if ft.Kind() == reflect.Uint32 {
|
||||||
return nil, coderFixed32
|
return nil, coderFixed32
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if ft.Kind() == reflect.Float32 {
|
if ft.Kind() == reflect.Float32 {
|
||||||
return nil, coderFloat
|
return nil, coderFloat
|
||||||
}
|
}
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
if ft.Kind() == reflect.Int64 {
|
if ft.Kind() == reflect.Int64 {
|
||||||
return nil, coderSfixed64
|
return nil, coderSfixed64
|
||||||
}
|
}
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
if ft.Kind() == reflect.Uint64 {
|
if ft.Kind() == reflect.Uint64 {
|
||||||
return nil, coderFixed64
|
return nil, coderFixed64
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if ft.Kind() == reflect.Float64 {
|
if ft.Kind() == reflect.Float64 {
|
||||||
return nil, coderDouble
|
return nil, coderDouble
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||||
return nil, coderStringValidateUTF8
|
return nil, coderStringValidateUTF8
|
||||||
}
|
}
|
||||||
@ -420,7 +420,7 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
|||||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||||
return nil, coderBytes
|
return nil, coderBytes
|
||||||
}
|
}
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if ft.Kind() == reflect.String {
|
if ft.Kind() == reflect.String {
|
||||||
return nil, coderString
|
return nil, coderString
|
||||||
}
|
}
|
||||||
@ -434,122 +434,122 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
|||||||
|
|
||||||
// encoderFuncsForValue returns value functions for a field, used for
|
// encoderFuncsForValue returns value functions for a field, used for
|
||||||
// extension values and map encoding.
|
// extension values and map encoding.
|
||||||
func encoderFuncsForValue(fd pref.FieldDescriptor) valueCoderFuncs {
|
func encoderFuncsForValue(fd protoreflect.FieldDescriptor) valueCoderFuncs {
|
||||||
switch {
|
switch {
|
||||||
case fd.Cardinality() == pref.Repeated && !fd.IsPacked():
|
case fd.Cardinality() == protoreflect.Repeated && !fd.IsPacked():
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
return coderBoolSliceValue
|
return coderBoolSliceValue
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
return coderEnumSliceValue
|
return coderEnumSliceValue
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
return coderInt32SliceValue
|
return coderInt32SliceValue
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
return coderSint32SliceValue
|
return coderSint32SliceValue
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
return coderUint32SliceValue
|
return coderUint32SliceValue
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
return coderInt64SliceValue
|
return coderInt64SliceValue
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
return coderSint64SliceValue
|
return coderSint64SliceValue
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
return coderUint64SliceValue
|
return coderUint64SliceValue
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
return coderSfixed32SliceValue
|
return coderSfixed32SliceValue
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
return coderFixed32SliceValue
|
return coderFixed32SliceValue
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
return coderFloatSliceValue
|
return coderFloatSliceValue
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
return coderSfixed64SliceValue
|
return coderSfixed64SliceValue
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
return coderFixed64SliceValue
|
return coderFixed64SliceValue
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
return coderDoubleSliceValue
|
return coderDoubleSliceValue
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
// We don't have a UTF-8 validating coder for repeated string fields.
|
// We don't have a UTF-8 validating coder for repeated string fields.
|
||||||
// Value coders are used for extensions and maps.
|
// Value coders are used for extensions and maps.
|
||||||
// Extensions are never proto3, and maps never contain lists.
|
// Extensions are never proto3, and maps never contain lists.
|
||||||
return coderStringSliceValue
|
return coderStringSliceValue
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
return coderBytesSliceValue
|
return coderBytesSliceValue
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
return coderMessageSliceValue
|
return coderMessageSliceValue
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
return coderGroupSliceValue
|
return coderGroupSliceValue
|
||||||
}
|
}
|
||||||
case fd.Cardinality() == pref.Repeated && fd.IsPacked():
|
case fd.Cardinality() == protoreflect.Repeated && fd.IsPacked():
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
return coderBoolPackedSliceValue
|
return coderBoolPackedSliceValue
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
return coderEnumPackedSliceValue
|
return coderEnumPackedSliceValue
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
return coderInt32PackedSliceValue
|
return coderInt32PackedSliceValue
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
return coderSint32PackedSliceValue
|
return coderSint32PackedSliceValue
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
return coderUint32PackedSliceValue
|
return coderUint32PackedSliceValue
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
return coderInt64PackedSliceValue
|
return coderInt64PackedSliceValue
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
return coderSint64PackedSliceValue
|
return coderSint64PackedSliceValue
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
return coderUint64PackedSliceValue
|
return coderUint64PackedSliceValue
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
return coderSfixed32PackedSliceValue
|
return coderSfixed32PackedSliceValue
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
return coderFixed32PackedSliceValue
|
return coderFixed32PackedSliceValue
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
return coderFloatPackedSliceValue
|
return coderFloatPackedSliceValue
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
return coderSfixed64PackedSliceValue
|
return coderSfixed64PackedSliceValue
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
return coderFixed64PackedSliceValue
|
return coderFixed64PackedSliceValue
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
return coderDoublePackedSliceValue
|
return coderDoublePackedSliceValue
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
default:
|
default:
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
return coderBoolValue
|
return coderBoolValue
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
return coderEnumValue
|
return coderEnumValue
|
||||||
case pref.Int32Kind:
|
case protoreflect.Int32Kind:
|
||||||
return coderInt32Value
|
return coderInt32Value
|
||||||
case pref.Sint32Kind:
|
case protoreflect.Sint32Kind:
|
||||||
return coderSint32Value
|
return coderSint32Value
|
||||||
case pref.Uint32Kind:
|
case protoreflect.Uint32Kind:
|
||||||
return coderUint32Value
|
return coderUint32Value
|
||||||
case pref.Int64Kind:
|
case protoreflect.Int64Kind:
|
||||||
return coderInt64Value
|
return coderInt64Value
|
||||||
case pref.Sint64Kind:
|
case protoreflect.Sint64Kind:
|
||||||
return coderSint64Value
|
return coderSint64Value
|
||||||
case pref.Uint64Kind:
|
case protoreflect.Uint64Kind:
|
||||||
return coderUint64Value
|
return coderUint64Value
|
||||||
case pref.Sfixed32Kind:
|
case protoreflect.Sfixed32Kind:
|
||||||
return coderSfixed32Value
|
return coderSfixed32Value
|
||||||
case pref.Fixed32Kind:
|
case protoreflect.Fixed32Kind:
|
||||||
return coderFixed32Value
|
return coderFixed32Value
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
return coderFloatValue
|
return coderFloatValue
|
||||||
case pref.Sfixed64Kind:
|
case protoreflect.Sfixed64Kind:
|
||||||
return coderSfixed64Value
|
return coderSfixed64Value
|
||||||
case pref.Fixed64Kind:
|
case protoreflect.Fixed64Kind:
|
||||||
return coderFixed64Value
|
return coderFixed64Value
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
return coderDoubleValue
|
return coderDoubleValue
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
return coderStringValueValidateUTF8
|
return coderStringValueValidateUTF8
|
||||||
}
|
}
|
||||||
return coderStringValue
|
return coderStringValue
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
return coderBytesValue
|
return coderBytesValue
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
return coderMessageValue
|
return coderMessageValue
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
return coderGroupValue
|
return coderGroupValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
228
vendor/google.golang.org/protobuf/internal/impl/convert.go
generated
vendored
228
vendor/google.golang.org/protobuf/internal/impl/convert.go
generated
vendored
@ -8,7 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// unwrapper unwraps the value to the underlying value.
|
// unwrapper unwraps the value to the underlying value.
|
||||||
@ -20,13 +20,13 @@ type unwrapper interface {
|
|||||||
// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.
|
// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.
|
||||||
type Converter interface {
|
type Converter interface {
|
||||||
// PBValueOf converts a reflect.Value to a protoreflect.Value.
|
// PBValueOf converts a reflect.Value to a protoreflect.Value.
|
||||||
PBValueOf(reflect.Value) pref.Value
|
PBValueOf(reflect.Value) protoreflect.Value
|
||||||
|
|
||||||
// GoValueOf converts a protoreflect.Value to a reflect.Value.
|
// GoValueOf converts a protoreflect.Value to a reflect.Value.
|
||||||
GoValueOf(pref.Value) reflect.Value
|
GoValueOf(protoreflect.Value) reflect.Value
|
||||||
|
|
||||||
// IsValidPB returns whether a protoreflect.Value is compatible with this type.
|
// IsValidPB returns whether a protoreflect.Value is compatible with this type.
|
||||||
IsValidPB(pref.Value) bool
|
IsValidPB(protoreflect.Value) bool
|
||||||
|
|
||||||
// IsValidGo returns whether a reflect.Value is compatible with this type.
|
// IsValidGo returns whether a reflect.Value is compatible with this type.
|
||||||
IsValidGo(reflect.Value) bool
|
IsValidGo(reflect.Value) bool
|
||||||
@ -34,12 +34,12 @@ type Converter interface {
|
|||||||
// New returns a new field value.
|
// New returns a new field value.
|
||||||
// For scalars, it returns the default value of the field.
|
// For scalars, it returns the default value of the field.
|
||||||
// For composite types, it returns a new mutable value.
|
// For composite types, it returns a new mutable value.
|
||||||
New() pref.Value
|
New() protoreflect.Value
|
||||||
|
|
||||||
// Zero returns a new field value.
|
// Zero returns a new field value.
|
||||||
// For scalars, it returns the default value of the field.
|
// For scalars, it returns the default value of the field.
|
||||||
// For composite types, it returns an immutable, empty value.
|
// For composite types, it returns an immutable, empty value.
|
||||||
Zero() pref.Value
|
Zero() protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConverter matches a Go type with a protobuf field and returns a Converter
|
// NewConverter matches a Go type with a protobuf field and returns a Converter
|
||||||
@ -50,7 +50,7 @@ type Converter interface {
|
|||||||
// This matcher deliberately supports a wider range of Go types than what
|
// This matcher deliberately supports a wider range of Go types than what
|
||||||
// protoc-gen-go historically generated to be able to automatically wrap some
|
// protoc-gen-go historically generated to be able to automatically wrap some
|
||||||
// v1 messages generated by other forks of protoc-gen-go.
|
// v1 messages generated by other forks of protoc-gen-go.
|
||||||
func NewConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
func NewConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||||
switch {
|
switch {
|
||||||
case fd.IsList():
|
case fd.IsList():
|
||||||
return newListConverter(t, fd)
|
return newListConverter(t, fd)
|
||||||
@ -76,68 +76,68 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
boolZero = pref.ValueOfBool(false)
|
boolZero = protoreflect.ValueOfBool(false)
|
||||||
int32Zero = pref.ValueOfInt32(0)
|
int32Zero = protoreflect.ValueOfInt32(0)
|
||||||
int64Zero = pref.ValueOfInt64(0)
|
int64Zero = protoreflect.ValueOfInt64(0)
|
||||||
uint32Zero = pref.ValueOfUint32(0)
|
uint32Zero = protoreflect.ValueOfUint32(0)
|
||||||
uint64Zero = pref.ValueOfUint64(0)
|
uint64Zero = protoreflect.ValueOfUint64(0)
|
||||||
float32Zero = pref.ValueOfFloat32(0)
|
float32Zero = protoreflect.ValueOfFloat32(0)
|
||||||
float64Zero = pref.ValueOfFloat64(0)
|
float64Zero = protoreflect.ValueOfFloat64(0)
|
||||||
stringZero = pref.ValueOfString("")
|
stringZero = protoreflect.ValueOfString("")
|
||||||
bytesZero = pref.ValueOfBytes(nil)
|
bytesZero = protoreflect.ValueOfBytes(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
func newSingularConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
func newSingularConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||||
defVal := func(fd pref.FieldDescriptor, zero pref.Value) pref.Value {
|
defVal := func(fd protoreflect.FieldDescriptor, zero protoreflect.Value) protoreflect.Value {
|
||||||
if fd.Cardinality() == pref.Repeated {
|
if fd.Cardinality() == protoreflect.Repeated {
|
||||||
// Default isn't defined for repeated fields.
|
// Default isn't defined for repeated fields.
|
||||||
return zero
|
return zero
|
||||||
}
|
}
|
||||||
return fd.Default()
|
return fd.Default()
|
||||||
}
|
}
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
if t.Kind() == reflect.Bool {
|
if t.Kind() == reflect.Bool {
|
||||||
return &boolConverter{t, defVal(fd, boolZero)}
|
return &boolConverter{t, defVal(fd, boolZero)}
|
||||||
}
|
}
|
||||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||||
if t.Kind() == reflect.Int32 {
|
if t.Kind() == reflect.Int32 {
|
||||||
return &int32Converter{t, defVal(fd, int32Zero)}
|
return &int32Converter{t, defVal(fd, int32Zero)}
|
||||||
}
|
}
|
||||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||||
if t.Kind() == reflect.Int64 {
|
if t.Kind() == reflect.Int64 {
|
||||||
return &int64Converter{t, defVal(fd, int64Zero)}
|
return &int64Converter{t, defVal(fd, int64Zero)}
|
||||||
}
|
}
|
||||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||||
if t.Kind() == reflect.Uint32 {
|
if t.Kind() == reflect.Uint32 {
|
||||||
return &uint32Converter{t, defVal(fd, uint32Zero)}
|
return &uint32Converter{t, defVal(fd, uint32Zero)}
|
||||||
}
|
}
|
||||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||||
if t.Kind() == reflect.Uint64 {
|
if t.Kind() == reflect.Uint64 {
|
||||||
return &uint64Converter{t, defVal(fd, uint64Zero)}
|
return &uint64Converter{t, defVal(fd, uint64Zero)}
|
||||||
}
|
}
|
||||||
case pref.FloatKind:
|
case protoreflect.FloatKind:
|
||||||
if t.Kind() == reflect.Float32 {
|
if t.Kind() == reflect.Float32 {
|
||||||
return &float32Converter{t, defVal(fd, float32Zero)}
|
return &float32Converter{t, defVal(fd, float32Zero)}
|
||||||
}
|
}
|
||||||
case pref.DoubleKind:
|
case protoreflect.DoubleKind:
|
||||||
if t.Kind() == reflect.Float64 {
|
if t.Kind() == reflect.Float64 {
|
||||||
return &float64Converter{t, defVal(fd, float64Zero)}
|
return &float64Converter{t, defVal(fd, float64Zero)}
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
|
if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
|
||||||
return &stringConverter{t, defVal(fd, stringZero)}
|
return &stringConverter{t, defVal(fd, stringZero)}
|
||||||
}
|
}
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
|
if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
|
||||||
return &bytesConverter{t, defVal(fd, bytesZero)}
|
return &bytesConverter{t, defVal(fd, bytesZero)}
|
||||||
}
|
}
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
// Handle enums, which must be a named int32 type.
|
// Handle enums, which must be a named int32 type.
|
||||||
if t.Kind() == reflect.Int32 {
|
if t.Kind() == reflect.Int32 {
|
||||||
return newEnumConverter(t, fd)
|
return newEnumConverter(t, fd)
|
||||||
}
|
}
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
return newMessageConverter(t)
|
return newMessageConverter(t)
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
||||||
@ -145,184 +145,184 @@ func newSingularConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
|||||||
|
|
||||||
type boolConverter struct {
|
type boolConverter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *boolConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *boolConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfBool(v.Bool())
|
return protoreflect.ValueOfBool(v.Bool())
|
||||||
}
|
}
|
||||||
func (c *boolConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *boolConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(v.Bool()).Convert(c.goType)
|
return reflect.ValueOf(v.Bool()).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *boolConverter) IsValidPB(v pref.Value) bool {
|
func (c *boolConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(bool)
|
_, ok := v.Interface().(bool)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *boolConverter) IsValidGo(v reflect.Value) bool {
|
func (c *boolConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *boolConverter) New() pref.Value { return c.def }
|
func (c *boolConverter) New() protoreflect.Value { return c.def }
|
||||||
func (c *boolConverter) Zero() pref.Value { return c.def }
|
func (c *boolConverter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type int32Converter struct {
|
type int32Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *int32Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *int32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfInt32(int32(v.Int()))
|
return protoreflect.ValueOfInt32(int32(v.Int()))
|
||||||
}
|
}
|
||||||
func (c *int32Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *int32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(int32(v.Int())).Convert(c.goType)
|
return reflect.ValueOf(int32(v.Int())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *int32Converter) IsValidPB(v pref.Value) bool {
|
func (c *int32Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(int32)
|
_, ok := v.Interface().(int32)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *int32Converter) IsValidGo(v reflect.Value) bool {
|
func (c *int32Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *int32Converter) New() pref.Value { return c.def }
|
func (c *int32Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *int32Converter) Zero() pref.Value { return c.def }
|
func (c *int32Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type int64Converter struct {
|
type int64Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *int64Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *int64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfInt64(int64(v.Int()))
|
return protoreflect.ValueOfInt64(int64(v.Int()))
|
||||||
}
|
}
|
||||||
func (c *int64Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *int64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(int64(v.Int())).Convert(c.goType)
|
return reflect.ValueOf(int64(v.Int())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *int64Converter) IsValidPB(v pref.Value) bool {
|
func (c *int64Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(int64)
|
_, ok := v.Interface().(int64)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *int64Converter) IsValidGo(v reflect.Value) bool {
|
func (c *int64Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *int64Converter) New() pref.Value { return c.def }
|
func (c *int64Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *int64Converter) Zero() pref.Value { return c.def }
|
func (c *int64Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type uint32Converter struct {
|
type uint32Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *uint32Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *uint32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfUint32(uint32(v.Uint()))
|
return protoreflect.ValueOfUint32(uint32(v.Uint()))
|
||||||
}
|
}
|
||||||
func (c *uint32Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *uint32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(uint32(v.Uint())).Convert(c.goType)
|
return reflect.ValueOf(uint32(v.Uint())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *uint32Converter) IsValidPB(v pref.Value) bool {
|
func (c *uint32Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(uint32)
|
_, ok := v.Interface().(uint32)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *uint32Converter) IsValidGo(v reflect.Value) bool {
|
func (c *uint32Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *uint32Converter) New() pref.Value { return c.def }
|
func (c *uint32Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *uint32Converter) Zero() pref.Value { return c.def }
|
func (c *uint32Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type uint64Converter struct {
|
type uint64Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *uint64Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *uint64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfUint64(uint64(v.Uint()))
|
return protoreflect.ValueOfUint64(uint64(v.Uint()))
|
||||||
}
|
}
|
||||||
func (c *uint64Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *uint64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(uint64(v.Uint())).Convert(c.goType)
|
return reflect.ValueOf(uint64(v.Uint())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *uint64Converter) IsValidPB(v pref.Value) bool {
|
func (c *uint64Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(uint64)
|
_, ok := v.Interface().(uint64)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *uint64Converter) IsValidGo(v reflect.Value) bool {
|
func (c *uint64Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *uint64Converter) New() pref.Value { return c.def }
|
func (c *uint64Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *uint64Converter) Zero() pref.Value { return c.def }
|
func (c *uint64Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type float32Converter struct {
|
type float32Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *float32Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *float32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfFloat32(float32(v.Float()))
|
return protoreflect.ValueOfFloat32(float32(v.Float()))
|
||||||
}
|
}
|
||||||
func (c *float32Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *float32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(float32(v.Float())).Convert(c.goType)
|
return reflect.ValueOf(float32(v.Float())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *float32Converter) IsValidPB(v pref.Value) bool {
|
func (c *float32Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(float32)
|
_, ok := v.Interface().(float32)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *float32Converter) IsValidGo(v reflect.Value) bool {
|
func (c *float32Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *float32Converter) New() pref.Value { return c.def }
|
func (c *float32Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *float32Converter) Zero() pref.Value { return c.def }
|
func (c *float32Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type float64Converter struct {
|
type float64Converter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *float64Converter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *float64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfFloat64(float64(v.Float()))
|
return protoreflect.ValueOfFloat64(float64(v.Float()))
|
||||||
}
|
}
|
||||||
func (c *float64Converter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *float64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(float64(v.Float())).Convert(c.goType)
|
return reflect.ValueOf(float64(v.Float())).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *float64Converter) IsValidPB(v pref.Value) bool {
|
func (c *float64Converter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(float64)
|
_, ok := v.Interface().(float64)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *float64Converter) IsValidGo(v reflect.Value) bool {
|
func (c *float64Converter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *float64Converter) New() pref.Value { return c.def }
|
func (c *float64Converter) New() protoreflect.Value { return c.def }
|
||||||
func (c *float64Converter) Zero() pref.Value { return c.def }
|
func (c *float64Converter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type stringConverter struct {
|
type stringConverter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *stringConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *stringConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfString(v.Convert(stringType).String())
|
return protoreflect.ValueOfString(v.Convert(stringType).String())
|
||||||
}
|
}
|
||||||
func (c *stringConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *stringConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
// pref.Value.String never panics, so we go through an interface
|
// pref.Value.String never panics, so we go through an interface
|
||||||
// conversion here to check the type.
|
// conversion here to check the type.
|
||||||
s := v.Interface().(string)
|
s := v.Interface().(string)
|
||||||
@ -331,71 +331,71 @@ func (c *stringConverter) GoValueOf(v pref.Value) reflect.Value {
|
|||||||
}
|
}
|
||||||
return reflect.ValueOf(s).Convert(c.goType)
|
return reflect.ValueOf(s).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *stringConverter) IsValidPB(v pref.Value) bool {
|
func (c *stringConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(string)
|
_, ok := v.Interface().(string)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *stringConverter) IsValidGo(v reflect.Value) bool {
|
func (c *stringConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *stringConverter) New() pref.Value { return c.def }
|
func (c *stringConverter) New() protoreflect.Value { return c.def }
|
||||||
func (c *stringConverter) Zero() pref.Value { return c.def }
|
func (c *stringConverter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type bytesConverter struct {
|
type bytesConverter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *bytesConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *bytesConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
if c.goType.Kind() == reflect.String && v.Len() == 0 {
|
if c.goType.Kind() == reflect.String && v.Len() == 0 {
|
||||||
return pref.ValueOfBytes(nil) // ensure empty string is []byte(nil)
|
return protoreflect.ValueOfBytes(nil) // ensure empty string is []byte(nil)
|
||||||
}
|
}
|
||||||
return pref.ValueOfBytes(v.Convert(bytesType).Bytes())
|
return protoreflect.ValueOfBytes(v.Convert(bytesType).Bytes())
|
||||||
}
|
}
|
||||||
func (c *bytesConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *bytesConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(v.Bytes()).Convert(c.goType)
|
return reflect.ValueOf(v.Bytes()).Convert(c.goType)
|
||||||
}
|
}
|
||||||
func (c *bytesConverter) IsValidPB(v pref.Value) bool {
|
func (c *bytesConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().([]byte)
|
_, ok := v.Interface().([]byte)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
func (c *bytesConverter) IsValidGo(v reflect.Value) bool {
|
func (c *bytesConverter) IsValidGo(v reflect.Value) bool {
|
||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
func (c *bytesConverter) New() pref.Value { return c.def }
|
func (c *bytesConverter) New() protoreflect.Value { return c.def }
|
||||||
func (c *bytesConverter) Zero() pref.Value { return c.def }
|
func (c *bytesConverter) Zero() protoreflect.Value { return c.def }
|
||||||
|
|
||||||
type enumConverter struct {
|
type enumConverter struct {
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
def pref.Value
|
def protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func newEnumConverter(goType reflect.Type, fd pref.FieldDescriptor) Converter {
|
func newEnumConverter(goType reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||||
var def pref.Value
|
var def protoreflect.Value
|
||||||
if fd.Cardinality() == pref.Repeated {
|
if fd.Cardinality() == protoreflect.Repeated {
|
||||||
def = pref.ValueOfEnum(fd.Enum().Values().Get(0).Number())
|
def = protoreflect.ValueOfEnum(fd.Enum().Values().Get(0).Number())
|
||||||
} else {
|
} else {
|
||||||
def = fd.Default()
|
def = fd.Default()
|
||||||
}
|
}
|
||||||
return &enumConverter{goType, def}
|
return &enumConverter{goType, def}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *enumConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *enumConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfEnum(pref.EnumNumber(v.Int()))
|
return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v.Int()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *enumConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *enumConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return reflect.ValueOf(v.Enum()).Convert(c.goType)
|
return reflect.ValueOf(v.Enum()).Convert(c.goType)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *enumConverter) IsValidPB(v pref.Value) bool {
|
func (c *enumConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
_, ok := v.Interface().(pref.EnumNumber)
|
_, ok := v.Interface().(protoreflect.EnumNumber)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,11 +403,11 @@ func (c *enumConverter) IsValidGo(v reflect.Value) bool {
|
|||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *enumConverter) New() pref.Value {
|
func (c *enumConverter) New() protoreflect.Value {
|
||||||
return c.def
|
return c.def
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *enumConverter) Zero() pref.Value {
|
func (c *enumConverter) Zero() protoreflect.Value {
|
||||||
return c.def
|
return c.def
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ func newMessageConverter(goType reflect.Type) Converter {
|
|||||||
return &messageConverter{goType}
|
return &messageConverter{goType}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *messageConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *messageConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
@ -430,13 +430,13 @@ func (c *messageConverter) PBValueOf(v reflect.Value) pref.Value {
|
|||||||
v = reflect.Zero(reflect.PtrTo(v.Type()))
|
v = reflect.Zero(reflect.PtrTo(v.Type()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m, ok := v.Interface().(pref.ProtoMessage); ok {
|
if m, ok := v.Interface().(protoreflect.ProtoMessage); ok {
|
||||||
return pref.ValueOfMessage(m.ProtoReflect())
|
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||||
}
|
}
|
||||||
return pref.ValueOfMessage(legacyWrapMessage(v))
|
return protoreflect.ValueOfMessage(legacyWrapMessage(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *messageConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *messageConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
m := v.Message()
|
m := v.Message()
|
||||||
var rv reflect.Value
|
var rv reflect.Value
|
||||||
if u, ok := m.(unwrapper); ok {
|
if u, ok := m.(unwrapper); ok {
|
||||||
@ -460,7 +460,7 @@ func (c *messageConverter) GoValueOf(v pref.Value) reflect.Value {
|
|||||||
return rv
|
return rv
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *messageConverter) IsValidPB(v pref.Value) bool {
|
func (c *messageConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
m := v.Message()
|
m := v.Message()
|
||||||
var rv reflect.Value
|
var rv reflect.Value
|
||||||
if u, ok := m.(unwrapper); ok {
|
if u, ok := m.(unwrapper); ok {
|
||||||
@ -478,14 +478,14 @@ func (c *messageConverter) IsValidGo(v reflect.Value) bool {
|
|||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *messageConverter) New() pref.Value {
|
func (c *messageConverter) New() protoreflect.Value {
|
||||||
if c.isNonPointer() {
|
if c.isNonPointer() {
|
||||||
return c.PBValueOf(reflect.New(c.goType).Elem())
|
return c.PBValueOf(reflect.New(c.goType).Elem())
|
||||||
}
|
}
|
||||||
return c.PBValueOf(reflect.New(c.goType.Elem()))
|
return c.PBValueOf(reflect.New(c.goType.Elem()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *messageConverter) Zero() pref.Value {
|
func (c *messageConverter) Zero() protoreflect.Value {
|
||||||
return c.PBValueOf(reflect.Zero(c.goType))
|
return c.PBValueOf(reflect.Zero(c.goType))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
42
vendor/google.golang.org/protobuf/internal/impl/convert_list.go
generated
vendored
42
vendor/google.golang.org/protobuf/internal/impl/convert_list.go
generated
vendored
@ -8,10 +8,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newListConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
func newListConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||||
switch {
|
switch {
|
||||||
case t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Slice:
|
case t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Slice:
|
||||||
return &listPtrConverter{t, newSingularConverter(t.Elem().Elem(), fd)}
|
return &listPtrConverter{t, newSingularConverter(t.Elem().Elem(), fd)}
|
||||||
@ -26,16 +26,16 @@ type listConverter struct {
|
|||||||
c Converter
|
c Converter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *listConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
pv := reflect.New(c.goType)
|
pv := reflect.New(c.goType)
|
||||||
pv.Elem().Set(v)
|
pv.Elem().Set(v)
|
||||||
return pref.ValueOfList(&listReflect{pv, c.c})
|
return protoreflect.ValueOfList(&listReflect{pv, c.c})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *listConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
rv := v.List().(*listReflect).v
|
rv := v.List().(*listReflect).v
|
||||||
if rv.IsNil() {
|
if rv.IsNil() {
|
||||||
return reflect.Zero(c.goType)
|
return reflect.Zero(c.goType)
|
||||||
@ -43,7 +43,7 @@ func (c *listConverter) GoValueOf(v pref.Value) reflect.Value {
|
|||||||
return rv.Elem()
|
return rv.Elem()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listConverter) IsValidPB(v pref.Value) bool {
|
func (c *listConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
list, ok := v.Interface().(*listReflect)
|
list, ok := v.Interface().(*listReflect)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
@ -55,12 +55,12 @@ func (c *listConverter) IsValidGo(v reflect.Value) bool {
|
|||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listConverter) New() pref.Value {
|
func (c *listConverter) New() protoreflect.Value {
|
||||||
return pref.ValueOfList(&listReflect{reflect.New(c.goType), c.c})
|
return protoreflect.ValueOfList(&listReflect{reflect.New(c.goType), c.c})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listConverter) Zero() pref.Value {
|
func (c *listConverter) Zero() protoreflect.Value {
|
||||||
return pref.ValueOfList(&listReflect{reflect.Zero(reflect.PtrTo(c.goType)), c.c})
|
return protoreflect.ValueOfList(&listReflect{reflect.Zero(reflect.PtrTo(c.goType)), c.c})
|
||||||
}
|
}
|
||||||
|
|
||||||
type listPtrConverter struct {
|
type listPtrConverter struct {
|
||||||
@ -68,18 +68,18 @@ type listPtrConverter struct {
|
|||||||
c Converter
|
c Converter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listPtrConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *listPtrConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfList(&listReflect{v, c.c})
|
return protoreflect.ValueOfList(&listReflect{v, c.c})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listPtrConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *listPtrConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return v.List().(*listReflect).v
|
return v.List().(*listReflect).v
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listPtrConverter) IsValidPB(v pref.Value) bool {
|
func (c *listPtrConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
list, ok := v.Interface().(*listReflect)
|
list, ok := v.Interface().(*listReflect)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
@ -91,11 +91,11 @@ func (c *listPtrConverter) IsValidGo(v reflect.Value) bool {
|
|||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listPtrConverter) New() pref.Value {
|
func (c *listPtrConverter) New() protoreflect.Value {
|
||||||
return c.PBValueOf(reflect.New(c.goType.Elem()))
|
return c.PBValueOf(reflect.New(c.goType.Elem()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *listPtrConverter) Zero() pref.Value {
|
func (c *listPtrConverter) Zero() protoreflect.Value {
|
||||||
return c.PBValueOf(reflect.Zero(c.goType))
|
return c.PBValueOf(reflect.Zero(c.goType))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,16 +110,16 @@ func (ls *listReflect) Len() int {
|
|||||||
}
|
}
|
||||||
return ls.v.Elem().Len()
|
return ls.v.Elem().Len()
|
||||||
}
|
}
|
||||||
func (ls *listReflect) Get(i int) pref.Value {
|
func (ls *listReflect) Get(i int) protoreflect.Value {
|
||||||
return ls.conv.PBValueOf(ls.v.Elem().Index(i))
|
return ls.conv.PBValueOf(ls.v.Elem().Index(i))
|
||||||
}
|
}
|
||||||
func (ls *listReflect) Set(i int, v pref.Value) {
|
func (ls *listReflect) Set(i int, v protoreflect.Value) {
|
||||||
ls.v.Elem().Index(i).Set(ls.conv.GoValueOf(v))
|
ls.v.Elem().Index(i).Set(ls.conv.GoValueOf(v))
|
||||||
}
|
}
|
||||||
func (ls *listReflect) Append(v pref.Value) {
|
func (ls *listReflect) Append(v protoreflect.Value) {
|
||||||
ls.v.Elem().Set(reflect.Append(ls.v.Elem(), ls.conv.GoValueOf(v)))
|
ls.v.Elem().Set(reflect.Append(ls.v.Elem(), ls.conv.GoValueOf(v)))
|
||||||
}
|
}
|
||||||
func (ls *listReflect) AppendMutable() pref.Value {
|
func (ls *listReflect) AppendMutable() protoreflect.Value {
|
||||||
if _, ok := ls.conv.(*messageConverter); !ok {
|
if _, ok := ls.conv.(*messageConverter); !ok {
|
||||||
panic("invalid AppendMutable on list with non-message type")
|
panic("invalid AppendMutable on list with non-message type")
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ func (ls *listReflect) AppendMutable() pref.Value {
|
|||||||
func (ls *listReflect) Truncate(i int) {
|
func (ls *listReflect) Truncate(i int) {
|
||||||
ls.v.Elem().Set(ls.v.Elem().Slice(0, i))
|
ls.v.Elem().Set(ls.v.Elem().Slice(0, i))
|
||||||
}
|
}
|
||||||
func (ls *listReflect) NewElement() pref.Value {
|
func (ls *listReflect) NewElement() protoreflect.Value {
|
||||||
return ls.conv.New()
|
return ls.conv.New()
|
||||||
}
|
}
|
||||||
func (ls *listReflect) IsValid() bool {
|
func (ls *listReflect) IsValid() bool {
|
||||||
|
32
vendor/google.golang.org/protobuf/internal/impl/convert_map.go
generated
vendored
32
vendor/google.golang.org/protobuf/internal/impl/convert_map.go
generated
vendored
@ -8,7 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mapConverter struct {
|
type mapConverter struct {
|
||||||
@ -16,7 +16,7 @@ type mapConverter struct {
|
|||||||
keyConv, valConv Converter
|
keyConv, valConv Converter
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMapConverter(t reflect.Type, fd pref.FieldDescriptor) *mapConverter {
|
func newMapConverter(t reflect.Type, fd protoreflect.FieldDescriptor) *mapConverter {
|
||||||
if t.Kind() != reflect.Map {
|
if t.Kind() != reflect.Map {
|
||||||
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
||||||
}
|
}
|
||||||
@ -27,18 +27,18 @@ func newMapConverter(t reflect.Type, fd pref.FieldDescriptor) *mapConverter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mapConverter) PBValueOf(v reflect.Value) pref.Value {
|
func (c *mapConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||||
if v.Type() != c.goType {
|
if v.Type() != c.goType {
|
||||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||||
}
|
}
|
||||||
return pref.ValueOfMap(&mapReflect{v, c.keyConv, c.valConv})
|
return protoreflect.ValueOfMap(&mapReflect{v, c.keyConv, c.valConv})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mapConverter) GoValueOf(v pref.Value) reflect.Value {
|
func (c *mapConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||||
return v.Map().(*mapReflect).v
|
return v.Map().(*mapReflect).v
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mapConverter) IsValidPB(v pref.Value) bool {
|
func (c *mapConverter) IsValidPB(v protoreflect.Value) bool {
|
||||||
mapv, ok := v.Interface().(*mapReflect)
|
mapv, ok := v.Interface().(*mapReflect)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
@ -50,11 +50,11 @@ func (c *mapConverter) IsValidGo(v reflect.Value) bool {
|
|||||||
return v.IsValid() && v.Type() == c.goType
|
return v.IsValid() && v.Type() == c.goType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mapConverter) New() pref.Value {
|
func (c *mapConverter) New() protoreflect.Value {
|
||||||
return c.PBValueOf(reflect.MakeMap(c.goType))
|
return c.PBValueOf(reflect.MakeMap(c.goType))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *mapConverter) Zero() pref.Value {
|
func (c *mapConverter) Zero() protoreflect.Value {
|
||||||
return c.PBValueOf(reflect.Zero(c.goType))
|
return c.PBValueOf(reflect.Zero(c.goType))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,29 +67,29 @@ type mapReflect struct {
|
|||||||
func (ms *mapReflect) Len() int {
|
func (ms *mapReflect) Len() int {
|
||||||
return ms.v.Len()
|
return ms.v.Len()
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Has(k pref.MapKey) bool {
|
func (ms *mapReflect) Has(k protoreflect.MapKey) bool {
|
||||||
rk := ms.keyConv.GoValueOf(k.Value())
|
rk := ms.keyConv.GoValueOf(k.Value())
|
||||||
rv := ms.v.MapIndex(rk)
|
rv := ms.v.MapIndex(rk)
|
||||||
return rv.IsValid()
|
return rv.IsValid()
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Get(k pref.MapKey) pref.Value {
|
func (ms *mapReflect) Get(k protoreflect.MapKey) protoreflect.Value {
|
||||||
rk := ms.keyConv.GoValueOf(k.Value())
|
rk := ms.keyConv.GoValueOf(k.Value())
|
||||||
rv := ms.v.MapIndex(rk)
|
rv := ms.v.MapIndex(rk)
|
||||||
if !rv.IsValid() {
|
if !rv.IsValid() {
|
||||||
return pref.Value{}
|
return protoreflect.Value{}
|
||||||
}
|
}
|
||||||
return ms.valConv.PBValueOf(rv)
|
return ms.valConv.PBValueOf(rv)
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Set(k pref.MapKey, v pref.Value) {
|
func (ms *mapReflect) Set(k protoreflect.MapKey, v protoreflect.Value) {
|
||||||
rk := ms.keyConv.GoValueOf(k.Value())
|
rk := ms.keyConv.GoValueOf(k.Value())
|
||||||
rv := ms.valConv.GoValueOf(v)
|
rv := ms.valConv.GoValueOf(v)
|
||||||
ms.v.SetMapIndex(rk, rv)
|
ms.v.SetMapIndex(rk, rv)
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Clear(k pref.MapKey) {
|
func (ms *mapReflect) Clear(k protoreflect.MapKey) {
|
||||||
rk := ms.keyConv.GoValueOf(k.Value())
|
rk := ms.keyConv.GoValueOf(k.Value())
|
||||||
ms.v.SetMapIndex(rk, reflect.Value{})
|
ms.v.SetMapIndex(rk, reflect.Value{})
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Mutable(k pref.MapKey) pref.Value {
|
func (ms *mapReflect) Mutable(k protoreflect.MapKey) protoreflect.Value {
|
||||||
if _, ok := ms.valConv.(*messageConverter); !ok {
|
if _, ok := ms.valConv.(*messageConverter); !ok {
|
||||||
panic("invalid Mutable on map with non-message value type")
|
panic("invalid Mutable on map with non-message value type")
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ func (ms *mapReflect) Mutable(k pref.MapKey) pref.Value {
|
|||||||
}
|
}
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) Range(f func(pref.MapKey, pref.Value) bool) {
|
func (ms *mapReflect) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) {
|
||||||
iter := mapRange(ms.v)
|
iter := mapRange(ms.v)
|
||||||
for iter.Next() {
|
for iter.Next() {
|
||||||
k := ms.keyConv.PBValueOf(iter.Key()).MapKey()
|
k := ms.keyConv.PBValueOf(iter.Key()).MapKey()
|
||||||
@ -110,7 +110,7 @@ func (ms *mapReflect) Range(f func(pref.MapKey, pref.Value) bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) NewValue() pref.Value {
|
func (ms *mapReflect) NewValue() protoreflect.Value {
|
||||||
return ms.valConv.New()
|
return ms.valConv.New()
|
||||||
}
|
}
|
||||||
func (ms *mapReflect) IsValid() bool {
|
func (ms *mapReflect) IsValid() bool {
|
||||||
|
21
vendor/google.golang.org/protobuf/internal/impl/decode.go
generated
vendored
21
vendor/google.golang.org/protobuf/internal/impl/decode.go
generated
vendored
@ -12,9 +12,8 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/flags"
|
"google.golang.org/protobuf/internal/flags"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
"google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var errDecode = errors.New("cannot parse invalid wire-format data")
|
var errDecode = errors.New("cannot parse invalid wire-format data")
|
||||||
@ -38,14 +37,16 @@ func (o unmarshalOptions) Options() proto.UnmarshalOptions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o unmarshalOptions) DiscardUnknown() bool { return o.flags&piface.UnmarshalDiscardUnknown != 0 }
|
func (o unmarshalOptions) DiscardUnknown() bool {
|
||||||
|
return o.flags&protoiface.UnmarshalDiscardUnknown != 0
|
||||||
|
}
|
||||||
|
|
||||||
func (o unmarshalOptions) IsDefault() bool {
|
func (o unmarshalOptions) IsDefault() bool {
|
||||||
return o.flags == 0 && o.resolver == preg.GlobalTypes
|
return o.flags == 0 && o.resolver == protoregistry.GlobalTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
var lazyUnmarshalOptions = unmarshalOptions{
|
var lazyUnmarshalOptions = unmarshalOptions{
|
||||||
resolver: preg.GlobalTypes,
|
resolver: protoregistry.GlobalTypes,
|
||||||
depth: protowire.DefaultRecursionLimit,
|
depth: protowire.DefaultRecursionLimit,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ type unmarshalOutput struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unmarshal is protoreflect.Methods.Unmarshal.
|
// unmarshal is protoreflect.Methods.Unmarshal.
|
||||||
func (mi *MessageInfo) unmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {
|
func (mi *MessageInfo) unmarshal(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||||
var p pointer
|
var p pointer
|
||||||
if ms, ok := in.Message.(*messageState); ok {
|
if ms, ok := in.Message.(*messageState); ok {
|
||||||
p = ms.pointer()
|
p = ms.pointer()
|
||||||
@ -67,11 +68,11 @@ func (mi *MessageInfo) unmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutp
|
|||||||
resolver: in.Resolver,
|
resolver: in.Resolver,
|
||||||
depth: in.Depth,
|
depth: in.Depth,
|
||||||
})
|
})
|
||||||
var flags piface.UnmarshalOutputFlags
|
var flags protoiface.UnmarshalOutputFlags
|
||||||
if out.initialized {
|
if out.initialized {
|
||||||
flags |= piface.UnmarshalInitialized
|
flags |= protoiface.UnmarshalInitialized
|
||||||
}
|
}
|
||||||
return piface.UnmarshalOutput{
|
return protoiface.UnmarshalOutput{
|
||||||
Flags: flags,
|
Flags: flags,
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
@ -210,7 +211,7 @@ func (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp p
|
|||||||
var err error
|
var err error
|
||||||
xt, err = opts.resolver.FindExtensionByNumber(mi.Desc.FullName(), num)
|
xt, err = opts.resolver.FindExtensionByNumber(mi.Desc.FullName(), num)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == preg.NotFound {
|
if err == protoregistry.NotFound {
|
||||||
return out, errUnknown
|
return out, errUnknown
|
||||||
}
|
}
|
||||||
return out, errors.New("%v: unable to resolve extension %v: %v", mi.Desc.FullName(), num, err)
|
return out, errors.New("%v: unable to resolve extension %v: %v", mi.Desc.FullName(), num, err)
|
||||||
|
10
vendor/google.golang.org/protobuf/internal/impl/enum.go
generated
vendored
10
vendor/google.golang.org/protobuf/internal/impl/enum.go
generated
vendored
@ -7,15 +7,15 @@ package impl
|
|||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EnumInfo struct {
|
type EnumInfo struct {
|
||||||
GoReflectType reflect.Type // int32 kind
|
GoReflectType reflect.Type // int32 kind
|
||||||
Desc pref.EnumDescriptor
|
Desc protoreflect.EnumDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *EnumInfo) New(n pref.EnumNumber) pref.Enum {
|
func (t *EnumInfo) New(n protoreflect.EnumNumber) protoreflect.Enum {
|
||||||
return reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(pref.Enum)
|
return reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(protoreflect.Enum)
|
||||||
}
|
}
|
||||||
func (t *EnumInfo) Descriptor() pref.EnumDescriptor { return t.Desc }
|
func (t *EnumInfo) Descriptor() protoreflect.EnumDescriptor { return t.Desc }
|
||||||
|
26
vendor/google.golang.org/protobuf/internal/impl/extension.go
generated
vendored
26
vendor/google.golang.org/protobuf/internal/impl/extension.go
generated
vendored
@ -9,8 +9,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExtensionInfo implements ExtensionType.
|
// ExtensionInfo implements ExtensionType.
|
||||||
@ -45,7 +45,7 @@ type ExtensionInfo struct {
|
|||||||
// since the message may no longer implement the MessageV1 interface.
|
// since the message may no longer implement the MessageV1 interface.
|
||||||
//
|
//
|
||||||
// Deprecated: Use the ExtendedType method instead.
|
// Deprecated: Use the ExtendedType method instead.
|
||||||
ExtendedType piface.MessageV1
|
ExtendedType protoiface.MessageV1
|
||||||
|
|
||||||
// ExtensionType is the zero value of the extension type.
|
// ExtensionType is the zero value of the extension type.
|
||||||
//
|
//
|
||||||
@ -83,31 +83,31 @@ const (
|
|||||||
extensionInfoFullInit = 2
|
extensionInfoFullInit = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitExtensionInfo(xi *ExtensionInfo, xd pref.ExtensionDescriptor, goType reflect.Type) {
|
func InitExtensionInfo(xi *ExtensionInfo, xd protoreflect.ExtensionDescriptor, goType reflect.Type) {
|
||||||
xi.goType = goType
|
xi.goType = goType
|
||||||
xi.desc = extensionTypeDescriptor{xd, xi}
|
xi.desc = extensionTypeDescriptor{xd, xi}
|
||||||
xi.init = extensionInfoDescInit
|
xi.init = extensionInfoDescInit
|
||||||
}
|
}
|
||||||
|
|
||||||
func (xi *ExtensionInfo) New() pref.Value {
|
func (xi *ExtensionInfo) New() protoreflect.Value {
|
||||||
return xi.lazyInit().New()
|
return xi.lazyInit().New()
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) Zero() pref.Value {
|
func (xi *ExtensionInfo) Zero() protoreflect.Value {
|
||||||
return xi.lazyInit().Zero()
|
return xi.lazyInit().Zero()
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) ValueOf(v interface{}) pref.Value {
|
func (xi *ExtensionInfo) ValueOf(v interface{}) protoreflect.Value {
|
||||||
return xi.lazyInit().PBValueOf(reflect.ValueOf(v))
|
return xi.lazyInit().PBValueOf(reflect.ValueOf(v))
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) InterfaceOf(v pref.Value) interface{} {
|
func (xi *ExtensionInfo) InterfaceOf(v protoreflect.Value) interface{} {
|
||||||
return xi.lazyInit().GoValueOf(v).Interface()
|
return xi.lazyInit().GoValueOf(v).Interface()
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) IsValidValue(v pref.Value) bool {
|
func (xi *ExtensionInfo) IsValidValue(v protoreflect.Value) bool {
|
||||||
return xi.lazyInit().IsValidPB(v)
|
return xi.lazyInit().IsValidPB(v)
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) IsValidInterface(v interface{}) bool {
|
func (xi *ExtensionInfo) IsValidInterface(v interface{}) bool {
|
||||||
return xi.lazyInit().IsValidGo(reflect.ValueOf(v))
|
return xi.lazyInit().IsValidGo(reflect.ValueOf(v))
|
||||||
}
|
}
|
||||||
func (xi *ExtensionInfo) TypeDescriptor() pref.ExtensionTypeDescriptor {
|
func (xi *ExtensionInfo) TypeDescriptor() protoreflect.ExtensionTypeDescriptor {
|
||||||
if atomic.LoadUint32(&xi.init) < extensionInfoDescInit {
|
if atomic.LoadUint32(&xi.init) < extensionInfoDescInit {
|
||||||
xi.lazyInitSlow()
|
xi.lazyInitSlow()
|
||||||
}
|
}
|
||||||
@ -144,13 +144,13 @@ func (xi *ExtensionInfo) lazyInitSlow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type extensionTypeDescriptor struct {
|
type extensionTypeDescriptor struct {
|
||||||
pref.ExtensionDescriptor
|
protoreflect.ExtensionDescriptor
|
||||||
xi *ExtensionInfo
|
xi *ExtensionInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (xtd *extensionTypeDescriptor) Type() pref.ExtensionType {
|
func (xtd *extensionTypeDescriptor) Type() protoreflect.ExtensionType {
|
||||||
return xtd.xi
|
return xtd.xi
|
||||||
}
|
}
|
||||||
func (xtd *extensionTypeDescriptor) Descriptor() pref.ExtensionDescriptor {
|
func (xtd *extensionTypeDescriptor) Descriptor() protoreflect.ExtensionDescriptor {
|
||||||
return xtd.ExtensionDescriptor
|
return xtd.ExtensionDescriptor
|
||||||
}
|
}
|
||||||
|
55
vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
generated
vendored
55
vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
generated
vendored
@ -13,13 +13,12 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// legacyEnumName returns the name of enums used in legacy code.
|
// legacyEnumName returns the name of enums used in legacy code.
|
||||||
// It is neither the protobuf full name nor the qualified Go name,
|
// It is neither the protobuf full name nor the qualified Go name,
|
||||||
// but rather an odd hybrid of both.
|
// but rather an odd hybrid of both.
|
||||||
func legacyEnumName(ed pref.EnumDescriptor) string {
|
func legacyEnumName(ed protoreflect.EnumDescriptor) string {
|
||||||
var protoPkg string
|
var protoPkg string
|
||||||
enumName := string(ed.FullName())
|
enumName := string(ed.FullName())
|
||||||
if fd := ed.ParentFile(); fd != nil {
|
if fd := ed.ParentFile(); fd != nil {
|
||||||
@ -34,68 +33,68 @@ func legacyEnumName(ed pref.EnumDescriptor) string {
|
|||||||
|
|
||||||
// legacyWrapEnum wraps v as a protoreflect.Enum,
|
// legacyWrapEnum wraps v as a protoreflect.Enum,
|
||||||
// where v must be a int32 kind and not implement the v2 API already.
|
// where v must be a int32 kind and not implement the v2 API already.
|
||||||
func legacyWrapEnum(v reflect.Value) pref.Enum {
|
func legacyWrapEnum(v reflect.Value) protoreflect.Enum {
|
||||||
et := legacyLoadEnumType(v.Type())
|
et := legacyLoadEnumType(v.Type())
|
||||||
return et.New(pref.EnumNumber(v.Int()))
|
return et.New(protoreflect.EnumNumber(v.Int()))
|
||||||
}
|
}
|
||||||
|
|
||||||
var legacyEnumTypeCache sync.Map // map[reflect.Type]protoreflect.EnumType
|
var legacyEnumTypeCache sync.Map // map[reflect.Type]protoreflect.EnumType
|
||||||
|
|
||||||
// legacyLoadEnumType dynamically loads a protoreflect.EnumType for t,
|
// legacyLoadEnumType dynamically loads a protoreflect.EnumType for t,
|
||||||
// where t must be an int32 kind and not implement the v2 API already.
|
// where t must be an int32 kind and not implement the v2 API already.
|
||||||
func legacyLoadEnumType(t reflect.Type) pref.EnumType {
|
func legacyLoadEnumType(t reflect.Type) protoreflect.EnumType {
|
||||||
// Fast-path: check if a EnumType is cached for this concrete type.
|
// Fast-path: check if a EnumType is cached for this concrete type.
|
||||||
if et, ok := legacyEnumTypeCache.Load(t); ok {
|
if et, ok := legacyEnumTypeCache.Load(t); ok {
|
||||||
return et.(pref.EnumType)
|
return et.(protoreflect.EnumType)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow-path: derive enum descriptor and initialize EnumType.
|
// Slow-path: derive enum descriptor and initialize EnumType.
|
||||||
var et pref.EnumType
|
var et protoreflect.EnumType
|
||||||
ed := LegacyLoadEnumDesc(t)
|
ed := LegacyLoadEnumDesc(t)
|
||||||
et = &legacyEnumType{
|
et = &legacyEnumType{
|
||||||
desc: ed,
|
desc: ed,
|
||||||
goType: t,
|
goType: t,
|
||||||
}
|
}
|
||||||
if et, ok := legacyEnumTypeCache.LoadOrStore(t, et); ok {
|
if et, ok := legacyEnumTypeCache.LoadOrStore(t, et); ok {
|
||||||
return et.(pref.EnumType)
|
return et.(protoreflect.EnumType)
|
||||||
}
|
}
|
||||||
return et
|
return et
|
||||||
}
|
}
|
||||||
|
|
||||||
type legacyEnumType struct {
|
type legacyEnumType struct {
|
||||||
desc pref.EnumDescriptor
|
desc protoreflect.EnumDescriptor
|
||||||
goType reflect.Type
|
goType reflect.Type
|
||||||
m sync.Map // map[protoreflect.EnumNumber]proto.Enum
|
m sync.Map // map[protoreflect.EnumNumber]proto.Enum
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *legacyEnumType) New(n pref.EnumNumber) pref.Enum {
|
func (t *legacyEnumType) New(n protoreflect.EnumNumber) protoreflect.Enum {
|
||||||
if e, ok := t.m.Load(n); ok {
|
if e, ok := t.m.Load(n); ok {
|
||||||
return e.(pref.Enum)
|
return e.(protoreflect.Enum)
|
||||||
}
|
}
|
||||||
e := &legacyEnumWrapper{num: n, pbTyp: t, goTyp: t.goType}
|
e := &legacyEnumWrapper{num: n, pbTyp: t, goTyp: t.goType}
|
||||||
t.m.Store(n, e)
|
t.m.Store(n, e)
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
func (t *legacyEnumType) Descriptor() pref.EnumDescriptor {
|
func (t *legacyEnumType) Descriptor() protoreflect.EnumDescriptor {
|
||||||
return t.desc
|
return t.desc
|
||||||
}
|
}
|
||||||
|
|
||||||
type legacyEnumWrapper struct {
|
type legacyEnumWrapper struct {
|
||||||
num pref.EnumNumber
|
num protoreflect.EnumNumber
|
||||||
pbTyp pref.EnumType
|
pbTyp protoreflect.EnumType
|
||||||
goTyp reflect.Type
|
goTyp reflect.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *legacyEnumWrapper) Descriptor() pref.EnumDescriptor {
|
func (e *legacyEnumWrapper) Descriptor() protoreflect.EnumDescriptor {
|
||||||
return e.pbTyp.Descriptor()
|
return e.pbTyp.Descriptor()
|
||||||
}
|
}
|
||||||
func (e *legacyEnumWrapper) Type() pref.EnumType {
|
func (e *legacyEnumWrapper) Type() protoreflect.EnumType {
|
||||||
return e.pbTyp
|
return e.pbTyp
|
||||||
}
|
}
|
||||||
func (e *legacyEnumWrapper) Number() pref.EnumNumber {
|
func (e *legacyEnumWrapper) Number() protoreflect.EnumNumber {
|
||||||
return e.num
|
return e.num
|
||||||
}
|
}
|
||||||
func (e *legacyEnumWrapper) ProtoReflect() pref.Enum {
|
func (e *legacyEnumWrapper) ProtoReflect() protoreflect.Enum {
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
func (e *legacyEnumWrapper) protoUnwrap() interface{} {
|
func (e *legacyEnumWrapper) protoUnwrap() interface{} {
|
||||||
@ -105,7 +104,7 @@ func (e *legacyEnumWrapper) protoUnwrap() interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ pref.Enum = (*legacyEnumWrapper)(nil)
|
_ protoreflect.Enum = (*legacyEnumWrapper)(nil)
|
||||||
_ unwrapper = (*legacyEnumWrapper)(nil)
|
_ unwrapper = (*legacyEnumWrapper)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -115,15 +114,15 @@ var legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor
|
|||||||
// which must be an int32 kind and not implement the v2 API already.
|
// which must be an int32 kind and not implement the v2 API already.
|
||||||
//
|
//
|
||||||
// This is exported for testing purposes.
|
// This is exported for testing purposes.
|
||||||
func LegacyLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
func LegacyLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
|
||||||
// Fast-path: check if an EnumDescriptor is cached for this concrete type.
|
// Fast-path: check if an EnumDescriptor is cached for this concrete type.
|
||||||
if ed, ok := legacyEnumDescCache.Load(t); ok {
|
if ed, ok := legacyEnumDescCache.Load(t); ok {
|
||||||
return ed.(pref.EnumDescriptor)
|
return ed.(protoreflect.EnumDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow-path: initialize EnumDescriptor from the raw descriptor.
|
// Slow-path: initialize EnumDescriptor from the raw descriptor.
|
||||||
ev := reflect.Zero(t).Interface()
|
ev := reflect.Zero(t).Interface()
|
||||||
if _, ok := ev.(pref.Enum); ok {
|
if _, ok := ev.(protoreflect.Enum); ok {
|
||||||
panic(fmt.Sprintf("%v already implements proto.Enum", t))
|
panic(fmt.Sprintf("%v already implements proto.Enum", t))
|
||||||
}
|
}
|
||||||
edV1, ok := ev.(enumV1)
|
edV1, ok := ev.(enumV1)
|
||||||
@ -132,7 +131,7 @@ func LegacyLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
|||||||
}
|
}
|
||||||
b, idxs := edV1.EnumDescriptor()
|
b, idxs := edV1.EnumDescriptor()
|
||||||
|
|
||||||
var ed pref.EnumDescriptor
|
var ed protoreflect.EnumDescriptor
|
||||||
if len(idxs) == 1 {
|
if len(idxs) == 1 {
|
||||||
ed = legacyLoadFileDesc(b).Enums().Get(idxs[0])
|
ed = legacyLoadFileDesc(b).Enums().Get(idxs[0])
|
||||||
} else {
|
} else {
|
||||||
@ -158,10 +157,10 @@ var aberrantEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescript
|
|||||||
// We are unable to use the global enum registry since it is
|
// We are unable to use the global enum registry since it is
|
||||||
// unfortunately keyed by the protobuf full name, which we also do not know.
|
// unfortunately keyed by the protobuf full name, which we also do not know.
|
||||||
// Thus, this produces some bogus enum descriptor based on the Go type name.
|
// Thus, this produces some bogus enum descriptor based on the Go type name.
|
||||||
func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
func aberrantLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
|
||||||
// Fast-path: check if an EnumDescriptor is cached for this concrete type.
|
// Fast-path: check if an EnumDescriptor is cached for this concrete type.
|
||||||
if ed, ok := aberrantEnumDescCache.Load(t); ok {
|
if ed, ok := aberrantEnumDescCache.Load(t); ok {
|
||||||
return ed.(pref.EnumDescriptor)
|
return ed.(protoreflect.EnumDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow-path: construct a bogus, but unique EnumDescriptor.
|
// Slow-path: construct a bogus, but unique EnumDescriptor.
|
||||||
@ -182,7 +181,7 @@ func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
|||||||
// An exhaustive query is clearly impractical, but can be best-effort.
|
// An exhaustive query is clearly impractical, but can be best-effort.
|
||||||
|
|
||||||
if ed, ok := aberrantEnumDescCache.LoadOrStore(t, ed); ok {
|
if ed, ok := aberrantEnumDescCache.LoadOrStore(t, ed); ok {
|
||||||
return ed.(pref.EnumDescriptor)
|
return ed.(protoreflect.EnumDescriptor)
|
||||||
}
|
}
|
||||||
return ed
|
return ed
|
||||||
}
|
}
|
||||||
@ -192,7 +191,7 @@ func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
|||||||
// It should be sufficiently unique within a program.
|
// It should be sufficiently unique within a program.
|
||||||
//
|
//
|
||||||
// This is exported for testing purposes.
|
// This is exported for testing purposes.
|
||||||
func AberrantDeriveFullName(t reflect.Type) pref.FullName {
|
func AberrantDeriveFullName(t reflect.Type) protoreflect.FullName {
|
||||||
sanitize := func(r rune) rune {
|
sanitize := func(r rune) rune {
|
||||||
switch {
|
switch {
|
||||||
case r == '/':
|
case r == '/':
|
||||||
@ -215,5 +214,5 @@ func AberrantDeriveFullName(t reflect.Type) pref.FullName {
|
|||||||
ss[i] = "x" + s
|
ss[i] = "x" + s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pref.FullName(strings.Join(ss, "."))
|
return protoreflect.FullName(strings.Join(ss, "."))
|
||||||
}
|
}
|
||||||
|
18
vendor/google.golang.org/protobuf/internal/impl/legacy_export.go
generated
vendored
18
vendor/google.golang.org/protobuf/internal/impl/legacy_export.go
generated
vendored
@ -12,21 +12,21 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// These functions exist to support exported APIs in generated protobufs.
|
// These functions exist to support exported APIs in generated protobufs.
|
||||||
// While these are deprecated, they cannot be removed for compatibility reasons.
|
// While these are deprecated, they cannot be removed for compatibility reasons.
|
||||||
|
|
||||||
// LegacyEnumName returns the name of enums used in legacy code.
|
// LegacyEnumName returns the name of enums used in legacy code.
|
||||||
func (Export) LegacyEnumName(ed pref.EnumDescriptor) string {
|
func (Export) LegacyEnumName(ed protoreflect.EnumDescriptor) string {
|
||||||
return legacyEnumName(ed)
|
return legacyEnumName(ed)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LegacyMessageTypeOf returns the protoreflect.MessageType for m,
|
// LegacyMessageTypeOf returns the protoreflect.MessageType for m,
|
||||||
// with name used as the message name if necessary.
|
// with name used as the message name if necessary.
|
||||||
func (Export) LegacyMessageTypeOf(m piface.MessageV1, name pref.FullName) pref.MessageType {
|
func (Export) LegacyMessageTypeOf(m protoiface.MessageV1, name protoreflect.FullName) protoreflect.MessageType {
|
||||||
if mv := (Export{}).protoMessageV2Of(m); mv != nil {
|
if mv := (Export{}).protoMessageV2Of(m); mv != nil {
|
||||||
return mv.ProtoReflect().Type()
|
return mv.ProtoReflect().Type()
|
||||||
}
|
}
|
||||||
@ -36,9 +36,9 @@ func (Export) LegacyMessageTypeOf(m piface.MessageV1, name pref.FullName) pref.M
|
|||||||
// UnmarshalJSONEnum unmarshals an enum from a JSON-encoded input.
|
// UnmarshalJSONEnum unmarshals an enum from a JSON-encoded input.
|
||||||
// The input can either be a string representing the enum value by name,
|
// The input can either be a string representing the enum value by name,
|
||||||
// or a number representing the enum number itself.
|
// or a number representing the enum number itself.
|
||||||
func (Export) UnmarshalJSONEnum(ed pref.EnumDescriptor, b []byte) (pref.EnumNumber, error) {
|
func (Export) UnmarshalJSONEnum(ed protoreflect.EnumDescriptor, b []byte) (protoreflect.EnumNumber, error) {
|
||||||
if b[0] == '"' {
|
if b[0] == '"' {
|
||||||
var name pref.Name
|
var name protoreflect.Name
|
||||||
if err := json.Unmarshal(b, &name); err != nil {
|
if err := json.Unmarshal(b, &name); err != nil {
|
||||||
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ func (Export) UnmarshalJSONEnum(ed pref.EnumDescriptor, b []byte) (pref.EnumNumb
|
|||||||
}
|
}
|
||||||
return ev.Number(), nil
|
return ev.Number(), nil
|
||||||
} else {
|
} else {
|
||||||
var num pref.EnumNumber
|
var num protoreflect.EnumNumber
|
||||||
if err := json.Unmarshal(b, &num); err != nil {
|
if err := json.Unmarshal(b, &num); err != nil {
|
||||||
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
||||||
}
|
}
|
||||||
@ -81,8 +81,8 @@ func (Export) CompressGZIP(in []byte) (out []byte) {
|
|||||||
blockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3.
|
blockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3.
|
||||||
blockSize = len(in)
|
blockSize = len(in)
|
||||||
}
|
}
|
||||||
binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize)^0x0000)
|
binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize))
|
||||||
binary.LittleEndian.PutUint16(blockHeader[3:5], uint16(blockSize)^0xffff)
|
binary.LittleEndian.PutUint16(blockHeader[3:5], ^uint16(blockSize))
|
||||||
out = append(out, blockHeader[:]...)
|
out = append(out, blockHeader[:]...)
|
||||||
out = append(out, in[:blockSize]...)
|
out = append(out, in[:blockSize]...)
|
||||||
in = in[blockSize:]
|
in = in[blockSize:]
|
||||||
|
72
vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
generated
vendored
72
vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
generated
vendored
@ -12,16 +12,16 @@ import (
|
|||||||
ptag "google.golang.org/protobuf/internal/encoding/tag"
|
ptag "google.golang.org/protobuf/internal/encoding/tag"
|
||||||
"google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (xi *ExtensionInfo) initToLegacy() {
|
func (xi *ExtensionInfo) initToLegacy() {
|
||||||
xd := xi.desc
|
xd := xi.desc
|
||||||
var parent piface.MessageV1
|
var parent protoiface.MessageV1
|
||||||
messageName := xd.ContainingMessage().FullName()
|
messageName := xd.ContainingMessage().FullName()
|
||||||
if mt, _ := preg.GlobalTypes.FindMessageByName(messageName); mt != nil {
|
if mt, _ := protoregistry.GlobalTypes.FindMessageByName(messageName); mt != nil {
|
||||||
// Create a new parent message and unwrap it if possible.
|
// Create a new parent message and unwrap it if possible.
|
||||||
mv := mt.New().Interface()
|
mv := mt.New().Interface()
|
||||||
t := reflect.TypeOf(mv)
|
t := reflect.TypeOf(mv)
|
||||||
@ -31,7 +31,7 @@ func (xi *ExtensionInfo) initToLegacy() {
|
|||||||
|
|
||||||
// Check whether the message implements the legacy v1 Message interface.
|
// Check whether the message implements the legacy v1 Message interface.
|
||||||
mz := reflect.Zero(t).Interface()
|
mz := reflect.Zero(t).Interface()
|
||||||
if mz, ok := mz.(piface.MessageV1); ok {
|
if mz, ok := mz.(protoiface.MessageV1); ok {
|
||||||
parent = mz
|
parent = mz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ func (xi *ExtensionInfo) initToLegacy() {
|
|||||||
|
|
||||||
// Reconstruct the legacy enum full name.
|
// Reconstruct the legacy enum full name.
|
||||||
var enumName string
|
var enumName string
|
||||||
if xd.Kind() == pref.EnumKind {
|
if xd.Kind() == protoreflect.EnumKind {
|
||||||
enumName = legacyEnumName(xd.Enum())
|
enumName = legacyEnumName(xd.Enum())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,16 +77,16 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
|||||||
// field number is specified. In such a case, use a placeholder.
|
// field number is specified. In such a case, use a placeholder.
|
||||||
if xi.ExtendedType == nil || xi.ExtensionType == nil {
|
if xi.ExtendedType == nil || xi.ExtensionType == nil {
|
||||||
xd := placeholderExtension{
|
xd := placeholderExtension{
|
||||||
name: pref.FullName(xi.Name),
|
name: protoreflect.FullName(xi.Name),
|
||||||
number: pref.FieldNumber(xi.Field),
|
number: protoreflect.FieldNumber(xi.Field),
|
||||||
}
|
}
|
||||||
xi.desc = extensionTypeDescriptor{xd, xi}
|
xi.desc = extensionTypeDescriptor{xd, xi}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve enum or message dependencies.
|
// Resolve enum or message dependencies.
|
||||||
var ed pref.EnumDescriptor
|
var ed protoreflect.EnumDescriptor
|
||||||
var md pref.MessageDescriptor
|
var md protoreflect.MessageDescriptor
|
||||||
t := reflect.TypeOf(xi.ExtensionType)
|
t := reflect.TypeOf(xi.ExtensionType)
|
||||||
isOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct
|
isOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct
|
||||||
isRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
|
isRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
|
||||||
@ -94,18 +94,18 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
|||||||
t = t.Elem()
|
t = t.Elem()
|
||||||
}
|
}
|
||||||
switch v := reflect.Zero(t).Interface().(type) {
|
switch v := reflect.Zero(t).Interface().(type) {
|
||||||
case pref.Enum:
|
case protoreflect.Enum:
|
||||||
ed = v.Descriptor()
|
ed = v.Descriptor()
|
||||||
case enumV1:
|
case enumV1:
|
||||||
ed = LegacyLoadEnumDesc(t)
|
ed = LegacyLoadEnumDesc(t)
|
||||||
case pref.ProtoMessage:
|
case protoreflect.ProtoMessage:
|
||||||
md = v.ProtoReflect().Descriptor()
|
md = v.ProtoReflect().Descriptor()
|
||||||
case messageV1:
|
case messageV1:
|
||||||
md = LegacyLoadMessageDesc(t)
|
md = LegacyLoadMessageDesc(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derive basic field information from the struct tag.
|
// Derive basic field information from the struct tag.
|
||||||
var evs pref.EnumValueDescriptors
|
var evs protoreflect.EnumValueDescriptors
|
||||||
if ed != nil {
|
if ed != nil {
|
||||||
evs = ed.Values()
|
evs = ed.Values()
|
||||||
}
|
}
|
||||||
@ -114,8 +114,8 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
|||||||
// Construct a v2 ExtensionType.
|
// Construct a v2 ExtensionType.
|
||||||
xd := &filedesc.Extension{L2: new(filedesc.ExtensionL2)}
|
xd := &filedesc.Extension{L2: new(filedesc.ExtensionL2)}
|
||||||
xd.L0.ParentFile = filedesc.SurrogateProto2
|
xd.L0.ParentFile = filedesc.SurrogateProto2
|
||||||
xd.L0.FullName = pref.FullName(xi.Name)
|
xd.L0.FullName = protoreflect.FullName(xi.Name)
|
||||||
xd.L1.Number = pref.FieldNumber(xi.Field)
|
xd.L1.Number = protoreflect.FieldNumber(xi.Field)
|
||||||
xd.L1.Cardinality = fd.L1.Cardinality
|
xd.L1.Cardinality = fd.L1.Cardinality
|
||||||
xd.L1.Kind = fd.L1.Kind
|
xd.L1.Kind = fd.L1.Kind
|
||||||
xd.L2.IsPacked = fd.L1.IsPacked
|
xd.L2.IsPacked = fd.L1.IsPacked
|
||||||
@ -138,21 +138,21 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type placeholderExtension struct {
|
type placeholderExtension struct {
|
||||||
name pref.FullName
|
name protoreflect.FullName
|
||||||
number pref.FieldNumber
|
number protoreflect.FieldNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x placeholderExtension) ParentFile() pref.FileDescriptor { return nil }
|
func (x placeholderExtension) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||||
func (x placeholderExtension) Parent() pref.Descriptor { return nil }
|
func (x placeholderExtension) Parent() protoreflect.Descriptor { return nil }
|
||||||
func (x placeholderExtension) Index() int { return 0 }
|
func (x placeholderExtension) Index() int { return 0 }
|
||||||
func (x placeholderExtension) Syntax() pref.Syntax { return 0 }
|
func (x placeholderExtension) Syntax() protoreflect.Syntax { return 0 }
|
||||||
func (x placeholderExtension) Name() pref.Name { return x.name.Name() }
|
func (x placeholderExtension) Name() protoreflect.Name { return x.name.Name() }
|
||||||
func (x placeholderExtension) FullName() pref.FullName { return x.name }
|
func (x placeholderExtension) FullName() protoreflect.FullName { return x.name }
|
||||||
func (x placeholderExtension) IsPlaceholder() bool { return true }
|
func (x placeholderExtension) IsPlaceholder() bool { return true }
|
||||||
func (x placeholderExtension) Options() pref.ProtoMessage { return descopts.Field }
|
func (x placeholderExtension) Options() protoreflect.ProtoMessage { return descopts.Field }
|
||||||
func (x placeholderExtension) Number() pref.FieldNumber { return x.number }
|
func (x placeholderExtension) Number() protoreflect.FieldNumber { return x.number }
|
||||||
func (x placeholderExtension) Cardinality() pref.Cardinality { return 0 }
|
func (x placeholderExtension) Cardinality() protoreflect.Cardinality { return 0 }
|
||||||
func (x placeholderExtension) Kind() pref.Kind { return 0 }
|
func (x placeholderExtension) Kind() protoreflect.Kind { return 0 }
|
||||||
func (x placeholderExtension) HasJSONName() bool { return false }
|
func (x placeholderExtension) HasJSONName() bool { return false }
|
||||||
func (x placeholderExtension) JSONName() string { return "[" + string(x.name) + "]" }
|
func (x placeholderExtension) JSONName() string { return "[" + string(x.name) + "]" }
|
||||||
func (x placeholderExtension) TextName() string { return "[" + string(x.name) + "]" }
|
func (x placeholderExtension) TextName() string { return "[" + string(x.name) + "]" }
|
||||||
@ -163,14 +163,14 @@ func (x placeholderExtension) IsWeak() bool { retu
|
|||||||
func (x placeholderExtension) IsPacked() bool { return false }
|
func (x placeholderExtension) IsPacked() bool { return false }
|
||||||
func (x placeholderExtension) IsList() bool { return false }
|
func (x placeholderExtension) IsList() bool { return false }
|
||||||
func (x placeholderExtension) IsMap() bool { return false }
|
func (x placeholderExtension) IsMap() bool { return false }
|
||||||
func (x placeholderExtension) MapKey() pref.FieldDescriptor { return nil }
|
func (x placeholderExtension) MapKey() protoreflect.FieldDescriptor { return nil }
|
||||||
func (x placeholderExtension) MapValue() pref.FieldDescriptor { return nil }
|
func (x placeholderExtension) MapValue() protoreflect.FieldDescriptor { return nil }
|
||||||
func (x placeholderExtension) HasDefault() bool { return false }
|
func (x placeholderExtension) HasDefault() bool { return false }
|
||||||
func (x placeholderExtension) Default() pref.Value { return pref.Value{} }
|
func (x placeholderExtension) Default() protoreflect.Value { return protoreflect.Value{} }
|
||||||
func (x placeholderExtension) DefaultEnumValue() pref.EnumValueDescriptor { return nil }
|
func (x placeholderExtension) DefaultEnumValue() protoreflect.EnumValueDescriptor { return nil }
|
||||||
func (x placeholderExtension) ContainingOneof() pref.OneofDescriptor { return nil }
|
func (x placeholderExtension) ContainingOneof() protoreflect.OneofDescriptor { return nil }
|
||||||
func (x placeholderExtension) ContainingMessage() pref.MessageDescriptor { return nil }
|
func (x placeholderExtension) ContainingMessage() protoreflect.MessageDescriptor { return nil }
|
||||||
func (x placeholderExtension) Enum() pref.EnumDescriptor { return nil }
|
func (x placeholderExtension) Enum() protoreflect.EnumDescriptor { return nil }
|
||||||
func (x placeholderExtension) Message() pref.MessageDescriptor { return nil }
|
func (x placeholderExtension) Message() protoreflect.MessageDescriptor { return nil }
|
||||||
func (x placeholderExtension) ProtoType(pref.FieldDescriptor) { return }
|
func (x placeholderExtension) ProtoType(protoreflect.FieldDescriptor) { return }
|
||||||
func (x placeholderExtension) ProtoInternal(pragma.DoNotImplement) { return }
|
func (x placeholderExtension) ProtoInternal(pragma.DoNotImplement) { return }
|
||||||
|
122
vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
generated
vendored
122
vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
generated
vendored
@ -16,14 +16,12 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/filedesc"
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
"google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// legacyWrapMessage wraps v as a protoreflect.Message,
|
// legacyWrapMessage wraps v as a protoreflect.Message,
|
||||||
// where v must be a *struct kind and not implement the v2 API already.
|
// where v must be a *struct kind and not implement the v2 API already.
|
||||||
func legacyWrapMessage(v reflect.Value) pref.Message {
|
func legacyWrapMessage(v reflect.Value) protoreflect.Message {
|
||||||
t := v.Type()
|
t := v.Type()
|
||||||
if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
|
if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
|
||||||
return aberrantMessage{v: v}
|
return aberrantMessage{v: v}
|
||||||
@ -35,7 +33,7 @@ func legacyWrapMessage(v reflect.Value) pref.Message {
|
|||||||
// legacyLoadMessageType dynamically loads a protoreflect.Type for t,
|
// legacyLoadMessageType dynamically loads a protoreflect.Type for t,
|
||||||
// where t must be not implement the v2 API already.
|
// where t must be not implement the v2 API already.
|
||||||
// The provided name is used if it cannot be determined from the message.
|
// The provided name is used if it cannot be determined from the message.
|
||||||
func legacyLoadMessageType(t reflect.Type, name pref.FullName) protoreflect.MessageType {
|
func legacyLoadMessageType(t reflect.Type, name protoreflect.FullName) protoreflect.MessageType {
|
||||||
if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
|
if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
|
||||||
return aberrantMessageType{t}
|
return aberrantMessageType{t}
|
||||||
}
|
}
|
||||||
@ -47,7 +45,7 @@ var legacyMessageTypeCache sync.Map // map[reflect.Type]*MessageInfo
|
|||||||
// legacyLoadMessageInfo dynamically loads a *MessageInfo for t,
|
// legacyLoadMessageInfo dynamically loads a *MessageInfo for t,
|
||||||
// where t must be a *struct kind and not implement the v2 API already.
|
// where t must be a *struct kind and not implement the v2 API already.
|
||||||
// The provided name is used if it cannot be determined from the message.
|
// The provided name is used if it cannot be determined from the message.
|
||||||
func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {
|
func legacyLoadMessageInfo(t reflect.Type, name protoreflect.FullName) *MessageInfo {
|
||||||
// Fast-path: check if a MessageInfo is cached for this concrete type.
|
// Fast-path: check if a MessageInfo is cached for this concrete type.
|
||||||
if mt, ok := legacyMessageTypeCache.Load(t); ok {
|
if mt, ok := legacyMessageTypeCache.Load(t); ok {
|
||||||
return mt.(*MessageInfo)
|
return mt.(*MessageInfo)
|
||||||
@ -68,7 +66,7 @@ func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {
|
|||||||
// supports deterministic serialization or not, but this
|
// supports deterministic serialization or not, but this
|
||||||
// preserves the v1 implementation's behavior of always
|
// preserves the v1 implementation's behavior of always
|
||||||
// calling Marshal methods when present.
|
// calling Marshal methods when present.
|
||||||
mi.methods.Flags |= piface.SupportMarshalDeterministic
|
mi.methods.Flags |= protoiface.SupportMarshalDeterministic
|
||||||
}
|
}
|
||||||
if _, hasUnmarshal = v.(legacyUnmarshaler); hasUnmarshal {
|
if _, hasUnmarshal = v.(legacyUnmarshaler); hasUnmarshal {
|
||||||
mi.methods.Unmarshal = legacyUnmarshal
|
mi.methods.Unmarshal = legacyUnmarshal
|
||||||
@ -89,18 +87,18 @@ var legacyMessageDescCache sync.Map // map[reflect.Type]protoreflect.MessageDesc
|
|||||||
// which should be a *struct kind and must not implement the v2 API already.
|
// which should be a *struct kind and must not implement the v2 API already.
|
||||||
//
|
//
|
||||||
// This is exported for testing purposes.
|
// This is exported for testing purposes.
|
||||||
func LegacyLoadMessageDesc(t reflect.Type) pref.MessageDescriptor {
|
func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {
|
||||||
return legacyLoadMessageDesc(t, "")
|
return legacyLoadMessageDesc(t, "")
|
||||||
}
|
}
|
||||||
func legacyLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
|
func legacyLoadMessageDesc(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
|
||||||
// Fast-path: check if a MessageDescriptor is cached for this concrete type.
|
// Fast-path: check if a MessageDescriptor is cached for this concrete type.
|
||||||
if mi, ok := legacyMessageDescCache.Load(t); ok {
|
if mi, ok := legacyMessageDescCache.Load(t); ok {
|
||||||
return mi.(pref.MessageDescriptor)
|
return mi.(protoreflect.MessageDescriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slow-path: initialize MessageDescriptor from the raw descriptor.
|
// Slow-path: initialize MessageDescriptor from the raw descriptor.
|
||||||
mv := reflect.Zero(t).Interface()
|
mv := reflect.Zero(t).Interface()
|
||||||
if _, ok := mv.(pref.ProtoMessage); ok {
|
if _, ok := mv.(protoreflect.ProtoMessage); ok {
|
||||||
panic(fmt.Sprintf("%v already implements proto.Message", t))
|
panic(fmt.Sprintf("%v already implements proto.Message", t))
|
||||||
}
|
}
|
||||||
mdV1, ok := mv.(messageV1)
|
mdV1, ok := mv.(messageV1)
|
||||||
@ -164,7 +162,7 @@ var (
|
|||||||
//
|
//
|
||||||
// This is a best-effort derivation of the message descriptor using the protobuf
|
// This is a best-effort derivation of the message descriptor using the protobuf
|
||||||
// tags on the struct fields.
|
// tags on the struct fields.
|
||||||
func aberrantLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
|
func aberrantLoadMessageDesc(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
|
||||||
aberrantMessageDescLock.Lock()
|
aberrantMessageDescLock.Lock()
|
||||||
defer aberrantMessageDescLock.Unlock()
|
defer aberrantMessageDescLock.Unlock()
|
||||||
if aberrantMessageDescCache == nil {
|
if aberrantMessageDescCache == nil {
|
||||||
@ -172,7 +170,7 @@ func aberrantLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDes
|
|||||||
}
|
}
|
||||||
return aberrantLoadMessageDescReentrant(t, name)
|
return aberrantLoadMessageDescReentrant(t, name)
|
||||||
}
|
}
|
||||||
func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
|
func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
|
||||||
// Fast-path: check if an MessageDescriptor is cached for this concrete type.
|
// Fast-path: check if an MessageDescriptor is cached for this concrete type.
|
||||||
if md, ok := aberrantMessageDescCache[t]; ok {
|
if md, ok := aberrantMessageDescCache[t]; ok {
|
||||||
return md
|
return md
|
||||||
@ -225,9 +223,9 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
|||||||
vs := fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0]
|
vs := fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0]
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
v := vs.Index(i)
|
v := vs.Index(i)
|
||||||
md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]pref.FieldNumber{
|
md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]protoreflect.FieldNumber{
|
||||||
pref.FieldNumber(v.FieldByName("Start").Int()),
|
protoreflect.FieldNumber(v.FieldByName("Start").Int()),
|
||||||
pref.FieldNumber(v.FieldByName("End").Int() + 1),
|
protoreflect.FieldNumber(v.FieldByName("End").Int() + 1),
|
||||||
})
|
})
|
||||||
md.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, nil)
|
md.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, nil)
|
||||||
}
|
}
|
||||||
@ -245,7 +243,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
|||||||
n := len(md.L2.Oneofs.List)
|
n := len(md.L2.Oneofs.List)
|
||||||
md.L2.Oneofs.List = append(md.L2.Oneofs.List, filedesc.Oneof{})
|
md.L2.Oneofs.List = append(md.L2.Oneofs.List, filedesc.Oneof{})
|
||||||
od := &md.L2.Oneofs.List[n]
|
od := &md.L2.Oneofs.List[n]
|
||||||
od.L0.FullName = md.FullName().Append(pref.Name(tag))
|
od.L0.FullName = md.FullName().Append(protoreflect.Name(tag))
|
||||||
od.L0.ParentFile = md.L0.ParentFile
|
od.L0.ParentFile = md.L0.ParentFile
|
||||||
od.L0.Parent = md
|
od.L0.Parent = md
|
||||||
od.L0.Index = n
|
od.L0.Index = n
|
||||||
@ -267,14 +265,14 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
|||||||
return md
|
return md
|
||||||
}
|
}
|
||||||
|
|
||||||
func aberrantDeriveMessageName(t reflect.Type, name pref.FullName) pref.FullName {
|
func aberrantDeriveMessageName(t reflect.Type, name protoreflect.FullName) protoreflect.FullName {
|
||||||
if name.IsValid() {
|
if name.IsValid() {
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
func() {
|
func() {
|
||||||
defer func() { recover() }() // swallow possible nil panics
|
defer func() { recover() }() // swallow possible nil panics
|
||||||
if m, ok := reflect.Zero(t).Interface().(interface{ XXX_MessageName() string }); ok {
|
if m, ok := reflect.Zero(t).Interface().(interface{ XXX_MessageName() string }); ok {
|
||||||
name = pref.FullName(m.XXX_MessageName())
|
name = protoreflect.FullName(m.XXX_MessageName())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if name.IsValid() {
|
if name.IsValid() {
|
||||||
@ -305,7 +303,7 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,
|
|||||||
fd.L0.Index = n
|
fd.L0.Index = n
|
||||||
|
|
||||||
if fd.L1.IsWeak || fd.L1.HasPacked {
|
if fd.L1.IsWeak || fd.L1.HasPacked {
|
||||||
fd.L1.Options = func() pref.ProtoMessage {
|
fd.L1.Options = func() protoreflect.ProtoMessage {
|
||||||
opts := descopts.Field.ProtoReflect().New()
|
opts := descopts.Field.ProtoReflect().New()
|
||||||
if fd.L1.IsWeak {
|
if fd.L1.IsWeak {
|
||||||
opts.Set(opts.Descriptor().Fields().ByName("weak"), protoreflect.ValueOfBool(true))
|
opts.Set(opts.Descriptor().Fields().ByName("weak"), protoreflect.ValueOfBool(true))
|
||||||
@ -318,17 +316,17 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Populate Enum and Message.
|
// Populate Enum and Message.
|
||||||
if fd.Enum() == nil && fd.Kind() == pref.EnumKind {
|
if fd.Enum() == nil && fd.Kind() == protoreflect.EnumKind {
|
||||||
switch v := reflect.Zero(t).Interface().(type) {
|
switch v := reflect.Zero(t).Interface().(type) {
|
||||||
case pref.Enum:
|
case protoreflect.Enum:
|
||||||
fd.L1.Enum = v.Descriptor()
|
fd.L1.Enum = v.Descriptor()
|
||||||
default:
|
default:
|
||||||
fd.L1.Enum = LegacyLoadEnumDesc(t)
|
fd.L1.Enum = LegacyLoadEnumDesc(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if fd.Message() == nil && (fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind) {
|
if fd.Message() == nil && (fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind) {
|
||||||
switch v := reflect.Zero(t).Interface().(type) {
|
switch v := reflect.Zero(t).Interface().(type) {
|
||||||
case pref.ProtoMessage:
|
case protoreflect.ProtoMessage:
|
||||||
fd.L1.Message = v.ProtoReflect().Descriptor()
|
fd.L1.Message = v.ProtoReflect().Descriptor()
|
||||||
case messageV1:
|
case messageV1:
|
||||||
fd.L1.Message = LegacyLoadMessageDesc(t)
|
fd.L1.Message = LegacyLoadMessageDesc(t)
|
||||||
@ -337,13 +335,13 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,
|
|||||||
n := len(md.L1.Messages.List)
|
n := len(md.L1.Messages.List)
|
||||||
md.L1.Messages.List = append(md.L1.Messages.List, filedesc.Message{L2: new(filedesc.MessageL2)})
|
md.L1.Messages.List = append(md.L1.Messages.List, filedesc.Message{L2: new(filedesc.MessageL2)})
|
||||||
md2 := &md.L1.Messages.List[n]
|
md2 := &md.L1.Messages.List[n]
|
||||||
md2.L0.FullName = md.FullName().Append(pref.Name(strs.MapEntryName(string(fd.Name()))))
|
md2.L0.FullName = md.FullName().Append(protoreflect.Name(strs.MapEntryName(string(fd.Name()))))
|
||||||
md2.L0.ParentFile = md.L0.ParentFile
|
md2.L0.ParentFile = md.L0.ParentFile
|
||||||
md2.L0.Parent = md
|
md2.L0.Parent = md
|
||||||
md2.L0.Index = n
|
md2.L0.Index = n
|
||||||
|
|
||||||
md2.L1.IsMapEntry = true
|
md2.L1.IsMapEntry = true
|
||||||
md2.L2.Options = func() pref.ProtoMessage {
|
md2.L2.Options = func() protoreflect.ProtoMessage {
|
||||||
opts := descopts.Message.ProtoReflect().New()
|
opts := descopts.Message.ProtoReflect().New()
|
||||||
opts.Set(opts.Descriptor().Fields().ByName("map_entry"), protoreflect.ValueOfBool(true))
|
opts.Set(opts.Descriptor().Fields().ByName("map_entry"), protoreflect.ValueOfBool(true))
|
||||||
return opts.Interface()
|
return opts.Interface()
|
||||||
@ -364,8 +362,8 @@ type placeholderEnumValues struct {
|
|||||||
protoreflect.EnumValueDescriptors
|
protoreflect.EnumValueDescriptors
|
||||||
}
|
}
|
||||||
|
|
||||||
func (placeholderEnumValues) ByNumber(n pref.EnumNumber) pref.EnumValueDescriptor {
|
func (placeholderEnumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor {
|
||||||
return filedesc.PlaceholderEnumValue(pref.FullName(fmt.Sprintf("UNKNOWN_%d", n)))
|
return filedesc.PlaceholderEnumValue(protoreflect.FullName(fmt.Sprintf("UNKNOWN_%d", n)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// legacyMarshaler is the proto.Marshaler interface superseded by protoiface.Methoder.
|
// legacyMarshaler is the proto.Marshaler interface superseded by protoiface.Methoder.
|
||||||
@ -383,7 +381,7 @@ type legacyMerger interface {
|
|||||||
Merge(protoiface.MessageV1)
|
Merge(protoiface.MessageV1)
|
||||||
}
|
}
|
||||||
|
|
||||||
var aberrantProtoMethods = &piface.Methods{
|
var aberrantProtoMethods = &protoiface.Methods{
|
||||||
Marshal: legacyMarshal,
|
Marshal: legacyMarshal,
|
||||||
Unmarshal: legacyUnmarshal,
|
Unmarshal: legacyUnmarshal,
|
||||||
Merge: legacyMerge,
|
Merge: legacyMerge,
|
||||||
@ -392,40 +390,40 @@ var aberrantProtoMethods = &piface.Methods{
|
|||||||
// supports deterministic serialization or not, but this
|
// supports deterministic serialization or not, but this
|
||||||
// preserves the v1 implementation's behavior of always
|
// preserves the v1 implementation's behavior of always
|
||||||
// calling Marshal methods when present.
|
// calling Marshal methods when present.
|
||||||
Flags: piface.SupportMarshalDeterministic,
|
Flags: protoiface.SupportMarshalDeterministic,
|
||||||
}
|
}
|
||||||
|
|
||||||
func legacyMarshal(in piface.MarshalInput) (piface.MarshalOutput, error) {
|
func legacyMarshal(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||||
v := in.Message.(unwrapper).protoUnwrap()
|
v := in.Message.(unwrapper).protoUnwrap()
|
||||||
marshaler, ok := v.(legacyMarshaler)
|
marshaler, ok := v.(legacyMarshaler)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.MarshalOutput{}, errors.New("%T does not implement Marshal", v)
|
return protoiface.MarshalOutput{}, errors.New("%T does not implement Marshal", v)
|
||||||
}
|
}
|
||||||
out, err := marshaler.Marshal()
|
out, err := marshaler.Marshal()
|
||||||
if in.Buf != nil {
|
if in.Buf != nil {
|
||||||
out = append(in.Buf, out...)
|
out = append(in.Buf, out...)
|
||||||
}
|
}
|
||||||
return piface.MarshalOutput{
|
return protoiface.MarshalOutput{
|
||||||
Buf: out,
|
Buf: out,
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func legacyUnmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {
|
func legacyUnmarshal(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||||
v := in.Message.(unwrapper).protoUnwrap()
|
v := in.Message.(unwrapper).protoUnwrap()
|
||||||
unmarshaler, ok := v.(legacyUnmarshaler)
|
unmarshaler, ok := v.(legacyUnmarshaler)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.UnmarshalOutput{}, errors.New("%T does not implement Unmarshal", v)
|
return protoiface.UnmarshalOutput{}, errors.New("%T does not implement Unmarshal", v)
|
||||||
}
|
}
|
||||||
return piface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)
|
return protoiface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func legacyMerge(in piface.MergeInput) piface.MergeOutput {
|
func legacyMerge(in protoiface.MergeInput) protoiface.MergeOutput {
|
||||||
// Check whether this supports the legacy merger.
|
// Check whether this supports the legacy merger.
|
||||||
dstv := in.Destination.(unwrapper).protoUnwrap()
|
dstv := in.Destination.(unwrapper).protoUnwrap()
|
||||||
merger, ok := dstv.(legacyMerger)
|
merger, ok := dstv.(legacyMerger)
|
||||||
if ok {
|
if ok {
|
||||||
merger.Merge(Export{}.ProtoMessageV1Of(in.Source))
|
merger.Merge(Export{}.ProtoMessageV1Of(in.Source))
|
||||||
return piface.MergeOutput{Flags: piface.MergeComplete}
|
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If legacy merger is unavailable, implement merge in terms of
|
// If legacy merger is unavailable, implement merge in terms of
|
||||||
@ -433,29 +431,29 @@ func legacyMerge(in piface.MergeInput) piface.MergeOutput {
|
|||||||
srcv := in.Source.(unwrapper).protoUnwrap()
|
srcv := in.Source.(unwrapper).protoUnwrap()
|
||||||
marshaler, ok := srcv.(legacyMarshaler)
|
marshaler, ok := srcv.(legacyMarshaler)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
dstv = in.Destination.(unwrapper).protoUnwrap()
|
dstv = in.Destination.(unwrapper).protoUnwrap()
|
||||||
unmarshaler, ok := dstv.(legacyUnmarshaler)
|
unmarshaler, ok := dstv.(legacyUnmarshaler)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
if !in.Source.IsValid() {
|
if !in.Source.IsValid() {
|
||||||
// Legacy Marshal methods may not function on nil messages.
|
// Legacy Marshal methods may not function on nil messages.
|
||||||
// Check for a typed nil source only after we confirm that
|
// Check for a typed nil source only after we confirm that
|
||||||
// legacy Marshal/Unmarshal methods are present, for
|
// legacy Marshal/Unmarshal methods are present, for
|
||||||
// consistency.
|
// consistency.
|
||||||
return piface.MergeOutput{Flags: piface.MergeComplete}
|
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||||
}
|
}
|
||||||
b, err := marshaler.Marshal()
|
b, err := marshaler.Marshal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
err = unmarshaler.Unmarshal(b)
|
err = unmarshaler.Unmarshal(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
return piface.MergeOutput{Flags: piface.MergeComplete}
|
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||||
}
|
}
|
||||||
|
|
||||||
// aberrantMessageType implements MessageType for all types other than pointer-to-struct.
|
// aberrantMessageType implements MessageType for all types other than pointer-to-struct.
|
||||||
@ -463,19 +461,19 @@ type aberrantMessageType struct {
|
|||||||
t reflect.Type
|
t reflect.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mt aberrantMessageType) New() pref.Message {
|
func (mt aberrantMessageType) New() protoreflect.Message {
|
||||||
if mt.t.Kind() == reflect.Ptr {
|
if mt.t.Kind() == reflect.Ptr {
|
||||||
return aberrantMessage{reflect.New(mt.t.Elem())}
|
return aberrantMessage{reflect.New(mt.t.Elem())}
|
||||||
}
|
}
|
||||||
return aberrantMessage{reflect.Zero(mt.t)}
|
return aberrantMessage{reflect.Zero(mt.t)}
|
||||||
}
|
}
|
||||||
func (mt aberrantMessageType) Zero() pref.Message {
|
func (mt aberrantMessageType) Zero() protoreflect.Message {
|
||||||
return aberrantMessage{reflect.Zero(mt.t)}
|
return aberrantMessage{reflect.Zero(mt.t)}
|
||||||
}
|
}
|
||||||
func (mt aberrantMessageType) GoType() reflect.Type {
|
func (mt aberrantMessageType) GoType() reflect.Type {
|
||||||
return mt.t
|
return mt.t
|
||||||
}
|
}
|
||||||
func (mt aberrantMessageType) Descriptor() pref.MessageDescriptor {
|
func (mt aberrantMessageType) Descriptor() protoreflect.MessageDescriptor {
|
||||||
return LegacyLoadMessageDesc(mt.t)
|
return LegacyLoadMessageDesc(mt.t)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,56 +497,56 @@ func (m aberrantMessage) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m aberrantMessage) ProtoReflect() pref.Message {
|
func (m aberrantMessage) ProtoReflect() protoreflect.Message {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m aberrantMessage) Descriptor() pref.MessageDescriptor {
|
func (m aberrantMessage) Descriptor() protoreflect.MessageDescriptor {
|
||||||
return LegacyLoadMessageDesc(m.v.Type())
|
return LegacyLoadMessageDesc(m.v.Type())
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Type() pref.MessageType {
|
func (m aberrantMessage) Type() protoreflect.MessageType {
|
||||||
return aberrantMessageType{m.v.Type()}
|
return aberrantMessageType{m.v.Type()}
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) New() pref.Message {
|
func (m aberrantMessage) New() protoreflect.Message {
|
||||||
if m.v.Type().Kind() == reflect.Ptr {
|
if m.v.Type().Kind() == reflect.Ptr {
|
||||||
return aberrantMessage{reflect.New(m.v.Type().Elem())}
|
return aberrantMessage{reflect.New(m.v.Type().Elem())}
|
||||||
}
|
}
|
||||||
return aberrantMessage{reflect.Zero(m.v.Type())}
|
return aberrantMessage{reflect.Zero(m.v.Type())}
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Interface() pref.ProtoMessage {
|
func (m aberrantMessage) Interface() protoreflect.ProtoMessage {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
func (m aberrantMessage) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Has(pref.FieldDescriptor) bool {
|
func (m aberrantMessage) Has(protoreflect.FieldDescriptor) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Clear(pref.FieldDescriptor) {
|
func (m aberrantMessage) Clear(protoreflect.FieldDescriptor) {
|
||||||
panic("invalid Message.Clear on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.Clear on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Get(fd pref.FieldDescriptor) pref.Value {
|
func (m aberrantMessage) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
if fd.Default().IsValid() {
|
if fd.Default().IsValid() {
|
||||||
return fd.Default()
|
return fd.Default()
|
||||||
}
|
}
|
||||||
panic("invalid Message.Get on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.Get on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Set(pref.FieldDescriptor, pref.Value) {
|
func (m aberrantMessage) Set(protoreflect.FieldDescriptor, protoreflect.Value) {
|
||||||
panic("invalid Message.Set on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.Set on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) Mutable(pref.FieldDescriptor) pref.Value {
|
func (m aberrantMessage) Mutable(protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
panic("invalid Message.Mutable on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.Mutable on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) NewField(pref.FieldDescriptor) pref.Value {
|
func (m aberrantMessage) NewField(protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
panic("invalid Message.NewField on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.NewField on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) WhichOneof(pref.OneofDescriptor) pref.FieldDescriptor {
|
func (m aberrantMessage) WhichOneof(protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||||
panic("invalid Message.WhichOneof descriptor on " + string(m.Descriptor().FullName()))
|
panic("invalid Message.WhichOneof descriptor on " + string(m.Descriptor().FullName()))
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) GetUnknown() pref.RawFields {
|
func (m aberrantMessage) GetUnknown() protoreflect.RawFields {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) SetUnknown(pref.RawFields) {
|
func (m aberrantMessage) SetUnknown(protoreflect.RawFields) {
|
||||||
// SetUnknown discards its input on messages which don't support unknown field storage.
|
// SetUnknown discards its input on messages which don't support unknown field storage.
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) IsValid() bool {
|
func (m aberrantMessage) IsValid() bool {
|
||||||
@ -557,7 +555,7 @@ func (m aberrantMessage) IsValid() bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) ProtoMethods() *piface.Methods {
|
func (m aberrantMessage) ProtoMethods() *protoiface.Methods {
|
||||||
return aberrantProtoMethods
|
return aberrantProtoMethods
|
||||||
}
|
}
|
||||||
func (m aberrantMessage) protoUnwrap() interface{} {
|
func (m aberrantMessage) protoUnwrap() interface{} {
|
||||||
|
32
vendor/google.golang.org/protobuf/internal/impl/merge.go
generated
vendored
32
vendor/google.golang.org/protobuf/internal/impl/merge.go
generated
vendored
@ -9,8 +9,8 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mergeOptions struct{}
|
type mergeOptions struct{}
|
||||||
@ -20,17 +20,17 @@ func (o mergeOptions) Merge(dst, src proto.Message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// merge is protoreflect.Methods.Merge.
|
// merge is protoreflect.Methods.Merge.
|
||||||
func (mi *MessageInfo) merge(in piface.MergeInput) piface.MergeOutput {
|
func (mi *MessageInfo) merge(in protoiface.MergeInput) protoiface.MergeOutput {
|
||||||
dp, ok := mi.getPointer(in.Destination)
|
dp, ok := mi.getPointer(in.Destination)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
sp, ok := mi.getPointer(in.Source)
|
sp, ok := mi.getPointer(in.Source)
|
||||||
if !ok {
|
if !ok {
|
||||||
return piface.MergeOutput{}
|
return protoiface.MergeOutput{}
|
||||||
}
|
}
|
||||||
mi.mergePointer(dp, sp, mergeOptions{})
|
mi.mergePointer(dp, sp, mergeOptions{})
|
||||||
return piface.MergeOutput{Flags: piface.MergeComplete}
|
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
||||||
@ -64,7 +64,7 @@ func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
dx := (*dext)[num]
|
dx := (*dext)[num]
|
||||||
var dv pref.Value
|
var dv protoreflect.Value
|
||||||
if dx.Type() == sx.Type() {
|
if dx.Type() == sx.Type() {
|
||||||
dv = dx.Value()
|
dv = dx.Value()
|
||||||
}
|
}
|
||||||
@ -85,15 +85,15 @@ func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeScalarValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeScalarValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
return src
|
return src
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeBytesValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeBytesValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
return pref.ValueOfBytes(append(emptyBuf[:], src.Bytes()...))
|
return protoreflect.ValueOfBytes(append(emptyBuf[:], src.Bytes()...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
dstl := dst.List()
|
dstl := dst.List()
|
||||||
srcl := src.List()
|
srcl := src.List()
|
||||||
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
||||||
@ -102,29 +102,29 @@ func mergeListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
|||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeBytesListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeBytesListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
dstl := dst.List()
|
dstl := dst.List()
|
||||||
srcl := src.List()
|
srcl := src.List()
|
||||||
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
||||||
sb := srcl.Get(i).Bytes()
|
sb := srcl.Get(i).Bytes()
|
||||||
db := append(emptyBuf[:], sb...)
|
db := append(emptyBuf[:], sb...)
|
||||||
dstl.Append(pref.ValueOfBytes(db))
|
dstl.Append(protoreflect.ValueOfBytes(db))
|
||||||
}
|
}
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeMessageListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeMessageListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
dstl := dst.List()
|
dstl := dst.List()
|
||||||
srcl := src.List()
|
srcl := src.List()
|
||||||
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
||||||
sm := srcl.Get(i).Message()
|
sm := srcl.Get(i).Message()
|
||||||
dm := proto.Clone(sm.Interface()).ProtoReflect()
|
dm := proto.Clone(sm.Interface()).ProtoReflect()
|
||||||
dstl.Append(pref.ValueOfMessage(dm))
|
dstl.Append(protoreflect.ValueOfMessage(dm))
|
||||||
}
|
}
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeMessageValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
func mergeMessageValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||||
opts.Merge(dst.Message().Interface(), src.Message().Interface())
|
opts.Merge(dst.Message().Interface(), src.Message().Interface())
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
41
vendor/google.golang.org/protobuf/internal/impl/message.go
generated
vendored
41
vendor/google.golang.org/protobuf/internal/impl/message.go
generated
vendored
@ -14,8 +14,7 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MessageInfo provides protobuf related functionality for a given Go type
|
// MessageInfo provides protobuf related functionality for a given Go type
|
||||||
@ -29,7 +28,7 @@ type MessageInfo struct {
|
|||||||
GoReflectType reflect.Type // pointer to struct
|
GoReflectType reflect.Type // pointer to struct
|
||||||
|
|
||||||
// Desc is the underlying message descriptor type and must be populated.
|
// Desc is the underlying message descriptor type and must be populated.
|
||||||
Desc pref.MessageDescriptor
|
Desc protoreflect.MessageDescriptor
|
||||||
|
|
||||||
// Exporter must be provided in a purego environment in order to provide
|
// Exporter must be provided in a purego environment in order to provide
|
||||||
// access to unexported fields.
|
// access to unexported fields.
|
||||||
@ -54,7 +53,7 @@ type exporter func(v interface{}, i int) interface{}
|
|||||||
// is generated by our implementation of protoc-gen-go (for v2 and on).
|
// is generated by our implementation of protoc-gen-go (for v2 and on).
|
||||||
// If it is unable to obtain a MessageInfo, it returns nil.
|
// If it is unable to obtain a MessageInfo, it returns nil.
|
||||||
func getMessageInfo(mt reflect.Type) *MessageInfo {
|
func getMessageInfo(mt reflect.Type) *MessageInfo {
|
||||||
m, ok := reflect.Zero(mt).Interface().(pref.ProtoMessage)
|
m, ok := reflect.Zero(mt).Interface().(protoreflect.ProtoMessage)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -97,7 +96,7 @@ func (mi *MessageInfo) initOnce() {
|
|||||||
// getPointer returns the pointer for a message, which should be of
|
// getPointer returns the pointer for a message, which should be of
|
||||||
// the type of the MessageInfo. If the message is of a different type,
|
// the type of the MessageInfo. If the message is of a different type,
|
||||||
// it returns ok==false.
|
// it returns ok==false.
|
||||||
func (mi *MessageInfo) getPointer(m pref.Message) (p pointer, ok bool) {
|
func (mi *MessageInfo) getPointer(m protoreflect.Message) (p pointer, ok bool) {
|
||||||
switch m := m.(type) {
|
switch m := m.(type) {
|
||||||
case *messageState:
|
case *messageState:
|
||||||
return m.pointer(), m.messageInfo() == mi
|
return m.pointer(), m.messageInfo() == mi
|
||||||
@ -134,10 +133,10 @@ type structInfo struct {
|
|||||||
extensionOffset offset
|
extensionOffset offset
|
||||||
extensionType reflect.Type
|
extensionType reflect.Type
|
||||||
|
|
||||||
fieldsByNumber map[pref.FieldNumber]reflect.StructField
|
fieldsByNumber map[protoreflect.FieldNumber]reflect.StructField
|
||||||
oneofsByName map[pref.Name]reflect.StructField
|
oneofsByName map[protoreflect.Name]reflect.StructField
|
||||||
oneofWrappersByType map[reflect.Type]pref.FieldNumber
|
oneofWrappersByType map[reflect.Type]protoreflect.FieldNumber
|
||||||
oneofWrappersByNumber map[pref.FieldNumber]reflect.Type
|
oneofWrappersByNumber map[protoreflect.FieldNumber]reflect.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {
|
func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {
|
||||||
@ -147,10 +146,10 @@ func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {
|
|||||||
unknownOffset: invalidOffset,
|
unknownOffset: invalidOffset,
|
||||||
extensionOffset: invalidOffset,
|
extensionOffset: invalidOffset,
|
||||||
|
|
||||||
fieldsByNumber: map[pref.FieldNumber]reflect.StructField{},
|
fieldsByNumber: map[protoreflect.FieldNumber]reflect.StructField{},
|
||||||
oneofsByName: map[pref.Name]reflect.StructField{},
|
oneofsByName: map[protoreflect.Name]reflect.StructField{},
|
||||||
oneofWrappersByType: map[reflect.Type]pref.FieldNumber{},
|
oneofWrappersByType: map[reflect.Type]protoreflect.FieldNumber{},
|
||||||
oneofWrappersByNumber: map[pref.FieldNumber]reflect.Type{},
|
oneofWrappersByNumber: map[protoreflect.FieldNumber]reflect.Type{},
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldLoop:
|
fieldLoop:
|
||||||
@ -180,12 +179,12 @@ fieldLoop:
|
|||||||
for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
|
for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
|
||||||
if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
|
if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
|
||||||
n, _ := strconv.ParseUint(s, 10, 64)
|
n, _ := strconv.ParseUint(s, 10, 64)
|
||||||
si.fieldsByNumber[pref.FieldNumber(n)] = f
|
si.fieldsByNumber[protoreflect.FieldNumber(n)] = f
|
||||||
continue fieldLoop
|
continue fieldLoop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if s := f.Tag.Get("protobuf_oneof"); len(s) > 0 {
|
if s := f.Tag.Get("protobuf_oneof"); len(s) > 0 {
|
||||||
si.oneofsByName[pref.Name(s)] = f
|
si.oneofsByName[protoreflect.Name(s)] = f
|
||||||
continue fieldLoop
|
continue fieldLoop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,8 +207,8 @@ fieldLoop:
|
|||||||
for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
|
for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
|
||||||
if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
|
if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
|
||||||
n, _ := strconv.ParseUint(s, 10, 64)
|
n, _ := strconv.ParseUint(s, 10, 64)
|
||||||
si.oneofWrappersByType[tf] = pref.FieldNumber(n)
|
si.oneofWrappersByType[tf] = protoreflect.FieldNumber(n)
|
||||||
si.oneofWrappersByNumber[pref.FieldNumber(n)] = tf
|
si.oneofWrappersByNumber[protoreflect.FieldNumber(n)] = tf
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +218,11 @@ fieldLoop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mi *MessageInfo) New() protoreflect.Message {
|
func (mi *MessageInfo) New() protoreflect.Message {
|
||||||
return mi.MessageOf(reflect.New(mi.GoReflectType.Elem()).Interface())
|
m := reflect.New(mi.GoReflectType.Elem()).Interface()
|
||||||
|
if r, ok := m.(protoreflect.ProtoMessage); ok {
|
||||||
|
return r.ProtoReflect()
|
||||||
|
}
|
||||||
|
return mi.MessageOf(m)
|
||||||
}
|
}
|
||||||
func (mi *MessageInfo) Zero() protoreflect.Message {
|
func (mi *MessageInfo) Zero() protoreflect.Message {
|
||||||
return mi.MessageOf(reflect.Zero(mi.GoReflectType).Interface())
|
return mi.MessageOf(reflect.Zero(mi.GoReflectType).Interface())
|
||||||
@ -237,7 +240,7 @@ func (mi *MessageInfo) Message(i int) protoreflect.MessageType {
|
|||||||
fd := mi.Desc.Fields().Get(i)
|
fd := mi.Desc.Fields().Get(i)
|
||||||
switch {
|
switch {
|
||||||
case fd.IsWeak():
|
case fd.IsWeak():
|
||||||
mt, _ := preg.GlobalTypes.FindMessageByName(fd.Message().FullName())
|
mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName())
|
||||||
return mt
|
return mt
|
||||||
case fd.IsMap():
|
case fd.IsMap():
|
||||||
return mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]}
|
return mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]}
|
||||||
|
66
vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
generated
vendored
66
vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
generated
vendored
@ -10,17 +10,17 @@ import (
|
|||||||
|
|
||||||
"google.golang.org/protobuf/internal/detrand"
|
"google.golang.org/protobuf/internal/detrand"
|
||||||
"google.golang.org/protobuf/internal/pragma"
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type reflectMessageInfo struct {
|
type reflectMessageInfo struct {
|
||||||
fields map[pref.FieldNumber]*fieldInfo
|
fields map[protoreflect.FieldNumber]*fieldInfo
|
||||||
oneofs map[pref.Name]*oneofInfo
|
oneofs map[protoreflect.Name]*oneofInfo
|
||||||
|
|
||||||
// fieldTypes contains the zero value of an enum or message field.
|
// fieldTypes contains the zero value of an enum or message field.
|
||||||
// For lists, it contains the element type.
|
// For lists, it contains the element type.
|
||||||
// For maps, it contains the entry value type.
|
// For maps, it contains the entry value type.
|
||||||
fieldTypes map[pref.FieldNumber]interface{}
|
fieldTypes map[protoreflect.FieldNumber]interface{}
|
||||||
|
|
||||||
// denseFields is a subset of fields where:
|
// denseFields is a subset of fields where:
|
||||||
// 0 < fieldDesc.Number() < len(denseFields)
|
// 0 < fieldDesc.Number() < len(denseFields)
|
||||||
@ -30,8 +30,8 @@ type reflectMessageInfo struct {
|
|||||||
// rangeInfos is a list of all fields (not belonging to a oneof) and oneofs.
|
// rangeInfos is a list of all fields (not belonging to a oneof) and oneofs.
|
||||||
rangeInfos []interface{} // either *fieldInfo or *oneofInfo
|
rangeInfos []interface{} // either *fieldInfo or *oneofInfo
|
||||||
|
|
||||||
getUnknown func(pointer) pref.RawFields
|
getUnknown func(pointer) protoreflect.RawFields
|
||||||
setUnknown func(pointer, pref.RawFields)
|
setUnknown func(pointer, protoreflect.RawFields)
|
||||||
extensionMap func(pointer) *extensionMap
|
extensionMap func(pointer) *extensionMap
|
||||||
|
|
||||||
nilMessage atomicNilMessage
|
nilMessage atomicNilMessage
|
||||||
@ -52,7 +52,7 @@ func (mi *MessageInfo) makeReflectFuncs(t reflect.Type, si structInfo) {
|
|||||||
// This code assumes that the struct is well-formed and panics if there are
|
// This code assumes that the struct is well-formed and panics if there are
|
||||||
// any discrepancies.
|
// any discrepancies.
|
||||||
func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {
|
func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {
|
||||||
mi.fields = map[pref.FieldNumber]*fieldInfo{}
|
mi.fields = map[protoreflect.FieldNumber]*fieldInfo{}
|
||||||
md := mi.Desc
|
md := mi.Desc
|
||||||
fds := md.Fields()
|
fds := md.Fields()
|
||||||
for i := 0; i < fds.Len(); i++ {
|
for i := 0; i < fds.Len(); i++ {
|
||||||
@ -82,7 +82,7 @@ func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {
|
|||||||
mi.fields[fd.Number()] = &fi
|
mi.fields[fd.Number()] = &fi
|
||||||
}
|
}
|
||||||
|
|
||||||
mi.oneofs = map[pref.Name]*oneofInfo{}
|
mi.oneofs = map[protoreflect.Name]*oneofInfo{}
|
||||||
for i := 0; i < md.Oneofs().Len(); i++ {
|
for i := 0; i < md.Oneofs().Len(); i++ {
|
||||||
od := md.Oneofs().Get(i)
|
od := md.Oneofs().Get(i)
|
||||||
mi.oneofs[od.Name()] = makeOneofInfo(od, si, mi.Exporter)
|
mi.oneofs[od.Name()] = makeOneofInfo(od, si, mi.Exporter)
|
||||||
@ -117,13 +117,13 @@ func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {
|
|||||||
switch {
|
switch {
|
||||||
case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsAType:
|
case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsAType:
|
||||||
// Handle as []byte.
|
// Handle as []byte.
|
||||||
mi.getUnknown = func(p pointer) pref.RawFields {
|
mi.getUnknown = func(p pointer) protoreflect.RawFields {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return *p.Apply(mi.unknownOffset).Bytes()
|
return *p.Apply(mi.unknownOffset).Bytes()
|
||||||
}
|
}
|
||||||
mi.setUnknown = func(p pointer, b pref.RawFields) {
|
mi.setUnknown = func(p pointer, b protoreflect.RawFields) {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
panic("invalid SetUnknown on nil Message")
|
panic("invalid SetUnknown on nil Message")
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {
|
|||||||
}
|
}
|
||||||
case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsBType:
|
case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsBType:
|
||||||
// Handle as *[]byte.
|
// Handle as *[]byte.
|
||||||
mi.getUnknown = func(p pointer) pref.RawFields {
|
mi.getUnknown = func(p pointer) protoreflect.RawFields {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {
|
|||||||
}
|
}
|
||||||
return **bp
|
return **bp
|
||||||
}
|
}
|
||||||
mi.setUnknown = func(p pointer, b pref.RawFields) {
|
mi.setUnknown = func(p pointer, b protoreflect.RawFields) {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
panic("invalid SetUnknown on nil Message")
|
panic("invalid SetUnknown on nil Message")
|
||||||
}
|
}
|
||||||
@ -152,10 +152,10 @@ func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {
|
|||||||
**bp = b
|
**bp = b
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
mi.getUnknown = func(pointer) pref.RawFields {
|
mi.getUnknown = func(pointer) protoreflect.RawFields {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
mi.setUnknown = func(p pointer, _ pref.RawFields) {
|
mi.setUnknown = func(p pointer, _ protoreflect.RawFields) {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
panic("invalid SetUnknown on nil Message")
|
panic("invalid SetUnknown on nil Message")
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ func (mi *MessageInfo) makeFieldTypes(si structInfo) {
|
|||||||
}
|
}
|
||||||
if ft != nil {
|
if ft != nil {
|
||||||
if mi.fieldTypes == nil {
|
if mi.fieldTypes == nil {
|
||||||
mi.fieldTypes = make(map[pref.FieldNumber]interface{})
|
mi.fieldTypes = make(map[protoreflect.FieldNumber]interface{})
|
||||||
}
|
}
|
||||||
mi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface()
|
mi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface()
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ func (mi *MessageInfo) makeFieldTypes(si structInfo) {
|
|||||||
|
|
||||||
type extensionMap map[int32]ExtensionField
|
type extensionMap map[int32]ExtensionField
|
||||||
|
|
||||||
func (m *extensionMap) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
func (m *extensionMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
for _, x := range *m {
|
for _, x := range *m {
|
||||||
xd := x.Type().TypeDescriptor()
|
xd := x.Type().TypeDescriptor()
|
||||||
@ -247,7 +247,7 @@ func (m *extensionMap) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *extensionMap) Has(xt pref.ExtensionType) (ok bool) {
|
func (m *extensionMap) Has(xt protoreflect.ExtensionType) (ok bool) {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -266,10 +266,10 @@ func (m *extensionMap) Has(xt pref.ExtensionType) (ok bool) {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
func (m *extensionMap) Clear(xt pref.ExtensionType) {
|
func (m *extensionMap) Clear(xt protoreflect.ExtensionType) {
|
||||||
delete(*m, int32(xt.TypeDescriptor().Number()))
|
delete(*m, int32(xt.TypeDescriptor().Number()))
|
||||||
}
|
}
|
||||||
func (m *extensionMap) Get(xt pref.ExtensionType) pref.Value {
|
func (m *extensionMap) Get(xt protoreflect.ExtensionType) protoreflect.Value {
|
||||||
xd := xt.TypeDescriptor()
|
xd := xt.TypeDescriptor()
|
||||||
if m != nil {
|
if m != nil {
|
||||||
if x, ok := (*m)[int32(xd.Number())]; ok {
|
if x, ok := (*m)[int32(xd.Number())]; ok {
|
||||||
@ -278,7 +278,7 @@ func (m *extensionMap) Get(xt pref.ExtensionType) pref.Value {
|
|||||||
}
|
}
|
||||||
return xt.Zero()
|
return xt.Zero()
|
||||||
}
|
}
|
||||||
func (m *extensionMap) Set(xt pref.ExtensionType, v pref.Value) {
|
func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value) {
|
||||||
xd := xt.TypeDescriptor()
|
xd := xt.TypeDescriptor()
|
||||||
isValid := true
|
isValid := true
|
||||||
switch {
|
switch {
|
||||||
@ -302,9 +302,9 @@ func (m *extensionMap) Set(xt pref.ExtensionType, v pref.Value) {
|
|||||||
x.Set(xt, v)
|
x.Set(xt, v)
|
||||||
(*m)[int32(xd.Number())] = x
|
(*m)[int32(xd.Number())] = x
|
||||||
}
|
}
|
||||||
func (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {
|
func (m *extensionMap) Mutable(xt protoreflect.ExtensionType) protoreflect.Value {
|
||||||
xd := xt.TypeDescriptor()
|
xd := xt.TypeDescriptor()
|
||||||
if xd.Kind() != pref.MessageKind && xd.Kind() != pref.GroupKind && !xd.IsList() && !xd.IsMap() {
|
if xd.Kind() != protoreflect.MessageKind && xd.Kind() != protoreflect.GroupKind && !xd.IsList() && !xd.IsMap() {
|
||||||
panic("invalid Mutable on field with non-composite type")
|
panic("invalid Mutable on field with non-composite type")
|
||||||
}
|
}
|
||||||
if x, ok := (*m)[int32(xd.Number())]; ok {
|
if x, ok := (*m)[int32(xd.Number())]; ok {
|
||||||
@ -320,7 +320,6 @@ func (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {
|
|||||||
// in an allocation-free way without needing to have a shadow Go type generated
|
// in an allocation-free way without needing to have a shadow Go type generated
|
||||||
// for every message type. This technique only works using unsafe.
|
// for every message type. This technique only works using unsafe.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Example generated code:
|
// Example generated code:
|
||||||
//
|
//
|
||||||
// type M struct {
|
// type M struct {
|
||||||
@ -351,11 +350,10 @@ func (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {
|
|||||||
// It has access to the message info as its first field, and a pointer to the
|
// It has access to the message info as its first field, and a pointer to the
|
||||||
// MessageState is identical to a pointer to the concrete message value.
|
// MessageState is identical to a pointer to the concrete message value.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Requirements:
|
// Requirements:
|
||||||
// • The type M must implement protoreflect.ProtoMessage.
|
// - The type M must implement protoreflect.ProtoMessage.
|
||||||
// • The address of m must not be nil.
|
// - The address of m must not be nil.
|
||||||
// • The address of m and the address of m.state must be equal,
|
// - The address of m and the address of m.state must be equal,
|
||||||
// even though they are different Go types.
|
// even though they are different Go types.
|
||||||
type MessageState struct {
|
type MessageState struct {
|
||||||
pragma.NoUnkeyedLiterals
|
pragma.NoUnkeyedLiterals
|
||||||
@ -368,7 +366,7 @@ type MessageState struct {
|
|||||||
type messageState MessageState
|
type messageState MessageState
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ pref.Message = (*messageState)(nil)
|
_ protoreflect.Message = (*messageState)(nil)
|
||||||
_ unwrapper = (*messageState)(nil)
|
_ unwrapper = (*messageState)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -387,16 +385,16 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ pref.Message = (*messageReflectWrapper)(nil)
|
_ protoreflect.Message = (*messageReflectWrapper)(nil)
|
||||||
_ unwrapper = (*messageReflectWrapper)(nil)
|
_ unwrapper = (*messageReflectWrapper)(nil)
|
||||||
_ pref.ProtoMessage = (*messageIfaceWrapper)(nil)
|
_ protoreflect.ProtoMessage = (*messageIfaceWrapper)(nil)
|
||||||
_ unwrapper = (*messageIfaceWrapper)(nil)
|
_ unwrapper = (*messageIfaceWrapper)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
// MessageOf returns a reflective view over a message. The input must be a
|
// MessageOf returns a reflective view over a message. The input must be a
|
||||||
// pointer to a named Go struct. If the provided type has a ProtoReflect method,
|
// pointer to a named Go struct. If the provided type has a ProtoReflect method,
|
||||||
// it must be implemented by calling this method.
|
// it must be implemented by calling this method.
|
||||||
func (mi *MessageInfo) MessageOf(m interface{}) pref.Message {
|
func (mi *MessageInfo) MessageOf(m interface{}) protoreflect.Message {
|
||||||
if reflect.TypeOf(m) != mi.GoReflectType {
|
if reflect.TypeOf(m) != mi.GoReflectType {
|
||||||
panic(fmt.Sprintf("type mismatch: got %T, want %v", m, mi.GoReflectType))
|
panic(fmt.Sprintf("type mismatch: got %T, want %v", m, mi.GoReflectType))
|
||||||
}
|
}
|
||||||
@ -421,7 +419,7 @@ func (m *messageIfaceWrapper) Reset() {
|
|||||||
rv.Elem().Set(reflect.Zero(rv.Type().Elem()))
|
rv.Elem().Set(reflect.Zero(rv.Type().Elem()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *messageIfaceWrapper) ProtoReflect() pref.Message {
|
func (m *messageIfaceWrapper) ProtoReflect() protoreflect.Message {
|
||||||
return (*messageReflectWrapper)(m)
|
return (*messageReflectWrapper)(m)
|
||||||
}
|
}
|
||||||
func (m *messageIfaceWrapper) protoUnwrap() interface{} {
|
func (m *messageIfaceWrapper) protoUnwrap() interface{} {
|
||||||
@ -430,7 +428,7 @@ func (m *messageIfaceWrapper) protoUnwrap() interface{} {
|
|||||||
|
|
||||||
// checkField verifies that the provided field descriptor is valid.
|
// checkField verifies that the provided field descriptor is valid.
|
||||||
// Exactly one of the returned values is populated.
|
// Exactly one of the returned values is populated.
|
||||||
func (mi *MessageInfo) checkField(fd pref.FieldDescriptor) (*fieldInfo, pref.ExtensionType) {
|
func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, protoreflect.ExtensionType) {
|
||||||
var fi *fieldInfo
|
var fi *fieldInfo
|
||||||
if n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) {
|
if n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) {
|
||||||
fi = mi.denseFields[n]
|
fi = mi.denseFields[n]
|
||||||
@ -455,7 +453,7 @@ func (mi *MessageInfo) checkField(fd pref.FieldDescriptor) (*fieldInfo, pref.Ext
|
|||||||
if !mi.Desc.ExtensionRanges().Has(fd.Number()) {
|
if !mi.Desc.ExtensionRanges().Has(fd.Number()) {
|
||||||
panic(fmt.Sprintf("extension %v extends %v outside the extension range", fd.FullName(), mi.Desc.FullName()))
|
panic(fmt.Sprintf("extension %v extends %v outside the extension range", fd.FullName(), mi.Desc.FullName()))
|
||||||
}
|
}
|
||||||
xtd, ok := fd.(pref.ExtensionTypeDescriptor)
|
xtd, ok := fd.(protoreflect.ExtensionTypeDescriptor)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic(fmt.Sprintf("extension %v does not implement protoreflect.ExtensionTypeDescriptor", fd.FullName()))
|
panic(fmt.Sprintf("extension %v does not implement protoreflect.ExtensionTypeDescriptor", fd.FullName()))
|
||||||
}
|
}
|
||||||
|
118
vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go
generated
vendored
118
vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go
generated
vendored
@ -11,24 +11,24 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"google.golang.org/protobuf/internal/flags"
|
"google.golang.org/protobuf/internal/flags"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
type fieldInfo struct {
|
type fieldInfo struct {
|
||||||
fieldDesc pref.FieldDescriptor
|
fieldDesc protoreflect.FieldDescriptor
|
||||||
|
|
||||||
// These fields are used for protobuf reflection support.
|
// These fields are used for protobuf reflection support.
|
||||||
has func(pointer) bool
|
has func(pointer) bool
|
||||||
clear func(pointer)
|
clear func(pointer)
|
||||||
get func(pointer) pref.Value
|
get func(pointer) protoreflect.Value
|
||||||
set func(pointer, pref.Value)
|
set func(pointer, protoreflect.Value)
|
||||||
mutable func(pointer) pref.Value
|
mutable func(pointer) protoreflect.Value
|
||||||
newMessage func() pref.Message
|
newMessage func() protoreflect.Message
|
||||||
newField func() pref.Value
|
newField func() protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForMissing(fd pref.FieldDescriptor) fieldInfo {
|
func fieldInfoForMissing(fd protoreflect.FieldDescriptor) fieldInfo {
|
||||||
// This never occurs for generated message types.
|
// This never occurs for generated message types.
|
||||||
// It implies that a hand-crafted type has missing Go fields
|
// It implies that a hand-crafted type has missing Go fields
|
||||||
// for specific protobuf message fields.
|
// for specific protobuf message fields.
|
||||||
@ -40,19 +40,19 @@ func fieldInfoForMissing(fd pref.FieldDescriptor) fieldInfo {
|
|||||||
clear: func(p pointer) {
|
clear: func(p pointer) {
|
||||||
panic("missing Go struct field for " + string(fd.FullName()))
|
panic("missing Go struct field for " + string(fd.FullName()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
return fd.Default()
|
return fd.Default()
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
panic("missing Go struct field for " + string(fd.FullName()))
|
panic("missing Go struct field for " + string(fd.FullName()))
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
panic("missing Go struct field for " + string(fd.FullName()))
|
panic("missing Go struct field for " + string(fd.FullName()))
|
||||||
},
|
},
|
||||||
newMessage: func() pref.Message {
|
newMessage: func() protoreflect.Message {
|
||||||
panic("missing Go struct field for " + string(fd.FullName()))
|
panic("missing Go struct field for " + string(fd.FullName()))
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
if v := fd.Default(); v.IsValid() {
|
if v := fd.Default(); v.IsValid() {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ func fieldInfoForMissing(fd pref.FieldDescriptor) fieldInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo {
|
func fieldInfoForOneof(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo {
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
if ft.Kind() != reflect.Interface {
|
if ft.Kind() != reflect.Interface {
|
||||||
panic(fmt.Sprintf("field %v has invalid type: got %v, want interface kind", fd.FullName(), ft))
|
panic(fmt.Sprintf("field %v has invalid type: got %v, want interface kind", fd.FullName(), ft))
|
||||||
@ -102,7 +102,7 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
|||||||
}
|
}
|
||||||
rv.Set(reflect.Zero(rv.Type()))
|
rv.Set(reflect.Zero(rv.Type()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return conv.Zero()
|
return conv.Zero()
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
|||||||
rv = rv.Elem().Elem().Field(0)
|
rv = rv.Elem().Elem().Field(0)
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {
|
if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {
|
||||||
rv.Set(reflect.New(ot))
|
rv.Set(reflect.New(ot))
|
||||||
@ -121,7 +121,7 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
|||||||
rv = rv.Elem().Elem().Field(0)
|
rv = rv.Elem().Elem().Field(0)
|
||||||
rv.Set(conv.GoValueOf(v))
|
rv.Set(conv.GoValueOf(v))
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
if !isMessage {
|
if !isMessage {
|
||||||
panic(fmt.Sprintf("field %v with invalid Mutable call on field with non-composite type", fd.FullName()))
|
panic(fmt.Sprintf("field %v with invalid Mutable call on field with non-composite type", fd.FullName()))
|
||||||
}
|
}
|
||||||
@ -131,20 +131,20 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
|||||||
}
|
}
|
||||||
rv = rv.Elem().Elem().Field(0)
|
rv = rv.Elem().Elem().Field(0)
|
||||||
if rv.Kind() == reflect.Ptr && rv.IsNil() {
|
if rv.Kind() == reflect.Ptr && rv.IsNil() {
|
||||||
rv.Set(conv.GoValueOf(pref.ValueOfMessage(conv.New().Message())))
|
rv.Set(conv.GoValueOf(protoreflect.ValueOfMessage(conv.New().Message())))
|
||||||
}
|
}
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
newMessage: func() pref.Message {
|
newMessage: func() protoreflect.Message {
|
||||||
return conv.New().Message()
|
return conv.New().Message()
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
return conv.New()
|
return conv.New()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
func fieldInfoForMap(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
if ft.Kind() != reflect.Map {
|
if ft.Kind() != reflect.Map {
|
||||||
panic(fmt.Sprintf("field %v has invalid type: got %v, want map kind", fd.FullName(), ft))
|
panic(fmt.Sprintf("field %v has invalid type: got %v, want map kind", fd.FullName(), ft))
|
||||||
@ -166,7 +166,7 @@ func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter
|
|||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
rv.Set(reflect.Zero(rv.Type()))
|
rv.Set(reflect.Zero(rv.Type()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return conv.Zero()
|
return conv.Zero()
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter
|
|||||||
}
|
}
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
pv := conv.GoValueOf(v)
|
pv := conv.GoValueOf(v)
|
||||||
if pv.IsNil() {
|
if pv.IsNil() {
|
||||||
@ -184,20 +184,20 @@ func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter
|
|||||||
}
|
}
|
||||||
rv.Set(pv)
|
rv.Set(pv)
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
v := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
v := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
if v.IsNil() {
|
if v.IsNil() {
|
||||||
v.Set(reflect.MakeMap(fs.Type))
|
v.Set(reflect.MakeMap(fs.Type))
|
||||||
}
|
}
|
||||||
return conv.PBValueOf(v)
|
return conv.PBValueOf(v)
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
return conv.New()
|
return conv.New()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
func fieldInfoForList(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
if ft.Kind() != reflect.Slice {
|
if ft.Kind() != reflect.Slice {
|
||||||
panic(fmt.Sprintf("field %v has invalid type: got %v, want slice kind", fd.FullName(), ft))
|
panic(fmt.Sprintf("field %v has invalid type: got %v, want slice kind", fd.FullName(), ft))
|
||||||
@ -219,7 +219,7 @@ func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporte
|
|||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
rv.Set(reflect.Zero(rv.Type()))
|
rv.Set(reflect.Zero(rv.Type()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return conv.Zero()
|
return conv.Zero()
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporte
|
|||||||
}
|
}
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
pv := conv.GoValueOf(v)
|
pv := conv.GoValueOf(v)
|
||||||
if pv.IsNil() {
|
if pv.IsNil() {
|
||||||
@ -237,11 +237,11 @@ func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporte
|
|||||||
}
|
}
|
||||||
rv.Set(pv.Elem())
|
rv.Set(pv.Elem())
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
v := p.Apply(fieldOffset).AsValueOf(fs.Type)
|
v := p.Apply(fieldOffset).AsValueOf(fs.Type)
|
||||||
return conv.PBValueOf(v)
|
return conv.PBValueOf(v)
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
return conv.New()
|
return conv.New()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ var (
|
|||||||
emptyBytes = reflect.ValueOf([]byte{})
|
emptyBytes = reflect.ValueOf([]byte{})
|
||||||
)
|
)
|
||||||
|
|
||||||
func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
func fieldInfoForScalar(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
nullable := fd.HasPresence()
|
nullable := fd.HasPresence()
|
||||||
isBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8
|
isBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8
|
||||||
@ -300,7 +300,7 @@ func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x expor
|
|||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
rv.Set(reflect.Zero(rv.Type()))
|
rv.Set(reflect.Zero(rv.Type()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return conv.Zero()
|
return conv.Zero()
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x expor
|
|||||||
}
|
}
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
if nullable && rv.Kind() == reflect.Ptr {
|
if nullable && rv.Kind() == reflect.Ptr {
|
||||||
if rv.IsNil() {
|
if rv.IsNil() {
|
||||||
@ -332,23 +332,23 @@ func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x expor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
return conv.New()
|
return conv.New()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldInfo {
|
func fieldInfoForWeakMessage(fd protoreflect.FieldDescriptor, weakOffset offset) fieldInfo {
|
||||||
if !flags.ProtoLegacy {
|
if !flags.ProtoLegacy {
|
||||||
panic("no support for proto1 weak fields")
|
panic("no support for proto1 weak fields")
|
||||||
}
|
}
|
||||||
|
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
var messageType pref.MessageType
|
var messageType protoreflect.MessageType
|
||||||
lazyInit := func() {
|
lazyInit := func() {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
messageName := fd.Message().FullName()
|
messageName := fd.Message().FullName()
|
||||||
messageType, _ = preg.GlobalTypes.FindMessageByName(messageName)
|
messageType, _ = protoregistry.GlobalTypes.FindMessageByName(messageName)
|
||||||
if messageType == nil {
|
if messageType == nil {
|
||||||
panic(fmt.Sprintf("weak message %v for field %v is not linked in", messageName, fd.FullName()))
|
panic(fmt.Sprintf("weak message %v for field %v is not linked in", messageName, fd.FullName()))
|
||||||
}
|
}
|
||||||
@ -368,18 +368,18 @@ func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldIn
|
|||||||
clear: func(p pointer) {
|
clear: func(p pointer) {
|
||||||
p.Apply(weakOffset).WeakFields().clear(num)
|
p.Apply(weakOffset).WeakFields().clear(num)
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
lazyInit()
|
lazyInit()
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return pref.ValueOfMessage(messageType.Zero())
|
return protoreflect.ValueOfMessage(messageType.Zero())
|
||||||
}
|
}
|
||||||
m, ok := p.Apply(weakOffset).WeakFields().get(num)
|
m, ok := p.Apply(weakOffset).WeakFields().get(num)
|
||||||
if !ok {
|
if !ok {
|
||||||
return pref.ValueOfMessage(messageType.Zero())
|
return protoreflect.ValueOfMessage(messageType.Zero())
|
||||||
}
|
}
|
||||||
return pref.ValueOfMessage(m.ProtoReflect())
|
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
lazyInit()
|
lazyInit()
|
||||||
m := v.Message()
|
m := v.Message()
|
||||||
if m.Descriptor() != messageType.Descriptor() {
|
if m.Descriptor() != messageType.Descriptor() {
|
||||||
@ -390,7 +390,7 @@ func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldIn
|
|||||||
}
|
}
|
||||||
p.Apply(weakOffset).WeakFields().set(num, m.Interface())
|
p.Apply(weakOffset).WeakFields().set(num, m.Interface())
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
lazyInit()
|
lazyInit()
|
||||||
fs := p.Apply(weakOffset).WeakFields()
|
fs := p.Apply(weakOffset).WeakFields()
|
||||||
m, ok := fs.get(num)
|
m, ok := fs.get(num)
|
||||||
@ -398,20 +398,20 @@ func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldIn
|
|||||||
m = messageType.New().Interface()
|
m = messageType.New().Interface()
|
||||||
fs.set(num, m)
|
fs.set(num, m)
|
||||||
}
|
}
|
||||||
return pref.ValueOfMessage(m.ProtoReflect())
|
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||||
},
|
},
|
||||||
newMessage: func() pref.Message {
|
newMessage: func() protoreflect.Message {
|
||||||
lazyInit()
|
lazyInit()
|
||||||
return messageType.New()
|
return messageType.New()
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
lazyInit()
|
lazyInit()
|
||||||
return pref.ValueOfMessage(messageType.New())
|
return protoreflect.ValueOfMessage(messageType.New())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
func fieldInfoForMessage(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||||
ft := fs.Type
|
ft := fs.Type
|
||||||
conv := NewConverter(ft, fd)
|
conv := NewConverter(ft, fd)
|
||||||
|
|
||||||
@ -433,47 +433,47 @@ func fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x expo
|
|||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
rv.Set(reflect.Zero(rv.Type()))
|
rv.Set(reflect.Zero(rv.Type()))
|
||||||
},
|
},
|
||||||
get: func(p pointer) pref.Value {
|
get: func(p pointer) protoreflect.Value {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return conv.Zero()
|
return conv.Zero()
|
||||||
}
|
}
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
set: func(p pointer, v pref.Value) {
|
set: func(p pointer, v protoreflect.Value) {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
rv.Set(conv.GoValueOf(v))
|
rv.Set(conv.GoValueOf(v))
|
||||||
if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
|
if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
|
||||||
panic(fmt.Sprintf("field %v has invalid nil pointer", fd.FullName()))
|
panic(fmt.Sprintf("field %v has invalid nil pointer", fd.FullName()))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutable: func(p pointer) pref.Value {
|
mutable: func(p pointer) protoreflect.Value {
|
||||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||||
if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
|
if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
|
||||||
rv.Set(conv.GoValueOf(conv.New()))
|
rv.Set(conv.GoValueOf(conv.New()))
|
||||||
}
|
}
|
||||||
return conv.PBValueOf(rv)
|
return conv.PBValueOf(rv)
|
||||||
},
|
},
|
||||||
newMessage: func() pref.Message {
|
newMessage: func() protoreflect.Message {
|
||||||
return conv.New().Message()
|
return conv.New().Message()
|
||||||
},
|
},
|
||||||
newField: func() pref.Value {
|
newField: func() protoreflect.Value {
|
||||||
return conv.New()
|
return conv.New()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type oneofInfo struct {
|
type oneofInfo struct {
|
||||||
oneofDesc pref.OneofDescriptor
|
oneofDesc protoreflect.OneofDescriptor
|
||||||
which func(pointer) pref.FieldNumber
|
which func(pointer) protoreflect.FieldNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInfo {
|
func makeOneofInfo(od protoreflect.OneofDescriptor, si structInfo, x exporter) *oneofInfo {
|
||||||
oi := &oneofInfo{oneofDesc: od}
|
oi := &oneofInfo{oneofDesc: od}
|
||||||
if od.IsSynthetic() {
|
if od.IsSynthetic() {
|
||||||
fs := si.fieldsByNumber[od.Fields().Get(0).Number()]
|
fs := si.fieldsByNumber[od.Fields().Get(0).Number()]
|
||||||
fieldOffset := offsetOf(fs, x)
|
fieldOffset := offsetOf(fs, x)
|
||||||
oi.which = func(p pointer) pref.FieldNumber {
|
oi.which = func(p pointer) protoreflect.FieldNumber {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -486,7 +486,7 @@ func makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInf
|
|||||||
} else {
|
} else {
|
||||||
fs := si.oneofsByName[od.Name()]
|
fs := si.oneofsByName[od.Name()]
|
||||||
fieldOffset := offsetOf(fs, x)
|
fieldOffset := offsetOf(fs, x)
|
||||||
oi.which = func(p pointer) pref.FieldNumber {
|
oi.which = func(p pointer) protoreflect.FieldNumber {
|
||||||
if p.IsNil() {
|
if p.IsNil() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
50
vendor/google.golang.org/protobuf/internal/impl/validate.go
generated
vendored
50
vendor/google.golang.org/protobuf/internal/impl/validate.go
generated
vendored
@ -16,9 +16,9 @@ import (
|
|||||||
"google.golang.org/protobuf/internal/flags"
|
"google.golang.org/protobuf/internal/flags"
|
||||||
"google.golang.org/protobuf/internal/genid"
|
"google.golang.org/protobuf/internal/genid"
|
||||||
"google.golang.org/protobuf/internal/strs"
|
"google.golang.org/protobuf/internal/strs"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
"google.golang.org/protobuf/runtime/protoiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ValidationStatus is the result of validating the wire-format encoding of a message.
|
// ValidationStatus is the result of validating the wire-format encoding of a message.
|
||||||
@ -56,20 +56,20 @@ func (v ValidationStatus) String() string {
|
|||||||
// of the message type.
|
// of the message type.
|
||||||
//
|
//
|
||||||
// This function is exposed for testing.
|
// This function is exposed for testing.
|
||||||
func Validate(mt pref.MessageType, in piface.UnmarshalInput) (out piface.UnmarshalOutput, _ ValidationStatus) {
|
func Validate(mt protoreflect.MessageType, in protoiface.UnmarshalInput) (out protoiface.UnmarshalOutput, _ ValidationStatus) {
|
||||||
mi, ok := mt.(*MessageInfo)
|
mi, ok := mt.(*MessageInfo)
|
||||||
if !ok {
|
if !ok {
|
||||||
return out, ValidationUnknown
|
return out, ValidationUnknown
|
||||||
}
|
}
|
||||||
if in.Resolver == nil {
|
if in.Resolver == nil {
|
||||||
in.Resolver = preg.GlobalTypes
|
in.Resolver = protoregistry.GlobalTypes
|
||||||
}
|
}
|
||||||
o, st := mi.validate(in.Buf, 0, unmarshalOptions{
|
o, st := mi.validate(in.Buf, 0, unmarshalOptions{
|
||||||
flags: in.Flags,
|
flags: in.Flags,
|
||||||
resolver: in.Resolver,
|
resolver: in.Resolver,
|
||||||
})
|
})
|
||||||
if o.initialized {
|
if o.initialized {
|
||||||
out.Flags |= piface.UnmarshalInitialized
|
out.Flags |= protoiface.UnmarshalInitialized
|
||||||
}
|
}
|
||||||
return out, st
|
return out, st
|
||||||
}
|
}
|
||||||
@ -106,22 +106,22 @@ const (
|
|||||||
validationTypeMessageSetItem
|
validationTypeMessageSetItem
|
||||||
)
|
)
|
||||||
|
|
||||||
func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescriptor, ft reflect.Type) validationInfo {
|
func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd protoreflect.FieldDescriptor, ft reflect.Type) validationInfo {
|
||||||
var vi validationInfo
|
var vi validationInfo
|
||||||
switch {
|
switch {
|
||||||
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
vi.typ = validationTypeMessage
|
vi.typ = validationTypeMessage
|
||||||
if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
|
if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
|
||||||
vi.mi = getMessageInfo(ot.Field(0).Type)
|
vi.mi = getMessageInfo(ot.Field(0).Type)
|
||||||
}
|
}
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
vi.typ = validationTypeGroup
|
vi.typ = validationTypeGroup
|
||||||
if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
|
if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
|
||||||
vi.mi = getMessageInfo(ot.Field(0).Type)
|
vi.mi = getMessageInfo(ot.Field(0).Type)
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
vi.typ = validationTypeUTF8String
|
vi.typ = validationTypeUTF8String
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescrip
|
|||||||
default:
|
default:
|
||||||
vi = newValidationInfo(fd, ft)
|
vi = newValidationInfo(fd, ft)
|
||||||
}
|
}
|
||||||
if fd.Cardinality() == pref.Required {
|
if fd.Cardinality() == protoreflect.Required {
|
||||||
// Avoid overflow. The required field check is done with a 64-bit mask, with
|
// Avoid overflow. The required field check is done with a 64-bit mask, with
|
||||||
// any message containing more than 64 required fields always reported as
|
// any message containing more than 64 required fields always reported as
|
||||||
// potentially uninitialized, so it is not important to get a precise count
|
// potentially uninitialized, so it is not important to get a precise count
|
||||||
@ -142,22 +142,22 @@ func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescrip
|
|||||||
return vi
|
return vi
|
||||||
}
|
}
|
||||||
|
|
||||||
func newValidationInfo(fd pref.FieldDescriptor, ft reflect.Type) validationInfo {
|
func newValidationInfo(fd protoreflect.FieldDescriptor, ft reflect.Type) validationInfo {
|
||||||
var vi validationInfo
|
var vi validationInfo
|
||||||
switch {
|
switch {
|
||||||
case fd.IsList():
|
case fd.IsList():
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
vi.typ = validationTypeMessage
|
vi.typ = validationTypeMessage
|
||||||
if ft.Kind() == reflect.Slice {
|
if ft.Kind() == reflect.Slice {
|
||||||
vi.mi = getMessageInfo(ft.Elem())
|
vi.mi = getMessageInfo(ft.Elem())
|
||||||
}
|
}
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
vi.typ = validationTypeGroup
|
vi.typ = validationTypeGroup
|
||||||
if ft.Kind() == reflect.Slice {
|
if ft.Kind() == reflect.Slice {
|
||||||
vi.mi = getMessageInfo(ft.Elem())
|
vi.mi = getMessageInfo(ft.Elem())
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
vi.typ = validationTypeBytes
|
vi.typ = validationTypeBytes
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
vi.typ = validationTypeUTF8String
|
vi.typ = validationTypeUTF8String
|
||||||
@ -175,33 +175,33 @@ func newValidationInfo(fd pref.FieldDescriptor, ft reflect.Type) validationInfo
|
|||||||
case fd.IsMap():
|
case fd.IsMap():
|
||||||
vi.typ = validationTypeMap
|
vi.typ = validationTypeMap
|
||||||
switch fd.MapKey().Kind() {
|
switch fd.MapKey().Kind() {
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
vi.keyType = validationTypeUTF8String
|
vi.keyType = validationTypeUTF8String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch fd.MapValue().Kind() {
|
switch fd.MapValue().Kind() {
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
vi.valType = validationTypeMessage
|
vi.valType = validationTypeMessage
|
||||||
if ft.Kind() == reflect.Map {
|
if ft.Kind() == reflect.Map {
|
||||||
vi.mi = getMessageInfo(ft.Elem())
|
vi.mi = getMessageInfo(ft.Elem())
|
||||||
}
|
}
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
vi.valType = validationTypeUTF8String
|
vi.valType = validationTypeUTF8String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.MessageKind:
|
case protoreflect.MessageKind:
|
||||||
vi.typ = validationTypeMessage
|
vi.typ = validationTypeMessage
|
||||||
if !fd.IsWeak() {
|
if !fd.IsWeak() {
|
||||||
vi.mi = getMessageInfo(ft)
|
vi.mi = getMessageInfo(ft)
|
||||||
}
|
}
|
||||||
case pref.GroupKind:
|
case protoreflect.GroupKind:
|
||||||
vi.typ = validationTypeGroup
|
vi.typ = validationTypeGroup
|
||||||
vi.mi = getMessageInfo(ft)
|
vi.mi = getMessageInfo(ft)
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
vi.typ = validationTypeBytes
|
vi.typ = validationTypeBytes
|
||||||
if strs.EnforceUTF8(fd) {
|
if strs.EnforceUTF8(fd) {
|
||||||
vi.typ = validationTypeUTF8String
|
vi.typ = validationTypeUTF8String
|
||||||
@ -314,11 +314,11 @@ State:
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
messageName := fd.Message().FullName()
|
messageName := fd.Message().FullName()
|
||||||
messageType, err := preg.GlobalTypes.FindMessageByName(messageName)
|
messageType, err := protoregistry.GlobalTypes.FindMessageByName(messageName)
|
||||||
switch err {
|
switch err {
|
||||||
case nil:
|
case nil:
|
||||||
vi.mi, _ = messageType.(*MessageInfo)
|
vi.mi, _ = messageType.(*MessageInfo)
|
||||||
case preg.NotFound:
|
case protoregistry.NotFound:
|
||||||
vi.typ = validationTypeBytes
|
vi.typ = validationTypeBytes
|
||||||
default:
|
default:
|
||||||
return out, ValidationUnknown
|
return out, ValidationUnknown
|
||||||
@ -335,7 +335,7 @@ State:
|
|||||||
// unmarshaling to begin failing. Supporting this requires some way to
|
// unmarshaling to begin failing. Supporting this requires some way to
|
||||||
// determine if the resolver is frozen.
|
// determine if the resolver is frozen.
|
||||||
xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), num)
|
xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), num)
|
||||||
if err != nil && err != preg.NotFound {
|
if err != nil && err != protoregistry.NotFound {
|
||||||
return out, ValidationUnknown
|
return out, ValidationUnknown
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -513,7 +513,7 @@ State:
|
|||||||
}
|
}
|
||||||
xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), typeid)
|
xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), typeid)
|
||||||
switch {
|
switch {
|
||||||
case err == preg.NotFound:
|
case err == protoregistry.NotFound:
|
||||||
b = b[n:]
|
b = b[n:]
|
||||||
case err != nil:
|
case err != nil:
|
||||||
return out, ValidationUnknown
|
return out, ValidationUnknown
|
||||||
|
16
vendor/google.golang.org/protobuf/internal/impl/weak.go
generated
vendored
16
vendor/google.golang.org/protobuf/internal/impl/weak.go
generated
vendored
@ -7,7 +7,7 @@ package impl
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -17,32 +17,32 @@ import (
|
|||||||
// defined directly on it.
|
// defined directly on it.
|
||||||
type weakFields WeakFields
|
type weakFields WeakFields
|
||||||
|
|
||||||
func (w weakFields) get(num pref.FieldNumber) (pref.ProtoMessage, bool) {
|
func (w weakFields) get(num protoreflect.FieldNumber) (protoreflect.ProtoMessage, bool) {
|
||||||
m, ok := w[int32(num)]
|
m, ok := w[int32(num)]
|
||||||
return m, ok
|
return m, ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *weakFields) set(num pref.FieldNumber, m pref.ProtoMessage) {
|
func (w *weakFields) set(num protoreflect.FieldNumber, m protoreflect.ProtoMessage) {
|
||||||
if *w == nil {
|
if *w == nil {
|
||||||
*w = make(weakFields)
|
*w = make(weakFields)
|
||||||
}
|
}
|
||||||
(*w)[int32(num)] = m
|
(*w)[int32(num)] = m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *weakFields) clear(num pref.FieldNumber) {
|
func (w *weakFields) clear(num protoreflect.FieldNumber) {
|
||||||
delete(*w, int32(num))
|
delete(*w, int32(num))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Export) HasWeak(w WeakFields, num pref.FieldNumber) bool {
|
func (Export) HasWeak(w WeakFields, num protoreflect.FieldNumber) bool {
|
||||||
_, ok := w[int32(num)]
|
_, ok := w[int32(num)]
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Export) ClearWeak(w *WeakFields, num pref.FieldNumber) {
|
func (Export) ClearWeak(w *WeakFields, num protoreflect.FieldNumber) {
|
||||||
delete(*w, int32(num))
|
delete(*w, int32(num))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Export) GetWeak(w WeakFields, num pref.FieldNumber, name pref.FullName) pref.ProtoMessage {
|
func (Export) GetWeak(w WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName) protoreflect.ProtoMessage {
|
||||||
if m, ok := w[int32(num)]; ok {
|
if m, ok := w[int32(num)]; ok {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ func (Export) GetWeak(w WeakFields, num pref.FieldNumber, name pref.FullName) pr
|
|||||||
return mt.Zero().Interface()
|
return mt.Zero().Interface()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Export) SetWeak(w *WeakFields, num pref.FieldNumber, name pref.FullName, m pref.ProtoMessage) {
|
func (Export) SetWeak(w *WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName, m protoreflect.ProtoMessage) {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
mt, _ := protoregistry.GlobalTypes.FindMessageByName(name)
|
mt, _ := protoregistry.GlobalTypes.FindMessageByName(name)
|
||||||
if mt == nil {
|
if mt == nil {
|
||||||
|
16
vendor/google.golang.org/protobuf/internal/order/order.go
generated
vendored
16
vendor/google.golang.org/protobuf/internal/order/order.go
generated
vendored
@ -5,12 +5,12 @@
|
|||||||
package order
|
package order
|
||||||
|
|
||||||
import (
|
import (
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FieldOrder specifies the ordering to visit message fields.
|
// FieldOrder specifies the ordering to visit message fields.
|
||||||
// It is a function that reports whether x is ordered before y.
|
// It is a function that reports whether x is ordered before y.
|
||||||
type FieldOrder func(x, y pref.FieldDescriptor) bool
|
type FieldOrder func(x, y protoreflect.FieldDescriptor) bool
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// AnyFieldOrder specifies no specific field ordering.
|
// AnyFieldOrder specifies no specific field ordering.
|
||||||
@ -18,9 +18,9 @@ var (
|
|||||||
|
|
||||||
// LegacyFieldOrder sorts fields in the same ordering as emitted by
|
// LegacyFieldOrder sorts fields in the same ordering as emitted by
|
||||||
// wire serialization in the github.com/golang/protobuf implementation.
|
// wire serialization in the github.com/golang/protobuf implementation.
|
||||||
LegacyFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {
|
LegacyFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
|
||||||
ox, oy := x.ContainingOneof(), y.ContainingOneof()
|
ox, oy := x.ContainingOneof(), y.ContainingOneof()
|
||||||
inOneof := func(od pref.OneofDescriptor) bool {
|
inOneof := func(od protoreflect.OneofDescriptor) bool {
|
||||||
return od != nil && !od.IsSynthetic()
|
return od != nil && !od.IsSynthetic()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,14 +41,14 @@ var (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NumberFieldOrder sorts fields by their field number.
|
// NumberFieldOrder sorts fields by their field number.
|
||||||
NumberFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {
|
NumberFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
|
||||||
return x.Number() < y.Number()
|
return x.Number() < y.Number()
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexNameFieldOrder sorts non-extension fields before extension fields.
|
// IndexNameFieldOrder sorts non-extension fields before extension fields.
|
||||||
// Non-extensions are sorted according to their declaration index.
|
// Non-extensions are sorted according to their declaration index.
|
||||||
// Extensions are sorted according to their full name.
|
// Extensions are sorted according to their full name.
|
||||||
IndexNameFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {
|
IndexNameFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
|
||||||
// Non-extension fields sort before extension fields.
|
// Non-extension fields sort before extension fields.
|
||||||
if x.IsExtension() != y.IsExtension() {
|
if x.IsExtension() != y.IsExtension() {
|
||||||
return !x.IsExtension() && y.IsExtension()
|
return !x.IsExtension() && y.IsExtension()
|
||||||
@ -64,7 +64,7 @@ var (
|
|||||||
|
|
||||||
// KeyOrder specifies the ordering to visit map entries.
|
// KeyOrder specifies the ordering to visit map entries.
|
||||||
// It is a function that reports whether x is ordered before y.
|
// It is a function that reports whether x is ordered before y.
|
||||||
type KeyOrder func(x, y pref.MapKey) bool
|
type KeyOrder func(x, y protoreflect.MapKey) bool
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// AnyKeyOrder specifies no specific key ordering.
|
// AnyKeyOrder specifies no specific key ordering.
|
||||||
@ -72,7 +72,7 @@ var (
|
|||||||
|
|
||||||
// GenericKeyOrder sorts false before true, numeric keys in ascending order,
|
// GenericKeyOrder sorts false before true, numeric keys in ascending order,
|
||||||
// and strings in lexicographical ordering according to UTF-8 codepoints.
|
// and strings in lexicographical ordering according to UTF-8 codepoints.
|
||||||
GenericKeyOrder KeyOrder = func(x, y pref.MapKey) bool {
|
GenericKeyOrder KeyOrder = func(x, y protoreflect.MapKey) bool {
|
||||||
switch x.Interface().(type) {
|
switch x.Interface().(type) {
|
||||||
case bool:
|
case bool:
|
||||||
return !x.Bool() && y.Bool()
|
return !x.Bool() && y.Bool()
|
||||||
|
22
vendor/google.golang.org/protobuf/internal/order/range.go
generated
vendored
22
vendor/google.golang.org/protobuf/internal/order/range.go
generated
vendored
@ -9,12 +9,12 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type messageField struct {
|
type messageField struct {
|
||||||
fd pref.FieldDescriptor
|
fd protoreflect.FieldDescriptor
|
||||||
v pref.Value
|
v protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
var messageFieldPool = sync.Pool{
|
var messageFieldPool = sync.Pool{
|
||||||
@ -25,8 +25,8 @@ type (
|
|||||||
// FieldRnger is an interface for visiting all fields in a message.
|
// FieldRnger is an interface for visiting all fields in a message.
|
||||||
// The protoreflect.Message type implements this interface.
|
// The protoreflect.Message type implements this interface.
|
||||||
FieldRanger interface{ Range(VisitField) }
|
FieldRanger interface{ Range(VisitField) }
|
||||||
// VisitField is called everytime a message field is visited.
|
// VisitField is called every time a message field is visited.
|
||||||
VisitField = func(pref.FieldDescriptor, pref.Value) bool
|
VisitField = func(protoreflect.FieldDescriptor, protoreflect.Value) bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// RangeFields iterates over the fields of fs according to the specified order.
|
// RangeFields iterates over the fields of fs according to the specified order.
|
||||||
@ -47,7 +47,7 @@ func RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
// Collect all fields in the message and sort them.
|
// Collect all fields in the message and sort them.
|
||||||
fs.Range(func(fd pref.FieldDescriptor, v pref.Value) bool {
|
fs.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
|
||||||
fields = append(fields, messageField{fd, v})
|
fields = append(fields, messageField{fd, v})
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
@ -64,8 +64,8 @@ func RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type mapEntry struct {
|
type mapEntry struct {
|
||||||
k pref.MapKey
|
k protoreflect.MapKey
|
||||||
v pref.Value
|
v protoreflect.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapEntryPool = sync.Pool{
|
var mapEntryPool = sync.Pool{
|
||||||
@ -76,8 +76,8 @@ type (
|
|||||||
// EntryRanger is an interface for visiting all fields in a message.
|
// EntryRanger is an interface for visiting all fields in a message.
|
||||||
// The protoreflect.Map type implements this interface.
|
// The protoreflect.Map type implements this interface.
|
||||||
EntryRanger interface{ Range(VisitEntry) }
|
EntryRanger interface{ Range(VisitEntry) }
|
||||||
// VisitEntry is called everytime a map entry is visited.
|
// VisitEntry is called every time a map entry is visited.
|
||||||
VisitEntry = func(pref.MapKey, pref.Value) bool
|
VisitEntry = func(protoreflect.MapKey, protoreflect.Value) bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// RangeEntries iterates over the entries of es according to the specified order.
|
// RangeEntries iterates over the entries of es according to the specified order.
|
||||||
@ -98,7 +98,7 @@ func RangeEntries(es EntryRanger, less KeyOrder, fn VisitEntry) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
// Collect all entries in the map and sort them.
|
// Collect all entries in the map and sort them.
|
||||||
es.Range(func(k pref.MapKey, v pref.Value) bool {
|
es.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
|
||||||
entries = append(entries, mapEntry{k, v})
|
entries = append(entries, mapEntry{k, v})
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
6
vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go
generated
vendored
6
vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go
generated
vendored
@ -10,7 +10,7 @@ package strs
|
|||||||
import (
|
import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -59,7 +59,7 @@ type Builder struct {
|
|||||||
|
|
||||||
// AppendFullName is equivalent to protoreflect.FullName.Append,
|
// AppendFullName is equivalent to protoreflect.FullName.Append,
|
||||||
// but optimized for large batches where each name has a shared lifetime.
|
// but optimized for large batches where each name has a shared lifetime.
|
||||||
func (sb *Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName {
|
func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName {
|
||||||
n := len(prefix) + len(".") + len(name)
|
n := len(prefix) + len(".") + len(name)
|
||||||
if len(prefix) == 0 {
|
if len(prefix) == 0 {
|
||||||
n -= len(".")
|
n -= len(".")
|
||||||
@ -68,7 +68,7 @@ func (sb *Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.Ful
|
|||||||
sb.buf = append(sb.buf, prefix...)
|
sb.buf = append(sb.buf, prefix...)
|
||||||
sb.buf = append(sb.buf, '.')
|
sb.buf = append(sb.buf, '.')
|
||||||
sb.buf = append(sb.buf, name...)
|
sb.buf = append(sb.buf, name...)
|
||||||
return pref.FullName(sb.last(n))
|
return protoreflect.FullName(sb.last(n))
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeString is equivalent to string(b), but optimized for large batches
|
// MakeString is equivalent to string(b), but optimized for large batches
|
||||||
|
12
vendor/google.golang.org/protobuf/internal/version/version.go
generated
vendored
12
vendor/google.golang.org/protobuf/internal/version/version.go
generated
vendored
@ -12,16 +12,15 @@ import (
|
|||||||
|
|
||||||
// These constants determine the current version of this module.
|
// These constants determine the current version of this module.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// For our release process, we enforce the following rules:
|
// For our release process, we enforce the following rules:
|
||||||
// * Tagged releases use a tag that is identical to String.
|
// - Tagged releases use a tag that is identical to String.
|
||||||
// * Tagged releases never reference a commit where the String
|
// - Tagged releases never reference a commit where the String
|
||||||
// contains "devel".
|
// contains "devel".
|
||||||
// * The set of all commits in this repository where String
|
// - The set of all commits in this repository where String
|
||||||
// does not contain "devel" must have a unique String.
|
// does not contain "devel" must have a unique String.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Steps for tagging a new release:
|
// Steps for tagging a new release:
|
||||||
|
//
|
||||||
// 1. Create a new CL.
|
// 1. Create a new CL.
|
||||||
//
|
//
|
||||||
// 2. Update Minor, Patch, and/or PreRelease as necessary.
|
// 2. Update Minor, Patch, and/or PreRelease as necessary.
|
||||||
@ -53,13 +52,14 @@ import (
|
|||||||
const (
|
const (
|
||||||
Major = 1
|
Major = 1
|
||||||
Minor = 28
|
Minor = 28
|
||||||
Patch = 0
|
Patch = 1
|
||||||
PreRelease = ""
|
PreRelease = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
// String formats the version string for this module in semver format.
|
// String formats the version string for this module in semver format.
|
||||||
//
|
//
|
||||||
// Examples:
|
// Examples:
|
||||||
|
//
|
||||||
// v1.20.1
|
// v1.20.1
|
||||||
// v1.21.0-rc.1
|
// v1.21.0-rc.1
|
||||||
func String() string {
|
func String() string {
|
||||||
|
1
vendor/google.golang.org/protobuf/proto/decode.go
generated
vendored
1
vendor/google.golang.org/protobuf/proto/decode.go
generated
vendored
@ -19,6 +19,7 @@ import (
|
|||||||
// UnmarshalOptions configures the unmarshaler.
|
// UnmarshalOptions configures the unmarshaler.
|
||||||
//
|
//
|
||||||
// Example usage:
|
// Example usage:
|
||||||
|
//
|
||||||
// err := UnmarshalOptions{DiscardUnknown: true}.Unmarshal(b, m)
|
// err := UnmarshalOptions{DiscardUnknown: true}.Unmarshal(b, m)
|
||||||
type UnmarshalOptions struct {
|
type UnmarshalOptions struct {
|
||||||
pragma.NoUnkeyedLiterals
|
pragma.NoUnkeyedLiterals
|
||||||
|
15
vendor/google.golang.org/protobuf/proto/doc.go
generated
vendored
15
vendor/google.golang.org/protobuf/proto/doc.go
generated
vendored
@ -16,8 +16,7 @@
|
|||||||
//
|
//
|
||||||
// https://developers.google.com/protocol-buffers/docs/reference/go-generated
|
// https://developers.google.com/protocol-buffers/docs/reference/go-generated
|
||||||
//
|
//
|
||||||
//
|
// # Binary serialization
|
||||||
// Binary serialization
|
|
||||||
//
|
//
|
||||||
// This package contains functions to convert to and from the wire format,
|
// This package contains functions to convert to and from the wire format,
|
||||||
// an efficient binary serialization of protocol buffers.
|
// an efficient binary serialization of protocol buffers.
|
||||||
@ -30,8 +29,7 @@
|
|||||||
// • Unmarshal converts a message from the wire format.
|
// • Unmarshal converts a message from the wire format.
|
||||||
// The UnmarshalOptions type provides more control over wire unmarshaling.
|
// The UnmarshalOptions type provides more control over wire unmarshaling.
|
||||||
//
|
//
|
||||||
//
|
// # Basic message operations
|
||||||
// Basic message operations
|
|
||||||
//
|
//
|
||||||
// • Clone makes a deep copy of a message.
|
// • Clone makes a deep copy of a message.
|
||||||
//
|
//
|
||||||
@ -45,8 +43,7 @@
|
|||||||
//
|
//
|
||||||
// • CheckInitialized reports whether all required fields in a message are set.
|
// • CheckInitialized reports whether all required fields in a message are set.
|
||||||
//
|
//
|
||||||
//
|
// # Optional scalar constructors
|
||||||
// Optional scalar constructors
|
|
||||||
//
|
//
|
||||||
// The API for some generated messages represents optional scalar fields
|
// The API for some generated messages represents optional scalar fields
|
||||||
// as pointers to a value. For example, an optional string field has the
|
// as pointers to a value. For example, an optional string field has the
|
||||||
@ -61,16 +58,14 @@
|
|||||||
//
|
//
|
||||||
// Optional scalar fields are only supported in proto2.
|
// Optional scalar fields are only supported in proto2.
|
||||||
//
|
//
|
||||||
//
|
// # Extension accessors
|
||||||
// Extension accessors
|
|
||||||
//
|
//
|
||||||
// • HasExtension, GetExtension, SetExtension, and ClearExtension
|
// • HasExtension, GetExtension, SetExtension, and ClearExtension
|
||||||
// access extension field values in a protocol buffer message.
|
// access extension field values in a protocol buffer message.
|
||||||
//
|
//
|
||||||
// Extension fields are only supported in proto2.
|
// Extension fields are only supported in proto2.
|
||||||
//
|
//
|
||||||
//
|
// # Related packages
|
||||||
// Related packages
|
|
||||||
//
|
//
|
||||||
// • Package "google.golang.org/protobuf/encoding/protojson" converts messages to
|
// • Package "google.golang.org/protobuf/encoding/protojson" converts messages to
|
||||||
// and from JSON.
|
// and from JSON.
|
||||||
|
3
vendor/google.golang.org/protobuf/proto/encode.go
generated
vendored
3
vendor/google.golang.org/protobuf/proto/encode.go
generated
vendored
@ -16,6 +16,7 @@ import (
|
|||||||
// MarshalOptions configures the marshaler.
|
// MarshalOptions configures the marshaler.
|
||||||
//
|
//
|
||||||
// Example usage:
|
// Example usage:
|
||||||
|
//
|
||||||
// b, err := MarshalOptions{Deterministic: true}.Marshal(m)
|
// b, err := MarshalOptions{Deterministic: true}.Marshal(m)
|
||||||
type MarshalOptions struct {
|
type MarshalOptions struct {
|
||||||
pragma.NoUnkeyedLiterals
|
pragma.NoUnkeyedLiterals
|
||||||
@ -101,7 +102,9 @@ func (o MarshalOptions) Marshal(m Message) ([]byte, error) {
|
|||||||
// otherwise it returns a non-nil empty buffer.
|
// otherwise it returns a non-nil empty buffer.
|
||||||
//
|
//
|
||||||
// This is to assist the edge-case where user-code does the following:
|
// This is to assist the edge-case where user-code does the following:
|
||||||
|
//
|
||||||
// m1.OptionalBytes, _ = proto.Marshal(m2)
|
// m1.OptionalBytes, _ = proto.Marshal(m2)
|
||||||
|
//
|
||||||
// where they expect the proto2 "optional_bytes" field to be populated
|
// where they expect the proto2 "optional_bytes" field to be populated
|
||||||
// if any only if m2 is a valid message.
|
// if any only if m2 is a valid message.
|
||||||
func emptyBytesForMessage(m Message) []byte {
|
func emptyBytesForMessage(m Message) []byte {
|
||||||
|
50
vendor/google.golang.org/protobuf/proto/equal.go
generated
vendored
50
vendor/google.golang.org/protobuf/proto/equal.go
generated
vendored
@ -10,7 +10,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Equal reports whether two messages are equal.
|
// Equal reports whether two messages are equal.
|
||||||
@ -33,6 +33,10 @@ func Equal(x, y Message) bool {
|
|||||||
if x == nil || y == nil {
|
if x == nil || y == nil {
|
||||||
return x == nil && y == nil
|
return x == nil && y == nil
|
||||||
}
|
}
|
||||||
|
if reflect.TypeOf(x).Kind() == reflect.Ptr && x == y {
|
||||||
|
// Avoid an expensive comparison if both inputs are identical pointers.
|
||||||
|
return true
|
||||||
|
}
|
||||||
mx := x.ProtoReflect()
|
mx := x.ProtoReflect()
|
||||||
my := y.ProtoReflect()
|
my := y.ProtoReflect()
|
||||||
if mx.IsValid() != my.IsValid() {
|
if mx.IsValid() != my.IsValid() {
|
||||||
@ -42,14 +46,14 @@ func Equal(x, y Message) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// equalMessage compares two messages.
|
// equalMessage compares two messages.
|
||||||
func equalMessage(mx, my pref.Message) bool {
|
func equalMessage(mx, my protoreflect.Message) bool {
|
||||||
if mx.Descriptor() != my.Descriptor() {
|
if mx.Descriptor() != my.Descriptor() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
nx := 0
|
nx := 0
|
||||||
equal := true
|
equal := true
|
||||||
mx.Range(func(fd pref.FieldDescriptor, vx pref.Value) bool {
|
mx.Range(func(fd protoreflect.FieldDescriptor, vx protoreflect.Value) bool {
|
||||||
nx++
|
nx++
|
||||||
vy := my.Get(fd)
|
vy := my.Get(fd)
|
||||||
equal = my.Has(fd) && equalField(fd, vx, vy)
|
equal = my.Has(fd) && equalField(fd, vx, vy)
|
||||||
@ -59,7 +63,7 @@ func equalMessage(mx, my pref.Message) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
ny := 0
|
ny := 0
|
||||||
my.Range(func(fd pref.FieldDescriptor, vx pref.Value) bool {
|
my.Range(func(fd protoreflect.FieldDescriptor, vx protoreflect.Value) bool {
|
||||||
ny++
|
ny++
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
@ -71,7 +75,7 @@ func equalMessage(mx, my pref.Message) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// equalField compares two fields.
|
// equalField compares two fields.
|
||||||
func equalField(fd pref.FieldDescriptor, x, y pref.Value) bool {
|
func equalField(fd protoreflect.FieldDescriptor, x, y protoreflect.Value) bool {
|
||||||
switch {
|
switch {
|
||||||
case fd.IsList():
|
case fd.IsList():
|
||||||
return equalList(fd, x.List(), y.List())
|
return equalList(fd, x.List(), y.List())
|
||||||
@ -83,12 +87,12 @@ func equalField(fd pref.FieldDescriptor, x, y pref.Value) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// equalMap compares two maps.
|
// equalMap compares two maps.
|
||||||
func equalMap(fd pref.FieldDescriptor, x, y pref.Map) bool {
|
func equalMap(fd protoreflect.FieldDescriptor, x, y protoreflect.Map) bool {
|
||||||
if x.Len() != y.Len() {
|
if x.Len() != y.Len() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
equal := true
|
equal := true
|
||||||
x.Range(func(k pref.MapKey, vx pref.Value) bool {
|
x.Range(func(k protoreflect.MapKey, vx protoreflect.Value) bool {
|
||||||
vy := y.Get(k)
|
vy := y.Get(k)
|
||||||
equal = y.Has(k) && equalValue(fd.MapValue(), vx, vy)
|
equal = y.Has(k) && equalValue(fd.MapValue(), vx, vy)
|
||||||
return equal
|
return equal
|
||||||
@ -97,7 +101,7 @@ func equalMap(fd pref.FieldDescriptor, x, y pref.Map) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// equalList compares two lists.
|
// equalList compares two lists.
|
||||||
func equalList(fd pref.FieldDescriptor, x, y pref.List) bool {
|
func equalList(fd protoreflect.FieldDescriptor, x, y protoreflect.List) bool {
|
||||||
if x.Len() != y.Len() {
|
if x.Len() != y.Len() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -110,31 +114,31 @@ func equalList(fd pref.FieldDescriptor, x, y pref.List) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// equalValue compares two singular values.
|
// equalValue compares two singular values.
|
||||||
func equalValue(fd pref.FieldDescriptor, x, y pref.Value) bool {
|
func equalValue(fd protoreflect.FieldDescriptor, x, y protoreflect.Value) bool {
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
case pref.BoolKind:
|
case protoreflect.BoolKind:
|
||||||
return x.Bool() == y.Bool()
|
return x.Bool() == y.Bool()
|
||||||
case pref.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
return x.Enum() == y.Enum()
|
return x.Enum() == y.Enum()
|
||||||
case pref.Int32Kind, pref.Sint32Kind,
|
case protoreflect.Int32Kind, protoreflect.Sint32Kind,
|
||||||
pref.Int64Kind, pref.Sint64Kind,
|
protoreflect.Int64Kind, protoreflect.Sint64Kind,
|
||||||
pref.Sfixed32Kind, pref.Sfixed64Kind:
|
protoreflect.Sfixed32Kind, protoreflect.Sfixed64Kind:
|
||||||
return x.Int() == y.Int()
|
return x.Int() == y.Int()
|
||||||
case pref.Uint32Kind, pref.Uint64Kind,
|
case protoreflect.Uint32Kind, protoreflect.Uint64Kind,
|
||||||
pref.Fixed32Kind, pref.Fixed64Kind:
|
protoreflect.Fixed32Kind, protoreflect.Fixed64Kind:
|
||||||
return x.Uint() == y.Uint()
|
return x.Uint() == y.Uint()
|
||||||
case pref.FloatKind, pref.DoubleKind:
|
case protoreflect.FloatKind, protoreflect.DoubleKind:
|
||||||
fx := x.Float()
|
fx := x.Float()
|
||||||
fy := y.Float()
|
fy := y.Float()
|
||||||
if math.IsNaN(fx) || math.IsNaN(fy) {
|
if math.IsNaN(fx) || math.IsNaN(fy) {
|
||||||
return math.IsNaN(fx) && math.IsNaN(fy)
|
return math.IsNaN(fx) && math.IsNaN(fy)
|
||||||
}
|
}
|
||||||
return fx == fy
|
return fx == fy
|
||||||
case pref.StringKind:
|
case protoreflect.StringKind:
|
||||||
return x.String() == y.String()
|
return x.String() == y.String()
|
||||||
case pref.BytesKind:
|
case protoreflect.BytesKind:
|
||||||
return bytes.Equal(x.Bytes(), y.Bytes())
|
return bytes.Equal(x.Bytes(), y.Bytes())
|
||||||
case pref.MessageKind, pref.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
return equalMessage(x.Message(), y.Message())
|
return equalMessage(x.Message(), y.Message())
|
||||||
default:
|
default:
|
||||||
return x.Interface() == y.Interface()
|
return x.Interface() == y.Interface()
|
||||||
@ -143,7 +147,7 @@ func equalValue(fd pref.FieldDescriptor, x, y pref.Value) bool {
|
|||||||
|
|
||||||
// equalUnknown compares unknown fields by direct comparison on the raw bytes
|
// equalUnknown compares unknown fields by direct comparison on the raw bytes
|
||||||
// of each individual field number.
|
// of each individual field number.
|
||||||
func equalUnknown(x, y pref.RawFields) bool {
|
func equalUnknown(x, y protoreflect.RawFields) bool {
|
||||||
if len(x) != len(y) {
|
if len(x) != len(y) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -151,8 +155,8 @@ func equalUnknown(x, y pref.RawFields) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
mx := make(map[pref.FieldNumber]pref.RawFields)
|
mx := make(map[protoreflect.FieldNumber]protoreflect.RawFields)
|
||||||
my := make(map[pref.FieldNumber]pref.RawFields)
|
my := make(map[protoreflect.FieldNumber]protoreflect.RawFields)
|
||||||
for len(x) > 0 {
|
for len(x) > 0 {
|
||||||
fnum, _, n := protowire.ConsumeField(x)
|
fnum, _, n := protowire.ConsumeField(x)
|
||||||
mx[fnum] = append(mx[fnum], x[:n]...)
|
mx[fnum] = append(mx[fnum], x[:n]...)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user