mirror of https://github.com/grpc/grpc-node.git
Compare commits
548 Commits
@grpc/grpc
...
master
Author | SHA1 | Date |
---|---|---|
|
179dbfaecc | |
|
d22becc98e | |
|
987735920e | |
|
972bb23101 | |
|
7548f413a5 | |
|
110a273a06 | |
|
7ab3da2431 | |
|
5756fe7672 | |
|
eef4b080f5 | |
|
82b331d9e1 | |
|
21d40b0247 | |
|
1605b71a02 | |
|
0157776059 | |
|
537b32f116 | |
|
7905a76494 | |
|
c2b914d4fd | |
|
38e00726f4 | |
|
9843648afb | |
|
9b7402ffab | |
|
af53efcb85 | |
|
2e39783b36 | |
|
6f81b4ef9b | |
|
ff679ae473 | |
|
c4580fa80b | |
|
4a0f4cf5c8 | |
|
e6da4ad1d8 | |
|
024d5d8fdf | |
|
86aa0f2f8b | |
|
9e35cacfe5 | |
|
7a735ce062 | |
|
b74de954cf | |
|
4f0610338f | |
|
78f194be6e | |
|
6c7abfe4a8 | |
|
a8142c2bcb | |
|
abcf4306d6 | |
|
68bfa3b5e7 | |
|
fbd13e8474 | |
|
9691f0eb0e | |
|
c5b96a9054 | |
|
daa5127a95 | |
|
4132581c19 | |
|
b43225d6a6 | |
|
8499c7b20f | |
|
55b31f60d9 | |
|
7133635f1a | |
|
7d39d52b77 | |
|
46a5e517ec | |
|
d58144dfff | |
|
5eded95069 | |
|
6094ebed61 | |
|
0ebb571bb7 | |
|
510d68140b | |
|
6965250011 | |
|
36c9a4fd40 | |
|
822af6817f | |
|
a9cfd7a533 | |
|
1e28a04330 | |
|
7d99c4a7aa | |
|
65f4d76f15 | |
|
5cf1a876e5 | |
|
87f703403c | |
|
e883425ef3 | |
|
1fe3f7406c | |
|
bdd0dc8499 | |
|
5f12dc233f | |
|
0c093b0b7f | |
|
da5cca4156 | |
|
a8f981aefd | |
|
b44b14d831 | |
|
bb6fff7ff5 | |
|
6e901c1511 | |
|
2979fa706d | |
|
613c832aad | |
|
e55e596b29 | |
|
f6631f5162 | |
|
eed4d54537 | |
|
564e80f736 | |
|
e5fa6b7c05 | |
|
189bef2177 | |
|
fced35a7d1 | |
|
61349e09ab | |
|
d008d1e3c3 | |
|
0f0314f1ad | |
|
a7219808db | |
|
bf26f6e3a6 | |
|
1d9887224b | |
|
7a255395bc | |
|
0b6e2a3275 | |
|
06a05a4200 | |
|
1ed46a1ae5 | |
|
8fea44d2d5 | |
|
77dc658b46 | |
|
656ca0c00e | |
|
6bd791d254 | |
|
f1f2b2dd83 | |
|
588b69c12c | |
|
621f401e34 | |
|
d2a6dda689 | |
|
5f889b2dd2 | |
|
6dc3abe798 | |
|
0e6bfcc1a7 | |
|
e1a9f1275e | |
|
33fcde929f | |
|
ca21e4ab1f | |
|
d2462cad64 | |
|
9569f20fc6 | |
|
cacace75a0 | |
|
023b0862f0 | |
|
b1fd52d566 | |
|
23e6dd7d14 | |
|
8b64c8144c | |
|
0396cb92e4 | |
|
fdb6064721 | |
|
94781c9cc9 | |
|
7068708e93 | |
|
ffcb67cfa4 | |
|
854c15e113 | |
|
73dea90052 | |
|
a3d99e3554 | |
|
34b82cbf7f | |
|
908c22a3e3 | |
|
5e7cd85290 | |
|
a5b6178d99 | |
|
5a942ed648 | |
|
bfd87a9bf6 | |
|
22bbe8a315 | |
|
d9b677a74a | |
|
198ff4e9ea | |
|
5f20dc91f0 | |
|
bfebbe7047 | |
|
2a6ce92a55 | |
|
0a20c2df64 | |
|
2fa886109b | |
|
ef510d9e9a | |
|
c6c69df25b | |
|
b396b7d5ae | |
|
5b0956a9df | |
|
bb6bb4a5ca | |
|
137f476040 | |
|
9620806dcd | |
|
7346a186e3 | |
|
ca07343b78 | |
|
c591c2a268 | |
|
a0914c6cda | |
|
bae98b3d2f | |
|
63d97170da | |
|
daaa1c37b3 | |
|
263c478c9a | |
|
2a48d2689c | |
|
5cd30ae4b8 | |
|
fad797fd92 | |
|
2a4cd42f82 | |
|
614e5f948c | |
|
41f3fc096d | |
|
b84940ef0c | |
|
d08318d8c1 | |
|
e9359efc24 | |
|
5e3b0fb8e0 | |
|
a524d15488 | |
|
848e00e54c | |
|
f0c58f79c5 | |
|
bc749acad8 | |
|
8f08bbe621 | |
|
165732467d | |
|
f5133e4822 | |
|
bd00ccf5f3 | |
|
f154954854 | |
|
f44b5e50e8 | |
|
86e62f2426 | |
|
f621dc6c48 | |
|
b6fbfa3bfc | |
|
2ed62c1b76 | |
|
f003315809 | |
|
c405404d96 | |
|
7a6107f7d3 | |
|
77c5e768a7 | |
|
ec9b3cfbb0 | |
|
ac9ad67f0a | |
|
361c42f8da | |
|
969a0e00fd | |
|
67f47c9cbb | |
|
83b6e60cde | |
|
eee7030a28 | |
|
8a314311f8 | |
|
6e907b3153 | |
|
26265a36cc | |
|
912beea1d9 | |
|
aec0c9bd95 | |
|
1a1024aa1e | |
|
c87767e029 | |
|
d8f4343958 | |
|
1ce0143220 | |
|
0e39b261b1 | |
|
e907d199c5 | |
|
08172ba9d9 | |
|
dce2272362 | |
|
67322057b2 | |
|
65cd9b678e | |
|
f21855d882 | |
|
8aacdfd1f3 | |
|
051c0480f5 | |
|
707f6cb30d | |
|
50668f7164 | |
|
3c9436be8e | |
|
0430dc5523 | |
|
6d09389f95 | |
|
7121f27bb0 | |
|
9e6887368c | |
|
d95ea3074d | |
|
3f84a73d93 | |
|
e0ab3c34b3 | |
|
4500c06e11 | |
|
8841efee5e | |
|
a1b897206e | |
|
94f62ddf7b | |
|
b3c24d080f | |
|
b16e1c9fe4 | |
|
605f14a0b5 | |
|
57f0a71399 | |
|
21f470824c | |
|
6a4e2dba98 | |
|
0c5ab9876b | |
|
bb4496b482 | |
|
90e472e4a1 | |
|
c63bdae8da | |
|
268d7eb42b | |
|
ca9f8c78e1 | |
|
3d43b1a7be | |
|
d409311bf2 | |
|
a6575c3e73 | |
|
b763f98e07 | |
|
f5ea6ce271 | |
|
ef7368263a | |
|
ed53ea644c | |
|
33073d0db2 | |
|
15d422d5bb | |
|
43032b1855 | |
|
2ecd53d815 | |
|
4da4fdc830 | |
|
996a6375c6 | |
|
87ea7ce106 | |
|
2ee8911dc4 | |
|
7e4c8f058c | |
|
bf8e071efd | |
|
e13d5e7006 | |
|
d60f5166b2 | |
|
b35896be52 | |
|
8ee8e99d99 | |
|
ebdf52f3f2 | |
|
9ea4187849 | |
|
f8338c55c2 | |
|
023c1d0532 | |
|
fbbc78d978 | |
|
f867643d8e | |
|
201595c665 | |
|
810e9e6a40 | |
|
a9aea45570 | |
|
3aaf0c6e52 | |
|
2a9f8f4c40 | |
|
395de4b333 | |
|
745a451e4c | |
|
f0afe6946f | |
|
a5fac6f056 | |
|
717725caf1 | |
|
e804ad65b6 | |
|
c1815e09e2 | |
|
c9fc8b2e0c | |
|
da54e75638 | |
|
cb58fbc5b0 | |
|
f2dcb21a77 | |
|
bac66ad291 | |
|
d83355ba1c | |
|
7f27b32245 | |
|
d6925d9141 | |
|
1faf6ced97 | |
|
fc5bee791d | |
|
65d8ef1b69 | |
|
1e31c0f47f | |
|
f3aa040df3 | |
|
c9342572aa | |
|
3c55b5b7b5 | |
|
97c4cdac48 | |
|
42844cffd2 | |
|
6278da6aec | |
|
c3d073b0cc | |
|
cbab4e51cd | |
|
5ae5514454 | |
|
e759029532 | |
|
c447875796 | |
|
d90ca240fc | |
|
5c0226d0db | |
|
52fe8e94e7 | |
|
e2a93d188a | |
|
674f4e351a | |
|
7ecaa2d2dc | |
|
98cd87f751 | |
|
e64d816d7d | |
|
3c5ab229b1 | |
|
7719e37c83 | |
|
6957c6c4ec | |
|
c2da436a8e | |
|
a77d94f7c6 | |
|
8e2dc274a3 | |
|
d325b5fff3 | |
|
bed5e85af9 | |
|
19cdc1233c | |
|
7883164137 | |
|
577b4b4748 | |
|
d799a7a5bd | |
|
334f0dcdb5 | |
|
a4c2106e63 | |
|
ad598ecbe4 | |
|
71853407a4 | |
|
45e5fe5462 | |
|
87a3541402 | |
|
3e89fdcec1 | |
|
3105791fbe | |
|
fec135a980 | |
|
15b7d4dcd4 | |
|
1495b020f5 | |
|
76fe802309 | |
|
d5edf49f6c | |
|
1a8678e493 | |
|
5b76d7dfe8 | |
|
23c05fca84 | |
|
0ae86b13f0 | |
|
0bbfb920d1 | |
|
5e1ab3ecf8 | |
|
e4f2ecd053 | |
|
cf9cba6142 | |
|
8754ccb7db | |
|
b292946de7 | |
|
567449875d | |
|
6c7225f3ba | |
|
db1c05eb09 | |
|
2af21a55f3 | |
|
b2e9d04cec | |
|
ade39e8baa | |
|
e6ac1a49ed | |
|
6e441a8d03 | |
|
1e37caadfc | |
|
27d608763b | |
|
99e8a060f6 | |
|
5bd37a9de1 | |
|
260966c070 | |
|
4c185fa2e6 | |
|
d335428458 | |
|
68ea1f43e2 | |
|
ae33e8797a | |
|
dfb10f9ac4 | |
|
fc9db761a9 | |
|
c8b5e05366 | |
|
c7d4566353 | |
|
dac9321e97 | |
|
0d9a8c1dcf | |
|
be40682090 | |
|
c3c7cc4d75 | |
|
cc44d785c9 | |
|
06ff52596d | |
|
f7c3b3a3d8 | |
|
213230c73b | |
|
74e4da5cc6 | |
|
e1f831a57b | |
|
77dca7a2a9 | |
|
8e0f0abdb0 | |
|
9f83845adc | |
|
e6f13e015c | |
|
5d8d5b513e | |
|
dfd8f0f7ea | |
|
2099f540d2 | |
|
7b74d51a6f | |
|
7b4509ec47 | |
|
3b0e4ac8ff | |
|
d3e16a43ea | |
|
6f5a955d8c | |
|
729a3f52cf | |
|
c1df94edb2 | |
|
f2c5facba6 | |
|
eccccd9e8c | |
|
d9c26724a5 | |
|
055282a140 | |
|
8d69e9fa7a | |
|
9948aea5a5 | |
|
443992bd04 | |
|
f4330f72c9 | |
|
83d9f1c8b9 | |
|
14f1d02c9a | |
|
d7d171776d | |
|
649412f1ea | |
|
a8c6c33daa | |
|
d0c2026887 | |
|
bcea4b40bf | |
|
f794b77934 | |
|
c3e9fbe538 | |
|
0edd1948ab | |
|
55b98529f8 | |
|
cb966dfcd6 | |
|
4d235c339b | |
|
400147c501 | |
|
74ddb3bd6f | |
|
07ee52acb0 | |
|
cf321a80b1 | |
|
4a3fefa2b3 | |
|
62e8ea97e6 | |
|
b873dce908 | |
|
bedb5055e8 | |
|
11a98b5f37 | |
|
74102fcc87 | |
|
0b79b7420a | |
|
b8f157ed21 | |
|
a4a676d378 | |
|
e0b900dd69 | |
|
cfa8072099 | |
|
210967ffa3 | |
|
6c2bc599e5 | |
|
0207979a4d | |
|
c10d973d38 | |
|
3f527fbdf9 | |
|
7e5f58b112 | |
|
9886ee2da7 | |
|
321b6603b0 | |
|
7c0511f2df | |
|
0ba7d70fb9 | |
|
1bc1cd573c | |
|
513a61a730 | |
|
429a66d1cb | |
|
9b61f4adc0 | |
|
a114b9f152 | |
|
5e2fa71713 | |
|
76717f88a6 | |
|
300a23698c | |
|
9c3291eeaa | |
|
a1fde62101 | |
|
1b753af868 | |
|
25557253c2 | |
|
5b44a4428f | |
|
b1c45a819f | |
|
322b165c85 | |
|
f70c322e57 | |
|
c2e72e833b | |
|
4d7a7fbca1 | |
|
7c9a5e7147 | |
|
24c258ad58 | |
|
f52d1429fb | |
|
666a374457 | |
|
3915f579f2 | |
|
2a7c9062b8 | |
|
9b68bceb74 | |
|
3cdaebdd0c | |
|
493f9bfa67 | |
|
c5d35fe22d | |
|
bda01f97f4 | |
|
7eb9f42af5 | |
|
5fe8afc4e7 | |
|
2116df0f01 | |
|
3f2217e220 | |
|
d46360df74 | |
|
6a88cf21f4 | |
|
674a6716d0 | |
|
8016d8758b | |
|
c53656d67b | |
|
234f7f0a0c | |
|
bc8f2ead26 | |
|
7a15a1cccb | |
|
87e1f79846 | |
|
f04db5b87a | |
|
2449abe398 | |
|
89a5cbbdf4 | |
|
3a16187451 | |
|
58b13ac6df | |
|
66f972cb87 | |
|
3b4f92ee62 | |
|
215078f49a | |
|
54df17727f | |
|
779e970099 | |
|
976567395e | |
|
4342f60671 | |
|
abac01a9cf | |
|
83743646cf | |
|
2003c8859c | |
|
f7d9baaf25 | |
|
220ee8b771 | |
|
0ebfe60bf2 | |
|
86debcd83b | |
|
71936fab74 | |
|
32c816c9d1 | |
|
47c54ec88f | |
|
5be024f060 | |
|
ddb8de2992 | |
|
524bb7d341 | |
|
afbdbdeec3 | |
|
ab02dc0be4 | |
|
fe74b60440 | |
|
6567f8d7cd | |
|
f68ceaa44e | |
|
a02622572a | |
|
506748b8a4 | |
|
8df1bd712f | |
|
57c1bd2ede | |
|
e570a99d6d | |
|
5c8b11b0be | |
|
c41c3dae7b | |
|
0b2281b028 | |
|
9e487e44ab | |
|
9974f7704d | |
|
4bff372df7 | |
|
036e0e1b7f | |
|
3a43cba3a3 | |
|
3096f22ba6 | |
|
71d8118cc7 | |
|
00e1ac46a8 | |
|
092d1e96e2 | |
|
266af4c19f | |
|
3ff8b674bb | |
|
e919aa7aa3 | |
|
49b7c6af34 | |
|
8d532f95db | |
|
613c9144d9 | |
|
9272aee975 | |
|
04ef12518d | |
|
d1f0d9f80d | |
|
354bd2d5c3 | |
|
91631ba11c | |
|
c8b5d3119b | |
|
fa26f4f70f | |
|
9ca8302725 | |
|
4daa6dc6b0 | |
|
7326035363 | |
|
a417e9bc3b | |
|
c679726246 | |
|
13a6e6d273 | |
|
eb6f1338ab | |
|
089a8a881e | |
|
ea5c18d232 | |
|
004a5063d2 | |
|
d7c27fb3aa | |
|
aa905bf289 | |
|
b2ad73a0f3 | |
|
b979cbd16c | |
|
4f8db6907e | |
|
1137102cc7 | |
|
7ae331bd93 | |
|
11e19fb450 | |
|
8f9bd7a9ee | |
|
4d288dec0a | |
|
08bcbfc677 | |
|
d28b9e8c37 |
|
@ -8,9 +8,9 @@ on:
|
|||
branches:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
|
||||
jobs:
|
||||
linux_build:
|
||||
name: Linux grpc-tools Build
|
||||
|
@ -23,7 +23,7 @@ jobs:
|
|||
run: |
|
||||
docker build -t kokoro-native-image tools/release/native
|
||||
docker run -v /var/run/docker.sock:/var/run/docker.sock -v $GITHUB_WORKSPACE:$GITHUB_WORKSPACE kokoro-native-image $GITHUB_WORKSPACE/packages/grpc-tools/build_binaries.sh
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: grpc-tools_linux
|
||||
path: artifacts/
|
||||
|
@ -36,7 +36,7 @@ jobs:
|
|||
submodules: recursive
|
||||
- name: Build
|
||||
run: packages/grpc-tools/build_binaries.sh
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: grpc-tools_macos
|
||||
path: artifacts/
|
||||
|
@ -55,7 +55,7 @@ jobs:
|
|||
- name: Build
|
||||
run: powershell -File ./packages/grpc-tools/build_binaries.ps1
|
||||
shell: cmd
|
||||
- uses: actions/upload-artifact@v1
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: grpc-tools_windows_${{matrix.arch}}
|
||||
path: artifacts/
|
||||
|
@ -64,12 +64,12 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
needs: [linux_build, macos_build, windows_build]
|
||||
steps:
|
||||
- uses: actions/download-artifact@v2
|
||||
- uses: actions/download-artifact@v4
|
||||
- name: Copy
|
||||
run: |
|
||||
mkdir artifacts
|
||||
cp -r ./**/* artifacts/
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: combined-artifacts
|
||||
path: artifacts/
|
||||
|
|
|
@ -8,17 +8,21 @@ See [CONTRIBUTING.md](https://github.com/grpc/grpc-community/blob/master/CONTRIB
|
|||
for general contribution guidelines.
|
||||
|
||||
## Maintainers (in alphabetical order)
|
||||
|
||||
- [jtattermusch](https://github.com/jtattermusch), Google Inc.
|
||||
|
||||
- [gnossen](https://github.com/gnossen), Google Inc.
|
||||
- [murgatroid99](https://github.com/murgatroid99), Google Inc.
|
||||
- [nicolasnoble](https://github.com/nicolasnoble), Google Inc.
|
||||
- [srini100](https://github.com/srini100), Google Inc.
|
||||
- [sergiitk](https://github.com/sergiitk), Google Inc.
|
||||
- [temawi](https://github.com/temawi), Google Inc.
|
||||
- [wenbozhu](https://github.com/wenbozhu), Google Inc.
|
||||
|
||||
## Emeritus Maintainers (in alphabetical order)
|
||||
- [jiangtaoli2016](https://github.com/jiangtaoli2016), Google Inc.
|
||||
- [kjin](https://github.com/kjin), Google Inc.
|
||||
- [matt-kwong](https://github.com/matt-kwong), Google Inc.
|
||||
- [ofrobots](https://github.com/ofrobots), Google Inc.
|
||||
- [WeiranFang](https://github.com/WeiranFang), Google Inc.
|
||||
- [jiangtaoli2016](https://github.com/jiangtaoli2016)
|
||||
- [jtattermusch](https://github.com/jtattermusch)
|
||||
- [kjin](https://github.com/kjin)
|
||||
- [matt-kwong](https://github.com/matt-kwong)
|
||||
- [nicolasnoble](https://github.com/nicolasnoble)
|
||||
- [nimf](https://github.com/nimf)
|
||||
- [ofrobots](https://github.com/ofrobots)
|
||||
- [srini100](https://github.com/srini100)
|
||||
- [WeiranFang](https://github.com/WeiranFang)
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
[](https://travis-ci.org/grpc/grpc-node)
|
||||
# gRPC on Node.js
|
||||
|
||||
## Implementations
|
||||
|
@ -46,3 +45,11 @@ Directory: [`packages/grpc-health-check`](https://github.com/grpc/grpc-node/tree
|
|||
npm package: [grpc-health-check](https://www.npmjs.com/package/grpc-health-check)
|
||||
|
||||
Health check service for gRPC servers.
|
||||
|
||||
### gRPC Reflection API Service
|
||||
|
||||
Directory: [`packages/grpc-reflection`](https://github.com/grpc/grpc-node/tree/master/packages/grpc-reflection)
|
||||
|
||||
npm package: [@grpc/reflection](https://www.npmjs.com/package/@grpc/reflection)
|
||||
|
||||
Reflection API service for gRPC servers.
|
||||
|
|
|
@ -11,8 +11,10 @@ can be set.
|
|||
checked in order, and the first one that has a value is used.
|
||||
|
||||
* no_grpc_proxy, no_proxy
|
||||
A comma separated list of hostnames to connect to without using a proxy even
|
||||
if a proxy is set. These variables are checked in order, and the first one
|
||||
A comma separated list of hostnames, IP addresses,
|
||||
or CIDR blocks to connect to without using a proxy even
|
||||
if a proxy is set, for example: no_proxy=example.com,192.168.0.1,192.168.0.0/16.
|
||||
These variables are checked in order, and the first one
|
||||
that has a value is used.
|
||||
|
||||
* GRPC_SSL_CIPHER_SUITES
|
||||
|
@ -62,3 +64,8 @@ can be set.
|
|||
- INFO - log INFO and ERROR message
|
||||
- ERROR - log only errors (default)
|
||||
- NONE - won't log any
|
||||
|
||||
* GRPC_NODE_USE_ALTERNATIVE_RESOLVER
|
||||
Allows changing dns resolve behavior and parse DNS server authority as described in https://github.com/grpc/grpc/blob/master/doc/naming.md
|
||||
- true - use alternative resolver
|
||||
- false - use default resolver (default)
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Cancellation
|
||||
|
||||
This example shows how clients can cancel in-flight RPCs by cancelling the
|
||||
call object returned by the method invocation. The client will receive a status
|
||||
with code `CANCELLED` and the server handler's call object will emit either a
|
||||
`'cancelled'` event or an `'end'` event.
|
||||
|
||||
## Start the server
|
||||
|
||||
```
|
||||
node server.js
|
||||
```
|
||||
|
||||
## Run the client
|
||||
|
||||
```
|
||||
node client.js
|
||||
```
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2023 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const echoProto = grpc.loadPackageDefinition(packageDefinition).grpc.examples.echo;
|
||||
|
||||
function main() {
|
||||
let argv = parseArgs(process.argv.slice(2), {
|
||||
string: 'target',
|
||||
default: {target: 'localhost:50052'}
|
||||
});
|
||||
const client = new echoProto.Echo(argv.target, grpc.credentials.createInsecure());
|
||||
const call = client.bidirectionalStreamingEcho();
|
||||
const EXPECTED_MESSAGES = 2;
|
||||
let receivedMessages = 0;
|
||||
call.on('data', value => {
|
||||
console.log(`received message "${value.message}"`)
|
||||
receivedMessages += 1;
|
||||
if (receivedMessages >= EXPECTED_MESSAGES) {
|
||||
console.log('cancelling call');
|
||||
call.cancel();
|
||||
}
|
||||
});
|
||||
call.on('status', statusObject => {
|
||||
console.log(`received call status with code ${grpc.status[statusObject.code]}`);
|
||||
});
|
||||
call.on('error', error => {
|
||||
console.log(`received error ${error}`);
|
||||
})
|
||||
console.log('sending message "hello"');
|
||||
call.write({message: 'hello'});
|
||||
console.log('sending message "world"')
|
||||
call.write({message: 'world'});
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2023 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const echoProto = grpc.loadPackageDefinition(packageDefinition).grpc.examples.echo;
|
||||
|
||||
function bidirectionalStreamingEcho(call) {
|
||||
call.on('data', value => {
|
||||
const message = value.message;
|
||||
console.log(`echoing message "${message}"`);
|
||||
call.write({message: message});
|
||||
});
|
||||
// Either 'end' or 'cancelled' will be emitted when the call is cancelled
|
||||
call.on('end', () => {
|
||||
console.log('server received end event')
|
||||
call.end();
|
||||
});
|
||||
call.on('cancelled', () => {
|
||||
console.log('server received cancelled event');
|
||||
});
|
||||
}
|
||||
|
||||
const serviceImplementation = {
|
||||
bidirectionalStreamingEcho
|
||||
}
|
||||
|
||||
function main() {
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
string: 'port',
|
||||
default: {port: '50052'}
|
||||
});
|
||||
const server = new grpc.Server();
|
||||
server.addService(echoProto.Echo.service, serviceImplementation);
|
||||
server.bindAsync(`0.0.0.0:${argv.port}`, grpc.ServerCredentials.createInsecure(), () => {
|
||||
server.start();
|
||||
});
|
||||
client = new echoProto.Echo(`localhost:${argv.port}`, grpc.credentials.createInsecure());
|
||||
}
|
||||
|
||||
main();
|
|
@ -100,8 +100,11 @@ function main() {
|
|||
});
|
||||
const server = new grpc.Server();
|
||||
server.addService(echoProto.Echo.service, serviceImplementation);
|
||||
server.bindAsync(`0.0.0.0:${argv.port}`, grpc.ServerCredentials.createInsecure(), () => {
|
||||
server.start();
|
||||
server.bindAsync(`0.0.0.0:${argv.port}`, grpc.ServerCredentials.createInsecure(), (err, port) => {
|
||||
if (err != null) {
|
||||
return console.error(err);
|
||||
}
|
||||
console.log(`gRPC listening on ${port}`)
|
||||
});
|
||||
client = new echoProto.Echo(`localhost:${argv.port}`, grpc.credentials.createInsecure());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# Debugging
|
||||
|
||||
Currently, grpc provides two major tools to help user debug issues, which are logging and channelz.
|
||||
|
||||
## Logs
|
||||
|
||||
gRPC has put substantial logging instruments on critical paths of gRPC to help users debug issues. The [Environment Variables](https://github.com/grpc/grpc-node/blob/master/doc/environment_variables.md) doc describes the environment variables that control debug logging.
|
||||
|
||||
To enable full debug logging, run the code with the following environment variables: `GRPC_TRACE=all GRPC_VERBOSITY=DEBUG`.
|
||||
|
||||
## Channelz
|
||||
|
||||
We also provide a runtime debugging tool, Channelz, to help users with live debugging.
|
||||
|
||||
See the channelz blog post here ([link](https://grpc.io/blog/a-short-introduction-to-channelz/)) for details about how to use channelz service to debug live program.
|
||||
|
||||
## Try it
|
||||
|
||||
The example is able to showcase how logging and channelz can help with debugging. See the channelz blog post linked above for full explanation.
|
||||
|
||||
```
|
||||
node server.js
|
||||
```
|
||||
|
||||
```
|
||||
node client.js
|
||||
```
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2025 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
|
||||
var PROTO_PATH = __dirname + '/../protos/helloworld.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
var helloProto = grpc.loadPackageDefinition(packageDefinition).helloworld;
|
||||
|
||||
function serverBindPort(server, port) {
|
||||
return new Promise((resolve, reject) => {
|
||||
server.bindAsync(port, grpc.ServerCredentials.createInsecure(), (error, port) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(port);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
const addressString = 'ipv4:///127.0.0.1:10001,127.0.0.1:10002,127.0.0.1:10003';
|
||||
|
||||
function callSayHello(client, name) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const deadline = new Date();
|
||||
deadline.setMilliseconds(deadline.getMilliseconds() + 150);
|
||||
client.sayHello({name}, {deadline}, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
string: ['addr', 'name'],
|
||||
default: {addr: 'localhost:50051', name: 'world'}
|
||||
});
|
||||
|
||||
// Set up the server serving channelz service.
|
||||
const channelzServer = new grpc.Server();
|
||||
grpc.addAdminServicesToServer(channelzServer);
|
||||
await serverBindPort(channelzServer, argv.addr);
|
||||
|
||||
const roundRobinServiceConfig = {
|
||||
methodConfig: [],
|
||||
loadBalancingConfig: [{ round_robin: {} }]
|
||||
};
|
||||
const client = new helloProto.Greeter(addressString, grpc.credentials.createInsecure(), {'grpc.service_config': JSON.stringify(roundRobinServiceConfig)});
|
||||
|
||||
// Contact the server and print out its response
|
||||
|
||||
// Make 100 SayHello RPCs
|
||||
for (let i = 0; i < 100; i++) {
|
||||
try {
|
||||
const response = await callSayHello(client, argv.name);
|
||||
console.log(`Greeting: ${response.message}`);
|
||||
} catch (e) {
|
||||
console.log(`could not greet: ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Unless you exit the program (e.g. CTRL+C), channelz data will be available for querying.
|
||||
// Users can take time to examine and learn about the info provided by channelz.
|
||||
setInterval(() => {}, 10000);
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2025 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
|
||||
var PROTO_PATH = __dirname + '/../protos/helloworld.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
var helloProto = grpc.loadPackageDefinition(packageDefinition).helloworld;
|
||||
|
||||
const greeterImplementation = {
|
||||
sayHello: (call, callback) => {
|
||||
callback(null, { message: `Hello ${call.request.name}`});
|
||||
}
|
||||
};
|
||||
|
||||
const slowGreeterImplementation = {
|
||||
sayHello: (call, callback) => {
|
||||
const waitTimeMs = 100 + (Math.random() * 100)|0;
|
||||
setTimeout(() => {
|
||||
callback(null, { message: `Hello ${call.request.name}`});
|
||||
}, waitTimeMs);
|
||||
}
|
||||
}
|
||||
|
||||
function serverBindPort(server, port) {
|
||||
return new Promise((resolve, reject) => {
|
||||
server.bindAsync(`0.0.0.0:${port}`, grpc.ServerCredentials.createInsecure(), (error, port) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(port);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const channelzServer = new grpc.Server();
|
||||
grpc.addAdminServicesToServer(channelzServer);
|
||||
await serverBindPort(channelzServer, 50052);
|
||||
|
||||
const server1 = new grpc.Server();
|
||||
server1.addService(helloProto.Greeter.service, greeterImplementation);
|
||||
await serverBindPort(server1, 10001);
|
||||
|
||||
const server2 = new grpc.Server();
|
||||
server2.addService(helloProto.Greeter.service, greeterImplementation);
|
||||
await serverBindPort(server2, 10002);
|
||||
|
||||
const server3 = new grpc.Server();
|
||||
server3.addService(helloProto.Greeter.service, slowGreeterImplementation);
|
||||
await serverBindPort(server3, 10003);
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,23 @@
|
|||
# Error Handling
|
||||
|
||||
This example demonstrates basic RPC error handling in gRPC for unary and
|
||||
streaming response cardinalities.
|
||||
|
||||
## Start the server
|
||||
|
||||
Run the server, whcih returns an error if the RPC request's `name` field is
|
||||
empty.
|
||||
|
||||
```
|
||||
node server.js
|
||||
```
|
||||
|
||||
## Run the client
|
||||
|
||||
Then run the client in another terminal, which makes two requests for each of
|
||||
unary and streaming responses: one with an empty Name field and one with it
|
||||
populated with the current username provided by os/user.
|
||||
|
||||
```
|
||||
node client.js
|
||||
```
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2023 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
const os = require('os');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/helloworld.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const helloProto = grpc.loadPackageDefinition(packageDefinition).helloworld;
|
||||
|
||||
function unaryCall(client, requestId, name, expectedCode) {
|
||||
console.log(`[${requestId}] Calling SayHello with name:"${name}"`);
|
||||
return new Promise((resolve, reject) => {
|
||||
client.sayHello({name: name}, (error, value) => {
|
||||
if (error) {
|
||||
if (error.code === expectedCode) {
|
||||
console.log(`[${requestId}] Received error ${error.message}`);
|
||||
} else {
|
||||
console.log(`[${requestId}] Received unexpected error ${error.message}`);
|
||||
}
|
||||
}
|
||||
if (value) {
|
||||
console.log(`[${requestId}] Received response ${value.message}`);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function streamingCall(client, requestId, name, expectedCode) {
|
||||
console.log(`[${requestId}] Calling SayHelloStreamReply with name:"${name}"`);
|
||||
return new Promise((resolve, reject) => {
|
||||
const call = client.sayHelloStreamReply({name: name});
|
||||
call.on('data', value => {
|
||||
console.log(`[${requestId}] Received response ${value.message}`);
|
||||
});
|
||||
call.on('status', status => {
|
||||
console.log(`[${requestId}] Received status with code=${grpc.status[status.code]} details=${status.details}`);
|
||||
resolve();
|
||||
});
|
||||
call.on('error', error => {
|
||||
if (error.code === expectedCode) {
|
||||
console.log(`[${requestId}] Received expected error ${error.message}`);
|
||||
} else {
|
||||
console.log(`[${requestId}] Received unexpected error ${error.message}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
let argv = parseArgs(process.argv.slice(2), {
|
||||
string: 'target',
|
||||
default: {target: 'localhost:50052'}
|
||||
});
|
||||
const client = new helloProto.Greeter(argv.target, grpc.credentials.createInsecure());
|
||||
const name = os.userInfo().username ?? 'unknown';
|
||||
await unaryCall(client, 1, '', grpc.status.INVALID_ARGUMENT);
|
||||
await unaryCall(client, 2, name, grpc.status.OK);
|
||||
await streamingCall(client, 3, '', grpc.status.INVALID_ARGUMENT);
|
||||
await streamingCall(client, 4, name, grpc.status.OK);
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2023 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.
|
||||
*
|
||||
*/
|
||||
|
||||
var PROTO_PATH = __dirname + '/../protos/helloworld.proto';
|
||||
|
||||
var grpc = require('@grpc/grpc-js');
|
||||
var protoLoader = require('@grpc/proto-loader');
|
||||
var packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
var hello_proto = grpc.loadPackageDefinition(packageDefinition).helloworld;
|
||||
|
||||
/**
|
||||
* Implements the SayHello RPC method.
|
||||
*/
|
||||
function sayHello(call, callback) {
|
||||
if (call.request.name === '') {
|
||||
callback({code: grpc.status.INVALID_ARGUMENT, details: 'request missing required field: name'});
|
||||
}
|
||||
callback(null, {message: 'Hello ' + call.request.name});
|
||||
}
|
||||
|
||||
const REPLY_COUNT = 5;
|
||||
|
||||
function sayHelloStreamReply(call) {
|
||||
if (call.request.name === '') {
|
||||
call.emit('error', {code: grpc.status.INVALID_ARGUMENT, details: 'request missing required field: name'});
|
||||
} else {
|
||||
for (let i = 0; i < REPLY_COUNT; i++) {
|
||||
call.write({message: 'Hello ' + call.request.name});
|
||||
}
|
||||
call.end();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts an RPC server that receives requests for the Greeter service at the
|
||||
* sample server port
|
||||
*/
|
||||
function main() {
|
||||
var server = new grpc.Server();
|
||||
server.addService(hello_proto.Greeter.service, {sayHello: sayHello, sayHelloStreamReply: sayHelloStreamReply});
|
||||
server.bindAsync('0.0.0.0:50052', grpc.ServerCredentials.createInsecure(), () => {
|
||||
server.start();
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
|
@ -44,8 +44,11 @@ function sayHello(call, callback) {
|
|||
function main() {
|
||||
var server = new grpc.Server();
|
||||
server.addService(hello_proto.Greeter.service, {sayHello: sayHello});
|
||||
server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => {
|
||||
server.start();
|
||||
server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), (err, port) => {
|
||||
if (err != null) {
|
||||
return console.error(err);
|
||||
}
|
||||
console.log(`gRPC listening on ${port}`)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,11 @@ function sayHello(call, callback) {
|
|||
function main() {
|
||||
var server = new grpc.Server();
|
||||
server.addService(services.GreeterService, {sayHello: sayHello});
|
||||
server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => {
|
||||
server.start();
|
||||
server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), (err, port) => {
|
||||
if (err != null) {
|
||||
return console.error(err);
|
||||
}
|
||||
console.log(`gRPC listening on ${port}`)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
# Interceptor
|
||||
|
||||
Node gRPC provides simple APIs to implement and install interceptors on clients
|
||||
and servers. An interceptor intercepts the execution of each incoming/outgoing
|
||||
RPC call on the client or server where it is installed. Users can use
|
||||
interceptors to do logging, authentication/authorization, metrics collection,
|
||||
and many other functions that can be shared across RPCs.
|
||||
|
||||
## Run the server
|
||||
|
||||
```
|
||||
node server.js
|
||||
```
|
||||
|
||||
## Run the client
|
||||
|
||||
```
|
||||
node client.js
|
||||
```
|
||||
|
||||
# Explanation
|
||||
|
||||
In Node gRPC, clients and servers each have their own types of interceptors.
|
||||
|
||||
## Client
|
||||
|
||||
Node gRPC client interceptors are formally specified in [gRFC L5](https://github.com/grpc/proposal/blob/master/L5-node-client-interceptors.md).
|
||||
An interceptor is a function that can wrap a call object with an
|
||||
`InterceptingCall`, with intercepting functions for individual call operations.
|
||||
To illustrate, the following is a trivial interceptor with all interception
|
||||
methods:
|
||||
|
||||
```js
|
||||
const interceptor = function(options, nextCall) {
|
||||
const requester = {
|
||||
start: function(metadata, listener, next) {
|
||||
const listener = {
|
||||
onReceiveMetadata: function(metadata, next) {
|
||||
next(metadata);
|
||||
},
|
||||
onReceiveMessage: function(message, next) {
|
||||
next(message);
|
||||
},
|
||||
onReceiveStatus: function(status, next) {
|
||||
next(status);
|
||||
}
|
||||
};
|
||||
next(metadata, listener);
|
||||
},
|
||||
sendMessage: function(message, next) {
|
||||
next(messasge);
|
||||
},
|
||||
halfClose: function(next) {
|
||||
next();
|
||||
},
|
||||
cancel: function(message, next) {
|
||||
next();
|
||||
}
|
||||
};
|
||||
return new InterceptingCall(nextCall(options), requester);
|
||||
};
|
||||
```
|
||||
|
||||
The requester intercepts outgoing operations, and the listener intercepts
|
||||
incoming operations. Each intercepting method can read or modify the data for
|
||||
that operation before passing it along to the `next` callback.
|
||||
|
||||
The `RequesterBuilder` and `ListenerBuilder` utility classes provide an
|
||||
alternative way to construct requester and listener objects
|
||||
|
||||
## Server
|
||||
|
||||
Node gRPC server interceptors are formally specified in [gRFC L112](https://github.com/grpc/proposal/blob/master/L112-node-server-interceptors.md).
|
||||
Similar to client interceptors, a server interceptor is a function that can
|
||||
wrap a call object with a `ServerInterceptingCall`, with intercepting functions
|
||||
for individual call operations. Server intercepting functions broadly mirror
|
||||
the client intercepting functions, with sending and receiving switched. To
|
||||
illustrate, the following is a trivial server interceptor with all interception
|
||||
methods:
|
||||
|
||||
```js
|
||||
const interceptor = function(methodDescriptor, call) {
|
||||
const responder = {
|
||||
start: function(next) {
|
||||
const listener = {
|
||||
onReceiveMetadata: function(metadata, next) {
|
||||
next(metadata);
|
||||
},
|
||||
onReceiveMessage: function(message, next) {
|
||||
next(message);
|
||||
},
|
||||
onReceiveHalfClose: function(next) {
|
||||
next();
|
||||
},
|
||||
onCancel: function() {
|
||||
}
|
||||
};
|
||||
next(listener);
|
||||
},
|
||||
sendMetadata: function(metadata, next) {
|
||||
next(metadata);
|
||||
},
|
||||
sendMessage: function(message, next) {
|
||||
next(message);
|
||||
},
|
||||
sendStatus: function(status, next) {
|
||||
next(status);
|
||||
}
|
||||
};
|
||||
return new ServerInterceptingCall(call, responder);
|
||||
}
|
||||
```
|
||||
|
||||
As with client interceptors, the responder intercepts outgoing operations and
|
||||
the listener intercepts incoming operations. Each intercepting method can read
|
||||
or modify the data for that operation before passing it along to the `next`
|
||||
callback.
|
||||
|
||||
The `ResponderBuilder` and `ServerListenerBuilder` utility classes provide an
|
||||
alternative way to build responder and server listener objects.
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2024 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const echoProto = grpc.loadPackageDefinition(packageDefinition).grpc.examples.echo;
|
||||
|
||||
function authInterceptor(options, nextCall) {
|
||||
const requester = (new grpc.RequesterBuilder())
|
||||
.withStart((metadata, listener, next) => {
|
||||
metadata.set('authorization', 'some-secret-token');
|
||||
next(metadata, listener);
|
||||
}).build();
|
||||
return new grpc.InterceptingCall(nextCall(options), requester);
|
||||
}
|
||||
|
||||
// logger is to mock a sophisticated logging system. To simplify the example, we just print out the content.
|
||||
function logger(format, ...args) {
|
||||
console.log(`LOG (client):\t${format}\n`, ...args);
|
||||
}
|
||||
|
||||
function loggingInterceptor(options, nextCall) {
|
||||
const listener = (new grpc.ListenerBuilder())
|
||||
.withOnReceiveMessage((message, next) => {
|
||||
logger(`Receive a message ${JSON.stringify(message)} at ${(new Date()).toISOString()}`);
|
||||
next(message);
|
||||
}).build();
|
||||
const requester = (new grpc.RequesterBuilder())
|
||||
.withSendMessage((message, next) => {
|
||||
logger(`Send a message ${JSON.stringify(message)} at ${(new Date()).toISOString()}`);
|
||||
next(message);
|
||||
}).build();
|
||||
return new grpc.InterceptingCall(nextCall(options), requester);
|
||||
}
|
||||
|
||||
function callUnaryEcho(client, message) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const deadline = new Date();
|
||||
deadline.setSeconds(deadline.getSeconds() + 10);
|
||||
client.unaryEcho({message: message}, {deadline}, (error, value) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
console.log(`UnaryEcho: ${JSON.stringify(value)}`);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function callBidiStreamingEcho(client) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const deadline = new Date();
|
||||
deadline.setSeconds(deadline.getSeconds() + 10);
|
||||
const call = client.bidirectionalStreamingEcho({deadline});
|
||||
call.on('data', value => {
|
||||
console.log(`BidiStreamingEcho: ${JSON.stringify(value)}`);
|
||||
});
|
||||
call.on('status', status => {
|
||||
if (status.code === grpc.status.OK) {
|
||||
resolve();
|
||||
} else {
|
||||
reject(status);
|
||||
}
|
||||
});
|
||||
call.on('error', () => {
|
||||
// Ignore error event
|
||||
});
|
||||
for (let i = 0; i < 5; i++) {
|
||||
call.write({message: `Request ${i + 1}`});
|
||||
}
|
||||
call.end();
|
||||
});
|
||||
}
|
||||
|
||||
async function main() {
|
||||
let argv = parseArgs(process.argv.slice(2), {
|
||||
string: 'target',
|
||||
default: {target: 'localhost:50051'}
|
||||
});
|
||||
const client = new echoProto.Echo(argv.target, grpc.credentials.createInsecure(), {interceptors: [authInterceptor, loggingInterceptor]});
|
||||
await callUnaryEcho(client, 'hello world');
|
||||
await callBidiStreamingEcho(client);
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2024 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const echoProto = grpc.loadPackageDefinition(packageDefinition).grpc.examples.echo;
|
||||
|
||||
function unaryEcho(call, callback) {
|
||||
console.log(`unary echoing message ${call.request.message}`);
|
||||
callback(null, call.request);
|
||||
}
|
||||
|
||||
function bidirectionalStreamingEcho(call) {
|
||||
call.on('data', request => {
|
||||
console.log(`bidi echoing message ${request.message}`);
|
||||
call.write(request);
|
||||
});
|
||||
call.on('end', () => {
|
||||
call.end();
|
||||
});
|
||||
}
|
||||
|
||||
const serviceImplementation = {
|
||||
unaryEcho,
|
||||
bidirectionalStreamingEcho
|
||||
}
|
||||
|
||||
function validateAuthorizationMetadata(metadata) {
|
||||
const authorization = metadata.get('authorization');
|
||||
if (authorization.length < 1) {
|
||||
return false;
|
||||
}
|
||||
return authorization[0] === 'some-secret-token';
|
||||
}
|
||||
|
||||
function authInterceptor(methodDescriptor, call) {
|
||||
const listener = (new grpc.ServerListenerBuilder())
|
||||
.withOnReceiveMetadata((metadata, next) => {
|
||||
if (validateAuthorizationMetadata(metadata)) {
|
||||
next(metadata);
|
||||
} else {
|
||||
call.sendStatus({
|
||||
code: grpc.status.UNAUTHENTICATED,
|
||||
details: 'Auth metadata not correct'
|
||||
});
|
||||
}
|
||||
}).build();
|
||||
const responder = (new grpc.ResponderBuilder())
|
||||
.withStart(next => {
|
||||
next(listener);
|
||||
}).build();
|
||||
return new grpc.ServerInterceptingCall(call, responder);
|
||||
}
|
||||
|
||||
// logger is to mock a sophisticated logging system. To simplify the example, we just print out the content.
|
||||
function logger(format, ...args) {
|
||||
console.log(`LOG (server):\t${format}\n`, ...args);
|
||||
}
|
||||
|
||||
function loggingInterceptor(methodDescriptor, call) {
|
||||
const listener = new grpc.ServerListenerBuilder()
|
||||
.withOnReceiveMessage((message, next) => {
|
||||
logger(`Receive a message ${JSON.stringify(message)} at ${(new Date()).toISOString()}`);
|
||||
next(message);
|
||||
}).build();
|
||||
const responder = new grpc.ResponderBuilder()
|
||||
.withStart(next => {
|
||||
next(listener);
|
||||
})
|
||||
.withSendMessage((message, next) => {
|
||||
logger(`Send a message ${JSON.stringify(message)} at ${(new Date()).toISOString()}`);
|
||||
next(message);
|
||||
}).build();
|
||||
return new grpc.ServerInterceptingCall(call, responder);
|
||||
}
|
||||
|
||||
function main() {
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
string: 'port',
|
||||
default: {port: '50051'}
|
||||
});
|
||||
const server = new grpc.Server({interceptors: [authInterceptor, loggingInterceptor]});
|
||||
server.addService(echoProto.Echo.service, serviceImplementation);
|
||||
server.bindAsync(`0.0.0.0:${argv.port}`, grpc.ServerCredentials.createInsecure(), (err, port) => {
|
||||
if (err != null) {
|
||||
return console.error(err);
|
||||
}
|
||||
console.log(`gRPC listening on ${port}`)
|
||||
});
|
||||
client = new echoProto.Echo(`localhost:${argv.port}`, grpc.credentials.createInsecure());
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,16 @@
|
|||
# Keepalive
|
||||
|
||||
This example illustrates how to set up client-side keepalive pings and
|
||||
server-side keepalive pings and connection age and idleness settings.
|
||||
|
||||
## Start the server
|
||||
|
||||
```
|
||||
node server.js
|
||||
```
|
||||
|
||||
## Start the client
|
||||
|
||||
```
|
||||
GRPC_TRACE=transport,keepalive GRPC_VERBOSITY=DEBUG node client.js
|
||||
```
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2024 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const echoProto = grpc.loadPackageDefinition(packageDefinition).grpc.examples.echo;
|
||||
|
||||
const keepaliveOptions = {
|
||||
// Ping the server every 10 seconds to ensure the connection is still active
|
||||
'grpc.keepalive_time_ms': 10_000,
|
||||
// Wait 1 second for the ping ack before assuming the connection is dead
|
||||
'grpc.keepalive_timeout_ms': 1_000,
|
||||
// send pings even without active streams
|
||||
'grpc.keepalive_permit_without_calls': 1
|
||||
}
|
||||
|
||||
function main() {
|
||||
let argv = parseArgs(process.argv.slice(2), {
|
||||
string: 'target',
|
||||
default: {target: 'localhost:50052'}
|
||||
});
|
||||
const client = new echoProto.Echo(argv.target, grpc.credentials.createInsecure(), keepaliveOptions);
|
||||
client.unaryEcho({message: 'keepalive demo'}, (error, value) => {
|
||||
if (error) {
|
||||
console.log(`Unexpected error from UnaryEcho: ${error}`);
|
||||
return;
|
||||
}
|
||||
console.log(`RPC response: ${JSON.stringify(value)}`);
|
||||
});
|
||||
// Keep process alive forever; run with GRPC_TRACE=transport,keepalive GRPC_VERBOSITY=DEBUG to observe ping frames and GOAWAYs due to idleness.
|
||||
setInterval(() => {}, 1000);
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2024 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const echoProto = grpc.loadPackageDefinition(packageDefinition).grpc.examples.echo;
|
||||
|
||||
const keepaliveOptions = {
|
||||
// If a client is idle for 15 seconds, send a GOAWAY
|
||||
'grpc.max_connection_idle_ms': 15_000,
|
||||
// If any connection is alive for more than 30 seconds, send a GOAWAY
|
||||
'grpc.max_connection_age_ms': 30_000,
|
||||
// Allow 5 seconds for pending RPCs to complete before forcibly closing connections
|
||||
'grpc.max_connection_age_grace_ms': 5_000,
|
||||
// Ping the client every 5 seconds to ensure the connection is still active
|
||||
'grpc.keepalive_time_ms': 5_000,
|
||||
// Wait 1 second for the ping ack before assuming the connection is dead
|
||||
'grpc.keepalive_timeout_ms': 1_000
|
||||
}
|
||||
|
||||
function unaryEcho(call, callback) {
|
||||
callback(null, call.request);
|
||||
}
|
||||
|
||||
const serviceImplementation = {
|
||||
unaryEcho
|
||||
};
|
||||
|
||||
function main() {
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
string: 'port',
|
||||
default: {port: '50052'}
|
||||
});
|
||||
const server = new grpc.Server(keepaliveOptions);
|
||||
server.addService(echoProto.Echo.service, serviceImplementation);
|
||||
server.bindAsync(`0.0.0.0:${argv.port}`, grpc.ServerCredentials.createInsecure(), (err, port) => {
|
||||
if (err != null) {
|
||||
return console.error(err);
|
||||
}
|
||||
console.log(`gRPC listening on ${port}`)
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,57 @@
|
|||
# Load balancing
|
||||
|
||||
This examples shows how `Client` can pick different load balancing policies.
|
||||
|
||||
## Try it
|
||||
|
||||
```
|
||||
node server.js
|
||||
```
|
||||
|
||||
```
|
||||
node client.js
|
||||
```
|
||||
|
||||
## Explanation
|
||||
|
||||
Two echo servers are serving on "0.0.0.0:50051" and "0.0.0.0:50052". They will include their serving address in the response. So the server on "0.0.0.0:50051" will reply to the RPC with this is examples/load_balancing (from 0.0.0.0:50051).
|
||||
|
||||
Two clients are created, to connect to both of these servers. Each client picks a different load balancer (using the `grpc.service_config` option): `pick_first` or `round_robin`.
|
||||
|
||||
Note that balancers can also be switched using service config, which allows service owners (instead of client owners) to pick the balancer to use. Service config doc is available at https://github.com/grpc/grpc/blob/master/doc/service_config.md.
|
||||
|
||||
### pick_first
|
||||
|
||||
The first client is configured to use `pick_first`. `pick_first` tries to connect to the first address, uses it for all RPCs if it connects, or try the next address if it fails (and keep doing that until one connection is successful). Because of this, all the RPCs will be sent to the same backend. The responses received all show the same backend address.
|
||||
|
||||
```
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
```
|
||||
|
||||
### round_robin
|
||||
|
||||
The second client is configured to use `round_robin`. `round_robin` connects to all the addresses it sees, and sends an RPC to each backend one at a time in order. E.g. the first RPC will be sent to backend-1, the second RPC will be sent to backend-2, and the third RPC will be sent to backend-1 again.
|
||||
|
||||
```
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50052)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50052)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50052)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
this is examples/load_balancing (from 0.0.0.0:50052)
|
||||
this is examples/load_balancing (from 0.0.0.0:50051)
|
||||
```
|
||||
|
||||
Note that it's possible to see two consecutive RPC sent to the same backend. That's because `round_robin` only picks the connections ready for RPCs. So if one of the two connections is not ready for some reason, all RPCs will be sent to the ready connection.
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2025 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const echoProto = grpc.loadPackageDefinition(packageDefinition).grpc.examples.echo;
|
||||
|
||||
const addressString = 'ipv4:///127.0.0.1:50051,127.0.0.1:50052';
|
||||
|
||||
function callUnaryEcho(client, message) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const deadline = new Date();
|
||||
deadline.setSeconds(deadline.getSeconds() + 1);
|
||||
client.unaryEcho({message}, {deadline}, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
console.log(response.message);
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function makeRPCs(client, count) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
await callUnaryEcho(client, "this is examples/load_balancing");
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
// "pick_first" is the default, so there's no need to set the load balancing policy.
|
||||
const pickFirstClient = new echoProto.Echo(addressString, grpc.credentials.createInsecure());
|
||||
console.log("--- calling helloworld.Greeter/SayHello with pick_first ---");
|
||||
await makeRPCs(pickFirstClient, 10);
|
||||
console.log();
|
||||
|
||||
const roundRobinServiceConfig = {
|
||||
methodConfig: [],
|
||||
loadBalancingConfig: [{ round_robin: {} }]
|
||||
};
|
||||
const roundRobinClient = new echoProto.Echo(addressString, grpc.credentials.createInsecure(), {'grpc.service_config': JSON.stringify(roundRobinServiceConfig)});
|
||||
console.log("--- calling helloworld.Greeter/SayHello with round_robin ---");
|
||||
await makeRPCs(roundRobinClient, 10);
|
||||
pickFirstClient.close();
|
||||
roundRobinClient.close();
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2025 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const echoProto = grpc.loadPackageDefinition(packageDefinition).grpc.examples.echo;
|
||||
|
||||
function startServer(address) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const server = new grpc.Server();
|
||||
server.addService(echoProto.Echo.service, {
|
||||
unaryEcho: (call, callback) => {
|
||||
callback(null, {message: `${call.request.message} (from ${address})`});
|
||||
}
|
||||
});
|
||||
server.bindAsync(address, grpc.ServerCredentials.createInsecure(), (error, port) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(server);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const addresses = ['0.0.0.0:50051', '0.0.0.0:50052'];
|
||||
|
||||
async function main() {
|
||||
for (const address of addresses) {
|
||||
await startServer(address)
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
|
@ -148,8 +149,11 @@ function main() {
|
|||
});
|
||||
const server = new grpc.Server();
|
||||
server.addService(echoProto.Echo.service, serviceImplementation);
|
||||
server.bindAsync(`0.0.0.0:${argv.port}`, grpc.ServerCredentials.createInsecure(), () => {
|
||||
server.start();
|
||||
server.bindAsync(`0.0.0.0:${argv.port}`, grpc.ServerCredentials.createInsecure(), (err, port) => {
|
||||
if (err != null) {
|
||||
return console.error(err);
|
||||
}
|
||||
console.log(`gRPC listening on ${port}`)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
"@grpc/proto-loader": "^0.6.0",
|
||||
"async": "^1.5.2",
|
||||
"google-protobuf": "^3.0.0",
|
||||
"@grpc/grpc-js": "^1.8.0",
|
||||
"@grpc/grpc-js-xds": "^1.8.0",
|
||||
"@grpc/grpc-js": "^1.10.2",
|
||||
"@grpc/grpc-js-xds": "^1.10.0",
|
||||
"@grpc/reflection": "^1.0.0",
|
||||
"lodash": "^4.6.1",
|
||||
"minimist": "^1.2.0"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
var path = require('path');
|
||||
var grpc = require('@grpc/grpc-js');
|
||||
var protoLoader = require('@grpc/proto-loader');
|
||||
var reflection = require('@grpc/reflection');
|
||||
|
||||
var PROTO_PATH = path.join(__dirname, '../protos/helloworld.proto');
|
||||
|
||||
var server = new grpc.Server();
|
||||
var packageDefinition = protoLoader.loadSync(PROTO_PATH);
|
||||
var proto = grpc.loadPackageDefinition(packageDefinition);
|
||||
var reflection = new reflection.ReflectionService(packageDefinition);
|
||||
|
||||
reflection.addToServer(server);
|
||||
server.addService(proto.helloworld.Greeter.service, {
|
||||
sayHello: (call, callback) => { callback(null, { message: 'Hello' }) }
|
||||
});
|
||||
|
||||
server.bindAsync('localhost:5000', grpc.ServerCredentials.createInsecure(), () => {
|
||||
server.start();
|
||||
});
|
|
@ -0,0 +1,57 @@
|
|||
# Retry
|
||||
|
||||
This example shows how to enable and configure retry on gRPC clients.
|
||||
|
||||
## Documentation
|
||||
|
||||
[gRFC for client-side retry support](https://github.com/grpc/proposal/blob/master/A6-client-retries.md)
|
||||
|
||||
## Try it
|
||||
|
||||
This example includes a service implementation that fails requests three times with status code Unavailable, then passes the fourth. The client is configured to make four retry attempts when receiving an Unavailable status code.
|
||||
|
||||
First start the server:
|
||||
|
||||
```
|
||||
node server.js
|
||||
```
|
||||
|
||||
Then run the client:
|
||||
|
||||
```
|
||||
node client.js
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Define your retry policy
|
||||
|
||||
Retry is configured via the service config, which can be provided by the name resolver, or as a channel option (described below). In the below example, we set the retry policy for the "grpc.example.echo.Echo" method.
|
||||
|
||||
```js
|
||||
const serviceConfig = {
|
||||
loadBalancingConfig: [],
|
||||
methodConfig: [
|
||||
{
|
||||
name: [
|
||||
{
|
||||
service: 'grpc.examples.echo.Echo',
|
||||
},
|
||||
],
|
||||
retryPolicy: {
|
||||
maxAttempts: 4,
|
||||
initialBackoff: '0.01s',
|
||||
maxBackoff: '0.01s',
|
||||
backoffMultiplier: 1.0,
|
||||
retryableStatusCodes: ['UNAVAILABLE'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
### Providing the retry policy as a channel option
|
||||
|
||||
```js
|
||||
const client = new Echo('localhost:50052', grpc.credentials.createInsecure(), { 'grpc.service_config': JSON.stringify(serviceConfig) });
|
||||
```
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2025 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const echoProto = grpc.loadPackageDefinition(packageDefinition).grpc.examples.echo;
|
||||
|
||||
const serviceConfig = {
|
||||
loadBalancingConfig: [],
|
||||
methodConfig: [
|
||||
{
|
||||
name: [
|
||||
{
|
||||
service: 'grpc.examples.echo.Echo',
|
||||
},
|
||||
],
|
||||
retryPolicy: {
|
||||
maxAttempts: 4,
|
||||
initialBackoff: '0.01s',
|
||||
maxBackoff: '0.01s',
|
||||
backoffMultiplier: 1.0,
|
||||
retryableStatusCodes: ['UNAVAILABLE'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
function main() {
|
||||
let argv = parseArgs(process.argv.slice(2), {
|
||||
string: 'target',
|
||||
default: {target: 'localhost:50052'}
|
||||
});
|
||||
|
||||
// Set up a connection to the server with service config and create the channel.
|
||||
// However, the recommended approach is to fetch the retry configuration
|
||||
// (which is part of the service config) from the name resolver rather than
|
||||
// defining it on the client side.
|
||||
const client = new echoProto.Echo('localhost:50052', grpc.credentials.createInsecure(), { 'grpc.service_config': JSON.stringify(serviceConfig) });
|
||||
client.unaryEcho({message: 'Try and Success'}, (error, value) => {
|
||||
if (error) {
|
||||
console.log(`Unexpected error from UnaryEcho: ${error}`);
|
||||
return;
|
||||
}
|
||||
console.log(`RPC response: ${JSON.stringify(value)}`);
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2025 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.
|
||||
*
|
||||
*/
|
||||
|
||||
const grpc = require('@grpc/grpc-js');
|
||||
const protoLoader = require('@grpc/proto-loader');
|
||||
const parseArgs = require('minimist');
|
||||
|
||||
const PROTO_PATH = __dirname + '/../protos/echo.proto';
|
||||
|
||||
const packageDefinition = protoLoader.loadSync(
|
||||
PROTO_PATH,
|
||||
{keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true
|
||||
});
|
||||
const echoProto = grpc.loadPackageDefinition(packageDefinition).grpc.examples.echo;
|
||||
|
||||
const SUCCEED_EVERY = 4
|
||||
let callCount = 0;
|
||||
|
||||
/* This method will succeed every SUCCEED_EVERY calls, and fail all others with status code
|
||||
* UNAVAILABLE. */
|
||||
function unaryEcho(call, callback) {
|
||||
callCount++;
|
||||
if (callCount % SUCCEED_EVERY === 0) {
|
||||
console.log(`Request succeeded count: ${callCount}`);
|
||||
callback(null, call.request);
|
||||
} else {
|
||||
console.log(`Request failed count: ${callCount}`);
|
||||
callback({
|
||||
code: grpc.status.UNAVAILABLE,
|
||||
details: 'Request failed by policy'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const serviceImplementation = {
|
||||
unaryEcho
|
||||
};
|
||||
|
||||
function main() {
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
string: 'port',
|
||||
default: {port: '50052'}
|
||||
});
|
||||
const server = new grpc.Server();
|
||||
server.addService(echoProto.Echo.service, serviceImplementation);
|
||||
server.bindAsync(`0.0.0.0:${argv.port}`, grpc.ServerCredentials.createInsecure(), (err, port) => {
|
||||
if (err != null) {
|
||||
return console.error(err);
|
||||
}
|
||||
console.log(`gRPC listening on ${port}`)
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
|
@ -19,18 +19,19 @@ import * as gulp from 'gulp';
|
|||
import * as healthCheck from './packages/grpc-health-check/gulpfile';
|
||||
import * as jsCore from './packages/grpc-js/gulpfile';
|
||||
import * as jsXds from './packages/grpc-js-xds/gulpfile';
|
||||
import * as reflection from './packages/grpc-reflection/gulpfile';
|
||||
import * as protobuf from './packages/proto-loader/gulpfile';
|
||||
import * as internalTest from './test/gulpfile';
|
||||
|
||||
const installAll = gulp.series(jsCore.install, healthCheck.install, protobuf.install, internalTest.install, jsXds.install);
|
||||
const installAll = gulp.series(protobuf.install, jsCore.install, healthCheck.install, reflection.install, internalTest.install, jsXds.install);
|
||||
|
||||
const lint = gulp.parallel(jsCore.lint);
|
||||
|
||||
const build = gulp.series(jsCore.compile, protobuf.compile, jsXds.compile);
|
||||
const build = gulp.series(protobuf.compile, jsCore.compile, jsXds.compile);
|
||||
|
||||
const setup = gulp.series(installAll);
|
||||
|
||||
const setupPureJSInterop = gulp.series(jsCore.install, protobuf.install, internalTest.install);
|
||||
const setupPureJSInterop = gulp.series(protobuf.install, jsCore.install, internalTest.install);
|
||||
|
||||
const clean = gulp.series(jsCore.clean, protobuf.clean, jsXds.clean);
|
||||
|
||||
|
@ -40,7 +41,7 @@ const nativeTestOnly = gulp.parallel(healthCheck.test);
|
|||
|
||||
const nativeTest = gulp.series(build, nativeTestOnly);
|
||||
|
||||
const testOnly = gulp.parallel(jsCore.test, nativeTestOnly, protobuf.test, jsXds.test);
|
||||
const testOnly = gulp.series(jsCore.test, nativeTestOnly, protobuf.test, jsXds.test, reflection.test);
|
||||
|
||||
const test = gulp.series(build, testOnly, internalTest.test);
|
||||
|
||||
|
|
|
@ -20,14 +20,13 @@
|
|||
"del": "^3.0.0",
|
||||
"execa": "^0.8.0",
|
||||
"gulp": "^4.0.1",
|
||||
"gulp-jsdoc3": "^1.0.1",
|
||||
"gulp-jshint": "^2.0.4",
|
||||
"gulp-mocha": "^4.3.1",
|
||||
"gulp-sourcemaps": "^2.6.1",
|
||||
"gulp-tslint": "^8.1.1",
|
||||
"gulp-typescript": "^3.2.2",
|
||||
"gulp-util": "^3.0.8",
|
||||
"jsdoc": "^3.3.2",
|
||||
"jsdoc": "^4.0.3",
|
||||
"jshint": "^2.9.5",
|
||||
"make-dir": "^1.1.0",
|
||||
"merge2": "^1.1.0",
|
||||
|
@ -54,7 +53,8 @@
|
|||
"include": [
|
||||
"packages/grpc-health-check/health.js",
|
||||
"packages/grpc-js/build/src/*",
|
||||
"packages/proto-loader/build/src/*"
|
||||
"packages/proto-loader/build/src/*",
|
||||
"packages/grpc-reflection/build/src/*"
|
||||
],
|
||||
"cache": true,
|
||||
"all": true
|
||||
|
|
|
@ -4,11 +4,7 @@ Health check client and service for use with gRPC-node.
|
|||
|
||||
## Background
|
||||
|
||||
This package exports both a client and server that adhere to the [gRPC Health Checking Protocol](https://github.com/grpc/grpc/blob/master/doc/health-checking.md).
|
||||
|
||||
By using this package, clients and servers can rely on common proto and service definitions. This means:
|
||||
- Clients can use the generated stubs to health check _any_ server that adheres to the protocol.
|
||||
- Servers do not reimplement common logic for publishing health statuses.
|
||||
This package provides an implementation of the [gRPC Health Checking Protocol](https://github.com/grpc/grpc/blob/master/doc/health-checking.md) service, as described in [gRFC L106](https://github.com/grpc/proposal/blob/master/L106-node-heath-check-library.md).
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -22,33 +18,39 @@ npm install grpc-health-check
|
|||
|
||||
### Server
|
||||
|
||||
Any gRPC-node server can use `grpc-health-check` to adhere to the gRPC Health Checking Protocol.
|
||||
Any gRPC-node server can use `grpc-health-check` to adhere to the gRPC Health Checking Protocol.
|
||||
The following shows how this package can be added to a pre-existing gRPC server.
|
||||
|
||||
```javascript 1.8
|
||||
```typescript
|
||||
// Import package
|
||||
let health = require('grpc-health-check');
|
||||
import { HealthImplementation, ServingStatusMap } from 'grpc-health-check';
|
||||
|
||||
// Define service status map. Key is the service name, value is the corresponding status.
|
||||
// By convention, the empty string "" key represents that status of the entire server.
|
||||
// By convention, the empty string '' key represents that status of the entire server.
|
||||
const statusMap = {
|
||||
"ServiceFoo": proto.grpc.health.v1.HealthCheckResponse.ServingStatus.SERVING,
|
||||
"ServiceBar": proto.grpc.health.v1.HealthCheckResponse.ServingStatus.NOT_SERVING,
|
||||
"": proto.grpc.health.v1.HealthCheckResponse.ServingStatus.NOT_SERVING,
|
||||
'ServiceFoo': 'SERVING',
|
||||
'ServiceBar': 'NOT_SERVING',
|
||||
'': 'NOT_SERVING',
|
||||
};
|
||||
|
||||
// Construct the service implementation
|
||||
let healthImpl = new health.Implementation(statusMap);
|
||||
const healthImpl = new HealthImplementation(statusMap);
|
||||
|
||||
// Add the service and implementation to your pre-existing gRPC-node server
|
||||
server.addService(health.service, healthImpl);
|
||||
healthImpl.addToServer(server);
|
||||
|
||||
// When ServiceBar comes up
|
||||
healthImpl.setStatus('serviceBar', 'SERVING');
|
||||
```
|
||||
|
||||
Congrats! Your server now allows any client to run a health check against it.
|
||||
|
||||
### Client
|
||||
|
||||
Any gRPC-node client can use `grpc-health-check` to run health checks against other servers that follow the protocol.
|
||||
Any gRPC-node client can use the `service` object exported by `grpc-health-check` to generate clients that can make health check requests.
|
||||
|
||||
### Command Line Usage
|
||||
|
||||
The absolute path to `health.proto` can be obtained on the command line with `node -p 'require("grpc-health-check").protoPath'`.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
|
@ -19,22 +19,32 @@ import * as gulp from 'gulp';
|
|||
import * as mocha from 'gulp-mocha';
|
||||
import * as execa from 'execa';
|
||||
import * as path from 'path';
|
||||
import * as del from 'del';
|
||||
import {linkSync} from '../../util';
|
||||
|
||||
const healthCheckDir = __dirname;
|
||||
const baseDir = path.resolve(healthCheckDir, '..', '..');
|
||||
const testDir = path.resolve(healthCheckDir, 'test');
|
||||
const outDir = path.resolve(healthCheckDir, 'build');
|
||||
|
||||
const runInstall = () => execa('npm', ['install', '--unsafe-perm'], {cwd: healthCheckDir, stdio: 'inherit'});
|
||||
const execNpmVerb = (verb: string, ...args: string[]) =>
|
||||
execa('npm', [verb, ...args], {cwd: healthCheckDir, stdio: 'inherit'});
|
||||
const execNpmCommand = execNpmVerb.bind(null, 'run');
|
||||
|
||||
const runRebuild = () => execa('npm', ['rebuild', '--unsafe-perm'], {cwd: healthCheckDir, stdio: 'inherit'});
|
||||
const install = () => execNpmVerb('install', '--unsafe-perm');
|
||||
|
||||
const install = gulp.series(runInstall, runRebuild);
|
||||
/**
|
||||
* Transpiles TypeScript files in src/ to JavaScript according to the settings
|
||||
* found in tsconfig.json.
|
||||
*/
|
||||
const compile = () => execNpmCommand('compile');
|
||||
|
||||
const test = () => gulp.src(`${testDir}/*.js`).pipe(mocha({reporter: 'mocha-jenkins-reporter'}));
|
||||
const runTests = () => {
|
||||
return gulp.src(`${outDir}/test/**/*.js`)
|
||||
.pipe(mocha({reporter: 'mocha-jenkins-reporter',
|
||||
require: ['ts-node/register']}));
|
||||
};
|
||||
|
||||
const test = gulp.series(install, runTests);
|
||||
|
||||
export {
|
||||
install,
|
||||
compile,
|
||||
test
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2015 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.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var grpc = require('grpc');
|
||||
|
||||
var _get = require('lodash.get');
|
||||
var _clone = require('lodash.clone')
|
||||
|
||||
var health_messages = require('./v1/health_pb');
|
||||
var health_service = require('./v1/health_grpc_pb');
|
||||
|
||||
function HealthImplementation(statusMap) {
|
||||
this.statusMap = _clone(statusMap);
|
||||
}
|
||||
|
||||
HealthImplementation.prototype.setStatus = function(service, status) {
|
||||
this.statusMap[service] = status;
|
||||
};
|
||||
|
||||
HealthImplementation.prototype.check = function(call, callback){
|
||||
var service = call.request.getService();
|
||||
var status = _get(this.statusMap, service, null);
|
||||
if (status === null) {
|
||||
// TODO(murgatroid99): Do this without an explicit reference to grpc.
|
||||
callback({code:grpc.status.NOT_FOUND});
|
||||
} else {
|
||||
var response = new health_messages.HealthCheckResponse();
|
||||
response.setStatus(status);
|
||||
callback(null, response);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
Client: health_service.HealthClient,
|
||||
messages: health_messages,
|
||||
service: health_service.HealthService,
|
||||
Implementation: HealthImplementation
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "grpc-health-check",
|
||||
"version": "1.8.0",
|
||||
"version": "2.0.2",
|
||||
"author": "Google Inc.",
|
||||
"description": "Health check client and service for use with gRPC-node",
|
||||
"repository": {
|
||||
|
@ -14,18 +14,28 @@
|
|||
"email": "mlumish@google.com"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"compile": "tsc -p .",
|
||||
"prepare": "npm run generate-types && npm run compile",
|
||||
"generate-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ -O src/generated health/v1/health.proto",
|
||||
"generate-test-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ -O test/generated --grpcLib=@grpc/grpc-js health/v1/health.proto"
|
||||
},
|
||||
"dependencies": {
|
||||
"google-protobuf": "^3.4.0",
|
||||
"grpc": "^1.6.0",
|
||||
"lodash.clone": "^4.5.0",
|
||||
"lodash.get": "^4.4.2"
|
||||
"@grpc/proto-loader": "^0.7.13"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"health.js",
|
||||
"v1"
|
||||
"src",
|
||||
"build",
|
||||
"proto"
|
||||
],
|
||||
"main": "health.js",
|
||||
"license": "Apache-2.0"
|
||||
"main": "build/src/health.js",
|
||||
"types": "build/src/health.d.ts",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@grpc/grpc-js": "file:../grpc-js",
|
||||
"@types/mocha": "^10.0.10",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
// 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
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package grpc.health.v1;
|
||||
|
||||
option csharp_namespace = "Grpc.Health.V1";
|
||||
option go_package = "google.golang.org/grpc/health/grpc_health_v1";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "HealthProto";
|
||||
option java_package = "io.grpc.health.v1";
|
||||
|
||||
message HealthListRequest {}
|
||||
|
||||
message HealthListResponse {
|
||||
// statuses contains all the services and their respective status.
|
||||
map<string, HealthCheckResponse> statuses = 1;
|
||||
}
|
||||
|
||||
message HealthCheckRequest {
|
||||
string service = 1;
|
||||
}
|
||||
|
||||
message HealthCheckResponse {
|
||||
enum ServingStatus {
|
||||
UNKNOWN = 0;
|
||||
SERVING = 1;
|
||||
NOT_SERVING = 2;
|
||||
SERVICE_UNKNOWN = 3; // Used only by the Watch method.
|
||||
}
|
||||
ServingStatus status = 1;
|
||||
}
|
||||
|
||||
// Health is gRPC's mechanism for checking whether a server is able to handle
|
||||
// RPCs. Its semantics are documented in
|
||||
// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
|
||||
service Health {
|
||||
// Check gets the health of the specified service. If the requested service
|
||||
// is unknown, the call will fail with status NOT_FOUND. If the caller does
|
||||
// not specify a service name, the server should respond with its overall
|
||||
// health status.
|
||||
//
|
||||
// Clients should set a deadline when calling Check, and can declare the
|
||||
// server unhealthy if they do not receive a timely response.
|
||||
//
|
||||
// Check implementations should be idempotent and side effect free.
|
||||
rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
|
||||
|
||||
// Performs a watch for the serving status of the requested service.
|
||||
// The server will immediately send back a message indicating the current
|
||||
// serving status. It will then subsequently send a new message whenever
|
||||
// the service's serving status changes.
|
||||
//
|
||||
// If the requested service is unknown when the call is received, the
|
||||
// server will send a message setting the serving status to
|
||||
// SERVICE_UNKNOWN but will *not* terminate the call. If at some
|
||||
// future point, the serving status of the service becomes known, the
|
||||
// server will send a new message with the service's serving status.
|
||||
//
|
||||
// If the call terminates with status UNIMPLEMENTED, then clients
|
||||
// should assume this method is not supported and should not retry the
|
||||
// call. If the call terminates with any other status (including OK),
|
||||
// clients should retry the call with appropriate exponential backoff.
|
||||
rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse);
|
||||
|
||||
// List provides a non-atomic snapshot of the health of all the available
|
||||
// services.
|
||||
//
|
||||
// The server may respond with a RESOURCE_EXHAUSTED error if too many services
|
||||
// exist.
|
||||
//
|
||||
// Clients should set a deadline when calling List, and can declare the server
|
||||
// unhealthy if they do not receive a timely response.
|
||||
//
|
||||
// Clients should keep in mind that the list of health services exposed by an
|
||||
// application can change over the lifetime of the process.
|
||||
rpc List(HealthListRequest) returns (HealthListResponse);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// Original file: proto/health/v1/health.proto
|
||||
|
||||
import type { MethodDefinition } from '@grpc/proto-loader'
|
||||
import type { HealthCheckRequest as _grpc_health_v1_HealthCheckRequest, HealthCheckRequest__Output as _grpc_health_v1_HealthCheckRequest__Output } from '../../../grpc/health/v1/HealthCheckRequest';
|
||||
import type { HealthCheckResponse as _grpc_health_v1_HealthCheckResponse, HealthCheckResponse__Output as _grpc_health_v1_HealthCheckResponse__Output } from '../../../grpc/health/v1/HealthCheckResponse';
|
||||
|
||||
export interface HealthDefinition {
|
||||
Check: MethodDefinition<_grpc_health_v1_HealthCheckRequest, _grpc_health_v1_HealthCheckResponse, _grpc_health_v1_HealthCheckRequest__Output, _grpc_health_v1_HealthCheckResponse__Output>
|
||||
Watch: MethodDefinition<_grpc_health_v1_HealthCheckRequest, _grpc_health_v1_HealthCheckResponse, _grpc_health_v1_HealthCheckRequest__Output, _grpc_health_v1_HealthCheckResponse__Output>
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// Original file: proto/health/v1/health.proto
|
||||
|
||||
|
||||
export interface HealthCheckRequest {
|
||||
'service'?: (string);
|
||||
}
|
||||
|
||||
export interface HealthCheckRequest__Output {
|
||||
'service': (string);
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
// Original file: proto/health/v1/health.proto
|
||||
|
||||
|
||||
// Original file: proto/health/v1/health.proto
|
||||
|
||||
export const _grpc_health_v1_HealthCheckResponse_ServingStatus = {
|
||||
UNKNOWN: 'UNKNOWN',
|
||||
SERVING: 'SERVING',
|
||||
NOT_SERVING: 'NOT_SERVING',
|
||||
/**
|
||||
* Used only by the Watch method.
|
||||
*/
|
||||
SERVICE_UNKNOWN: 'SERVICE_UNKNOWN',
|
||||
} as const;
|
||||
|
||||
export type _grpc_health_v1_HealthCheckResponse_ServingStatus =
|
||||
| 'UNKNOWN'
|
||||
| 0
|
||||
| 'SERVING'
|
||||
| 1
|
||||
| 'NOT_SERVING'
|
||||
| 2
|
||||
/**
|
||||
* Used only by the Watch method.
|
||||
*/
|
||||
| 'SERVICE_UNKNOWN'
|
||||
| 3
|
||||
|
||||
export type _grpc_health_v1_HealthCheckResponse_ServingStatus__Output = typeof _grpc_health_v1_HealthCheckResponse_ServingStatus[keyof typeof _grpc_health_v1_HealthCheckResponse_ServingStatus]
|
||||
|
||||
export interface HealthCheckResponse {
|
||||
'status'?: (_grpc_health_v1_HealthCheckResponse_ServingStatus);
|
||||
}
|
||||
|
||||
export interface HealthCheckResponse__Output {
|
||||
'status': (_grpc_health_v1_HealthCheckResponse_ServingStatus__Output);
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2023 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.
|
||||
*
|
||||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import { loadSync, ServiceDefinition } from '@grpc/proto-loader';
|
||||
import { HealthCheckRequest__Output } from './generated/grpc/health/v1/HealthCheckRequest';
|
||||
import { HealthCheckResponse } from './generated/grpc/health/v1/HealthCheckResponse';
|
||||
import { sendUnaryData, Server, ServerUnaryCall, ServerWritableStream } from './server-type';
|
||||
|
||||
const loadedProto = loadSync('health/v1/health.proto', {
|
||||
keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
defaults: true,
|
||||
oneofs: true,
|
||||
includeDirs: [`${__dirname}/../../proto`],
|
||||
});
|
||||
|
||||
export const service = loadedProto['grpc.health.v1.Health'] as ServiceDefinition;
|
||||
|
||||
const GRPC_STATUS_NOT_FOUND = 5;
|
||||
|
||||
export type ServingStatus = 'UNKNOWN' | 'SERVING' | 'NOT_SERVING';
|
||||
|
||||
export interface ServingStatusMap {
|
||||
[serviceName: string]: ServingStatus;
|
||||
}
|
||||
|
||||
interface StatusWatcher {
|
||||
(status: ServingStatus): void;
|
||||
}
|
||||
|
||||
export class HealthImplementation {
|
||||
private statusMap: Map<string, ServingStatus> = new Map();
|
||||
private watchers: Map<string, Set<StatusWatcher>> = new Map();
|
||||
constructor(initialStatusMap?: ServingStatusMap) {
|
||||
if (initialStatusMap) {
|
||||
for (const [serviceName, status] of Object.entries(initialStatusMap)) {
|
||||
this.statusMap.set(serviceName, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setStatus(service: string, status: ServingStatus) {
|
||||
this.statusMap.set(service, status);
|
||||
for (const watcher of this.watchers.get(service) ?? []) {
|
||||
watcher(status);
|
||||
}
|
||||
}
|
||||
|
||||
private addWatcher(service: string, watcher: StatusWatcher) {
|
||||
const existingWatcherSet = this.watchers.get(service);
|
||||
if (existingWatcherSet) {
|
||||
existingWatcherSet.add(watcher);
|
||||
} else {
|
||||
const newWatcherSet = new Set<StatusWatcher>();
|
||||
newWatcherSet.add(watcher);
|
||||
this.watchers.set(service, newWatcherSet);
|
||||
}
|
||||
}
|
||||
|
||||
private removeWatcher(service: string, watcher: StatusWatcher) {
|
||||
this.watchers.get(service)?.delete(watcher);
|
||||
}
|
||||
|
||||
addToServer(server: Server) {
|
||||
server.addService(service, {
|
||||
check: (call: ServerUnaryCall<HealthCheckRequest__Output, HealthCheckResponse>, callback: sendUnaryData<HealthCheckResponse>) => {
|
||||
const serviceName = call.request.service;
|
||||
const status = this.statusMap.get(serviceName);
|
||||
if (status) {
|
||||
callback(null, {status: status});
|
||||
} else {
|
||||
callback({code: GRPC_STATUS_NOT_FOUND, details: `Health status unknown for service ${serviceName}`});
|
||||
}
|
||||
},
|
||||
watch: (call: ServerWritableStream<HealthCheckRequest__Output, HealthCheckResponse>) => {
|
||||
const serviceName = call.request.service;
|
||||
const statusWatcher = (status: ServingStatus) => {
|
||||
call.write({status: status});
|
||||
};
|
||||
this.addWatcher(serviceName, statusWatcher);
|
||||
call.on('cancelled', () => {
|
||||
this.removeWatcher(serviceName, statusWatcher);
|
||||
});
|
||||
const currentStatus = this.statusMap.get(serviceName);
|
||||
if (currentStatus) {
|
||||
call.write({status: currentStatus});
|
||||
} else {
|
||||
call.write({status: 'SERVICE_UNKNOWN'});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const protoPath = path.resolve(__dirname, '../../proto/health/v1/health.proto');
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright 2023 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.
|
||||
*
|
||||
*/
|
||||
|
||||
import { Readable, Writable } from 'stream';
|
||||
|
||||
interface EmitterAugmentation1<Name extends string | symbol, Arg> {
|
||||
addListener(event: Name, listener: (arg1: Arg) => void): this;
|
||||
emit(event: Name, arg1: Arg): boolean;
|
||||
on(event: Name, listener: (arg1: Arg) => void): this;
|
||||
once(event: Name, listener: (arg1: Arg) => void): this;
|
||||
prependListener(event: Name, listener: (arg1: Arg) => void): this;
|
||||
prependOnceListener(event: Name, listener: (arg1: Arg) => void): this;
|
||||
removeListener(event: Name, listener: (arg1: Arg) => void): this;
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export type WriteCallback = (error: Error | null | undefined) => void;
|
||||
|
||||
export interface IntermediateObjectReadable<T> extends Readable {
|
||||
read(size?: number): any & T;
|
||||
}
|
||||
|
||||
export type ObjectReadable<T> = {
|
||||
read(size?: number): T;
|
||||
} & EmitterAugmentation1<'data', T> &
|
||||
IntermediateObjectReadable<T>;
|
||||
|
||||
export interface IntermediateObjectWritable<T> extends Writable {
|
||||
_write(chunk: any & T, encoding: string, callback: Function): void;
|
||||
write(chunk: any & T, cb?: WriteCallback): boolean;
|
||||
write(chunk: any & T, encoding?: any, cb?: WriteCallback): boolean;
|
||||
setDefaultEncoding(encoding: string): this;
|
||||
end(): ReturnType<Writable['end']> extends Writable ? this : void;
|
||||
end(
|
||||
chunk: any & T,
|
||||
cb?: Function
|
||||
): ReturnType<Writable['end']> extends Writable ? this : void;
|
||||
end(
|
||||
chunk: any & T,
|
||||
encoding?: any,
|
||||
cb?: Function
|
||||
): ReturnType<Writable['end']> extends Writable ? this : void;
|
||||
}
|
||||
|
||||
export interface ObjectWritable<T> extends IntermediateObjectWritable<T> {
|
||||
_write(chunk: T, encoding: string, callback: Function): void;
|
||||
write(chunk: T, cb?: Function): boolean;
|
||||
write(chunk: T, encoding?: any, cb?: Function): boolean;
|
||||
setDefaultEncoding(encoding: string): this;
|
||||
end(): ReturnType<Writable['end']> extends Writable ? this : void;
|
||||
end(
|
||||
chunk: T,
|
||||
cb?: Function
|
||||
): ReturnType<Writable['end']> extends Writable ? this : void;
|
||||
end(
|
||||
chunk: T,
|
||||
encoding?: any,
|
||||
cb?: Function
|
||||
): ReturnType<Writable['end']> extends Writable ? this : void;
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright 2023 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.
|
||||
*
|
||||
*/
|
||||
|
||||
import { ServiceDefinition } from '@grpc/proto-loader';
|
||||
import { ObjectReadable, ObjectWritable } from './object-stream';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
type Metadata = any;
|
||||
|
||||
interface StatusObject {
|
||||
code: number;
|
||||
details: string;
|
||||
metadata: Metadata;
|
||||
}
|
||||
|
||||
type Deadline = Date | number;
|
||||
|
||||
type ServerStatusResponse = Partial<StatusObject>;
|
||||
|
||||
type ServerErrorResponse = ServerStatusResponse & Error;
|
||||
|
||||
type ServerSurfaceCall = {
|
||||
cancelled: boolean;
|
||||
readonly metadata: Metadata;
|
||||
getPeer(): string;
|
||||
sendMetadata(responseMetadata: Metadata): void;
|
||||
getDeadline(): Deadline;
|
||||
getPath(): string;
|
||||
} & EventEmitter;
|
||||
|
||||
export type ServerUnaryCall<RequestType, ResponseType> = ServerSurfaceCall & {
|
||||
request: RequestType;
|
||||
};
|
||||
type ServerReadableStream<RequestType, ResponseType> =
|
||||
ServerSurfaceCall & ObjectReadable<RequestType>;
|
||||
export type ServerWritableStream<RequestType, ResponseType> =
|
||||
ServerSurfaceCall &
|
||||
ObjectWritable<ResponseType> & {
|
||||
request: RequestType;
|
||||
end: (metadata?: Metadata) => void;
|
||||
};
|
||||
type ServerDuplexStream<RequestType, ResponseType> = ServerSurfaceCall &
|
||||
ObjectReadable<RequestType> &
|
||||
ObjectWritable<ResponseType> & { end: (metadata?: Metadata) => void };
|
||||
|
||||
// Unary response callback signature.
|
||||
export type sendUnaryData<ResponseType> = (
|
||||
error: ServerErrorResponse | ServerStatusResponse | null,
|
||||
value?: ResponseType | null,
|
||||
trailer?: Metadata,
|
||||
flags?: number
|
||||
) => void;
|
||||
|
||||
// User provided handler for unary calls.
|
||||
type handleUnaryCall<RequestType, ResponseType> = (
|
||||
call: ServerUnaryCall<RequestType, ResponseType>,
|
||||
callback: sendUnaryData<ResponseType>
|
||||
) => void;
|
||||
|
||||
// User provided handler for client streaming calls.
|
||||
type handleClientStreamingCall<RequestType, ResponseType> = (
|
||||
call: ServerReadableStream<RequestType, ResponseType>,
|
||||
callback: sendUnaryData<ResponseType>
|
||||
) => void;
|
||||
|
||||
// User provided handler for server streaming calls.
|
||||
type handleServerStreamingCall<RequestType, ResponseType> = (
|
||||
call: ServerWritableStream<RequestType, ResponseType>
|
||||
) => void;
|
||||
|
||||
// User provided handler for bidirectional streaming calls.
|
||||
type handleBidiStreamingCall<RequestType, ResponseType> = (
|
||||
call: ServerDuplexStream<RequestType, ResponseType>
|
||||
) => void;
|
||||
|
||||
export type HandleCall<RequestType, ResponseType> =
|
||||
| handleUnaryCall<RequestType, ResponseType>
|
||||
| handleClientStreamingCall<RequestType, ResponseType>
|
||||
| handleServerStreamingCall<RequestType, ResponseType>
|
||||
| handleBidiStreamingCall<RequestType, ResponseType>;
|
||||
|
||||
export type UntypedHandleCall = HandleCall<any, any>;
|
||||
export interface UntypedServiceImplementation {
|
||||
[name: string]: UntypedHandleCall;
|
||||
}
|
||||
|
||||
export interface Server {
|
||||
addService(service: ServiceDefinition, implementation: UntypedServiceImplementation): void;
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
// Original file: proto/health/v1/health.proto
|
||||
|
||||
import type * as grpc from '@grpc/grpc-js'
|
||||
import type { MethodDefinition } from '@grpc/proto-loader'
|
||||
import type { HealthCheckRequest as _grpc_health_v1_HealthCheckRequest, HealthCheckRequest__Output as _grpc_health_v1_HealthCheckRequest__Output } from '../../../grpc/health/v1/HealthCheckRequest';
|
||||
import type { HealthCheckResponse as _grpc_health_v1_HealthCheckResponse, HealthCheckResponse__Output as _grpc_health_v1_HealthCheckResponse__Output } from '../../../grpc/health/v1/HealthCheckResponse';
|
||||
|
||||
/**
|
||||
* Health is gRPC's mechanism for checking whether a server is able to handle
|
||||
* RPCs. Its semantics are documented in
|
||||
* https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
|
||||
*/
|
||||
export interface HealthClient extends grpc.Client {
|
||||
/**
|
||||
* Check gets the health of the specified service. If the requested service
|
||||
* is unknown, the call will fail with status NOT_FOUND. If the caller does
|
||||
* not specify a service name, the server should respond with its overall
|
||||
* health status.
|
||||
*
|
||||
* Clients should set a deadline when calling Check, and can declare the
|
||||
* server unhealthy if they do not receive a timely response.
|
||||
*
|
||||
* Check implementations should be idempotent and side effect free.
|
||||
*/
|
||||
Check(argument: _grpc_health_v1_HealthCheckRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_health_v1_HealthCheckResponse__Output>): grpc.ClientUnaryCall;
|
||||
Check(argument: _grpc_health_v1_HealthCheckRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_health_v1_HealthCheckResponse__Output>): grpc.ClientUnaryCall;
|
||||
Check(argument: _grpc_health_v1_HealthCheckRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_health_v1_HealthCheckResponse__Output>): grpc.ClientUnaryCall;
|
||||
Check(argument: _grpc_health_v1_HealthCheckRequest, callback: grpc.requestCallback<_grpc_health_v1_HealthCheckResponse__Output>): grpc.ClientUnaryCall;
|
||||
/**
|
||||
* Check gets the health of the specified service. If the requested service
|
||||
* is unknown, the call will fail with status NOT_FOUND. If the caller does
|
||||
* not specify a service name, the server should respond with its overall
|
||||
* health status.
|
||||
*
|
||||
* Clients should set a deadline when calling Check, and can declare the
|
||||
* server unhealthy if they do not receive a timely response.
|
||||
*
|
||||
* Check implementations should be idempotent and side effect free.
|
||||
*/
|
||||
check(argument: _grpc_health_v1_HealthCheckRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_health_v1_HealthCheckResponse__Output>): grpc.ClientUnaryCall;
|
||||
check(argument: _grpc_health_v1_HealthCheckRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_health_v1_HealthCheckResponse__Output>): grpc.ClientUnaryCall;
|
||||
check(argument: _grpc_health_v1_HealthCheckRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_health_v1_HealthCheckResponse__Output>): grpc.ClientUnaryCall;
|
||||
check(argument: _grpc_health_v1_HealthCheckRequest, callback: grpc.requestCallback<_grpc_health_v1_HealthCheckResponse__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
/**
|
||||
* Performs a watch for the serving status of the requested service.
|
||||
* The server will immediately send back a message indicating the current
|
||||
* serving status. It will then subsequently send a new message whenever
|
||||
* the service's serving status changes.
|
||||
*
|
||||
* If the requested service is unknown when the call is received, the
|
||||
* server will send a message setting the serving status to
|
||||
* SERVICE_UNKNOWN but will *not* terminate the call. If at some
|
||||
* future point, the serving status of the service becomes known, the
|
||||
* server will send a new message with the service's serving status.
|
||||
*
|
||||
* If the call terminates with status UNIMPLEMENTED, then clients
|
||||
* should assume this method is not supported and should not retry the
|
||||
* call. If the call terminates with any other status (including OK),
|
||||
* clients should retry the call with appropriate exponential backoff.
|
||||
*/
|
||||
Watch(argument: _grpc_health_v1_HealthCheckRequest, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_grpc_health_v1_HealthCheckResponse__Output>;
|
||||
Watch(argument: _grpc_health_v1_HealthCheckRequest, options?: grpc.CallOptions): grpc.ClientReadableStream<_grpc_health_v1_HealthCheckResponse__Output>;
|
||||
/**
|
||||
* Performs a watch for the serving status of the requested service.
|
||||
* The server will immediately send back a message indicating the current
|
||||
* serving status. It will then subsequently send a new message whenever
|
||||
* the service's serving status changes.
|
||||
*
|
||||
* If the requested service is unknown when the call is received, the
|
||||
* server will send a message setting the serving status to
|
||||
* SERVICE_UNKNOWN but will *not* terminate the call. If at some
|
||||
* future point, the serving status of the service becomes known, the
|
||||
* server will send a new message with the service's serving status.
|
||||
*
|
||||
* If the call terminates with status UNIMPLEMENTED, then clients
|
||||
* should assume this method is not supported and should not retry the
|
||||
* call. If the call terminates with any other status (including OK),
|
||||
* clients should retry the call with appropriate exponential backoff.
|
||||
*/
|
||||
watch(argument: _grpc_health_v1_HealthCheckRequest, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_grpc_health_v1_HealthCheckResponse__Output>;
|
||||
watch(argument: _grpc_health_v1_HealthCheckRequest, options?: grpc.CallOptions): grpc.ClientReadableStream<_grpc_health_v1_HealthCheckResponse__Output>;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Health is gRPC's mechanism for checking whether a server is able to handle
|
||||
* RPCs. Its semantics are documented in
|
||||
* https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
|
||||
*/
|
||||
export interface HealthHandlers extends grpc.UntypedServiceImplementation {
|
||||
/**
|
||||
* Check gets the health of the specified service. If the requested service
|
||||
* is unknown, the call will fail with status NOT_FOUND. If the caller does
|
||||
* not specify a service name, the server should respond with its overall
|
||||
* health status.
|
||||
*
|
||||
* Clients should set a deadline when calling Check, and can declare the
|
||||
* server unhealthy if they do not receive a timely response.
|
||||
*
|
||||
* Check implementations should be idempotent and side effect free.
|
||||
*/
|
||||
Check: grpc.handleUnaryCall<_grpc_health_v1_HealthCheckRequest__Output, _grpc_health_v1_HealthCheckResponse>;
|
||||
|
||||
/**
|
||||
* Performs a watch for the serving status of the requested service.
|
||||
* The server will immediately send back a message indicating the current
|
||||
* serving status. It will then subsequently send a new message whenever
|
||||
* the service's serving status changes.
|
||||
*
|
||||
* If the requested service is unknown when the call is received, the
|
||||
* server will send a message setting the serving status to
|
||||
* SERVICE_UNKNOWN but will *not* terminate the call. If at some
|
||||
* future point, the serving status of the service becomes known, the
|
||||
* server will send a new message with the service's serving status.
|
||||
*
|
||||
* If the call terminates with status UNIMPLEMENTED, then clients
|
||||
* should assume this method is not supported and should not retry the
|
||||
* call. If the call terminates with any other status (including OK),
|
||||
* clients should retry the call with appropriate exponential backoff.
|
||||
*/
|
||||
Watch: grpc.handleServerStreamingCall<_grpc_health_v1_HealthCheckRequest__Output, _grpc_health_v1_HealthCheckResponse>;
|
||||
|
||||
}
|
||||
|
||||
export interface HealthDefinition extends grpc.ServiceDefinition {
|
||||
Check: MethodDefinition<_grpc_health_v1_HealthCheckRequest, _grpc_health_v1_HealthCheckResponse, _grpc_health_v1_HealthCheckRequest__Output, _grpc_health_v1_HealthCheckResponse__Output>
|
||||
Watch: MethodDefinition<_grpc_health_v1_HealthCheckRequest, _grpc_health_v1_HealthCheckResponse, _grpc_health_v1_HealthCheckRequest__Output, _grpc_health_v1_HealthCheckResponse__Output>
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// Original file: proto/health/v1/health.proto
|
||||
|
||||
|
||||
export interface HealthCheckRequest {
|
||||
'service'?: (string);
|
||||
}
|
||||
|
||||
export interface HealthCheckRequest__Output {
|
||||
'service': (string);
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
// Original file: proto/health/v1/health.proto
|
||||
|
||||
|
||||
// Original file: proto/health/v1/health.proto
|
||||
|
||||
export const _grpc_health_v1_HealthCheckResponse_ServingStatus = {
|
||||
UNKNOWN: 'UNKNOWN',
|
||||
SERVING: 'SERVING',
|
||||
NOT_SERVING: 'NOT_SERVING',
|
||||
/**
|
||||
* Used only by the Watch method.
|
||||
*/
|
||||
SERVICE_UNKNOWN: 'SERVICE_UNKNOWN',
|
||||
} as const;
|
||||
|
||||
export type _grpc_health_v1_HealthCheckResponse_ServingStatus =
|
||||
| 'UNKNOWN'
|
||||
| 0
|
||||
| 'SERVING'
|
||||
| 1
|
||||
| 'NOT_SERVING'
|
||||
| 2
|
||||
/**
|
||||
* Used only by the Watch method.
|
||||
*/
|
||||
| 'SERVICE_UNKNOWN'
|
||||
| 3
|
||||
|
||||
export type _grpc_health_v1_HealthCheckResponse_ServingStatus__Output = typeof _grpc_health_v1_HealthCheckResponse_ServingStatus[keyof typeof _grpc_health_v1_HealthCheckResponse_ServingStatus]
|
||||
|
||||
export interface HealthCheckResponse {
|
||||
'status'?: (_grpc_health_v1_HealthCheckResponse_ServingStatus);
|
||||
}
|
||||
|
||||
export interface HealthCheckResponse__Output {
|
||||
'status': (_grpc_health_v1_HealthCheckResponse_ServingStatus__Output);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import type * as grpc from '@grpc/grpc-js';
|
||||
import type { MessageTypeDefinition } from '@grpc/proto-loader';
|
||||
|
||||
import type { HealthClient as _grpc_health_v1_HealthClient, HealthDefinition as _grpc_health_v1_HealthDefinition } from './grpc/health/v1/Health';
|
||||
|
||||
type SubtypeConstructor<Constructor extends new (...args: any) => any, Subtype> = {
|
||||
new(...args: ConstructorParameters<Constructor>): Subtype;
|
||||
};
|
||||
|
||||
export interface ProtoGrpcType {
|
||||
grpc: {
|
||||
health: {
|
||||
v1: {
|
||||
/**
|
||||
* Health is gRPC's mechanism for checking whether a server is able to handle
|
||||
* RPCs. Its semantics are documented in
|
||||
* https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
|
||||
*/
|
||||
Health: SubtypeConstructor<typeof grpc.Client, _grpc_health_v1_HealthClient> & { service: _grpc_health_v1_HealthDefinition }
|
||||
HealthCheckRequest: MessageTypeDefinition
|
||||
HealthCheckResponse: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2015 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.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
var health = require('../health');
|
||||
|
||||
var health_messages = require('../v1/health_pb');
|
||||
|
||||
var ServingStatus = health_messages.HealthCheckResponse.ServingStatus;
|
||||
|
||||
var grpc = require('grpc');
|
||||
|
||||
describe('Health Checking', function() {
|
||||
var statusMap = {
|
||||
'': ServingStatus.SERVING,
|
||||
'grpc.test.TestServiceNotServing': ServingStatus.NOT_SERVING,
|
||||
'grpc.test.TestServiceServing': ServingStatus.SERVING
|
||||
};
|
||||
var healthServer;
|
||||
var healthImpl;
|
||||
var healthClient;
|
||||
before(function() {
|
||||
healthServer = new grpc.Server();
|
||||
healthImpl = new health.Implementation(statusMap);
|
||||
healthServer.addService(health.service, healthImpl);
|
||||
var port_num = healthServer.bind('0.0.0.0:0',
|
||||
grpc.ServerCredentials.createInsecure());
|
||||
healthServer.start();
|
||||
healthClient = new health.Client('localhost:' + port_num,
|
||||
grpc.credentials.createInsecure());
|
||||
});
|
||||
after(function() {
|
||||
healthServer.forceShutdown();
|
||||
});
|
||||
it('should say an enabled service is SERVING', function(done) {
|
||||
var request = new health_messages.HealthCheckRequest();
|
||||
request.setService('');
|
||||
healthClient.check(request, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(response.getStatus(), ServingStatus.SERVING);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should say that a disabled service is NOT_SERVING', function(done) {
|
||||
var request = new health_messages.HealthCheckRequest();
|
||||
request.setService('grpc.test.TestServiceNotServing');
|
||||
healthClient.check(request, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(response.getStatus(), ServingStatus.NOT_SERVING);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should say that an enabled service is SERVING', function(done) {
|
||||
var request = new health_messages.HealthCheckRequest();
|
||||
request.setService('grpc.test.TestServiceServing');
|
||||
healthClient.check(request, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(response.getStatus(), ServingStatus.SERVING);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should get NOT_FOUND if the service is not registered', function(done) {
|
||||
var request = new health_messages.HealthCheckRequest();
|
||||
request.setService('not_registered');
|
||||
healthClient.check(request, function(err, response) {
|
||||
assert(err);
|
||||
assert.strictEqual(err.code, grpc.status.NOT_FOUND);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should get a different response if the status changes', function(done) {
|
||||
var request = new health_messages.HealthCheckRequest();
|
||||
request.setService('transient');
|
||||
healthClient.check(request, function(err, response) {
|
||||
assert(err);
|
||||
assert.strictEqual(err.code, grpc.status.NOT_FOUND);
|
||||
healthImpl.setStatus('transient', ServingStatus.SERVING);
|
||||
healthClient.check(request, function(err, response) {
|
||||
assert.ifError(err);
|
||||
assert.strictEqual(response.getStatus(), ServingStatus.SERVING);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2023 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.
|
||||
*
|
||||
*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as grpc from '@grpc/grpc-js';
|
||||
import { HealthImplementation, ServingStatusMap, service as healthServiceDefinition } from '../src/health';
|
||||
import { HealthClient } from './generated/grpc/health/v1/Health';
|
||||
import { HealthCheckResponse__Output, _grpc_health_v1_HealthCheckResponse_ServingStatus__Output } from './generated/grpc/health/v1/HealthCheckResponse';
|
||||
|
||||
describe('Health checking', () => {
|
||||
const statusMap: ServingStatusMap = {
|
||||
'': 'SERVING',
|
||||
'grpc.test.TestServiceNotServing': 'NOT_SERVING',
|
||||
'grpc.test.TestServiceServing': 'SERVING'
|
||||
};
|
||||
let healthServer: grpc.Server;
|
||||
let healthClient: HealthClient;
|
||||
let healthImpl: HealthImplementation;
|
||||
beforeEach(done => {
|
||||
healthServer = new grpc.Server();
|
||||
healthImpl = new HealthImplementation(statusMap);
|
||||
healthImpl.addToServer(healthServer);
|
||||
healthServer.bindAsync('localhost:0', grpc.ServerCredentials.createInsecure(), (error, port) => {
|
||||
if (error) {
|
||||
done(error);
|
||||
return;
|
||||
}
|
||||
const HealthClientConstructor = grpc.makeClientConstructor(healthServiceDefinition, 'grpc.health.v1.HealthService');
|
||||
healthClient = new HealthClientConstructor(`localhost:${port}`, grpc.credentials.createInsecure()) as unknown as HealthClient;
|
||||
healthServer.start();
|
||||
done();
|
||||
});
|
||||
});
|
||||
afterEach((done) => {
|
||||
healthClient.close();
|
||||
healthServer.tryShutdown(done);
|
||||
});
|
||||
describe('check', () => {
|
||||
it('Should say that an enabled service is SERVING', done => {
|
||||
healthClient.check({service: ''}, (error, value) => {
|
||||
assert.ifError(error);
|
||||
assert.strictEqual(value?.status, 'SERVING');
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('Should say that a disabled service is NOT_SERVING', done => {
|
||||
healthClient.check({service: 'grpc.test.TestServiceNotServing'}, (error, value) => {
|
||||
assert.ifError(error);
|
||||
assert.strictEqual(value?.status, 'NOT_SERVING');
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('Should get NOT_FOUND if the service is not registered', done => {
|
||||
healthClient.check({service: 'not_registered'}, (error, value) => {
|
||||
assert(error);
|
||||
assert.strictEqual(error.code, grpc.status.NOT_FOUND);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('Should get a different response if the health status changes', done => {
|
||||
healthClient.check({service: 'transient'}, (error, value) => {
|
||||
assert(error);
|
||||
assert.strictEqual(error.code, grpc.status.NOT_FOUND);
|
||||
healthImpl.setStatus('transient', 'SERVING');
|
||||
healthClient.check({service: 'transient'}, (error, value) => {
|
||||
assert.ifError(error);
|
||||
assert.strictEqual(value?.status, 'SERVING');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('watch', () => {
|
||||
it('Should respond with the health status for an existing service', done => {
|
||||
const call = healthClient.watch({service: ''});
|
||||
call.on('data', (response: HealthCheckResponse__Output) => {
|
||||
assert.strictEqual(response.status, 'SERVING');
|
||||
call.cancel();
|
||||
});
|
||||
call.on('error', () => {});
|
||||
call.on('status', status => {
|
||||
assert.strictEqual(status.code, grpc.status.CANCELLED);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('Should send a new update when the status changes', done => {
|
||||
const receivedStatusList: _grpc_health_v1_HealthCheckResponse_ServingStatus__Output[] = [];
|
||||
const call = healthClient.watch({service: 'grpc.test.TestServiceServing'});
|
||||
call.on('data', (response: HealthCheckResponse__Output) => {
|
||||
switch (receivedStatusList.length) {
|
||||
case 0:
|
||||
assert.strictEqual(response.status, 'SERVING');
|
||||
healthImpl.setStatus('grpc.test.TestServiceServing', 'NOT_SERVING');
|
||||
break;
|
||||
case 1:
|
||||
assert.strictEqual(response.status, 'NOT_SERVING');
|
||||
call.cancel();
|
||||
break;
|
||||
default:
|
||||
assert.fail(`Unexpected third status update ${response.status}`);
|
||||
}
|
||||
receivedStatusList.push(response.status);
|
||||
});
|
||||
call.on('error', () => {});
|
||||
call.on('status', status => {
|
||||
assert.deepStrictEqual(receivedStatusList, ['SERVING', 'NOT_SERVING']);
|
||||
assert.strictEqual(status.code, grpc.status.CANCELLED);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('Should update when a service that did not exist is added', done => {
|
||||
const receivedStatusList: _grpc_health_v1_HealthCheckResponse_ServingStatus__Output[] = [];
|
||||
const call = healthClient.watch({service: 'transient'});
|
||||
call.on('data', (response: HealthCheckResponse__Output) => {
|
||||
switch (receivedStatusList.length) {
|
||||
case 0:
|
||||
assert.strictEqual(response.status, 'SERVICE_UNKNOWN');
|
||||
healthImpl.setStatus('transient', 'SERVING');
|
||||
break;
|
||||
case 1:
|
||||
assert.strictEqual(response.status, 'SERVING');
|
||||
call.cancel();
|
||||
break;
|
||||
default:
|
||||
assert.fail(`Unexpected third status update ${response.status}`);
|
||||
}
|
||||
receivedStatusList.push(response.status);
|
||||
});
|
||||
call.on('error', () => {});
|
||||
call.on('status', status => {
|
||||
assert.deepStrictEqual(receivedStatusList, ['SERVICE_UNKNOWN', 'SERVING']);
|
||||
assert.strictEqual(status.code, grpc.status.CANCELLED);
|
||||
done();
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"allowUnreachableCode": false,
|
||||
"allowUnusedLabels": false,
|
||||
"declaration": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmitOnError": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitReturns": true,
|
||||
"pretty": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"lib": ["es2017"],
|
||||
"outDir": "build",
|
||||
"target": "es2017",
|
||||
"module": "commonjs",
|
||||
"resolveJsonModule": true,
|
||||
"incremental": true,
|
||||
"types": ["mocha"],
|
||||
"noUnusedLocals": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"test/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
# @grpc/grpc-js xDS plugin
|
||||
|
||||
This package provides support for the `xds://` URL scheme to the `@grpc/grpc-js` library. The latest version of this package is compatible with `@grpc/grpc-js` version 1.9.x.
|
||||
This package provides support for the `xds://` URL scheme to the `@grpc/grpc-js` library. The latest version of this package is compatible with `@grpc/grpc-js` version 1.13.x.
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -30,5 +30,10 @@ const client = new MyServiceClient('xds:///example.com:123');
|
|||
- [Client Status Discovery Service](https://github.com/grpc/proposal/blob/master/A40-csds-support.md)
|
||||
- [Outlier Detection](https://github.com/grpc/proposal/blob/master/A50-xds-outlier-detection.md)
|
||||
- [xDS Retry Support](https://github.com/grpc/proposal/blob/master/A44-xds-retry.md)
|
||||
- [xDS Aggregate and Logical DNS Clusters](https://github.com/grpc/proposal/blob/master/A37-xds-aggregate-and-logical-dns-clusters.md)'
|
||||
- [xDS Aggregate and Logical DNS Clusters](https://github.com/grpc/proposal/blob/master/A37-xds-aggregate-and-logical-dns-clusters.md)
|
||||
- [xDS Federation](https://github.com/grpc/proposal/blob/master/A47-xds-federation.md) (Currently experimental, enabled by environment variable `GRPC_EXPERIMENTAL_XDS_FEDERATION`)
|
||||
- [xDS Custom Load Balancer Configuration](https://github.com/grpc/proposal/blob/master/A52-xds-custom-lb-policies.md) (Custom load balancer registration not currently supported)
|
||||
- [xDS Ring Hash LB Policy](https://github.com/grpc/proposal/blob/master/A42-xds-ring-hash-lb-policy.md)
|
||||
- [`pick_first` via xDS](https://github.com/grpc/proposal/blob/master/A62-pick-first.md#pick_first-via-xds-1) (Currently experimental, enabled by environment variable `GRPC_EXPERIMENTAL_PICKFIRST_LB_CONFIG`)
|
||||
- [xDS-Enabled Servers](https://github.com/grpc/proposal/blob/master/A36-xds-for-servers.md)
|
||||
- [xDS-Based Security for gRPC Clients and Servers](https://github.com/grpc/proposal/blob/master/A29-xds-tls-security.md)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 20b1b5fcee88a20a08b71051a961181839ec7268
|
||||
Subproject commit f8b75d1efa92bbf534596a013d9ca5873f79dd30
|
|
@ -21,6 +21,10 @@ import * as mocha from 'gulp-mocha';
|
|||
import * as path from 'path';
|
||||
import * as execa from 'execa';
|
||||
import * as semver from 'semver';
|
||||
import { ncp } from 'ncp';
|
||||
import { promisify } from 'util';
|
||||
|
||||
const ncpP = promisify(ncp);
|
||||
|
||||
Error.stackTraceLimit = Infinity;
|
||||
|
||||
|
@ -60,14 +64,23 @@ const cleanAll = gulp.parallel(clean);
|
|||
*/
|
||||
const compile = checkTask(() => execNpmCommand('compile'));
|
||||
|
||||
const copyTestFixtures = checkTask(() =>
|
||||
ncpP(`${jsCoreDir}/test/fixtures`, `${outDir}/test/fixtures`)
|
||||
);
|
||||
|
||||
const runTests = checkTask(() => {
|
||||
process.env.GRPC_EXPERIMENTAL_XDS_FEDERATION = 'true';
|
||||
process.env.GRPC_EXPERIMENTAL_PICKFIRST_LB_CONFIG = 'true';
|
||||
process.env.GRPC_XDS_EXPERIMENTAL_RBAC = 'true';
|
||||
if (Number(process.versions.node.split('.')[0]) <= 14) {
|
||||
process.env.GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH = 'false';
|
||||
}
|
||||
return gulp.src(`${outDir}/test/**/*.js`)
|
||||
.pipe(mocha({reporter: 'mocha-jenkins-reporter',
|
||||
require: ['ts-node/register']}));
|
||||
});
|
||||
|
||||
const test = gulp.series(install, runTests);
|
||||
const test = gulp.series(install, copyTestFixtures, runTests);
|
||||
|
||||
export {
|
||||
install,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* Metadata to be attached for the given type of RPCs.
|
||||
*/
|
||||
export interface _grpc_testing_ClientConfigureRequest_Metadata {
|
||||
'type'?: (_grpc_testing_ClientConfigureRequest_RpcType | keyof typeof _grpc_testing_ClientConfigureRequest_RpcType);
|
||||
'type'?: (_grpc_testing_ClientConfigureRequest_RpcType);
|
||||
'key'?: (string);
|
||||
'value'?: (string);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ export interface _grpc_testing_ClientConfigureRequest_Metadata {
|
|||
* Metadata to be attached for the given type of RPCs.
|
||||
*/
|
||||
export interface _grpc_testing_ClientConfigureRequest_Metadata__Output {
|
||||
'type': (keyof typeof _grpc_testing_ClientConfigureRequest_RpcType);
|
||||
'type': (_grpc_testing_ClientConfigureRequest_RpcType__Output);
|
||||
'key': (string);
|
||||
'value': (string);
|
||||
}
|
||||
|
@ -24,10 +24,24 @@ export interface _grpc_testing_ClientConfigureRequest_Metadata__Output {
|
|||
/**
|
||||
* Type of RPCs to send.
|
||||
*/
|
||||
export enum _grpc_testing_ClientConfigureRequest_RpcType {
|
||||
EMPTY_CALL = 0,
|
||||
UNARY_CALL = 1,
|
||||
}
|
||||
export const _grpc_testing_ClientConfigureRequest_RpcType = {
|
||||
EMPTY_CALL: 'EMPTY_CALL',
|
||||
UNARY_CALL: 'UNARY_CALL',
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Type of RPCs to send.
|
||||
*/
|
||||
export type _grpc_testing_ClientConfigureRequest_RpcType =
|
||||
| 'EMPTY_CALL'
|
||||
| 0
|
||||
| 'UNARY_CALL'
|
||||
| 1
|
||||
|
||||
/**
|
||||
* Type of RPCs to send.
|
||||
*/
|
||||
export type _grpc_testing_ClientConfigureRequest_RpcType__Output = typeof _grpc_testing_ClientConfigureRequest_RpcType[keyof typeof _grpc_testing_ClientConfigureRequest_RpcType]
|
||||
|
||||
/**
|
||||
* Configurations for a test client.
|
||||
|
@ -36,7 +50,7 @@ export interface ClientConfigureRequest {
|
|||
/**
|
||||
* The types of RPCs the client sends.
|
||||
*/
|
||||
'types'?: (_grpc_testing_ClientConfigureRequest_RpcType | keyof typeof _grpc_testing_ClientConfigureRequest_RpcType)[];
|
||||
'types'?: (_grpc_testing_ClientConfigureRequest_RpcType)[];
|
||||
/**
|
||||
* The collection of custom metadata to be attached to RPCs sent by the client.
|
||||
*/
|
||||
|
@ -55,7 +69,7 @@ export interface ClientConfigureRequest__Output {
|
|||
/**
|
||||
* The types of RPCs the client sends.
|
||||
*/
|
||||
'types': (keyof typeof _grpc_testing_ClientConfigureRequest_RpcType)[];
|
||||
'types': (_grpc_testing_ClientConfigureRequest_RpcType__Output)[];
|
||||
/**
|
||||
* The collection of custom metadata to be attached to RPCs sent by the client.
|
||||
*/
|
||||
|
|
|
@ -8,17 +8,52 @@
|
|||
* the address of this server from the gRPCLB server BalanceLoad RPC). Exactly
|
||||
* how this detection is done is context and server dependent.
|
||||
*/
|
||||
export enum GrpclbRouteType {
|
||||
export const GrpclbRouteType = {
|
||||
/**
|
||||
* Server didn't detect the route that a client took to reach it.
|
||||
*/
|
||||
GRPCLB_ROUTE_TYPE_UNKNOWN = 0,
|
||||
GRPCLB_ROUTE_TYPE_UNKNOWN: 'GRPCLB_ROUTE_TYPE_UNKNOWN',
|
||||
/**
|
||||
* Indicates that a client reached a server via gRPCLB fallback.
|
||||
*/
|
||||
GRPCLB_ROUTE_TYPE_FALLBACK = 1,
|
||||
GRPCLB_ROUTE_TYPE_FALLBACK: 'GRPCLB_ROUTE_TYPE_FALLBACK',
|
||||
/**
|
||||
* Indicates that a client reached a server as a gRPCLB-given backend.
|
||||
*/
|
||||
GRPCLB_ROUTE_TYPE_BACKEND = 2,
|
||||
}
|
||||
GRPCLB_ROUTE_TYPE_BACKEND: 'GRPCLB_ROUTE_TYPE_BACKEND',
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* The type of route that a client took to reach a server w.r.t. gRPCLB.
|
||||
* The server must fill in "fallback" if it detects that the RPC reached
|
||||
* the server via the "gRPCLB fallback" path, and "backend" if it detects
|
||||
* that the RPC reached the server via "gRPCLB backend" path (i.e. if it got
|
||||
* the address of this server from the gRPCLB server BalanceLoad RPC). Exactly
|
||||
* how this detection is done is context and server dependent.
|
||||
*/
|
||||
export type GrpclbRouteType =
|
||||
/**
|
||||
* Server didn't detect the route that a client took to reach it.
|
||||
*/
|
||||
| 'GRPCLB_ROUTE_TYPE_UNKNOWN'
|
||||
| 0
|
||||
/**
|
||||
* Indicates that a client reached a server via gRPCLB fallback.
|
||||
*/
|
||||
| 'GRPCLB_ROUTE_TYPE_FALLBACK'
|
||||
| 1
|
||||
/**
|
||||
* Indicates that a client reached a server as a gRPCLB-given backend.
|
||||
*/
|
||||
| 'GRPCLB_ROUTE_TYPE_BACKEND'
|
||||
| 2
|
||||
|
||||
/**
|
||||
* The type of route that a client took to reach a server w.r.t. gRPCLB.
|
||||
* The server must fill in "fallback" if it detects that the RPC reached
|
||||
* the server via the "gRPCLB fallback" path, and "backend" if it detects
|
||||
* that the RPC reached the server via "gRPCLB backend" path (i.e. if it got
|
||||
* the address of this server from the gRPCLB server BalanceLoad RPC). Exactly
|
||||
* how this detection is done is context and server dependent.
|
||||
*/
|
||||
export type GrpclbRouteType__Output = typeof GrpclbRouteType[keyof typeof GrpclbRouteType]
|
||||
|
|
|
@ -32,16 +32,19 @@ export interface LoadBalancerAccumulatedStatsResponse {
|
|||
/**
|
||||
* The total number of RPCs have ever issued for each type.
|
||||
* Deprecated: use stats_per_method.rpcs_started instead.
|
||||
* @deprecated
|
||||
*/
|
||||
'num_rpcs_started_by_method'?: ({[key: string]: number});
|
||||
/**
|
||||
* The total number of RPCs have ever completed successfully for each type.
|
||||
* Deprecated: use stats_per_method.result instead.
|
||||
* @deprecated
|
||||
*/
|
||||
'num_rpcs_succeeded_by_method'?: ({[key: string]: number});
|
||||
/**
|
||||
* The total number of RPCs have ever failed for each type.
|
||||
* Deprecated: use stats_per_method.result instead.
|
||||
* @deprecated
|
||||
*/
|
||||
'num_rpcs_failed_by_method'?: ({[key: string]: number});
|
||||
/**
|
||||
|
@ -58,21 +61,24 @@ export interface LoadBalancerAccumulatedStatsResponse__Output {
|
|||
/**
|
||||
* The total number of RPCs have ever issued for each type.
|
||||
* Deprecated: use stats_per_method.rpcs_started instead.
|
||||
* @deprecated
|
||||
*/
|
||||
'num_rpcs_started_by_method': ({[key: string]: number});
|
||||
/**
|
||||
* The total number of RPCs have ever completed successfully for each type.
|
||||
* Deprecated: use stats_per_method.result instead.
|
||||
* @deprecated
|
||||
*/
|
||||
'num_rpcs_succeeded_by_method': ({[key: string]: number});
|
||||
/**
|
||||
* The total number of RPCs have ever failed for each type.
|
||||
* Deprecated: use stats_per_method.result instead.
|
||||
* @deprecated
|
||||
*/
|
||||
'num_rpcs_failed_by_method': ({[key: string]: number});
|
||||
/**
|
||||
* Per-method RPC statistics. The key is the RpcType in string form; e.g.
|
||||
* 'EMPTY_CALL' or 'UNARY_CALL'
|
||||
*/
|
||||
'stats_per_method'?: ({[key: string]: _grpc_testing_LoadBalancerAccumulatedStatsResponse_MethodStats__Output});
|
||||
'stats_per_method': ({[key: string]: _grpc_testing_LoadBalancerAccumulatedStatsResponse_MethodStats__Output});
|
||||
}
|
||||
|
|
|
@ -36,5 +36,5 @@ export interface LoadBalancerStatsResponse__Output {
|
|||
* The number of RPCs that failed to record a remote peer.
|
||||
*/
|
||||
'num_failures': (number);
|
||||
'rpcs_by_method'?: ({[key: string]: _grpc_testing_LoadBalancerStatsResponse_RpcsByPeer__Output});
|
||||
'rpcs_by_method': ({[key: string]: _grpc_testing_LoadBalancerStatsResponse_RpcsByPeer__Output});
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Original file: proto/grpc/testing/test.proto
|
||||
|
||||
import type * as grpc from '@grpc/grpc-js'
|
||||
import type { MethodDefinition } from '@grpc/proto-loader'
|
||||
import type { LoadBalancerAccumulatedStatsRequest as _grpc_testing_LoadBalancerAccumulatedStatsRequest, LoadBalancerAccumulatedStatsRequest__Output as _grpc_testing_LoadBalancerAccumulatedStatsRequest__Output } from '../../grpc/testing/LoadBalancerAccumulatedStatsRequest';
|
||||
import type { LoadBalancerAccumulatedStatsResponse as _grpc_testing_LoadBalancerAccumulatedStatsResponse, LoadBalancerAccumulatedStatsResponse__Output as _grpc_testing_LoadBalancerAccumulatedStatsResponse__Output } from '../../grpc/testing/LoadBalancerAccumulatedStatsResponse';
|
||||
import type { LoadBalancerStatsRequest as _grpc_testing_LoadBalancerStatsRequest, LoadBalancerStatsRequest__Output as _grpc_testing_LoadBalancerStatsRequest__Output } from '../../grpc/testing/LoadBalancerStatsRequest';
|
||||
|
@ -13,32 +14,32 @@ export interface LoadBalancerStatsServiceClient extends grpc.Client {
|
|||
/**
|
||||
* Gets the accumulated stats for RPCs sent by a test client.
|
||||
*/
|
||||
GetClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerAccumulatedStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
GetClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerAccumulatedStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
GetClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerAccumulatedStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
GetClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerAccumulatedStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
GetClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_LoadBalancerAccumulatedStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
GetClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_LoadBalancerAccumulatedStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
GetClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_LoadBalancerAccumulatedStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
GetClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, callback: grpc.requestCallback<_grpc_testing_LoadBalancerAccumulatedStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
/**
|
||||
* Gets the accumulated stats for RPCs sent by a test client.
|
||||
*/
|
||||
getClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerAccumulatedStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
getClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerAccumulatedStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
getClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerAccumulatedStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
getClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerAccumulatedStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
getClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_LoadBalancerAccumulatedStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
getClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_LoadBalancerAccumulatedStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
getClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_LoadBalancerAccumulatedStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
getClientAccumulatedStats(argument: _grpc_testing_LoadBalancerAccumulatedStatsRequest, callback: grpc.requestCallback<_grpc_testing_LoadBalancerAccumulatedStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
/**
|
||||
* Gets the backend distribution for RPCs sent by a test client.
|
||||
*/
|
||||
GetClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
GetClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
GetClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
GetClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
GetClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_LoadBalancerStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
GetClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_LoadBalancerStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
GetClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_LoadBalancerStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
GetClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, callback: grpc.requestCallback<_grpc_testing_LoadBalancerStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
/**
|
||||
* Gets the backend distribution for RPCs sent by a test client.
|
||||
*/
|
||||
getClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
getClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
getClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
getClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, callback: (error?: grpc.ServiceError, result?: _grpc_testing_LoadBalancerStatsResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
getClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_LoadBalancerStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
getClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_LoadBalancerStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
getClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_LoadBalancerStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
getClientStats(argument: _grpc_testing_LoadBalancerStatsRequest, callback: grpc.requestCallback<_grpc_testing_LoadBalancerStatsResponse__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
}
|
||||
|
||||
|
@ -57,3 +58,8 @@ export interface LoadBalancerStatsServiceHandlers extends grpc.UntypedServiceImp
|
|||
GetClientStats: grpc.handleUnaryCall<_grpc_testing_LoadBalancerStatsRequest__Output, _grpc_testing_LoadBalancerStatsResponse>;
|
||||
|
||||
}
|
||||
|
||||
export interface LoadBalancerStatsServiceDefinition extends grpc.ServiceDefinition {
|
||||
GetClientAccumulatedStats: MethodDefinition<_grpc_testing_LoadBalancerAccumulatedStatsRequest, _grpc_testing_LoadBalancerAccumulatedStatsResponse, _grpc_testing_LoadBalancerAccumulatedStatsRequest__Output, _grpc_testing_LoadBalancerAccumulatedStatsResponse__Output>
|
||||
GetClientStats: MethodDefinition<_grpc_testing_LoadBalancerStatsRequest, _grpc_testing_LoadBalancerStatsResponse, _grpc_testing_LoadBalancerStatsRequest__Output, _grpc_testing_LoadBalancerStatsResponse__Output>
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Original file: proto/grpc/testing/messages.proto
|
||||
|
||||
import type { PayloadType as _grpc_testing_PayloadType } from '../../grpc/testing/PayloadType';
|
||||
import type { PayloadType as _grpc_testing_PayloadType, PayloadType__Output as _grpc_testing_PayloadType__Output } from '../../grpc/testing/PayloadType';
|
||||
|
||||
/**
|
||||
* A block of data, to simply increase gRPC message size.
|
||||
|
@ -9,7 +9,7 @@ export interface Payload {
|
|||
/**
|
||||
* The type of data in body.
|
||||
*/
|
||||
'type'?: (_grpc_testing_PayloadType | keyof typeof _grpc_testing_PayloadType);
|
||||
'type'?: (_grpc_testing_PayloadType);
|
||||
/**
|
||||
* Primary contents of payload.
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@ export interface Payload__Output {
|
|||
/**
|
||||
* The type of data in body.
|
||||
*/
|
||||
'type': (keyof typeof _grpc_testing_PayloadType);
|
||||
'type': (_grpc_testing_PayloadType__Output);
|
||||
/**
|
||||
* Primary contents of payload.
|
||||
*/
|
||||
|
|
|
@ -3,9 +3,24 @@
|
|||
/**
|
||||
* The type of payload that should be returned.
|
||||
*/
|
||||
export enum PayloadType {
|
||||
export const PayloadType = {
|
||||
/**
|
||||
* Compressable text format.
|
||||
*/
|
||||
COMPRESSABLE = 0,
|
||||
}
|
||||
COMPRESSABLE: 'COMPRESSABLE',
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* The type of payload that should be returned.
|
||||
*/
|
||||
export type PayloadType =
|
||||
/**
|
||||
* Compressable text format.
|
||||
*/
|
||||
| 'COMPRESSABLE'
|
||||
| 0
|
||||
|
||||
/**
|
||||
* The type of payload that should be returned.
|
||||
*/
|
||||
export type PayloadType__Output = typeof PayloadType[keyof typeof PayloadType]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Original file: proto/grpc/testing/test.proto
|
||||
|
||||
import type * as grpc from '@grpc/grpc-js'
|
||||
import type { MethodDefinition } from '@grpc/proto-loader'
|
||||
import type { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
|
||||
import type { ReconnectInfo as _grpc_testing_ReconnectInfo, ReconnectInfo__Output as _grpc_testing_ReconnectInfo__Output } from '../../grpc/testing/ReconnectInfo';
|
||||
import type { ReconnectParams as _grpc_testing_ReconnectParams, ReconnectParams__Output as _grpc_testing_ReconnectParams__Output } from '../../grpc/testing/ReconnectParams';
|
||||
|
@ -9,23 +10,23 @@ import type { ReconnectParams as _grpc_testing_ReconnectParams, ReconnectParams_
|
|||
* A service used to control reconnect server.
|
||||
*/
|
||||
export interface ReconnectServiceClient extends grpc.Client {
|
||||
Start(argument: _grpc_testing_ReconnectParams, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
Start(argument: _grpc_testing_ReconnectParams, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
Start(argument: _grpc_testing_ReconnectParams, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
Start(argument: _grpc_testing_ReconnectParams, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
start(argument: _grpc_testing_ReconnectParams, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
start(argument: _grpc_testing_ReconnectParams, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
start(argument: _grpc_testing_ReconnectParams, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
start(argument: _grpc_testing_ReconnectParams, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
Start(argument: _grpc_testing_ReconnectParams, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
Start(argument: _grpc_testing_ReconnectParams, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
Start(argument: _grpc_testing_ReconnectParams, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
Start(argument: _grpc_testing_ReconnectParams, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
start(argument: _grpc_testing_ReconnectParams, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
start(argument: _grpc_testing_ReconnectParams, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
start(argument: _grpc_testing_ReconnectParams, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
start(argument: _grpc_testing_ReconnectParams, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
Stop(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ReconnectInfo__Output) => void): grpc.ClientUnaryCall;
|
||||
Stop(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ReconnectInfo__Output) => void): grpc.ClientUnaryCall;
|
||||
Stop(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ReconnectInfo__Output) => void): grpc.ClientUnaryCall;
|
||||
Stop(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ReconnectInfo__Output) => void): grpc.ClientUnaryCall;
|
||||
stop(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ReconnectInfo__Output) => void): grpc.ClientUnaryCall;
|
||||
stop(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ReconnectInfo__Output) => void): grpc.ClientUnaryCall;
|
||||
stop(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ReconnectInfo__Output) => void): grpc.ClientUnaryCall;
|
||||
stop(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ReconnectInfo__Output) => void): grpc.ClientUnaryCall;
|
||||
Stop(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_ReconnectInfo__Output>): grpc.ClientUnaryCall;
|
||||
Stop(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_ReconnectInfo__Output>): grpc.ClientUnaryCall;
|
||||
Stop(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_ReconnectInfo__Output>): grpc.ClientUnaryCall;
|
||||
Stop(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_ReconnectInfo__Output>): grpc.ClientUnaryCall;
|
||||
stop(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_ReconnectInfo__Output>): grpc.ClientUnaryCall;
|
||||
stop(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_ReconnectInfo__Output>): grpc.ClientUnaryCall;
|
||||
stop(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_ReconnectInfo__Output>): grpc.ClientUnaryCall;
|
||||
stop(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_ReconnectInfo__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
}
|
||||
|
||||
|
@ -38,3 +39,8 @@ export interface ReconnectServiceHandlers extends grpc.UntypedServiceImplementat
|
|||
Stop: grpc.handleUnaryCall<_grpc_testing_Empty__Output, _grpc_testing_ReconnectInfo>;
|
||||
|
||||
}
|
||||
|
||||
export interface ReconnectServiceDefinition extends grpc.ServiceDefinition {
|
||||
Start: MethodDefinition<_grpc_testing_ReconnectParams, _grpc_testing_Empty, _grpc_testing_ReconnectParams__Output, _grpc_testing_Empty__Output>
|
||||
Stop: MethodDefinition<_grpc_testing_Empty, _grpc_testing_ReconnectInfo, _grpc_testing_Empty__Output, _grpc_testing_ReconnectInfo__Output>
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ export interface ResponseParameters {
|
|||
* implement the full compression tests by introspecting the call to verify
|
||||
* the response's compression status.
|
||||
*/
|
||||
'compressed'?: (_grpc_testing_BoolValue);
|
||||
'compressed'?: (_grpc_testing_BoolValue | null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,5 +43,5 @@ export interface ResponseParameters__Output {
|
|||
* implement the full compression tests by introspecting the call to verify
|
||||
* the response's compression status.
|
||||
*/
|
||||
'compressed'?: (_grpc_testing_BoolValue__Output);
|
||||
'compressed': (_grpc_testing_BoolValue__Output | null);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Original file: proto/grpc/testing/messages.proto
|
||||
|
||||
import type { PayloadType as _grpc_testing_PayloadType } from '../../grpc/testing/PayloadType';
|
||||
import type { PayloadType as _grpc_testing_PayloadType, PayloadType__Output as _grpc_testing_PayloadType__Output } from '../../grpc/testing/PayloadType';
|
||||
import type { Payload as _grpc_testing_Payload, Payload__Output as _grpc_testing_Payload__Output } from '../../grpc/testing/Payload';
|
||||
import type { BoolValue as _grpc_testing_BoolValue, BoolValue__Output as _grpc_testing_BoolValue__Output } from '../../grpc/testing/BoolValue';
|
||||
import type { EchoStatus as _grpc_testing_EchoStatus, EchoStatus__Output as _grpc_testing_EchoStatus__Output } from '../../grpc/testing/EchoStatus';
|
||||
|
@ -13,7 +13,7 @@ export interface SimpleRequest {
|
|||
* Desired payload type in the response from the server.
|
||||
* If response_type is RANDOM, server randomly chooses one from other formats.
|
||||
*/
|
||||
'response_type'?: (_grpc_testing_PayloadType | keyof typeof _grpc_testing_PayloadType);
|
||||
'response_type'?: (_grpc_testing_PayloadType);
|
||||
/**
|
||||
* Desired payload size in the response from the server.
|
||||
*/
|
||||
|
@ -21,7 +21,7 @@ export interface SimpleRequest {
|
|||
/**
|
||||
* Optional input payload sent along with the request.
|
||||
*/
|
||||
'payload'?: (_grpc_testing_Payload);
|
||||
'payload'?: (_grpc_testing_Payload | null);
|
||||
/**
|
||||
* Whether SimpleResponse should include username.
|
||||
*/
|
||||
|
@ -36,15 +36,15 @@ export interface SimpleRequest {
|
|||
* implement the full compression tests by introspecting the call to verify
|
||||
* the response's compression status.
|
||||
*/
|
||||
'response_compressed'?: (_grpc_testing_BoolValue);
|
||||
'response_compressed'?: (_grpc_testing_BoolValue | null);
|
||||
/**
|
||||
* Whether server should return a given status
|
||||
*/
|
||||
'response_status'?: (_grpc_testing_EchoStatus);
|
||||
'response_status'?: (_grpc_testing_EchoStatus | null);
|
||||
/**
|
||||
* Whether the server should expect this request to be compressed.
|
||||
*/
|
||||
'expect_compressed'?: (_grpc_testing_BoolValue);
|
||||
'expect_compressed'?: (_grpc_testing_BoolValue | null);
|
||||
/**
|
||||
* Whether SimpleResponse should include server_id.
|
||||
*/
|
||||
|
@ -63,7 +63,7 @@ export interface SimpleRequest__Output {
|
|||
* Desired payload type in the response from the server.
|
||||
* If response_type is RANDOM, server randomly chooses one from other formats.
|
||||
*/
|
||||
'response_type': (keyof typeof _grpc_testing_PayloadType);
|
||||
'response_type': (_grpc_testing_PayloadType__Output);
|
||||
/**
|
||||
* Desired payload size in the response from the server.
|
||||
*/
|
||||
|
@ -71,7 +71,7 @@ export interface SimpleRequest__Output {
|
|||
/**
|
||||
* Optional input payload sent along with the request.
|
||||
*/
|
||||
'payload'?: (_grpc_testing_Payload__Output);
|
||||
'payload': (_grpc_testing_Payload__Output | null);
|
||||
/**
|
||||
* Whether SimpleResponse should include username.
|
||||
*/
|
||||
|
@ -86,15 +86,15 @@ export interface SimpleRequest__Output {
|
|||
* implement the full compression tests by introspecting the call to verify
|
||||
* the response's compression status.
|
||||
*/
|
||||
'response_compressed'?: (_grpc_testing_BoolValue__Output);
|
||||
'response_compressed': (_grpc_testing_BoolValue__Output | null);
|
||||
/**
|
||||
* Whether server should return a given status
|
||||
*/
|
||||
'response_status'?: (_grpc_testing_EchoStatus__Output);
|
||||
'response_status': (_grpc_testing_EchoStatus__Output | null);
|
||||
/**
|
||||
* Whether the server should expect this request to be compressed.
|
||||
*/
|
||||
'expect_compressed'?: (_grpc_testing_BoolValue__Output);
|
||||
'expect_compressed': (_grpc_testing_BoolValue__Output | null);
|
||||
/**
|
||||
* Whether SimpleResponse should include server_id.
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Original file: proto/grpc/testing/messages.proto
|
||||
|
||||
import type { Payload as _grpc_testing_Payload, Payload__Output as _grpc_testing_Payload__Output } from '../../grpc/testing/Payload';
|
||||
import type { GrpclbRouteType as _grpc_testing_GrpclbRouteType } from '../../grpc/testing/GrpclbRouteType';
|
||||
import type { GrpclbRouteType as _grpc_testing_GrpclbRouteType, GrpclbRouteType__Output as _grpc_testing_GrpclbRouteType__Output } from '../../grpc/testing/GrpclbRouteType';
|
||||
|
||||
/**
|
||||
* Unary response, as configured by the request.
|
||||
|
@ -10,7 +10,7 @@ export interface SimpleResponse {
|
|||
/**
|
||||
* Payload to increase message size.
|
||||
*/
|
||||
'payload'?: (_grpc_testing_Payload);
|
||||
'payload'?: (_grpc_testing_Payload | null);
|
||||
/**
|
||||
* The user the request came from, for verifying authentication was
|
||||
* successful when the client expected it.
|
||||
|
@ -28,7 +28,7 @@ export interface SimpleResponse {
|
|||
/**
|
||||
* gRPCLB Path.
|
||||
*/
|
||||
'grpclb_route_type'?: (_grpc_testing_GrpclbRouteType | keyof typeof _grpc_testing_GrpclbRouteType);
|
||||
'grpclb_route_type'?: (_grpc_testing_GrpclbRouteType);
|
||||
/**
|
||||
* Server hostname.
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ export interface SimpleResponse__Output {
|
|||
/**
|
||||
* Payload to increase message size.
|
||||
*/
|
||||
'payload'?: (_grpc_testing_Payload__Output);
|
||||
'payload': (_grpc_testing_Payload__Output | null);
|
||||
/**
|
||||
* The user the request came from, for verifying authentication was
|
||||
* successful when the client expected it.
|
||||
|
@ -60,7 +60,7 @@ export interface SimpleResponse__Output {
|
|||
/**
|
||||
* gRPCLB Path.
|
||||
*/
|
||||
'grpclb_route_type': (keyof typeof _grpc_testing_GrpclbRouteType);
|
||||
'grpclb_route_type': (_grpc_testing_GrpclbRouteType__Output);
|
||||
/**
|
||||
* Server hostname.
|
||||
*/
|
||||
|
|
|
@ -10,14 +10,14 @@ export interface StreamingInputCallRequest {
|
|||
/**
|
||||
* Optional input payload sent along with the request.
|
||||
*/
|
||||
'payload'?: (_grpc_testing_Payload);
|
||||
'payload'?: (_grpc_testing_Payload | null);
|
||||
/**
|
||||
* Whether the server should expect this request to be compressed. This field
|
||||
* is "nullable" in order to interoperate seamlessly with servers not able to
|
||||
* implement the full compression tests by introspecting the call to verify
|
||||
* the request's compression status.
|
||||
*/
|
||||
'expect_compressed'?: (_grpc_testing_BoolValue);
|
||||
'expect_compressed'?: (_grpc_testing_BoolValue | null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,12 +27,12 @@ export interface StreamingInputCallRequest__Output {
|
|||
/**
|
||||
* Optional input payload sent along with the request.
|
||||
*/
|
||||
'payload'?: (_grpc_testing_Payload__Output);
|
||||
'payload': (_grpc_testing_Payload__Output | null);
|
||||
/**
|
||||
* Whether the server should expect this request to be compressed. This field
|
||||
* is "nullable" in order to interoperate seamlessly with servers not able to
|
||||
* implement the full compression tests by introspecting the call to verify
|
||||
* the request's compression status.
|
||||
*/
|
||||
'expect_compressed'?: (_grpc_testing_BoolValue__Output);
|
||||
'expect_compressed': (_grpc_testing_BoolValue__Output | null);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Original file: proto/grpc/testing/messages.proto
|
||||
|
||||
import type { PayloadType as _grpc_testing_PayloadType } from '../../grpc/testing/PayloadType';
|
||||
import type { PayloadType as _grpc_testing_PayloadType, PayloadType__Output as _grpc_testing_PayloadType__Output } from '../../grpc/testing/PayloadType';
|
||||
import type { ResponseParameters as _grpc_testing_ResponseParameters, ResponseParameters__Output as _grpc_testing_ResponseParameters__Output } from '../../grpc/testing/ResponseParameters';
|
||||
import type { Payload as _grpc_testing_Payload, Payload__Output as _grpc_testing_Payload__Output } from '../../grpc/testing/Payload';
|
||||
import type { EchoStatus as _grpc_testing_EchoStatus, EchoStatus__Output as _grpc_testing_EchoStatus__Output } from '../../grpc/testing/EchoStatus';
|
||||
|
@ -15,7 +15,7 @@ export interface StreamingOutputCallRequest {
|
|||
* might be of different types. This is to simulate a mixed type of payload
|
||||
* stream.
|
||||
*/
|
||||
'response_type'?: (_grpc_testing_PayloadType | keyof typeof _grpc_testing_PayloadType);
|
||||
'response_type'?: (_grpc_testing_PayloadType);
|
||||
/**
|
||||
* Configuration for each expected response message.
|
||||
*/
|
||||
|
@ -23,11 +23,11 @@ export interface StreamingOutputCallRequest {
|
|||
/**
|
||||
* Optional input payload sent along with the request.
|
||||
*/
|
||||
'payload'?: (_grpc_testing_Payload);
|
||||
'payload'?: (_grpc_testing_Payload | null);
|
||||
/**
|
||||
* Whether server should return a given status
|
||||
*/
|
||||
'response_status'?: (_grpc_testing_EchoStatus);
|
||||
'response_status'?: (_grpc_testing_EchoStatus | null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,7 @@ export interface StreamingOutputCallRequest__Output {
|
|||
* might be of different types. This is to simulate a mixed type of payload
|
||||
* stream.
|
||||
*/
|
||||
'response_type': (keyof typeof _grpc_testing_PayloadType);
|
||||
'response_type': (_grpc_testing_PayloadType__Output);
|
||||
/**
|
||||
* Configuration for each expected response message.
|
||||
*/
|
||||
|
@ -48,9 +48,9 @@ export interface StreamingOutputCallRequest__Output {
|
|||
/**
|
||||
* Optional input payload sent along with the request.
|
||||
*/
|
||||
'payload'?: (_grpc_testing_Payload__Output);
|
||||
'payload': (_grpc_testing_Payload__Output | null);
|
||||
/**
|
||||
* Whether server should return a given status
|
||||
*/
|
||||
'response_status'?: (_grpc_testing_EchoStatus__Output);
|
||||
'response_status': (_grpc_testing_EchoStatus__Output | null);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ export interface StreamingOutputCallResponse {
|
|||
/**
|
||||
* Payload to increase response size.
|
||||
*/
|
||||
'payload'?: (_grpc_testing_Payload);
|
||||
'payload'?: (_grpc_testing_Payload | null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,5 +19,5 @@ export interface StreamingOutputCallResponse__Output {
|
|||
/**
|
||||
* Payload to increase response size.
|
||||
*/
|
||||
'payload'?: (_grpc_testing_Payload__Output);
|
||||
'payload': (_grpc_testing_Payload__Output | null);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Original file: proto/grpc/testing/test.proto
|
||||
|
||||
import type * as grpc from '@grpc/grpc-js'
|
||||
import type { MethodDefinition } from '@grpc/proto-loader'
|
||||
import type { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
|
||||
import type { SimpleRequest as _grpc_testing_SimpleRequest, SimpleRequest__Output as _grpc_testing_SimpleRequest__Output } from '../../grpc/testing/SimpleRequest';
|
||||
import type { SimpleResponse as _grpc_testing_SimpleResponse, SimpleResponse__Output as _grpc_testing_SimpleResponse__Output } from '../../grpc/testing/SimpleResponse';
|
||||
|
@ -19,34 +20,34 @@ export interface TestServiceClient extends grpc.Client {
|
|||
* headers set such that a caching HTTP proxy (such as GFE) can
|
||||
* satisfy subsequent requests.
|
||||
*/
|
||||
CacheableUnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
CacheableUnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
CacheableUnaryCall(argument: _grpc_testing_SimpleRequest, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
CacheableUnaryCall(argument: _grpc_testing_SimpleRequest, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
CacheableUnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
CacheableUnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
CacheableUnaryCall(argument: _grpc_testing_SimpleRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
CacheableUnaryCall(argument: _grpc_testing_SimpleRequest, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
/**
|
||||
* One request followed by one response. Response has cache control
|
||||
* headers set such that a caching HTTP proxy (such as GFE) can
|
||||
* satisfy subsequent requests.
|
||||
*/
|
||||
cacheableUnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
cacheableUnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
cacheableUnaryCall(argument: _grpc_testing_SimpleRequest, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
cacheableUnaryCall(argument: _grpc_testing_SimpleRequest, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
cacheableUnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
cacheableUnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
cacheableUnaryCall(argument: _grpc_testing_SimpleRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
cacheableUnaryCall(argument: _grpc_testing_SimpleRequest, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
/**
|
||||
* One empty request followed by one empty response.
|
||||
*/
|
||||
EmptyCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
EmptyCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
EmptyCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
EmptyCall(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
EmptyCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
EmptyCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
EmptyCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
EmptyCall(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
/**
|
||||
* One empty request followed by one empty response.
|
||||
*/
|
||||
emptyCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
emptyCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
emptyCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
emptyCall(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
emptyCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
emptyCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
emptyCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
emptyCall(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
/**
|
||||
* A sequence of requests with each request served by the server immediately.
|
||||
|
@ -84,18 +85,18 @@ export interface TestServiceClient extends grpc.Client {
|
|||
* A sequence of requests followed by one response (streamed upload).
|
||||
* The server returns the aggregated size of client payload as the result.
|
||||
*/
|
||||
StreamingInputCall(metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
StreamingInputCall(metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
StreamingInputCall(options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
StreamingInputCall(callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
StreamingInputCall(metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_StreamingInputCallResponse__Output>): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
StreamingInputCall(metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_StreamingInputCallResponse__Output>): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
StreamingInputCall(options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_StreamingInputCallResponse__Output>): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
StreamingInputCall(callback: grpc.requestCallback<_grpc_testing_StreamingInputCallResponse__Output>): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
/**
|
||||
* A sequence of requests followed by one response (streamed upload).
|
||||
* The server returns the aggregated size of client payload as the result.
|
||||
*/
|
||||
streamingInputCall(metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
streamingInputCall(metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
streamingInputCall(options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
streamingInputCall(callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
streamingInputCall(metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_StreamingInputCallResponse__Output>): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
streamingInputCall(metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_StreamingInputCallResponse__Output>): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
streamingInputCall(options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_StreamingInputCallResponse__Output>): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
streamingInputCall(callback: grpc.requestCallback<_grpc_testing_StreamingInputCallResponse__Output>): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallRequest>;
|
||||
|
||||
/**
|
||||
* One request followed by a sequence of responses (streamed download).
|
||||
|
@ -113,34 +114,34 @@ export interface TestServiceClient extends grpc.Client {
|
|||
/**
|
||||
* One request followed by one response.
|
||||
*/
|
||||
UnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
UnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
UnaryCall(argument: _grpc_testing_SimpleRequest, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
UnaryCall(argument: _grpc_testing_SimpleRequest, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
UnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
UnaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
UnaryCall(argument: _grpc_testing_SimpleRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
UnaryCall(argument: _grpc_testing_SimpleRequest, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
/**
|
||||
* One request followed by one response.
|
||||
*/
|
||||
unaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
unaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
unaryCall(argument: _grpc_testing_SimpleRequest, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
unaryCall(argument: _grpc_testing_SimpleRequest, callback: (error?: grpc.ServiceError, result?: _grpc_testing_SimpleResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
unaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
unaryCall(argument: _grpc_testing_SimpleRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
unaryCall(argument: _grpc_testing_SimpleRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
unaryCall(argument: _grpc_testing_SimpleRequest, callback: grpc.requestCallback<_grpc_testing_SimpleResponse__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
/**
|
||||
* The test server will not implement this method. It will be used
|
||||
* to test the behavior when clients call unimplemented methods.
|
||||
*/
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
/**
|
||||
* The test server will not implement this method. It will be used
|
||||
* to test the behavior when clients call unimplemented methods.
|
||||
*/
|
||||
unimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
}
|
||||
|
||||
|
@ -200,3 +201,14 @@ export interface TestServiceHandlers extends grpc.UntypedServiceImplementation {
|
|||
UnimplementedCall: grpc.handleUnaryCall<_grpc_testing_Empty__Output, _grpc_testing_Empty>;
|
||||
|
||||
}
|
||||
|
||||
export interface TestServiceDefinition extends grpc.ServiceDefinition {
|
||||
CacheableUnaryCall: MethodDefinition<_grpc_testing_SimpleRequest, _grpc_testing_SimpleResponse, _grpc_testing_SimpleRequest__Output, _grpc_testing_SimpleResponse__Output>
|
||||
EmptyCall: MethodDefinition<_grpc_testing_Empty, _grpc_testing_Empty, _grpc_testing_Empty__Output, _grpc_testing_Empty__Output>
|
||||
FullDuplexCall: MethodDefinition<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse, _grpc_testing_StreamingOutputCallRequest__Output, _grpc_testing_StreamingOutputCallResponse__Output>
|
||||
HalfDuplexCall: MethodDefinition<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse, _grpc_testing_StreamingOutputCallRequest__Output, _grpc_testing_StreamingOutputCallResponse__Output>
|
||||
StreamingInputCall: MethodDefinition<_grpc_testing_StreamingInputCallRequest, _grpc_testing_StreamingInputCallResponse, _grpc_testing_StreamingInputCallRequest__Output, _grpc_testing_StreamingInputCallResponse__Output>
|
||||
StreamingOutputCall: MethodDefinition<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse, _grpc_testing_StreamingOutputCallRequest__Output, _grpc_testing_StreamingOutputCallResponse__Output>
|
||||
UnaryCall: MethodDefinition<_grpc_testing_SimpleRequest, _grpc_testing_SimpleResponse, _grpc_testing_SimpleRequest__Output, _grpc_testing_SimpleResponse__Output>
|
||||
UnimplementedCall: MethodDefinition<_grpc_testing_Empty, _grpc_testing_Empty, _grpc_testing_Empty__Output, _grpc_testing_Empty__Output>
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Original file: proto/grpc/testing/test.proto
|
||||
|
||||
import type * as grpc from '@grpc/grpc-js'
|
||||
import type { MethodDefinition } from '@grpc/proto-loader'
|
||||
import type { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
|
||||
|
||||
/**
|
||||
|
@ -11,17 +12,17 @@ export interface UnimplementedServiceClient extends grpc.Client {
|
|||
/**
|
||||
* A call that no server should implement
|
||||
*/
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
UnimplementedCall(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
/**
|
||||
* A call that no server should implement
|
||||
*/
|
||||
unimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
unimplementedCall(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,3 +37,7 @@ export interface UnimplementedServiceHandlers extends grpc.UntypedServiceImpleme
|
|||
UnimplementedCall: grpc.handleUnaryCall<_grpc_testing_Empty__Output, _grpc_testing_Empty>;
|
||||
|
||||
}
|
||||
|
||||
export interface UnimplementedServiceDefinition extends grpc.ServiceDefinition {
|
||||
UnimplementedCall: MethodDefinition<_grpc_testing_Empty, _grpc_testing_Empty, _grpc_testing_Empty__Output, _grpc_testing_Empty__Output>
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Original file: proto/grpc/testing/test.proto
|
||||
|
||||
import type * as grpc from '@grpc/grpc-js'
|
||||
import type { MethodDefinition } from '@grpc/proto-loader'
|
||||
import type { ClientConfigureRequest as _grpc_testing_ClientConfigureRequest, ClientConfigureRequest__Output as _grpc_testing_ClientConfigureRequest__Output } from '../../grpc/testing/ClientConfigureRequest';
|
||||
import type { ClientConfigureResponse as _grpc_testing_ClientConfigureResponse, ClientConfigureResponse__Output as _grpc_testing_ClientConfigureResponse__Output } from '../../grpc/testing/ClientConfigureResponse';
|
||||
|
||||
|
@ -11,17 +12,17 @@ export interface XdsUpdateClientConfigureServiceClient extends grpc.Client {
|
|||
/**
|
||||
* Update the tes client's configuration.
|
||||
*/
|
||||
Configure(argument: _grpc_testing_ClientConfigureRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ClientConfigureResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
Configure(argument: _grpc_testing_ClientConfigureRequest, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ClientConfigureResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
Configure(argument: _grpc_testing_ClientConfigureRequest, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ClientConfigureResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
Configure(argument: _grpc_testing_ClientConfigureRequest, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ClientConfigureResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
Configure(argument: _grpc_testing_ClientConfigureRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_ClientConfigureResponse__Output>): grpc.ClientUnaryCall;
|
||||
Configure(argument: _grpc_testing_ClientConfigureRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_ClientConfigureResponse__Output>): grpc.ClientUnaryCall;
|
||||
Configure(argument: _grpc_testing_ClientConfigureRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_ClientConfigureResponse__Output>): grpc.ClientUnaryCall;
|
||||
Configure(argument: _grpc_testing_ClientConfigureRequest, callback: grpc.requestCallback<_grpc_testing_ClientConfigureResponse__Output>): grpc.ClientUnaryCall;
|
||||
/**
|
||||
* Update the tes client's configuration.
|
||||
*/
|
||||
configure(argument: _grpc_testing_ClientConfigureRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ClientConfigureResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
configure(argument: _grpc_testing_ClientConfigureRequest, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ClientConfigureResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
configure(argument: _grpc_testing_ClientConfigureRequest, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ClientConfigureResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
configure(argument: _grpc_testing_ClientConfigureRequest, callback: (error?: grpc.ServiceError, result?: _grpc_testing_ClientConfigureResponse__Output) => void): grpc.ClientUnaryCall;
|
||||
configure(argument: _grpc_testing_ClientConfigureRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_ClientConfigureResponse__Output>): grpc.ClientUnaryCall;
|
||||
configure(argument: _grpc_testing_ClientConfigureRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_ClientConfigureResponse__Output>): grpc.ClientUnaryCall;
|
||||
configure(argument: _grpc_testing_ClientConfigureRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_ClientConfigureResponse__Output>): grpc.ClientUnaryCall;
|
||||
configure(argument: _grpc_testing_ClientConfigureRequest, callback: grpc.requestCallback<_grpc_testing_ClientConfigureResponse__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
}
|
||||
|
||||
|
@ -35,3 +36,7 @@ export interface XdsUpdateClientConfigureServiceHandlers extends grpc.UntypedSer
|
|||
Configure: grpc.handleUnaryCall<_grpc_testing_ClientConfigureRequest__Output, _grpc_testing_ClientConfigureResponse>;
|
||||
|
||||
}
|
||||
|
||||
export interface XdsUpdateClientConfigureServiceDefinition extends grpc.ServiceDefinition {
|
||||
Configure: MethodDefinition<_grpc_testing_ClientConfigureRequest, _grpc_testing_ClientConfigureResponse, _grpc_testing_ClientConfigureRequest__Output, _grpc_testing_ClientConfigureResponse__Output>
|
||||
}
|
||||
|
|
|
@ -1,29 +1,30 @@
|
|||
// Original file: proto/grpc/testing/test.proto
|
||||
|
||||
import type * as grpc from '@grpc/grpc-js'
|
||||
import type { MethodDefinition } from '@grpc/proto-loader'
|
||||
import type { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
|
||||
|
||||
/**
|
||||
* A service to remotely control health status of an xDS test server.
|
||||
*/
|
||||
export interface XdsUpdateHealthServiceClient extends grpc.Client {
|
||||
SetNotServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
SetNotServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
SetNotServing(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
SetNotServing(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
setNotServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
setNotServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
setNotServing(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
setNotServing(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
SetNotServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
SetNotServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
SetNotServing(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
SetNotServing(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
setNotServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
setNotServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
setNotServing(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
setNotServing(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
SetServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
SetServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
SetServing(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
SetServing(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
setServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
setServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
setServing(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
setServing(argument: _grpc_testing_Empty, callback: (error?: grpc.ServiceError, result?: _grpc_testing_Empty__Output) => void): grpc.ClientUnaryCall;
|
||||
SetServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
SetServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
SetServing(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
SetServing(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
setServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
setServing(argument: _grpc_testing_Empty, metadata: grpc.Metadata, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
setServing(argument: _grpc_testing_Empty, options: grpc.CallOptions, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
setServing(argument: _grpc_testing_Empty, callback: grpc.requestCallback<_grpc_testing_Empty__Output>): grpc.ClientUnaryCall;
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,3 +37,8 @@ export interface XdsUpdateHealthServiceHandlers extends grpc.UntypedServiceImple
|
|||
SetServing: grpc.handleUnaryCall<_grpc_testing_Empty__Output, _grpc_testing_Empty>;
|
||||
|
||||
}
|
||||
|
||||
export interface XdsUpdateHealthServiceDefinition extends grpc.ServiceDefinition {
|
||||
SetNotServing: MethodDefinition<_grpc_testing_Empty, _grpc_testing_Empty, _grpc_testing_Empty__Output, _grpc_testing_Empty__Output>
|
||||
SetServing: MethodDefinition<_grpc_testing_Empty, _grpc_testing_Empty, _grpc_testing_Empty__Output, _grpc_testing_Empty__Output>
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import type * as grpc from '@grpc/grpc-js';
|
||||
import type { ServiceDefinition, EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
|
||||
import type { EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
|
||||
|
||||
import type { LoadBalancerStatsServiceClient as _grpc_testing_LoadBalancerStatsServiceClient } from './grpc/testing/LoadBalancerStatsService';
|
||||
import type { ReconnectServiceClient as _grpc_testing_ReconnectServiceClient } from './grpc/testing/ReconnectService';
|
||||
import type { TestServiceClient as _grpc_testing_TestServiceClient } from './grpc/testing/TestService';
|
||||
import type { UnimplementedServiceClient as _grpc_testing_UnimplementedServiceClient } from './grpc/testing/UnimplementedService';
|
||||
import type { XdsUpdateClientConfigureServiceClient as _grpc_testing_XdsUpdateClientConfigureServiceClient } from './grpc/testing/XdsUpdateClientConfigureService';
|
||||
import type { XdsUpdateHealthServiceClient as _grpc_testing_XdsUpdateHealthServiceClient } from './grpc/testing/XdsUpdateHealthService';
|
||||
import type { LoadBalancerStatsServiceClient as _grpc_testing_LoadBalancerStatsServiceClient, LoadBalancerStatsServiceDefinition as _grpc_testing_LoadBalancerStatsServiceDefinition } from './grpc/testing/LoadBalancerStatsService';
|
||||
import type { ReconnectServiceClient as _grpc_testing_ReconnectServiceClient, ReconnectServiceDefinition as _grpc_testing_ReconnectServiceDefinition } from './grpc/testing/ReconnectService';
|
||||
import type { TestServiceClient as _grpc_testing_TestServiceClient, TestServiceDefinition as _grpc_testing_TestServiceDefinition } from './grpc/testing/TestService';
|
||||
import type { UnimplementedServiceClient as _grpc_testing_UnimplementedServiceClient, UnimplementedServiceDefinition as _grpc_testing_UnimplementedServiceDefinition } from './grpc/testing/UnimplementedService';
|
||||
import type { XdsUpdateClientConfigureServiceClient as _grpc_testing_XdsUpdateClientConfigureServiceClient, XdsUpdateClientConfigureServiceDefinition as _grpc_testing_XdsUpdateClientConfigureServiceDefinition } from './grpc/testing/XdsUpdateClientConfigureService';
|
||||
import type { XdsUpdateHealthServiceClient as _grpc_testing_XdsUpdateHealthServiceClient, XdsUpdateHealthServiceDefinition as _grpc_testing_XdsUpdateHealthServiceDefinition } from './grpc/testing/XdsUpdateHealthService';
|
||||
|
||||
type SubtypeConstructor<Constructor extends new (...args: any) => any, Subtype> = {
|
||||
new(...args: ConstructorParameters<Constructor>): Subtype;
|
||||
|
@ -28,7 +28,7 @@ export interface ProtoGrpcType {
|
|||
/**
|
||||
* A service used to obtain stats for verifying LB behavior.
|
||||
*/
|
||||
LoadBalancerStatsService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_LoadBalancerStatsServiceClient> & { service: ServiceDefinition }
|
||||
LoadBalancerStatsService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_LoadBalancerStatsServiceClient> & { service: _grpc_testing_LoadBalancerStatsServiceDefinition }
|
||||
Payload: MessageTypeDefinition
|
||||
PayloadType: EnumTypeDefinition
|
||||
ReconnectInfo: MessageTypeDefinition
|
||||
|
@ -36,7 +36,7 @@ export interface ProtoGrpcType {
|
|||
/**
|
||||
* A service used to control reconnect server.
|
||||
*/
|
||||
ReconnectService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_ReconnectServiceClient> & { service: ServiceDefinition }
|
||||
ReconnectService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_ReconnectServiceClient> & { service: _grpc_testing_ReconnectServiceDefinition }
|
||||
ResponseParameters: MessageTypeDefinition
|
||||
SimpleRequest: MessageTypeDefinition
|
||||
SimpleResponse: MessageTypeDefinition
|
||||
|
@ -48,20 +48,20 @@ export interface ProtoGrpcType {
|
|||
* A simple service to test the various types of RPCs and experiment with
|
||||
* performance with various types of payload.
|
||||
*/
|
||||
TestService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_TestServiceClient> & { service: ServiceDefinition }
|
||||
TestService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_TestServiceClient> & { service: _grpc_testing_TestServiceDefinition }
|
||||
/**
|
||||
* A simple service NOT implemented at servers so clients can test for
|
||||
* that case.
|
||||
*/
|
||||
UnimplementedService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_UnimplementedServiceClient> & { service: ServiceDefinition }
|
||||
UnimplementedService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_UnimplementedServiceClient> & { service: _grpc_testing_UnimplementedServiceDefinition }
|
||||
/**
|
||||
* A service to dynamically update the configuration of an xDS test client.
|
||||
*/
|
||||
XdsUpdateClientConfigureService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_XdsUpdateClientConfigureServiceClient> & { service: ServiceDefinition }
|
||||
XdsUpdateClientConfigureService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_XdsUpdateClientConfigureServiceClient> & { service: _grpc_testing_XdsUpdateClientConfigureServiceDefinition }
|
||||
/**
|
||||
* A service to remotely control health status of an xDS test server.
|
||||
*/
|
||||
XdsUpdateHealthService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_XdsUpdateHealthServiceClient> & { service: ServiceDefinition }
|
||||
XdsUpdateHealthService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_XdsUpdateHealthServiceClient> & { service: _grpc_testing_XdsUpdateHealthServiceDefinition }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
# Dockerfile for building the xDS interop client. To build the image, run the
|
||||
# following command from grpc-node directory:
|
||||
# docker build -t <TAG> -f packages/grpc-js-xds/interop/Dockerfile .
|
||||
# docker build -t <TAG> -f packages/grpc-js-xds/interop/test-client.Dockerfile .
|
||||
|
||||
FROM node:18-slim as build
|
||||
|
||||
|
@ -22,17 +22,27 @@ FROM node:18-slim as build
|
|||
WORKDIR /node/src/grpc-node
|
||||
COPY . .
|
||||
|
||||
WORKDIR /node/src/grpc-node/packages/proto-loader
|
||||
RUN npm install
|
||||
WORKDIR /node/src/grpc-node/packages/grpc-js
|
||||
RUN npm install
|
||||
WORKDIR /node/src/grpc-node/packages/grpc-health-check
|
||||
RUN npm install
|
||||
WORKDIR /node/src/grpc-node/packages/grpc-reflection
|
||||
RUN npm install
|
||||
WORKDIR /node/src/grpc-node/packages/grpc-js-xds
|
||||
RUN npm install
|
||||
|
||||
FROM gcr.io/distroless/nodejs18-debian11:latest
|
||||
WORKDIR /node/src/grpc-node
|
||||
COPY --from=build /node/src/grpc-node/packages/proto-loader ./packages/proto-loader/
|
||||
COPY --from=build /node/src/grpc-node/packages/grpc-health-check ./packages/grpc-health-check/
|
||||
COPY --from=build /node/src/grpc-node/packages/grpc-reflection ./packages/grpc-reflection/
|
||||
COPY --from=build /node/src/grpc-node/packages/grpc-js ./packages/grpc-js/
|
||||
COPY --from=build /node/src/grpc-node/packages/grpc-js-xds ./packages/grpc-js-xds/
|
||||
|
||||
ENV GRPC_VERBOSITY="DEBUG"
|
||||
ENV GRPC_TRACE=xds_client,xds_resolver,xds_cluster_manager,cds_balancer,xds_cluster_resolver,xds_cluster_impl,priority,weighted_target,round_robin,resolving_load_balancer,subchannel,keepalive,dns_resolver,fault_injection,http_filter,csds,outlier_detection,server,server_call
|
||||
ENV GRPC_TRACE=xds_client,xds_resolver,xds_cluster_manager,cds_balancer,xds_cluster_resolver,xds_cluster_impl,priority,weighted_target,round_robin,resolving_load_balancer,subchannel,keepalive,dns_resolver,fault_injection,http_filter,csds,outlier_detection,server,server_call,ring_hash,transport,certificate_provider,xds_channel_credentials
|
||||
ENV NODE_XDS_INTEROP_VERBOSITY=1
|
||||
|
||||
ENTRYPOINT [ "/nodejs/bin/node", "/node/src/grpc-node/packages/grpc-js-xds/build/interop/xds-interop-client" ]
|
|
@ -0,0 +1,54 @@
|
|||
# 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.
|
||||
|
||||
# Dockerfile for building the xDS interop client. To build the image, run the
|
||||
# following command from grpc-node directory:
|
||||
# docker build -t <TAG> -f packages/grpc-js-xds/interop/test-server.Dockerfile .
|
||||
|
||||
FROM node:18-slim as build
|
||||
|
||||
# Make a grpc-node directory and copy the repo into it.
|
||||
WORKDIR /node/src/grpc-node
|
||||
COPY . .
|
||||
|
||||
WORKDIR /node/src/grpc-node/packages/proto-loader
|
||||
RUN npm install
|
||||
WORKDIR /node/src/grpc-node/packages/grpc-js
|
||||
RUN npm install
|
||||
WORKDIR /node/src/grpc-node/packages/grpc-health-check
|
||||
RUN npm install
|
||||
WORKDIR /node/src/grpc-node/packages/grpc-reflection
|
||||
RUN npm install
|
||||
WORKDIR /node/src/grpc-node/packages/grpc-js-xds
|
||||
RUN npm install
|
||||
|
||||
ENV TINI_VERSION v0.19.0
|
||||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
|
||||
RUN chmod +x /tini
|
||||
|
||||
FROM gcr.io/distroless/nodejs18-debian11:latest
|
||||
WORKDIR /node/src/grpc-node
|
||||
COPY --from=build /node/src/grpc-node/packages/proto-loader ./packages/proto-loader/
|
||||
COPY --from=build /node/src/grpc-node/packages/grpc-health-check ./packages/grpc-health-check/
|
||||
COPY --from=build /node/src/grpc-node/packages/grpc-reflection ./packages/grpc-reflection/
|
||||
COPY --from=build /node/src/grpc-node/packages/grpc-js ./packages/grpc-js/
|
||||
COPY --from=build /node/src/grpc-node/packages/grpc-js-xds ./packages/grpc-js-xds/
|
||||
|
||||
ENV GRPC_VERBOSITY="DEBUG"
|
||||
ENV GRPC_TRACE=xds_client,server,xds_server,http_filter,certificate_provider,rbac_filter
|
||||
|
||||
# tini serves as PID 1 and enables the server to properly respond to signals.
|
||||
COPY --from=build /tini /tini
|
||||
|
||||
ENTRYPOINT [ "/tini", "-g", "-vv", "--", "/nodejs/bin/node", "/node/src/grpc-node/packages/grpc-js-xds/build/interop/xds-interop-server" ]
|
|
@ -30,8 +30,100 @@ import { XdsUpdateClientConfigureServiceHandlers } from './generated/grpc/testin
|
|||
import { Empty__Output } from './generated/grpc/testing/Empty';
|
||||
import { LoadBalancerAccumulatedStatsResponse } from './generated/grpc/testing/LoadBalancerAccumulatedStatsResponse';
|
||||
|
||||
import TypedLoadBalancingConfig = grpc.experimental.TypedLoadBalancingConfig;
|
||||
import LoadBalancer = grpc.experimental.LoadBalancer;
|
||||
import ChannelControlHelper = grpc.experimental.ChannelControlHelper;
|
||||
import ChildLoadBalancerHandler = grpc.experimental.ChildLoadBalancerHandler;
|
||||
import Endpoint = grpc.experimental.Endpoint;
|
||||
import Picker = grpc.experimental.Picker;
|
||||
import PickArgs = grpc.experimental.PickArgs;
|
||||
import PickResult = grpc.experimental.PickResult;
|
||||
import PickResultType = grpc.experimental.PickResultType;
|
||||
import createChildChannelControlHelper = grpc.experimental.createChildChannelControlHelper;
|
||||
import parseLoadBalancingConfig = grpc.experimental.parseLoadBalancingConfig;
|
||||
import StatusOr = grpc.experimental.StatusOr;
|
||||
import { ChannelOptions } from '@grpc/grpc-js';
|
||||
|
||||
grpc_xds.register();
|
||||
|
||||
const LB_POLICY_NAME = 'test.RpcBehaviorLoadBalancer';
|
||||
|
||||
class RpcBehaviorLoadBalancingConfig implements TypedLoadBalancingConfig {
|
||||
constructor(private rpcBehavior: string) {}
|
||||
getLoadBalancerName(): string {
|
||||
return LB_POLICY_NAME;
|
||||
}
|
||||
toJsonObject(): object {
|
||||
return {
|
||||
[LB_POLICY_NAME]: {
|
||||
'rpcBehavior': this.rpcBehavior
|
||||
}
|
||||
};
|
||||
}
|
||||
getRpcBehavior() {
|
||||
return this.rpcBehavior;
|
||||
}
|
||||
static createFromJson(obj: any): RpcBehaviorLoadBalancingConfig {
|
||||
if (!('rpcBehavior' in obj && typeof obj.rpcBehavior === 'string')) {
|
||||
throw new Error(`${LB_POLICY_NAME} parsing error: expected string field rpcBehavior`);
|
||||
}
|
||||
return new RpcBehaviorLoadBalancingConfig(obj.rpcBehavior);
|
||||
}
|
||||
}
|
||||
|
||||
class RpcBehaviorPicker implements Picker {
|
||||
constructor(private wrappedPicker: Picker, private rpcBehavior: string) {}
|
||||
pick(pickArgs: PickArgs): PickResult {
|
||||
const wrappedPick = this.wrappedPicker.pick(pickArgs);
|
||||
if (wrappedPick.pickResultType === PickResultType.COMPLETE) {
|
||||
pickArgs.metadata.add('rpc-behavior', this.rpcBehavior);
|
||||
}
|
||||
return wrappedPick;
|
||||
}
|
||||
}
|
||||
|
||||
const RPC_BEHAVIOR_CHILD_CONFIG = parseLoadBalancingConfig({round_robin: {}});
|
||||
|
||||
/**
|
||||
* Load balancer implementation for Custom LB policy test
|
||||
*/
|
||||
class RpcBehaviorLoadBalancer implements LoadBalancer {
|
||||
private child: ChildLoadBalancerHandler;
|
||||
private latestConfig: RpcBehaviorLoadBalancingConfig | null = null;
|
||||
constructor(channelControlHelper: ChannelControlHelper) {
|
||||
const childChannelControlHelper = createChildChannelControlHelper(channelControlHelper, {
|
||||
updateState: (connectivityState, picker, errorMessage) => {
|
||||
if (connectivityState === grpc.connectivityState.READY && this.latestConfig) {
|
||||
picker = new RpcBehaviorPicker(picker, this.latestConfig.getRpcBehavior());
|
||||
}
|
||||
channelControlHelper.updateState(connectivityState, picker, errorMessage);
|
||||
}
|
||||
});
|
||||
this.child = new ChildLoadBalancerHandler(childChannelControlHelper);
|
||||
}
|
||||
updateAddressList(endpointList: StatusOr<Endpoint[]>, lbConfig: TypedLoadBalancingConfig, options: ChannelOptions, resolutionNote: string): boolean {
|
||||
if (!(lbConfig instanceof RpcBehaviorLoadBalancingConfig)) {
|
||||
return false;
|
||||
}
|
||||
this.latestConfig = lbConfig;
|
||||
return this.child.updateAddressList(endpointList, RPC_BEHAVIOR_CHILD_CONFIG, options, resolutionNote);
|
||||
}
|
||||
exitIdle(): void {
|
||||
this.child.exitIdle();
|
||||
}
|
||||
resetBackoff(): void {
|
||||
this.child.resetBackoff();
|
||||
}
|
||||
destroy(): void {
|
||||
this.child.destroy();
|
||||
}
|
||||
getTypeName(): string {
|
||||
return LB_POLICY_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
grpc.experimental.registerLoadBalancerType(LB_POLICY_NAME, RpcBehaviorLoadBalancer, RpcBehaviorLoadBalancingConfig);
|
||||
|
||||
const packageDefinition = protoLoader.loadSync('grpc/testing/test.proto', {
|
||||
keepCase: true,
|
||||
defaults: true,
|
||||
|
@ -91,7 +183,7 @@ class CallSubscriber {
|
|||
}
|
||||
if (peerName in this.callsSucceededByPeer) {
|
||||
this.callsSucceededByPeer[peerName] += 1;
|
||||
} else {
|
||||
} else {
|
||||
this.callsSucceededByPeer[peerName] = 1;
|
||||
}
|
||||
this.callsSucceeded += 1;
|
||||
|
@ -308,7 +400,7 @@ function makeSingleRequest(client: TestServiceClient, type: CallType, failOnFail
|
|||
const startTime = process.hrtime.bigint();
|
||||
const deadline = new Date();
|
||||
deadline.setSeconds(deadline.getSeconds() + currentConfig.timeoutSec);
|
||||
const callback = (error: grpc.ServiceError | undefined, value: Empty__Output | undefined) => {
|
||||
const callback = (error: grpc.ServiceError | null, value: Empty__Output | undefined) => {
|
||||
const statusCode = error?.code ?? grpc.status.OK;
|
||||
const duration = process.hrtime.bigint() - startTime;
|
||||
const durationSeconds = Number(duration / TIMESTAMP_ONE_SECOND) | 0;
|
||||
|
@ -377,9 +469,11 @@ function sendConstantQps(client: TestServiceClient, qps: number, failOnFailedRpc
|
|||
makeSingleRequest(client, callType, failOnFailedRpcs, callStatsTracker, callStartTimestampsTrackers[callType]);
|
||||
}
|
||||
}, 1000/qps);
|
||||
setInterval(() => {
|
||||
console.log(`Accumulated stats: ${JSON.stringify(accumulatedStats, undefined, 2)}`);
|
||||
}, 1000);
|
||||
if (VERBOSITY >= 2) {
|
||||
setInterval(() => {
|
||||
console.log(`Accumulated stats: ${JSON.stringify(accumulatedStats, undefined, 2)}`);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
const callTypeEnumMap = {
|
||||
|
@ -426,9 +520,11 @@ function main() {
|
|||
* channels do not share any subchannels. It does not have any
|
||||
* inherent function. */
|
||||
console.log(`Interop client channel ${i} starting sending ${argv.qps} QPS to ${argv.server}`);
|
||||
sendConstantQps(new loadedProto.grpc.testing.TestService(argv.server, grpc.credentials.createInsecure(), {'unique': i}),
|
||||
argv.qps,
|
||||
argv.fail_on_failed_rpcs === 'true',
|
||||
const insecureCreds = grpc.credentials.createInsecure();
|
||||
const creds = new grpc_xds.XdsChannelCredentials(insecureCreds);
|
||||
sendConstantQps(new loadedProto.grpc.testing.TestService(argv.server, creds, {'unique': i}),
|
||||
argv.qps,
|
||||
argv.fail_on_failed_rpcs === 'true',
|
||||
callStatsTracker);
|
||||
}
|
||||
|
||||
|
@ -486,4 +582,4 @@ function main() {
|
|||
|
||||
if (require.main === module) {
|
||||
main();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,314 @@
|
|||
/*
|
||||
* Copyright 2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
import * as grpc from '@grpc/grpc-js';
|
||||
|
||||
import * as grpc_xds from '../src';
|
||||
|
||||
import { ProtoGrpcType } from './generated/test';
|
||||
|
||||
import * as protoLoader from '@grpc/proto-loader';
|
||||
import * as yargs from 'yargs';
|
||||
import * as os from 'os';
|
||||
import { HealthImplementation } from 'grpc-health-check';
|
||||
import { Empty__Output, Empty } from './generated/grpc/testing/Empty';
|
||||
import { SimpleRequest__Output } from './generated/grpc/testing/SimpleRequest';
|
||||
import { SimpleResponse } from './generated/grpc/testing/SimpleResponse';
|
||||
import { ReflectionService } from '@grpc/reflection';
|
||||
|
||||
grpc_xds.register();
|
||||
|
||||
const packageDefinition = protoLoader.loadSync('grpc/testing/test.proto', {
|
||||
keepCase: true,
|
||||
defaults: true,
|
||||
oneofs: true,
|
||||
json: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
includeDirs: [__dirname + '/../../proto']
|
||||
});
|
||||
|
||||
const loadedProto = grpc.loadPackageDefinition(packageDefinition) as unknown as ProtoGrpcType;
|
||||
|
||||
function setAsyncTimeout(delayMs: number): Promise<void> {
|
||||
return new Promise<void>(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, delayMs);
|
||||
});
|
||||
}
|
||||
|
||||
const HOSTNAME = os.hostname();
|
||||
|
||||
const TEST_SERVICE_NAME = '/grpc.testing.TestService/';
|
||||
|
||||
function testInfoInterceptor(methodDescriptor: grpc.ServerMethodDefinition<any, any>, call: grpc.ServerInterceptingCallInterface) {
|
||||
const listener: grpc.ServerListener = {
|
||||
onReceiveMetadata: async (metadata, next) => {
|
||||
let attemptNum = 0;
|
||||
const attemptNumHeader = metadata.get('grpc-previous-rpc-attempts');
|
||||
if (attemptNumHeader.length > 0) {
|
||||
attemptNum = Number(attemptNumHeader[0]);
|
||||
if (Number.isNaN(attemptNum)) {
|
||||
call.sendStatus({
|
||||
code: grpc.status.INVALID_ARGUMENT,
|
||||
details: 'Invalid format for grpc-previous-rpc-attempts header: ' + attemptNumHeader[0]
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
const rpcBehavior = metadata.get('rpc-behavior').filter(v => typeof v === 'string').join(',');
|
||||
for (const value of rpcBehavior.split(',')) {
|
||||
let behaviorEntry: string;
|
||||
if (value.startsWith('hostname=')) {
|
||||
const splitValue = value.split(' ');
|
||||
if (splitValue.length > 1) {
|
||||
if (splitValue[0].substring('hostname='.length) !== HOSTNAME) {
|
||||
continue;
|
||||
}
|
||||
behaviorEntry = splitValue[1];
|
||||
} else {
|
||||
call.sendStatus({
|
||||
code: grpc.status.INVALID_ARGUMENT,
|
||||
details: 'Invalid format for rpc-behavior header: ' + value
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
behaviorEntry = value;
|
||||
}
|
||||
if (behaviorEntry.startsWith('sleep-')) {
|
||||
const delaySec = Number(behaviorEntry.substring('sleep-'.length));
|
||||
if (Number.isNaN(delaySec)) {
|
||||
call.sendStatus({
|
||||
code: grpc.status.INVALID_ARGUMENT,
|
||||
details: 'Invalid format for rpc-behavior header: ' + value
|
||||
});
|
||||
return;
|
||||
}
|
||||
await setAsyncTimeout(delaySec * 1000);
|
||||
}
|
||||
if (behaviorEntry === 'keep-open') {
|
||||
return;
|
||||
}
|
||||
if (behaviorEntry.startsWith('error-code-')) {
|
||||
const errorCode = Number(behaviorEntry.substring('error-code-'.length));
|
||||
if (Number.isNaN(errorCode)) {
|
||||
call.sendStatus({
|
||||
code: grpc.status.INVALID_ARGUMENT,
|
||||
details: 'Invalid format for rpc-behavior header: ' + value
|
||||
});
|
||||
return;
|
||||
}
|
||||
call.sendStatus({
|
||||
code: errorCode,
|
||||
details: 'RPC failed as directed by rpc-behavior header value ' + value
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (behaviorEntry.startsWith('succeed-on-retry-attempt-')) {
|
||||
const targetAttempt = Number(behaviorEntry.substring('succeed-on-retry-attempt-'.length));
|
||||
if (Number.isNaN(targetAttempt)) {
|
||||
call.sendStatus({
|
||||
code: grpc.status.INVALID_ARGUMENT,
|
||||
details: 'Invalid format for rpc-behavior header: ' + value
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (attemptNum === targetAttempt) {
|
||||
next(metadata);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
next(metadata);
|
||||
}
|
||||
};
|
||||
const responder: grpc.Responder = {
|
||||
start: next => {
|
||||
next(listener);
|
||||
},
|
||||
sendMetadata: (metadata, next) => {
|
||||
metadata.add('hostname', HOSTNAME);
|
||||
next(metadata);
|
||||
}
|
||||
}
|
||||
return new grpc.ServerInterceptingCall(call, responder);
|
||||
};
|
||||
|
||||
function adminServiceInterceptor(methodDescriptor: grpc.ServerMethodDefinition<any, any>, call: grpc.ServerInterceptingCallInterface): grpc.ServerInterceptingCall {
|
||||
const listener: grpc.ServerListener = {
|
||||
onReceiveMessage: (message, next) => {
|
||||
console.log(`Received request to method ${methodDescriptor.path}: ${JSON.stringify(message)}`);
|
||||
next(message);
|
||||
}
|
||||
}
|
||||
const responder: grpc.Responder = {
|
||||
start: next => {
|
||||
next(listener);
|
||||
},
|
||||
sendMessage: (message, next) => {
|
||||
console.log(`Responded to request to method ${methodDescriptor.path}: ${JSON.stringify(message)}`);
|
||||
next(message);
|
||||
}
|
||||
};
|
||||
return new grpc.ServerInterceptingCall(call, responder);
|
||||
}
|
||||
|
||||
function unifiedInterceptor(methodDescriptor: grpc.ServerMethodDefinition<any, any>, call: grpc.ServerInterceptingCallInterface): grpc.ServerInterceptingCall {
|
||||
if (methodDescriptor.path.startsWith(TEST_SERVICE_NAME)) {
|
||||
return testInfoInterceptor(methodDescriptor, call);
|
||||
} else {
|
||||
return adminServiceInterceptor(methodDescriptor, call);
|
||||
}
|
||||
}
|
||||
|
||||
const testServiceHandler = {
|
||||
EmptyCall: (call: grpc.ServerUnaryCall<Empty__Output, Empty>, callback: grpc.sendUnaryData<Empty>) => {
|
||||
callback(null, {});
|
||||
},
|
||||
UnaryCall: (call: grpc.ServerUnaryCall<SimpleRequest__Output, SimpleResponse>, callback: grpc.sendUnaryData<SimpleResponse>) => {
|
||||
callback(null, {
|
||||
hostname: HOSTNAME,
|
||||
payload: {
|
||||
body: Buffer.from('0'.repeat(call.request.response_size))
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function serverBindPromise(server: grpc.Server, port: string, credentials: grpc.ServerCredentials): Promise<number> {
|
||||
return new Promise((resolve, reject) => {
|
||||
server.bindAsync(port, credentials, (error, port) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(port);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function getIPv4Address(): string | null {
|
||||
for (const [name, addressList] of Object.entries(os.networkInterfaces())) {
|
||||
if (name === 'lo' || !addressList) {
|
||||
continue;
|
||||
}
|
||||
for (const address of addressList) {
|
||||
if (address.family === 'IPv4') {
|
||||
return address.address;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getIPv6Addresses(): string[] {
|
||||
const ipv6Addresses: string[] = [];
|
||||
for (const [name, addressList] of Object.entries(os.networkInterfaces())) {
|
||||
if (name === 'lo' || !addressList) {
|
||||
continue;
|
||||
}
|
||||
for (const address of addressList) {
|
||||
if (address.family === 'IPv6') {
|
||||
ipv6Addresses.push(address.address);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ipv6Addresses;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const argv = yargs
|
||||
.string(['port', 'maintenance_port', 'address_type', 'secure_mode'])
|
||||
.demandOption(['port'])
|
||||
.default('address_type', 'IPV4_IPV6')
|
||||
.default('secure_mode', 'false')
|
||||
.parse()
|
||||
console.log('Starting xDS interop server. Args: ', argv);
|
||||
const healthImpl = new HealthImplementation({'': 'NOT_SERVING'});
|
||||
const xdsUpdateHealthServiceImpl = {
|
||||
SetServing(call: grpc.ServerUnaryCall<Empty, Empty__Output>, callback: grpc.sendUnaryData<Empty__Output>) {
|
||||
healthImpl.setStatus('', 'SERVING');
|
||||
callback(null, {});
|
||||
},
|
||||
SetNotServing(call: grpc.ServerUnaryCall<Empty, Empty__Output>, callback: grpc.sendUnaryData<Empty__Output>) {
|
||||
healthImpl.setStatus('', 'NOT_SERVING');
|
||||
callback(null, {});
|
||||
}
|
||||
}
|
||||
const reflection = new ReflectionService(packageDefinition, {
|
||||
services: ['grpc.testing.TestService']
|
||||
})
|
||||
const addressType = argv.address_type.toUpperCase();
|
||||
const secureMode = argv.secure_mode.toLowerCase() == 'true';
|
||||
if (secureMode) {
|
||||
if (addressType !== 'IPV4_IPV6') {
|
||||
throw new Error('Secure mode only supports IPV4_IPV6 address type');
|
||||
}
|
||||
const maintenanceServer = new grpc.Server({interceptors: [adminServiceInterceptor]});
|
||||
maintenanceServer.addService(loadedProto.grpc.testing.XdsUpdateHealthService.service, xdsUpdateHealthServiceImpl)
|
||||
healthImpl.addToServer(maintenanceServer);
|
||||
reflection.addToServer(maintenanceServer);
|
||||
grpc.addAdminServicesToServer(maintenanceServer);
|
||||
|
||||
const server = new grpc_xds.XdsServer({interceptors: [testInfoInterceptor]});
|
||||
server.addService(loadedProto.grpc.testing.TestService.service, testServiceHandler);
|
||||
const xdsCreds = new grpc_xds.XdsServerCredentials(grpc.ServerCredentials.createInsecure());
|
||||
await Promise.all([
|
||||
serverBindPromise(maintenanceServer, `[::]:${argv.maintenance_port}`, grpc.ServerCredentials.createInsecure()),
|
||||
serverBindPromise(server, `0.0.0.0:${argv.port}`, xdsCreds)
|
||||
]);
|
||||
} else {
|
||||
const server = new grpc.Server({interceptors: [unifiedInterceptor]});
|
||||
server.addService(loadedProto.grpc.testing.XdsUpdateHealthService.service, xdsUpdateHealthServiceImpl);
|
||||
healthImpl.addToServer(server);
|
||||
reflection.addToServer(server);
|
||||
grpc.addAdminServicesToServer(server);
|
||||
server.addService(loadedProto.grpc.testing.TestService.service, testServiceHandler);
|
||||
const creds = grpc.ServerCredentials.createInsecure();
|
||||
switch (addressType) {
|
||||
case 'IPV4_IPV6':
|
||||
await serverBindPromise(server, `[::]:${argv.port}`, creds);
|
||||
break;
|
||||
case 'IPV4':
|
||||
await serverBindPromise(server, `127.0.0.1:${argv.port}`, creds);
|
||||
const address = getIPv4Address();
|
||||
if (address) {
|
||||
await serverBindPromise(server, `${address}:${argv.port}`, creds);
|
||||
}
|
||||
break;
|
||||
case 'IPV6':
|
||||
await serverBindPromise(server, `[::1]:${argv.port}`, creds);
|
||||
for (const address of getIPv6Addresses()) {
|
||||
try {
|
||||
await serverBindPromise(server, `[${address}]:${argv.port}`, creds);
|
||||
} catch (e) {
|
||||
console.log(`Binding ${address} failed with error ${(e as Error).message}`);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown address type: ${argv.address_type}`);
|
||||
}
|
||||
}
|
||||
healthImpl.setStatus('', 'SERVING');
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main();
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@grpc/grpc-js-xds",
|
||||
"version": "1.9.2",
|
||||
"version": "1.13.0",
|
||||
"description": "Plugin for @grpc/grpc-js. Adds the xds:// URL scheme and associated features.",
|
||||
"main": "build/src/index.js",
|
||||
"scripts": {
|
||||
|
@ -12,7 +12,7 @@
|
|||
"prepare": "npm run generate-types && npm run compile",
|
||||
"pretest": "npm run compile",
|
||||
"posttest": "npm run check",
|
||||
"generate-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs deps/envoy-api/ deps/xds/ deps/googleapis/ deps/protoc-gen-validate/ -O src/generated/ --grpcLib @grpc/grpc-js envoy/service/discovery/v3/ads.proto envoy/service/load_stats/v3/lrs.proto envoy/config/listener/v3/listener.proto envoy/config/route/v3/route.proto envoy/config/cluster/v3/cluster.proto envoy/config/endpoint/v3/endpoint.proto envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto udpa/type/v1/typed_struct.proto xds/type/v3/typed_struct.proto envoy/extensions/filters/http/fault/v3/fault.proto envoy/service/status/v3/csds.proto",
|
||||
"generate-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs deps/envoy-api/ deps/xds/ deps/googleapis/ deps/protoc-gen-validate/ -O src/generated/ --grpcLib @grpc/grpc-js envoy/service/discovery/v3/ads.proto envoy/service/load_stats/v3/lrs.proto envoy/config/listener/v3/listener.proto envoy/config/route/v3/route.proto envoy/config/cluster/v3/cluster.proto envoy/config/endpoint/v3/endpoint.proto envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto udpa/type/v1/typed_struct.proto xds/type/v3/typed_struct.proto envoy/extensions/filters/http/fault/v3/fault.proto envoy/service/status/v3/csds.proto envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.proto envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.proto envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.proto envoy/extensions/clusters/aggregate/v3/cluster.proto envoy/extensions/transport_sockets/tls/v3/tls.proto envoy/config/rbac/v3/rbac.proto envoy/extensions/filters/http/rbac/v3/rbac.proto",
|
||||
"generate-interop-types": "proto-loader-gen-types --keep-case --longs String --enums String --defaults --oneofs --json --includeComments --includeDirs proto/ -O interop/generated --grpcLib @grpc/grpc-js grpc/testing/test.proto",
|
||||
"generate-test-types": "proto-loader-gen-types --keep-case --longs String --enums String --defaults --oneofs --json --includeComments --includeDirs proto/ -O test/generated --grpcLib @grpc/grpc-js grpc/testing/echo.proto"
|
||||
},
|
||||
|
@ -33,23 +33,29 @@
|
|||
"homepage": "https://github.com/grpc/grpc-node#readme",
|
||||
"devDependencies": {
|
||||
"@grpc/grpc-js": "file:../grpc-js",
|
||||
"@grpc/proto-loader": "file:../proto-loader",
|
||||
"@types/gulp": "^4.0.6",
|
||||
"@types/gulp-mocha": "0.0.32",
|
||||
"@types/mocha": "^5.2.6",
|
||||
"@types/node": "^13.11.1",
|
||||
"@types/node": ">=20.11.20",
|
||||
"@grpc/reflection": "file:../grpc-reflection",
|
||||
"@types/yargs": "^15.0.5",
|
||||
"gts": "^2.0.2",
|
||||
"typescript": "^3.8.3",
|
||||
"find-free-ports": "^3.1.1",
|
||||
"grpc-health-check": "file:../grpc-health-check",
|
||||
"gts": "^5.0.1",
|
||||
"ncp": "^2.0.0",
|
||||
"typescript": "^5.1.3",
|
||||
"yargs": "^15.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grpc/proto-loader": "^0.6.0",
|
||||
"@grpc/proto-loader": "^0.7.13",
|
||||
"google-auth-library": "^7.0.2",
|
||||
"re2-wasm": "^1.0.1",
|
||||
"vscode-uri": "^3.0.7"
|
||||
"vscode-uri": "^3.0.7",
|
||||
"xxhash-wasm": "^1.0.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@grpc/grpc-js": "~1.9.0"
|
||||
"@grpc/grpc-js": "~1.13.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.10.0"
|
||||
|
@ -59,6 +65,7 @@
|
|||
"build/src/**/*.{js,d.ts,js.map}",
|
||||
"deps/envoy-api/envoy/admin/v3/**/*.proto",
|
||||
"deps/envoy-api/envoy/config/**/*.proto",
|
||||
"deps/envoy-api/envoy/data/**/*.proto",
|
||||
"deps/envoy-api/envoy/service/**/*.proto",
|
||||
"deps/envoy-api/envoy/type/**/*.proto",
|
||||
"deps/envoy-api/envoy/annotations/**/*.proto",
|
||||
|
@ -66,6 +73,7 @@
|
|||
"deps/googleapis/google/api/**/*.proto",
|
||||
"deps/googleapis/google/protobuf/**/*.proto",
|
||||
"deps/googleapis/google/rpc/**/*.proto",
|
||||
"deps/protoc-gen-validate/**/*.proto",
|
||||
"deps/xds/udpa/annotations/**/*.proto",
|
||||
"deps/xds/udpa/type/**/*.proto",
|
||||
"deps/xds/xds/annotations/**/*.proto",
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright 2024 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.
|
||||
set -eo pipefail
|
||||
|
||||
#######################################
|
||||
# Builds test app Docker images and pushes them to GCR.
|
||||
# Called from psm_interop_kokoro_lib.sh.
|
||||
#
|
||||
# Globals:
|
||||
# SRC_DIR: Absolute path to the source repo on Kokoro VM
|
||||
# SERVER_IMAGE_NAME: Test server Docker image name
|
||||
# CLIENT_IMAGE_NAME: Test client Docker image name
|
||||
# GIT_COMMIT: SHA-1 of git commit being built
|
||||
# DOCKER_REGISTRY: Docker registry to push to
|
||||
# Outputs:
|
||||
# Writes the output of docker image build stdout, stderr
|
||||
#######################################
|
||||
psm::lang::build_docker_images() {
|
||||
local client_dockerfile="packages/grpc-js-xds/interop/test-client.Dockerfile"
|
||||
local server_dockerfile="packages/grpc-js-xds/interop/test-server.Dockerfile"
|
||||
|
||||
cd "${SRC_DIR}"
|
||||
psm::tools::run_verbose git submodule update --init --recursive
|
||||
psm::tools::run_verbose git submodule status
|
||||
|
||||
psm::build::docker_images_generic "${client_dockerfile}" "${server_dockerfile}"
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright 2024 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.
|
||||
set -eo pipefail
|
||||
|
||||
# Input parameters to psm:: methods of the install script.
|
||||
readonly GRPC_LANGUAGE="node"
|
||||
readonly BUILD_SCRIPT_DIR="$(dirname "$0")"
|
||||
|
||||
# Used locally.
|
||||
readonly TEST_DRIVER_INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/${TEST_DRIVER_REPO_OWNER:-grpc}/psm-interop/${TEST_DRIVER_BRANCH:-main}/.kokoro/psm_interop_kokoro_lib.sh"
|
||||
|
||||
psm::lang::source_install_lib() {
|
||||
echo "Sourcing test driver install script from: ${TEST_DRIVER_INSTALL_SCRIPT_URL}"
|
||||
local install_lib
|
||||
# Download to a tmp file.
|
||||
install_lib="$(mktemp -d)/psm_interop_kokoro_lib.sh"
|
||||
curl -s --retry-connrefused --retry 5 -o "${install_lib}" "${TEST_DRIVER_INSTALL_SCRIPT_URL}"
|
||||
# Checksum.
|
||||
if command -v sha256sum &> /dev/null; then
|
||||
echo "Install script checksum:"
|
||||
sha256sum "${install_lib}"
|
||||
fi
|
||||
source "${install_lib}"
|
||||
}
|
||||
|
||||
psm::lang::source_install_lib
|
||||
source "${BUILD_SCRIPT_DIR}/psm-interop-build-${GRPC_LANGUAGE}.sh"
|
||||
psm::run "${PSM_TEST_SUITE}"
|
|
@ -34,9 +34,18 @@ echo "source $NVM_DIR/nvm.sh" > ~/.profile
|
|||
echo "source $NVM_DIR/nvm.sh" > ~/.shrc
|
||||
export ENV=~/.shrc
|
||||
|
||||
cd $base/../proto-loader
|
||||
npm install
|
||||
|
||||
cd $base/../grpc-js
|
||||
npm install
|
||||
|
||||
cd $base/../grpc-health-check
|
||||
npm install
|
||||
|
||||
cd $base/../grpc-reflection
|
||||
npm install
|
||||
|
||||
# grpc-js-xds has a dev dependency on "../grpc-js", so it should pull that in automatically
|
||||
cd $base
|
||||
git submodule update --init --recursive
|
||||
|
|
|
@ -1,175 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# 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.
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
# Constants
|
||||
readonly GITHUB_REPOSITORY_NAME="grpc-node"
|
||||
readonly TEST_DRIVER_INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/${TEST_DRIVER_REPO_OWNER:-grpc}/psm-interop/${TEST_DRIVER_BRANCH:-main}/.kokoro/psm_interop_kokoro_lib.sh"
|
||||
## xDS test client Docker images
|
||||
readonly SERVER_IMAGE_NAME="gcr.io/grpc-testing/xds-interop/java-server:558b5b0bfac8e21755c223063274a779b3898afe"
|
||||
readonly CLIENT_IMAGE_NAME="gcr.io/grpc-testing/xds-interop/node-client"
|
||||
readonly FORCE_IMAGE_BUILD="${FORCE_IMAGE_BUILD:-0}"
|
||||
readonly BUILD_APP_PATH="packages/grpc-js-xds/interop/Dockerfile"
|
||||
readonly LANGUAGE_NAME="Node"
|
||||
|
||||
#######################################
|
||||
# Builds test app Docker images and pushes them to GCR
|
||||
# Globals:
|
||||
# BUILD_APP_PATH
|
||||
# CLIENT_IMAGE_NAME: Test client Docker image name
|
||||
# GIT_COMMIT: SHA-1 of git commit being built
|
||||
# TESTING_VERSION: version branch under test, f.e. v1.42.x, master
|
||||
# Arguments:
|
||||
# None
|
||||
# Outputs:
|
||||
# Writes the output of `gcloud builds submit` to stdout, stderr
|
||||
#######################################
|
||||
build_test_app_docker_images() {
|
||||
echo "Building ${LANGUAGE_NAME} xDS interop test app Docker images"
|
||||
|
||||
pushd "${SRC_DIR}"
|
||||
docker build \
|
||||
-f "${BUILD_APP_PATH}" \
|
||||
-t "${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
|
||||
.
|
||||
|
||||
gcloud -q auth configure-docker
|
||||
docker push "${CLIENT_IMAGE_NAME}:${GIT_COMMIT}"
|
||||
if is_version_branch "${TESTING_VERSION}"; then
|
||||
tag_and_push_docker_image "${CLIENT_IMAGE_NAME}" "${GIT_COMMIT}" "${TESTING_VERSION}"
|
||||
fi
|
||||
popd
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Builds test app and its docker images unless they already exist
|
||||
# Globals:
|
||||
# CLIENT_IMAGE_NAME: Test client Docker image name
|
||||
# GIT_COMMIT: SHA-1 of git commit being built
|
||||
# FORCE_IMAGE_BUILD
|
||||
# Arguments:
|
||||
# None
|
||||
# Outputs:
|
||||
# Writes the output to stdout, stderr
|
||||
#######################################
|
||||
build_docker_images_if_needed() {
|
||||
# Check if images already exist
|
||||
client_tags="$(gcloud_gcr_list_image_tags "${CLIENT_IMAGE_NAME}" "${GIT_COMMIT}")"
|
||||
printf "Client image: %s:%s\n" "${CLIENT_IMAGE_NAME}" "${GIT_COMMIT}"
|
||||
echo "${client_tags:-Client image not found}"
|
||||
|
||||
# Build if any of the images are missing, or FORCE_IMAGE_BUILD=1
|
||||
if [[ "${FORCE_IMAGE_BUILD}" == "1" || -z "${client_tags}" ]]; then
|
||||
build_test_app_docker_images
|
||||
else
|
||||
echo "Skipping ${LANGUAGE_NAME} test app build"
|
||||
fi
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Executes the test case
|
||||
# Globals:
|
||||
# TEST_DRIVER_FLAGFILE: Relative path to test driver flagfile
|
||||
# KUBE_CONTEXT: The name of kubectl context with GKE cluster access
|
||||
# SECONDARY_KUBE_CONTEXT: The name of kubectl context with secondary GKE cluster access, if any
|
||||
# TEST_XML_OUTPUT_DIR: Output directory for the test xUnit XML report
|
||||
# CLIENT_IMAGE_NAME: Test client Docker image name
|
||||
# GIT_COMMIT: SHA-1 of git commit being built
|
||||
# Arguments:
|
||||
# Test case name
|
||||
# Outputs:
|
||||
# Writes the output of test execution to stdout, stderr
|
||||
# Test xUnit report to ${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml
|
||||
#######################################
|
||||
run_test() {
|
||||
# Test driver usage:
|
||||
# https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage
|
||||
local test_name="${1:?Usage: run_test test_name}"
|
||||
local out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
|
||||
mkdir -pv "${out_dir}"
|
||||
# testing_version is used by the framework to determine the supported PSM
|
||||
# features. It's captured from Kokoro job name of the Node repo, which takes
|
||||
# the form:
|
||||
# grpc/node/<branch name>/<job name>
|
||||
python3 -m "tests.${test_name}" \
|
||||
--flagfile="${TEST_DRIVER_FLAGFILE}" \
|
||||
--kube_context="${KUBE_CONTEXT}" \
|
||||
--secondary_kube_context="${SECONDARY_KUBE_CONTEXT}" \
|
||||
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
|
||||
--server_image="${SERVER_IMAGE_NAME}" \
|
||||
--testing_version="${TESTING_VERSION}" \
|
||||
--force_cleanup \
|
||||
--collect_app_logs \
|
||||
--log_dir="${out_dir}" \
|
||||
--xml_output_file="${out_dir}/sponge_log.xml" \
|
||||
|& tee "${out_dir}/sponge_log.log"
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Main function: provision software necessary to execute tests, and run them
|
||||
# Globals:
|
||||
# KOKORO_ARTIFACTS_DIR
|
||||
# GITHUB_REPOSITORY_NAME
|
||||
# SRC_DIR: Populated with absolute path to the source repo
|
||||
# TEST_DRIVER_REPO_DIR: Populated with the path to the repo containing
|
||||
# the test driver
|
||||
# TEST_DRIVER_FULL_DIR: Populated with the path to the test driver source code
|
||||
# TEST_DRIVER_FLAGFILE: Populated with relative path to test driver flagfile
|
||||
# TEST_XML_OUTPUT_DIR: Populated with the path to test xUnit XML report
|
||||
# GIT_ORIGIN_URL: Populated with the origin URL of git repo used for the build
|
||||
# GIT_COMMIT: Populated with the SHA-1 of git commit being built
|
||||
# GIT_COMMIT_SHORT: Populated with the short SHA-1 of git commit being built
|
||||
# KUBE_CONTEXT: Populated with name of kubectl context with GKE cluster access
|
||||
# SECONDARY_KUBE_CONTEXT: Populated with name of kubectl context with secondary GKE cluster access, if any
|
||||
# Arguments:
|
||||
# None
|
||||
# Outputs:
|
||||
# Writes the output of test execution to stdout, stderr
|
||||
#######################################
|
||||
main() {
|
||||
local script_dir
|
||||
script_dir="$(dirname "$0")"
|
||||
|
||||
cd "${script_dir}"
|
||||
|
||||
git submodule update --init --recursive
|
||||
|
||||
# Source the test driver from the master branch.
|
||||
echo "Sourcing test driver install script from: ${TEST_DRIVER_INSTALL_SCRIPT_URL}"
|
||||
source /dev/stdin <<< "$(curl -s "${TEST_DRIVER_INSTALL_SCRIPT_URL}")"
|
||||
|
||||
activate_gke_cluster GKE_CLUSTER_PSM_LB
|
||||
activate_secondary_gke_cluster GKE_CLUSTER_PSM_LB
|
||||
|
||||
set -x
|
||||
if [[ -n "${KOKORO_ARTIFACTS_DIR}" ]]; then
|
||||
kokoro_setup_test_driver "${GITHUB_REPOSITORY_NAME}"
|
||||
else
|
||||
local_setup_test_driver "${script_dir}"
|
||||
fi
|
||||
build_docker_images_if_needed
|
||||
|
||||
# Run tests
|
||||
cd "${TEST_DRIVER_FULL_DIR}"
|
||||
local failed_tests=0
|
||||
test_suites=("baseline_test" "api_listener_test" "change_backend_service_test" "failover_test" "remove_neg_test" "round_robin_test" "outlier_detection_test")
|
||||
for test in "${test_suites[@]}"; do
|
||||
run_test $test || (( ++failed_tests ))
|
||||
done
|
||||
echo "Failed test suites: ${failed_tests}"
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -1,162 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# 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.
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
# Constants
|
||||
readonly GITHUB_REPOSITORY_NAME="grpc-node"
|
||||
readonly TEST_DRIVER_INSTALL_SCRIPT_URL="https://raw.githubusercontent.com/${TEST_DRIVER_REPO_OWNER:-grpc}/psm-interop/${TEST_DRIVER_BRANCH:-main}/.kokoro/psm_interop_kokoro_lib.sh"
|
||||
## xDS test client Docker images
|
||||
readonly CLIENT_IMAGE_NAME="gcr.io/grpc-testing/xds-interop/node-client"
|
||||
readonly FORCE_IMAGE_BUILD="${FORCE_IMAGE_BUILD:-0}"
|
||||
readonly BUILD_APP_PATH="packages/grpc-js-xds/interop/Dockerfile"
|
||||
readonly LANGUAGE_NAME="Node"
|
||||
|
||||
#######################################
|
||||
# Builds test app Docker images and pushes them to GCR
|
||||
# Globals:
|
||||
# BUILD_APP_PATH
|
||||
# CLIENT_IMAGE_NAME: Test client Docker image name
|
||||
# GIT_COMMIT: SHA-1 of git commit being built
|
||||
# TESTING_VERSION: version branch under test, f.e. v1.42.x, master
|
||||
# Arguments:
|
||||
# None
|
||||
# Outputs:
|
||||
# Writes the output of `gcloud builds submit` to stdout, stderr
|
||||
#######################################
|
||||
build_test_app_docker_images() {
|
||||
echo "Building ${LANGUAGE_NAME} xDS interop test app Docker images"
|
||||
|
||||
pushd "${SRC_DIR}"
|
||||
docker build \
|
||||
-f "${BUILD_APP_PATH}" \
|
||||
-t "${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
|
||||
.
|
||||
|
||||
gcloud -q auth configure-docker
|
||||
docker push "${CLIENT_IMAGE_NAME}:${GIT_COMMIT}"
|
||||
if is_version_branch "${TESTING_VERSION}"; then
|
||||
tag_and_push_docker_image "${CLIENT_IMAGE_NAME}" "${GIT_COMMIT}" "${TESTING_VERSION}"
|
||||
fi
|
||||
popd
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Builds test app and its docker images unless they already exist
|
||||
# Globals:
|
||||
# CLIENT_IMAGE_NAME: Test client Docker image name
|
||||
# GIT_COMMIT: SHA-1 of git commit being built
|
||||
# FORCE_IMAGE_BUILD
|
||||
# Arguments:
|
||||
# None
|
||||
# Outputs:
|
||||
# Writes the output to stdout, stderr
|
||||
#######################################
|
||||
build_docker_images_if_needed() {
|
||||
# Check if images already exist
|
||||
client_tags="$(gcloud_gcr_list_image_tags "${CLIENT_IMAGE_NAME}" "${GIT_COMMIT}")"
|
||||
printf "Client image: %s:%s\n" "${CLIENT_IMAGE_NAME}" "${GIT_COMMIT}"
|
||||
echo "${client_tags:-Client image not found}"
|
||||
|
||||
# Build if any of the images are missing, or FORCE_IMAGE_BUILD=1
|
||||
if [[ "${FORCE_IMAGE_BUILD}" == "1" || -z "${client_tags}" ]]; then
|
||||
build_test_app_docker_images
|
||||
else
|
||||
echo "Skipping ${LANGUAGE_NAME} test app build"
|
||||
fi
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Executes the test case
|
||||
# Globals:
|
||||
# TEST_DRIVER_FLAGFILE: Relative path to test driver flagfile
|
||||
# KUBE_CONTEXT: The name of kubectl context with GKE cluster access
|
||||
# TEST_XML_OUTPUT_DIR: Output directory for the test xUnit XML report
|
||||
# CLIENT_IMAGE_NAME: Test client Docker image name
|
||||
# GIT_COMMIT: SHA-1 of git commit being built
|
||||
# TESTING_VERSION: version branch under test: used by the framework to determine the supported PSM
|
||||
# features.
|
||||
# Arguments:
|
||||
# Test case name
|
||||
# Outputs:
|
||||
# Writes the output of test execution to stdout, stderr
|
||||
# Test xUnit report to ${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml
|
||||
#######################################
|
||||
run_test() {
|
||||
# Test driver usage:
|
||||
# https://github.com/grpc/grpc/tree/master/tools/run_tests/xds_k8s_test_driver#basic-usage
|
||||
local test_name="${1:?Usage: run_test test_name}"
|
||||
local out_dir="${TEST_XML_OUTPUT_DIR}/${test_name}"
|
||||
mkdir -pv "${out_dir}"
|
||||
set -x
|
||||
python3 -m "tests.${test_name}" \
|
||||
--flagfile="${TEST_DRIVER_FLAGFILE}" \
|
||||
--flagfile="config/url-map.cfg" \
|
||||
--kube_context="${KUBE_CONTEXT}" \
|
||||
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
|
||||
--testing_version="${TESTING_VERSION}" \
|
||||
--collect_app_logs \
|
||||
--log_dir="${out_dir}" \
|
||||
--xml_output_file="${out_dir}/sponge_log.xml" \
|
||||
|& tee "${out_dir}/sponge_log.log"
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Main function: provision software necessary to execute tests, and run them
|
||||
# Globals:
|
||||
# KOKORO_ARTIFACTS_DIR
|
||||
# GITHUB_REPOSITORY_NAME
|
||||
# SRC_DIR: Populated with absolute path to the source repo
|
||||
# TEST_DRIVER_REPO_DIR: Populated with the path to the repo containing
|
||||
# the test driver
|
||||
# TEST_DRIVER_FULL_DIR: Populated with the path to the test driver source code
|
||||
# TEST_DRIVER_FLAGFILE: Populated with relative path to test driver flagfile
|
||||
# TEST_XML_OUTPUT_DIR: Populated with the path to test xUnit XML report
|
||||
# GIT_ORIGIN_URL: Populated with the origin URL of git repo used for the build
|
||||
# GIT_COMMIT: Populated with the SHA-1 of git commit being built
|
||||
# GIT_COMMIT_SHORT: Populated with the short SHA-1 of git commit being built
|
||||
# KUBE_CONTEXT: Populated with name of kubectl context with GKE cluster access
|
||||
# Arguments:
|
||||
# None
|
||||
# Outputs:
|
||||
# Writes the output of test execution to stdout, stderr
|
||||
#######################################
|
||||
main() {
|
||||
local script_dir
|
||||
script_dir="$(dirname "$0")"
|
||||
|
||||
cd "${script_dir}"
|
||||
|
||||
git submodule update --init --recursive
|
||||
|
||||
# Source the test driver from the master branch.
|
||||
echo "Sourcing test driver install script from: ${TEST_DRIVER_INSTALL_SCRIPT_URL}"
|
||||
source /dev/stdin <<< "$(curl -s "${TEST_DRIVER_INSTALL_SCRIPT_URL}")"
|
||||
|
||||
activate_gke_cluster GKE_CLUSTER_PSM_BASIC
|
||||
|
||||
set -x
|
||||
if [[ -n "${KOKORO_ARTIFACTS_DIR}" ]]; then
|
||||
kokoro_setup_test_driver "${GITHUB_REPOSITORY_NAME}"
|
||||
else
|
||||
local_setup_test_driver "${script_dir}"
|
||||
fi
|
||||
build_docker_images_if_needed
|
||||
# Run tests
|
||||
cd "${TEST_DRIVER_FULL_DIR}"
|
||||
run_test url_map || echo "Failed url_map test"
|
||||
}
|
||||
|
||||
main "$@"
|
|
@ -0,0 +1,192 @@
|
|||
/*
|
||||
* Copyright 2024 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.
|
||||
*/
|
||||
|
||||
import * as net from 'net';
|
||||
import { CidrRange__Output } from './generated/envoy/config/core/v3/CidrRange';
|
||||
|
||||
const IPV4_COMPONENT_COUNT = 4n;
|
||||
const IPV4_COMPONENT_SIZE = 8n;
|
||||
const IPV4_COMPONENT_CAP = 1n << IPV4_COMPONENT_SIZE;
|
||||
const IPV4_TOTAL_SIZE = IPV4_COMPONENT_COUNT * IPV4_COMPONENT_SIZE;
|
||||
const IPV6_COMPONENT_SIZE = 16n;
|
||||
const IPV6_COMPONENT_COUNT = 8n;
|
||||
const IPV6_COMPONENT_CAP = 1n << IPV6_COMPONENT_SIZE;
|
||||
const IPV6_TOTAL_SIZE = IPV6_COMPONENT_COUNT * IPV6_COMPONENT_SIZE;
|
||||
|
||||
export interface CidrRange {
|
||||
addressPrefix: string;
|
||||
prefixLen: number;
|
||||
}
|
||||
|
||||
export function parseIPv4(address: string): bigint {
|
||||
return address.split('.').map(component => BigInt(component)).reduce((accumulator, current) => accumulator * IPV4_COMPONENT_CAP + current, 0n);
|
||||
}
|
||||
|
||||
export function parseIPv6(address: string): bigint {
|
||||
/* If an IPv6 address contains two or more consecutive components with value
|
||||
* which can be collectively represented with the string '::'. For example,
|
||||
* the IPv6 adddress 0:0:0:0:0:0:0:1 can also be represented as ::1. Here we
|
||||
* expand any :: into the correct number of individual components. */
|
||||
const sections = address.split('::');
|
||||
let components: string[];
|
||||
if (sections.length === 1) {
|
||||
components = sections[0].split(':');
|
||||
} else if (sections.length === 2) {
|
||||
const beginning = sections[0].split(':').filter(value => value !== '');
|
||||
const end = sections[1].split(':').filter(value => value !== '');
|
||||
components = beginning.concat(Array(8 - beginning.length - end.length).fill('0'), end);
|
||||
} else {
|
||||
throw new Error('Invalid IPv6 address contains more than one instance of ::');
|
||||
}
|
||||
return components.map(component => BigInt('0x' + component)).reduce((accumulator, current) => accumulator * 65536n + current, 0n);
|
||||
}
|
||||
|
||||
function parseIP(address: string): bigint {
|
||||
switch (net.isIP(address)) {
|
||||
case 4:
|
||||
return parseIPv4(address);
|
||||
case 6:
|
||||
return parseIPv6(address);
|
||||
default:
|
||||
throw new Error(`Invalid IP address ${address}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function formatIPv4(address: bigint): string {
|
||||
const reverseComponents: bigint[] = [];
|
||||
for (let i = 0; i < IPV4_COMPONENT_COUNT; i++) {
|
||||
reverseComponents.push(address % IPV4_COMPONENT_CAP);
|
||||
address = address / IPV4_COMPONENT_CAP;
|
||||
}
|
||||
return reverseComponents.reverse().map(component => component.toString(10)).join('.');
|
||||
}
|
||||
|
||||
export function formatIPv6(address: bigint): string {
|
||||
const reverseComponents: bigint[] = [];
|
||||
for (let i = 0; i < IPV6_COMPONENT_COUNT; i++) {
|
||||
reverseComponents.push(address % IPV6_COMPONENT_CAP);
|
||||
address = address / IPV6_COMPONENT_CAP;
|
||||
}
|
||||
const components = reverseComponents.reverse();
|
||||
/* Find the longest run of consecutive 0 values in the list of components, to
|
||||
* replace it with :: in the output */
|
||||
let maxZeroRunIndex = 0;
|
||||
let maxZeroRunLength = 0;
|
||||
let inZeroRun = false;
|
||||
let currentZeroRunIndex = 0;
|
||||
let currentZeroRunLength = 0;
|
||||
for (let i = 0; i < components.length; i++) {
|
||||
if (components[i] === 0n) {
|
||||
if (inZeroRun) {
|
||||
currentZeroRunLength += 1;
|
||||
} else {
|
||||
inZeroRun = true;
|
||||
currentZeroRunIndex = i;
|
||||
currentZeroRunLength = 1;
|
||||
}
|
||||
if (currentZeroRunLength > maxZeroRunLength) {
|
||||
maxZeroRunIndex = currentZeroRunIndex;
|
||||
maxZeroRunLength = currentZeroRunLength;
|
||||
}
|
||||
} else {
|
||||
currentZeroRunLength = 0;
|
||||
inZeroRun = false;
|
||||
}
|
||||
}
|
||||
if (maxZeroRunLength >= 2) {
|
||||
const beginning = components.slice(0, maxZeroRunIndex);
|
||||
const end = components.slice(maxZeroRunIndex + maxZeroRunLength);
|
||||
return beginning.map(value => value.toString(16)).join(':') + '::' + end.map(value => value.toString(16)).join(':');
|
||||
} else {
|
||||
return components.map(value => value.toString(16)).join(':');
|
||||
}
|
||||
}
|
||||
|
||||
function getSubnetMaskIPv4(prefixLen: number) {
|
||||
return ~((1n << (IPV4_TOTAL_SIZE - BigInt(prefixLen))) - 1n);
|
||||
}
|
||||
|
||||
function getSubnetMaskIPv6(prefixLen: number) {
|
||||
return ~((1n << (IPV6_TOTAL_SIZE - BigInt(prefixLen))) - 1n);
|
||||
}
|
||||
|
||||
export function firstNBitsIPv4(address: string, prefixLen: number): string {
|
||||
const addressNum = parseIPv4(address);
|
||||
const prefixMask = getSubnetMaskIPv4(prefixLen);
|
||||
return formatIPv4(addressNum & prefixMask);
|
||||
}
|
||||
|
||||
export function firstNBitsIPv6(address: string, prefixLen: number): string {
|
||||
const addressNum = parseIPv6(address);
|
||||
const prefixMask = getSubnetMaskIPv6(prefixLen);
|
||||
return formatIPv6(addressNum & prefixMask);
|
||||
}
|
||||
|
||||
export function normalizeCidrRange(range: CidrRange): CidrRange {
|
||||
switch (net.isIP(range.addressPrefix)) {
|
||||
case 4: {
|
||||
const prefixLen = Math.min(Math.max(range.prefixLen, 0), 32);
|
||||
return {
|
||||
addressPrefix: firstNBitsIPv4(range.addressPrefix, prefixLen),
|
||||
prefixLen: prefixLen
|
||||
};
|
||||
}
|
||||
case 6: {
|
||||
const prefixLen = Math.min(Math.max(range.prefixLen, 0), 128);
|
||||
return {
|
||||
addressPrefix: firstNBitsIPv6(range.addressPrefix, prefixLen),
|
||||
prefixLen: prefixLen
|
||||
};
|
||||
}
|
||||
default:
|
||||
throw new Error(`Invalid IP address prefix ${range.addressPrefix}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function getCidrRangeSubnetMask(range: CidrRange): bigint {
|
||||
switch (net.isIP(range.addressPrefix)) {
|
||||
case 4:
|
||||
return getSubnetMaskIPv4(range.prefixLen);
|
||||
case 6:
|
||||
return getSubnetMaskIPv6(range.prefixLen);
|
||||
default:
|
||||
throw new Error('Invalid CIDR range');
|
||||
}
|
||||
}
|
||||
|
||||
export function inCidrRange(range: CidrRange, address: string): boolean {
|
||||
if (net.isIP(range.addressPrefix) !== net.isIP(address)) {
|
||||
return false;
|
||||
}
|
||||
return (parseIP(address) & getCidrRangeSubnetMask(range)) === parseIP(range.addressPrefix);
|
||||
}
|
||||
|
||||
export function cidrRangeEqual(range1: CidrRange | undefined, range2: CidrRange | undefined): boolean {
|
||||
if (range1 === undefined && range2 === undefined) {
|
||||
return true;
|
||||
}
|
||||
if (range1 === undefined || range2 === undefined) {
|
||||
return false;
|
||||
}
|
||||
return range1.addressPrefix === range2.addressPrefix && range1.prefixLen === range2.prefixLen;
|
||||
}
|
||||
|
||||
export function cidrRangeMessageToCidrRange(message: CidrRange__Output): CidrRange {
|
||||
return {
|
||||
addressPrefix: message.address_prefix,
|
||||
prefixLen: message.prefix_len?.value ?? 0
|
||||
};
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 2024 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.
|
||||
*/
|
||||
|
||||
// Types and function from https://stackoverflow.com/a/72059390/159388, with modifications
|
||||
type ElementType<A> = A extends ReadonlyArray<infer T> ? T | undefined : never;
|
||||
|
||||
type ElementsOfAll<Inputs, R extends ReadonlyArray<unknown> = []> = Inputs extends readonly [infer F, ...infer M] ? ElementsOfAll<M, [...R, ElementType<F>]> : R;
|
||||
|
||||
type CartesianProduct<Inputs> = ElementsOfAll<Inputs>[];
|
||||
|
||||
/**
|
||||
* Get the cross product or Cartesian product of a list of groups. The
|
||||
* implementation is copied, with some modifications, from
|
||||
* https://stackoverflow.com/a/72059390/159388.
|
||||
* @param sets A list of groups of elements
|
||||
* @returns A list of all possible combinations of one element from each group
|
||||
* in sets. Empty groups will result in undefined in that slot in each
|
||||
* combination.
|
||||
*/
|
||||
export function crossProduct<Sets extends ReadonlyArray<ReadonlyArray<unknown>>>(sets: Sets): CartesianProduct<Sets> {
|
||||
/* The input is an array of arrays, and the expected output is an array of
|
||||
* each possible combination of one element each of the input arrays, with
|
||||
* the exception that if one of the input arrays is empty, each combination
|
||||
* gets [undefined] in that slot.
|
||||
*
|
||||
* At each step in the reduce call, we start with the cross product of the
|
||||
* first N groups, and the next group. For each combation, for each element
|
||||
* of the next group, extend the combination with that element.
|
||||
*
|
||||
* The type assertion at the end is needed because TypeScript doesn't track
|
||||
* the types well enough through the reduce calls to see that the result has
|
||||
* the expected type.
|
||||
*/
|
||||
return sets.map(x => x.length === 0 ? [undefined] : x).reduce((combinations: unknown[][], nextGroup) => combinations.flatMap(combination => nextGroup.map(element => [...combination, element])), [[]] as unknown[][]) as CartesianProduct<Sets>;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2023 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.
|
||||
*/
|
||||
|
||||
import { experimental } from '@grpc/grpc-js';
|
||||
import { Duration__Output } from './generated/google/protobuf/Duration';
|
||||
import Duration = experimental.Duration;
|
||||
|
||||
/**
|
||||
* Convert a Duration protobuf message object to a Duration object as used in
|
||||
* the ServiceConfig definition. The difference is that the protobuf message
|
||||
* defines seconds as a long, which is represented as a string in JavaScript,
|
||||
* and the one used in the service config defines it as a number.
|
||||
* @param duration
|
||||
*/
|
||||
export function protoDurationToDuration(duration: Duration__Output): Duration {
|
||||
return {
|
||||
seconds: Number.parseInt(duration.seconds),
|
||||
nanos: duration.nanos
|
||||
};
|
||||
}
|
|
@ -15,7 +15,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/* Switches to enable or disable experimental features. If the default is
|
||||
* 'true', the feature is enabled by default, if the default is 'false' the
|
||||
* feature is disabled by default. */
|
||||
export const EXPERIMENTAL_FAULT_INJECTION = (process.env.GRPC_XDS_EXPERIMENTAL_FAULT_INJECTION ?? 'true') === 'true';
|
||||
export const EXPERIMENTAL_OUTLIER_DETECTION = (process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION ?? 'true') === 'true';
|
||||
export const EXPERIMENTAL_RETRY = (process.env.GRPC_XDS_EXPERIMENTAL_ENABLE_RETRY ?? 'true') === 'true';
|
||||
export const EXPERIMENTAL_FEDERATION = (process.env.GRPC_EXPERIMENTAL_XDS_FEDERATION ?? 'false') === 'true';
|
||||
export const EXPERIMENTAL_CUSTOM_LB_CONFIG = (process.env.GRPC_EXPERIMENTAL_XDS_CUSTOM_LB_CONFIG ?? 'true') === 'true';
|
||||
export const EXPERIMENTAL_RING_HASH = (process.env.GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH ?? 'true') === 'true';
|
||||
export const EXPERIMENTAL_PICK_FIRST = (process.env.GRPC_EXPERIMENTAL_PICKFIRST_LB_CONFIG ?? 'false') === 'true';
|
||||
export const EXPERIMENTAL_DUALSTACK_ENDPOINTS = (process.env.GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS ?? 'true') === 'true';
|
||||
export const AGGREGATE_CLUSTER_BACKWARDS_COMPAT = (process.env.GRPC_XDS_AGGREGATE_CLUSTER_BACKWARD_COMPAT ?? 'false') === 'true';
|
||||
export const EXPERIMENTAL_RBAC = (process.env.GRPC_XDS_EXPERIMENTAL_RBAC ?? 'false') === 'true';
|
||||
|
|
|
@ -24,10 +24,14 @@ export interface ProtoGrpcType {
|
|||
DataSource: MessageTypeDefinition
|
||||
EnvoyInternalAddress: MessageTypeDefinition
|
||||
Extension: MessageTypeDefinition
|
||||
ExtraSourceAddress: MessageTypeDefinition
|
||||
HeaderMap: MessageTypeDefinition
|
||||
HeaderValue: MessageTypeDefinition
|
||||
HeaderValueOption: MessageTypeDefinition
|
||||
HttpUri: MessageTypeDefinition
|
||||
KeyValue: MessageTypeDefinition
|
||||
KeyValueAppend: MessageTypeDefinition
|
||||
KeyValueMutation: MessageTypeDefinition
|
||||
Locality: MessageTypeDefinition
|
||||
Metadata: MessageTypeDefinition
|
||||
Node: MessageTypeDefinition
|
||||
|
@ -44,9 +48,11 @@ export interface ProtoGrpcType {
|
|||
RuntimeUInt32: MessageTypeDefinition
|
||||
SocketAddress: MessageTypeDefinition
|
||||
SocketOption: MessageTypeDefinition
|
||||
SocketOptionsOverride: MessageTypeDefinition
|
||||
TcpKeepalive: MessageTypeDefinition
|
||||
TrafficDirection: EnumTypeDefinition
|
||||
TransportSocket: MessageTypeDefinition
|
||||
TypedExtensionConfig: MessageTypeDefinition
|
||||
WatchedDirectory: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +62,7 @@ export interface ProtoGrpcType {
|
|||
v3: {
|
||||
AdsDummy: MessageTypeDefinition
|
||||
/**
|
||||
* See https://github.com/lyft/envoy-api#apis for a description of the role of
|
||||
* See https://github.com/envoyproxy/envoy-api#apis for a description of the role of
|
||||
* ADS and how it is intended to be used by a management server. ADS requests
|
||||
* have the same structure as their singleton xDS counterparts, but can
|
||||
* multiplex many resource types on a single stream. The type_url in the
|
||||
|
@ -68,7 +74,10 @@ export interface ProtoGrpcType {
|
|||
DeltaDiscoveryResponse: MessageTypeDefinition
|
||||
DiscoveryRequest: MessageTypeDefinition
|
||||
DiscoveryResponse: MessageTypeDefinition
|
||||
DynamicParameterConstraints: MessageTypeDefinition
|
||||
Resource: MessageTypeDefinition
|
||||
ResourceLocator: MessageTypeDefinition
|
||||
ResourceName: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ export interface ProtoGrpcType {
|
|||
LoadBalancingPolicy: MessageTypeDefinition
|
||||
OutlierDetection: MessageTypeDefinition
|
||||
TrackClusterStats: MessageTypeDefinition
|
||||
UpstreamBindConfig: MessageTypeDefinition
|
||||
UpstreamConnectionOptions: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +44,7 @@ export interface ProtoGrpcType {
|
|||
EventServiceConfig: MessageTypeDefinition
|
||||
Extension: MessageTypeDefinition
|
||||
ExtensionConfigSource: MessageTypeDefinition
|
||||
ExtraSourceAddress: MessageTypeDefinition
|
||||
GrpcProtocolOptions: MessageTypeDefinition
|
||||
GrpcService: MessageTypeDefinition
|
||||
HeaderMap: MessageTypeDefinition
|
||||
|
@ -52,17 +52,25 @@ export interface ProtoGrpcType {
|
|||
HeaderValueOption: MessageTypeDefinition
|
||||
HealthCheck: MessageTypeDefinition
|
||||
HealthStatus: EnumTypeDefinition
|
||||
HealthStatusSet: MessageTypeDefinition
|
||||
Http1ProtocolOptions: MessageTypeDefinition
|
||||
Http2ProtocolOptions: MessageTypeDefinition
|
||||
Http3ProtocolOptions: MessageTypeDefinition
|
||||
HttpProtocolOptions: MessageTypeDefinition
|
||||
HttpUri: MessageTypeDefinition
|
||||
KeepaliveSettings: MessageTypeDefinition
|
||||
KeyValue: MessageTypeDefinition
|
||||
KeyValueAppend: MessageTypeDefinition
|
||||
KeyValueMutation: MessageTypeDefinition
|
||||
Locality: MessageTypeDefinition
|
||||
Metadata: MessageTypeDefinition
|
||||
Node: MessageTypeDefinition
|
||||
PathConfigSource: MessageTypeDefinition
|
||||
Pipe: MessageTypeDefinition
|
||||
ProxyProtocolConfig: MessageTypeDefinition
|
||||
ProxyProtocolPassThroughTLVs: MessageTypeDefinition
|
||||
QueryParameter: MessageTypeDefinition
|
||||
QuicKeepAliveSettings: MessageTypeDefinition
|
||||
QuicProtocolOptions: MessageTypeDefinition
|
||||
RateLimitSettings: MessageTypeDefinition
|
||||
RemoteDataSource: MessageTypeDefinition
|
||||
|
@ -78,6 +86,7 @@ export interface ProtoGrpcType {
|
|||
SelfConfigSource: MessageTypeDefinition
|
||||
SocketAddress: MessageTypeDefinition
|
||||
SocketOption: MessageTypeDefinition
|
||||
SocketOptionsOverride: MessageTypeDefinition
|
||||
TcpKeepalive: MessageTypeDefinition
|
||||
TcpProtocolOptions: MessageTypeDefinition
|
||||
TrafficDirection: EnumTypeDefinition
|
||||
|
@ -97,6 +106,15 @@ export interface ProtoGrpcType {
|
|||
}
|
||||
}
|
||||
}
|
||||
extensions: {
|
||||
clusters: {
|
||||
aggregate: {
|
||||
v3: {
|
||||
ClusterConfig: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type: {
|
||||
matcher: {
|
||||
v3: {
|
||||
|
@ -106,6 +124,12 @@ export interface ProtoGrpcType {
|
|||
StringMatcher: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
metadata: {
|
||||
v3: {
|
||||
MetadataKey: MessageTypeDefinition
|
||||
MetadataKind: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
v3: {
|
||||
CodecClientType: EnumTypeDefinition
|
||||
DoubleRange: MessageTypeDefinition
|
||||
|
@ -211,6 +235,7 @@ export interface ProtoGrpcType {
|
|||
CollectionEntry: MessageTypeDefinition
|
||||
ContextParams: MessageTypeDefinition
|
||||
ResourceLocator: MessageTypeDefinition
|
||||
TypedExtensionConfig: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,109 +11,44 @@ export interface ProtoGrpcType {
|
|||
envoy: {
|
||||
admin: {
|
||||
v3: {
|
||||
BootstrapConfigDump: MessageTypeDefinition
|
||||
ClientResourceStatus: EnumTypeDefinition
|
||||
ClustersConfigDump: MessageTypeDefinition
|
||||
ConfigDump: MessageTypeDefinition
|
||||
EcdsConfigDump: MessageTypeDefinition
|
||||
EndpointsConfigDump: MessageTypeDefinition
|
||||
ListenersConfigDump: MessageTypeDefinition
|
||||
RoutesConfigDump: MessageTypeDefinition
|
||||
ScopedRoutesConfigDump: MessageTypeDefinition
|
||||
SecretsConfigDump: MessageTypeDefinition
|
||||
UpdateFailureState: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
annotations: {
|
||||
}
|
||||
config: {
|
||||
accesslog: {
|
||||
v3: {
|
||||
AccessLog: MessageTypeDefinition
|
||||
AccessLogFilter: MessageTypeDefinition
|
||||
AndFilter: MessageTypeDefinition
|
||||
ComparisonFilter: MessageTypeDefinition
|
||||
DurationFilter: MessageTypeDefinition
|
||||
ExtensionFilter: MessageTypeDefinition
|
||||
GrpcStatusFilter: MessageTypeDefinition
|
||||
HeaderFilter: MessageTypeDefinition
|
||||
MetadataFilter: MessageTypeDefinition
|
||||
NotHealthCheckFilter: MessageTypeDefinition
|
||||
OrFilter: MessageTypeDefinition
|
||||
ResponseFlagFilter: MessageTypeDefinition
|
||||
RuntimeFilter: MessageTypeDefinition
|
||||
StatusCodeFilter: MessageTypeDefinition
|
||||
TraceableFilter: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
bootstrap: {
|
||||
v3: {
|
||||
Admin: MessageTypeDefinition
|
||||
Bootstrap: MessageTypeDefinition
|
||||
ClusterManager: MessageTypeDefinition
|
||||
CustomInlineHeader: MessageTypeDefinition
|
||||
FatalAction: MessageTypeDefinition
|
||||
LayeredRuntime: MessageTypeDefinition
|
||||
Runtime: MessageTypeDefinition
|
||||
RuntimeLayer: MessageTypeDefinition
|
||||
Watchdog: MessageTypeDefinition
|
||||
Watchdogs: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
cluster: {
|
||||
v3: {
|
||||
CircuitBreakers: MessageTypeDefinition
|
||||
Cluster: MessageTypeDefinition
|
||||
ClusterCollection: MessageTypeDefinition
|
||||
Filter: MessageTypeDefinition
|
||||
LoadBalancingPolicy: MessageTypeDefinition
|
||||
OutlierDetection: MessageTypeDefinition
|
||||
TrackClusterStats: MessageTypeDefinition
|
||||
UpstreamBindConfig: MessageTypeDefinition
|
||||
UpstreamConnectionOptions: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
core: {
|
||||
v3: {
|
||||
Address: MessageTypeDefinition
|
||||
AggregatedConfigSource: MessageTypeDefinition
|
||||
AlternateProtocolsCacheOptions: MessageTypeDefinition
|
||||
ApiConfigSource: MessageTypeDefinition
|
||||
ApiVersion: EnumTypeDefinition
|
||||
AsyncDataSource: MessageTypeDefinition
|
||||
BackoffStrategy: MessageTypeDefinition
|
||||
BindConfig: MessageTypeDefinition
|
||||
BuildVersion: MessageTypeDefinition
|
||||
CidrRange: MessageTypeDefinition
|
||||
ConfigSource: MessageTypeDefinition
|
||||
ControlPlane: MessageTypeDefinition
|
||||
DataSource: MessageTypeDefinition
|
||||
DnsResolutionConfig: MessageTypeDefinition
|
||||
DnsResolverOptions: MessageTypeDefinition
|
||||
EnvoyInternalAddress: MessageTypeDefinition
|
||||
EventServiceConfig: MessageTypeDefinition
|
||||
Extension: MessageTypeDefinition
|
||||
ExtensionConfigSource: MessageTypeDefinition
|
||||
GrpcProtocolOptions: MessageTypeDefinition
|
||||
GrpcService: MessageTypeDefinition
|
||||
ExtraSourceAddress: MessageTypeDefinition
|
||||
HeaderMap: MessageTypeDefinition
|
||||
HeaderValue: MessageTypeDefinition
|
||||
HeaderValueOption: MessageTypeDefinition
|
||||
HealthCheck: MessageTypeDefinition
|
||||
HealthStatus: EnumTypeDefinition
|
||||
Http1ProtocolOptions: MessageTypeDefinition
|
||||
Http2ProtocolOptions: MessageTypeDefinition
|
||||
Http3ProtocolOptions: MessageTypeDefinition
|
||||
HttpProtocolOptions: MessageTypeDefinition
|
||||
HttpUri: MessageTypeDefinition
|
||||
KeepaliveSettings: MessageTypeDefinition
|
||||
KeyValue: MessageTypeDefinition
|
||||
KeyValueAppend: MessageTypeDefinition
|
||||
KeyValueMutation: MessageTypeDefinition
|
||||
Locality: MessageTypeDefinition
|
||||
Metadata: MessageTypeDefinition
|
||||
Node: MessageTypeDefinition
|
||||
Pipe: MessageTypeDefinition
|
||||
ProxyProtocolConfig: MessageTypeDefinition
|
||||
QueryParameter: MessageTypeDefinition
|
||||
QuicProtocolOptions: MessageTypeDefinition
|
||||
RateLimitSettings: MessageTypeDefinition
|
||||
RemoteDataSource: MessageTypeDefinition
|
||||
RequestMethod: EnumTypeDefinition
|
||||
RetryPolicy: MessageTypeDefinition
|
||||
|
@ -123,114 +58,16 @@ export interface ProtoGrpcType {
|
|||
RuntimeFractionalPercent: MessageTypeDefinition
|
||||
RuntimePercent: MessageTypeDefinition
|
||||
RuntimeUInt32: MessageTypeDefinition
|
||||
SchemeHeaderTransformation: MessageTypeDefinition
|
||||
SelfConfigSource: MessageTypeDefinition
|
||||
SocketAddress: MessageTypeDefinition
|
||||
SocketOption: MessageTypeDefinition
|
||||
SocketOptionsOverride: MessageTypeDefinition
|
||||
TcpKeepalive: MessageTypeDefinition
|
||||
TcpProtocolOptions: MessageTypeDefinition
|
||||
TrafficDirection: EnumTypeDefinition
|
||||
TransportSocket: MessageTypeDefinition
|
||||
TypedExtensionConfig: MessageTypeDefinition
|
||||
UdpSocketConfig: MessageTypeDefinition
|
||||
UpstreamHttpProtocolOptions: MessageTypeDefinition
|
||||
WatchedDirectory: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
endpoint: {
|
||||
v3: {
|
||||
ClusterLoadAssignment: MessageTypeDefinition
|
||||
Endpoint: MessageTypeDefinition
|
||||
LbEndpoint: MessageTypeDefinition
|
||||
LedsClusterLocalityConfig: MessageTypeDefinition
|
||||
LocalityLbEndpoints: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
listener: {
|
||||
v3: {
|
||||
ActiveRawUdpListenerConfig: MessageTypeDefinition
|
||||
ApiListener: MessageTypeDefinition
|
||||
Filter: MessageTypeDefinition
|
||||
FilterChain: MessageTypeDefinition
|
||||
FilterChainMatch: MessageTypeDefinition
|
||||
Listener: MessageTypeDefinition
|
||||
ListenerCollection: MessageTypeDefinition
|
||||
ListenerFilter: MessageTypeDefinition
|
||||
ListenerFilterChainMatchPredicate: MessageTypeDefinition
|
||||
QuicProtocolOptions: MessageTypeDefinition
|
||||
UdpListenerConfig: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
metrics: {
|
||||
v3: {
|
||||
DogStatsdSink: MessageTypeDefinition
|
||||
HistogramBucketSettings: MessageTypeDefinition
|
||||
HystrixSink: MessageTypeDefinition
|
||||
StatsConfig: MessageTypeDefinition
|
||||
StatsMatcher: MessageTypeDefinition
|
||||
StatsSink: MessageTypeDefinition
|
||||
StatsdSink: MessageTypeDefinition
|
||||
TagSpecifier: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
overload: {
|
||||
v3: {
|
||||
BufferFactoryConfig: MessageTypeDefinition
|
||||
OverloadAction: MessageTypeDefinition
|
||||
OverloadManager: MessageTypeDefinition
|
||||
ResourceMonitor: MessageTypeDefinition
|
||||
ScaleTimersOverloadActionConfig: MessageTypeDefinition
|
||||
ScaledTrigger: MessageTypeDefinition
|
||||
ThresholdTrigger: MessageTypeDefinition
|
||||
Trigger: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
route: {
|
||||
v3: {
|
||||
CorsPolicy: MessageTypeDefinition
|
||||
Decorator: MessageTypeDefinition
|
||||
DirectResponseAction: MessageTypeDefinition
|
||||
FilterAction: MessageTypeDefinition
|
||||
FilterConfig: MessageTypeDefinition
|
||||
HeaderMatcher: MessageTypeDefinition
|
||||
HedgePolicy: MessageTypeDefinition
|
||||
InternalRedirectPolicy: MessageTypeDefinition
|
||||
NonForwardingAction: MessageTypeDefinition
|
||||
QueryParameterMatcher: MessageTypeDefinition
|
||||
RateLimit: MessageTypeDefinition
|
||||
RedirectAction: MessageTypeDefinition
|
||||
RetryPolicy: MessageTypeDefinition
|
||||
Route: MessageTypeDefinition
|
||||
RouteAction: MessageTypeDefinition
|
||||
RouteMatch: MessageTypeDefinition
|
||||
Tracing: MessageTypeDefinition
|
||||
VirtualCluster: MessageTypeDefinition
|
||||
VirtualHost: MessageTypeDefinition
|
||||
WeightedCluster: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
trace: {
|
||||
v3: {
|
||||
Tracing: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
}
|
||||
extensions: {
|
||||
transport_sockets: {
|
||||
tls: {
|
||||
v3: {
|
||||
CertificateProviderPluginInstance: MessageTypeDefinition
|
||||
CertificateValidationContext: MessageTypeDefinition
|
||||
GenericSecret: MessageTypeDefinition
|
||||
PrivateKeyProvider: MessageTypeDefinition
|
||||
SdsSecretConfig: MessageTypeDefinition
|
||||
Secret: MessageTypeDefinition
|
||||
TlsCertificate: MessageTypeDefinition
|
||||
TlsParameters: MessageTypeDefinition
|
||||
TlsSessionTicketKeys: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
service: {
|
||||
status: {
|
||||
|
@ -256,8 +93,8 @@ export interface ProtoGrpcType {
|
|||
DoubleMatcher: MessageTypeDefinition
|
||||
ListMatcher: MessageTypeDefinition
|
||||
ListStringMatcher: MessageTypeDefinition
|
||||
MetadataMatcher: MessageTypeDefinition
|
||||
NodeMatcher: MessageTypeDefinition
|
||||
OrMatcher: MessageTypeDefinition
|
||||
RegexMatchAndSubstitute: MessageTypeDefinition
|
||||
RegexMatcher: MessageTypeDefinition
|
||||
StringMatcher: MessageTypeDefinition
|
||||
|
@ -265,19 +102,7 @@ export interface ProtoGrpcType {
|
|||
ValueMatcher: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
metadata: {
|
||||
v3: {
|
||||
MetadataKey: MessageTypeDefinition
|
||||
MetadataKind: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
tracing: {
|
||||
v3: {
|
||||
CustomTag: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
v3: {
|
||||
CodecClientType: EnumTypeDefinition
|
||||
DoubleRange: MessageTypeDefinition
|
||||
FractionalPercent: MessageTypeDefinition
|
||||
Int32Range: MessageTypeDefinition
|
||||
|
@ -300,7 +125,6 @@ export interface ProtoGrpcType {
|
|||
DescriptorProto: MessageTypeDefinition
|
||||
DoubleValue: MessageTypeDefinition
|
||||
Duration: MessageTypeDefinition
|
||||
Empty: MessageTypeDefinition
|
||||
EnumDescriptorProto: MessageTypeDefinition
|
||||
EnumOptions: MessageTypeDefinition
|
||||
EnumValueDescriptorProto: MessageTypeDefinition
|
||||
|
@ -336,7 +160,6 @@ export interface ProtoGrpcType {
|
|||
udpa: {
|
||||
annotations: {
|
||||
FieldMigrateAnnotation: MessageTypeDefinition
|
||||
FieldSecurityAnnotation: MessageTypeDefinition
|
||||
FileMigrateAnnotation: MessageTypeDefinition
|
||||
MigrateAnnotation: MessageTypeDefinition
|
||||
PackageVersionStatus: EnumTypeDefinition
|
||||
|
@ -382,10 +205,8 @@ export interface ProtoGrpcType {
|
|||
}
|
||||
core: {
|
||||
v3: {
|
||||
Authority: MessageTypeDefinition
|
||||
CollectionEntry: MessageTypeDefinition
|
||||
ContextParams: MessageTypeDefinition
|
||||
ResourceLocator: MessageTypeDefinition
|
||||
TypedExtensionConfig: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,17 +28,26 @@ export interface ProtoGrpcType {
|
|||
EnvoyInternalAddress: MessageTypeDefinition
|
||||
EventServiceConfig: MessageTypeDefinition
|
||||
Extension: MessageTypeDefinition
|
||||
ExtensionConfigSource: MessageTypeDefinition
|
||||
ExtraSourceAddress: MessageTypeDefinition
|
||||
GrpcService: MessageTypeDefinition
|
||||
HeaderMap: MessageTypeDefinition
|
||||
HeaderValue: MessageTypeDefinition
|
||||
HeaderValueOption: MessageTypeDefinition
|
||||
HealthCheck: MessageTypeDefinition
|
||||
HealthStatus: EnumTypeDefinition
|
||||
HealthStatusSet: MessageTypeDefinition
|
||||
HttpUri: MessageTypeDefinition
|
||||
KeyValue: MessageTypeDefinition
|
||||
KeyValueAppend: MessageTypeDefinition
|
||||
KeyValueMutation: MessageTypeDefinition
|
||||
Locality: MessageTypeDefinition
|
||||
Metadata: MessageTypeDefinition
|
||||
Node: MessageTypeDefinition
|
||||
PathConfigSource: MessageTypeDefinition
|
||||
Pipe: MessageTypeDefinition
|
||||
ProxyProtocolConfig: MessageTypeDefinition
|
||||
ProxyProtocolPassThroughTLVs: MessageTypeDefinition
|
||||
QueryParameter: MessageTypeDefinition
|
||||
RateLimitSettings: MessageTypeDefinition
|
||||
RemoteDataSource: MessageTypeDefinition
|
||||
|
@ -53,9 +62,11 @@ export interface ProtoGrpcType {
|
|||
SelfConfigSource: MessageTypeDefinition
|
||||
SocketAddress: MessageTypeDefinition
|
||||
SocketOption: MessageTypeDefinition
|
||||
SocketOptionsOverride: MessageTypeDefinition
|
||||
TcpKeepalive: MessageTypeDefinition
|
||||
TrafficDirection: EnumTypeDefinition
|
||||
TransportSocket: MessageTypeDefinition
|
||||
TypedExtensionConfig: MessageTypeDefinition
|
||||
WatchedDirectory: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
|
@ -180,6 +191,7 @@ export interface ProtoGrpcType {
|
|||
v3: {
|
||||
Authority: MessageTypeDefinition
|
||||
ContextParams: MessageTypeDefinition
|
||||
TypedExtensionConfig: MessageTypeDefinition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump.proto
|
||||
|
||||
import type { Bootstrap as _envoy_config_bootstrap_v3_Bootstrap, Bootstrap__Output as _envoy_config_bootstrap_v3_Bootstrap__Output } from '../../../envoy/config/bootstrap/v3/Bootstrap';
|
||||
import type { Timestamp as _google_protobuf_Timestamp, Timestamp__Output as _google_protobuf_Timestamp__Output } from '../../../google/protobuf/Timestamp';
|
||||
|
||||
/**
|
||||
* This message describes the bootstrap configuration that Envoy was started with. This includes
|
||||
* any CLI overrides that were merged. Bootstrap configuration information can be used to recreate
|
||||
* the static portions of an Envoy configuration by reusing the output as the bootstrap
|
||||
* configuration for another Envoy.
|
||||
*/
|
||||
export interface BootstrapConfigDump {
|
||||
'bootstrap'?: (_envoy_config_bootstrap_v3_Bootstrap | null);
|
||||
/**
|
||||
* The timestamp when the BootstrapConfig was last updated.
|
||||
*/
|
||||
'last_updated'?: (_google_protobuf_Timestamp | null);
|
||||
}
|
||||
|
||||
/**
|
||||
* This message describes the bootstrap configuration that Envoy was started with. This includes
|
||||
* any CLI overrides that were merged. Bootstrap configuration information can be used to recreate
|
||||
* the static portions of an Envoy configuration by reusing the output as the bootstrap
|
||||
* configuration for another Envoy.
|
||||
*/
|
||||
export interface BootstrapConfigDump__Output {
|
||||
'bootstrap': (_envoy_config_bootstrap_v3_Bootstrap__Output | null);
|
||||
/**
|
||||
* The timestamp when the BootstrapConfig was last updated.
|
||||
*/
|
||||
'last_updated': (_google_protobuf_Timestamp__Output | null);
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump.proto
|
||||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump_shared.proto
|
||||
|
||||
/**
|
||||
* Resource status from the view of a xDS client, which tells the synchronization
|
||||
* status between the xDS client and the xDS server.
|
||||
*/
|
||||
export enum ClientResourceStatus {
|
||||
export const ClientResourceStatus = {
|
||||
/**
|
||||
* Resource status is not available/unknown.
|
||||
*/
|
||||
UNKNOWN = 0,
|
||||
UNKNOWN: 'UNKNOWN',
|
||||
/**
|
||||
* Client requested this resource but hasn't received any update from management
|
||||
* server. The client will not fail requests, but will queue them until update
|
||||
* arrives or the client times out waiting for the resource.
|
||||
*/
|
||||
REQUESTED = 1,
|
||||
REQUESTED: 'REQUESTED',
|
||||
/**
|
||||
* This resource has been requested by the client but has either not been
|
||||
* delivered by the server or was previously delivered by the server and then
|
||||
|
@ -22,13 +22,56 @@ export enum ClientResourceStatus {
|
|||
* information, please refer to the :ref:`"Knowing When a Requested Resource
|
||||
* Does Not Exist" <xds_protocol_resource_not_existed>` section.
|
||||
*/
|
||||
DOES_NOT_EXIST = 2,
|
||||
DOES_NOT_EXIST: 'DOES_NOT_EXIST',
|
||||
/**
|
||||
* Client received this resource and replied with ACK.
|
||||
*/
|
||||
ACKED = 3,
|
||||
ACKED: 'ACKED',
|
||||
/**
|
||||
* Client received this resource and replied with NACK.
|
||||
*/
|
||||
NACKED = 4,
|
||||
}
|
||||
NACKED: 'NACKED',
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Resource status from the view of a xDS client, which tells the synchronization
|
||||
* status between the xDS client and the xDS server.
|
||||
*/
|
||||
export type ClientResourceStatus =
|
||||
/**
|
||||
* Resource status is not available/unknown.
|
||||
*/
|
||||
| 'UNKNOWN'
|
||||
| 0
|
||||
/**
|
||||
* Client requested this resource but hasn't received any update from management
|
||||
* server. The client will not fail requests, but will queue them until update
|
||||
* arrives or the client times out waiting for the resource.
|
||||
*/
|
||||
| 'REQUESTED'
|
||||
| 1
|
||||
/**
|
||||
* This resource has been requested by the client but has either not been
|
||||
* delivered by the server or was previously delivered by the server and then
|
||||
* subsequently removed from resources provided by the server. For more
|
||||
* information, please refer to the :ref:`"Knowing When a Requested Resource
|
||||
* Does Not Exist" <xds_protocol_resource_not_existed>` section.
|
||||
*/
|
||||
| 'DOES_NOT_EXIST'
|
||||
| 2
|
||||
/**
|
||||
* Client received this resource and replied with ACK.
|
||||
*/
|
||||
| 'ACKED'
|
||||
| 3
|
||||
/**
|
||||
* Client received this resource and replied with NACK.
|
||||
*/
|
||||
| 'NACKED'
|
||||
| 4
|
||||
|
||||
/**
|
||||
* Resource status from the view of a xDS client, which tells the synchronization
|
||||
* status between the xDS client and the xDS server.
|
||||
*/
|
||||
export type ClientResourceStatus__Output = typeof ClientResourceStatus[keyof typeof ClientResourceStatus]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump.proto
|
||||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump_shared.proto
|
||||
|
||||
import type { Any as _google_protobuf_Any, Any__Output as _google_protobuf_Any__Output } from '../../../google/protobuf/Any';
|
||||
import type { Timestamp as _google_protobuf_Timestamp, Timestamp__Output as _google_protobuf_Timestamp__Output } from '../../../google/protobuf/Timestamp';
|
||||
import type { UpdateFailureState as _envoy_admin_v3_UpdateFailureState, UpdateFailureState__Output as _envoy_admin_v3_UpdateFailureState__Output } from '../../../envoy/admin/v3/UpdateFailureState';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus, ClientResourceStatus__Output as _envoy_admin_v3_ClientResourceStatus__Output } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
|
||||
/**
|
||||
* Describes a dynamically loaded cluster via the CDS API.
|
||||
|
@ -27,7 +27,7 @@ export interface _envoy_admin_v3_ClustersConfigDump_DynamicCluster {
|
|||
'last_updated'?: (_google_protobuf_Timestamp | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The *error_state* field contains the rejected version of this particular
|
||||
* The ``error_state`` field contains the rejected version of this particular
|
||||
* resource along with the reason and timestamp. For successfully updated or
|
||||
* acknowledged resource, this field should be empty.
|
||||
* [#not-implemented-hide:]
|
||||
|
@ -37,7 +37,7 @@ export interface _envoy_admin_v3_ClustersConfigDump_DynamicCluster {
|
|||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus | keyof typeof _envoy_admin_v3_ClientResourceStatus);
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ export interface _envoy_admin_v3_ClustersConfigDump_DynamicCluster__Output {
|
|||
'last_updated': (_google_protobuf_Timestamp__Output | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The *error_state* field contains the rejected version of this particular
|
||||
* The ``error_state`` field contains the rejected version of this particular
|
||||
* resource along with the reason and timestamp. For successfully updated or
|
||||
* acknowledged resource, this field should be empty.
|
||||
* [#not-implemented-hide:]
|
||||
|
@ -72,7 +72,7 @@ export interface _envoy_admin_v3_ClustersConfigDump_DynamicCluster__Output {
|
|||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status': (keyof typeof _envoy_admin_v3_ClientResourceStatus);
|
||||
'client_status': (_envoy_admin_v3_ClientResourceStatus__Output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump.proto
|
||||
|
||||
import type { Any as _google_protobuf_Any, Any__Output as _google_protobuf_Any__Output } from '../../../google/protobuf/Any';
|
||||
|
||||
/**
|
||||
* The :ref:`/config_dump <operations_admin_interface_config_dump>` admin endpoint uses this wrapper
|
||||
* message to maintain and serve arbitrary configuration information from any component in Envoy.
|
||||
*/
|
||||
export interface ConfigDump {
|
||||
/**
|
||||
* This list is serialized and dumped in its entirety at the
|
||||
* :ref:`/config_dump <operations_admin_interface_config_dump>` endpoint.
|
||||
*
|
||||
* The following configurations are currently supported and will be dumped in the order given
|
||||
* below:
|
||||
*
|
||||
* * *bootstrap*: :ref:`BootstrapConfigDump <envoy_v3_api_msg_admin.v3.BootstrapConfigDump>`
|
||||
* * *clusters*: :ref:`ClustersConfigDump <envoy_v3_api_msg_admin.v3.ClustersConfigDump>`
|
||||
* * *endpoints*: :ref:`EndpointsConfigDump <envoy_v3_api_msg_admin.v3.EndpointsConfigDump>`
|
||||
* * *listeners*: :ref:`ListenersConfigDump <envoy_v3_api_msg_admin.v3.ListenersConfigDump>`
|
||||
* * *scoped_routes*: :ref:`ScopedRoutesConfigDump <envoy_v3_api_msg_admin.v3.ScopedRoutesConfigDump>`
|
||||
* * *routes*: :ref:`RoutesConfigDump <envoy_v3_api_msg_admin.v3.RoutesConfigDump>`
|
||||
* * *secrets*: :ref:`SecretsConfigDump <envoy_v3_api_msg_admin.v3.SecretsConfigDump>`
|
||||
*
|
||||
* EDS Configuration will only be dumped by using parameter `?include_eds`
|
||||
*
|
||||
* You can filter output with the resource and mask query parameters.
|
||||
* See :ref:`/config_dump?resource={} <operations_admin_interface_config_dump_by_resource>`,
|
||||
* :ref:`/config_dump?mask={} <operations_admin_interface_config_dump_by_mask>`,
|
||||
* or :ref:`/config_dump?resource={},mask={}
|
||||
* <operations_admin_interface_config_dump_by_resource_and_mask>` for more information.
|
||||
*/
|
||||
'configs'?: (_google_protobuf_Any)[];
|
||||
}
|
||||
|
||||
/**
|
||||
* The :ref:`/config_dump <operations_admin_interface_config_dump>` admin endpoint uses this wrapper
|
||||
* message to maintain and serve arbitrary configuration information from any component in Envoy.
|
||||
*/
|
||||
export interface ConfigDump__Output {
|
||||
/**
|
||||
* This list is serialized and dumped in its entirety at the
|
||||
* :ref:`/config_dump <operations_admin_interface_config_dump>` endpoint.
|
||||
*
|
||||
* The following configurations are currently supported and will be dumped in the order given
|
||||
* below:
|
||||
*
|
||||
* * *bootstrap*: :ref:`BootstrapConfigDump <envoy_v3_api_msg_admin.v3.BootstrapConfigDump>`
|
||||
* * *clusters*: :ref:`ClustersConfigDump <envoy_v3_api_msg_admin.v3.ClustersConfigDump>`
|
||||
* * *endpoints*: :ref:`EndpointsConfigDump <envoy_v3_api_msg_admin.v3.EndpointsConfigDump>`
|
||||
* * *listeners*: :ref:`ListenersConfigDump <envoy_v3_api_msg_admin.v3.ListenersConfigDump>`
|
||||
* * *scoped_routes*: :ref:`ScopedRoutesConfigDump <envoy_v3_api_msg_admin.v3.ScopedRoutesConfigDump>`
|
||||
* * *routes*: :ref:`RoutesConfigDump <envoy_v3_api_msg_admin.v3.RoutesConfigDump>`
|
||||
* * *secrets*: :ref:`SecretsConfigDump <envoy_v3_api_msg_admin.v3.SecretsConfigDump>`
|
||||
*
|
||||
* EDS Configuration will only be dumped by using parameter `?include_eds`
|
||||
*
|
||||
* You can filter output with the resource and mask query parameters.
|
||||
* See :ref:`/config_dump?resource={} <operations_admin_interface_config_dump_by_resource>`,
|
||||
* :ref:`/config_dump?mask={} <operations_admin_interface_config_dump_by_mask>`,
|
||||
* or :ref:`/config_dump?resource={},mask={}
|
||||
* <operations_admin_interface_config_dump_by_resource_and_mask>` for more information.
|
||||
*/
|
||||
'configs': (_google_protobuf_Any__Output)[];
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump_shared.proto
|
||||
|
||||
import type { Any as _google_protobuf_Any, Any__Output as _google_protobuf_Any__Output } from '../../../google/protobuf/Any';
|
||||
import type { Timestamp as _google_protobuf_Timestamp, Timestamp__Output as _google_protobuf_Timestamp__Output } from '../../../google/protobuf/Timestamp';
|
||||
import type { UpdateFailureState as _envoy_admin_v3_UpdateFailureState, UpdateFailureState__Output as _envoy_admin_v3_UpdateFailureState__Output } from '../../../envoy/admin/v3/UpdateFailureState';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus, ClientResourceStatus__Output as _envoy_admin_v3_ClientResourceStatus__Output } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
|
||||
/**
|
||||
* [#next-free-field: 6]
|
||||
*/
|
||||
export interface _envoy_admin_v3_EcdsConfigDump_EcdsFilterConfig {
|
||||
/**
|
||||
* This is the per-resource version information. This version is currently
|
||||
* taken from the :ref:`version_info
|
||||
* <envoy_v3_api_field_service.discovery.v3.DiscoveryResponse.version_info>`
|
||||
* field at the time that the ECDS filter was loaded.
|
||||
*/
|
||||
'version_info'?: (string);
|
||||
/**
|
||||
* The ECDS filter config.
|
||||
*/
|
||||
'ecds_filter'?: (_google_protobuf_Any | null);
|
||||
/**
|
||||
* The timestamp when the ECDS filter was last updated.
|
||||
*/
|
||||
'last_updated'?: (_google_protobuf_Timestamp | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The ``error_state`` field contains the rejected version of this
|
||||
* particular resource along with the reason and timestamp. For successfully
|
||||
* updated or acknowledged resource, this field should be empty.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'error_state'?: (_envoy_admin_v3_UpdateFailureState | null);
|
||||
/**
|
||||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* [#next-free-field: 6]
|
||||
*/
|
||||
export interface _envoy_admin_v3_EcdsConfigDump_EcdsFilterConfig__Output {
|
||||
/**
|
||||
* This is the per-resource version information. This version is currently
|
||||
* taken from the :ref:`version_info
|
||||
* <envoy_v3_api_field_service.discovery.v3.DiscoveryResponse.version_info>`
|
||||
* field at the time that the ECDS filter was loaded.
|
||||
*/
|
||||
'version_info': (string);
|
||||
/**
|
||||
* The ECDS filter config.
|
||||
*/
|
||||
'ecds_filter': (_google_protobuf_Any__Output | null);
|
||||
/**
|
||||
* The timestamp when the ECDS filter was last updated.
|
||||
*/
|
||||
'last_updated': (_google_protobuf_Timestamp__Output | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The ``error_state`` field contains the rejected version of this
|
||||
* particular resource along with the reason and timestamp. For successfully
|
||||
* updated or acknowledged resource, this field should be empty.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'error_state': (_envoy_admin_v3_UpdateFailureState__Output | null);
|
||||
/**
|
||||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status': (_envoy_admin_v3_ClientResourceStatus__Output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoy's ECDS service fills this message with all currently extension
|
||||
* configuration. Extension configuration information can be used to recreate
|
||||
* an Envoy ECDS listener and HTTP filters as static filters or by returning
|
||||
* them in ECDS response.
|
||||
*/
|
||||
export interface EcdsConfigDump {
|
||||
/**
|
||||
* The ECDS filter configs.
|
||||
*/
|
||||
'ecds_filters'?: (_envoy_admin_v3_EcdsConfigDump_EcdsFilterConfig)[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoy's ECDS service fills this message with all currently extension
|
||||
* configuration. Extension configuration information can be used to recreate
|
||||
* an Envoy ECDS listener and HTTP filters as static filters or by returning
|
||||
* them in ECDS response.
|
||||
*/
|
||||
export interface EcdsConfigDump__Output {
|
||||
/**
|
||||
* The ECDS filter configs.
|
||||
*/
|
||||
'ecds_filters': (_envoy_admin_v3_EcdsConfigDump_EcdsFilterConfig__Output)[];
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump.proto
|
||||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump_shared.proto
|
||||
|
||||
import type { Any as _google_protobuf_Any, Any__Output as _google_protobuf_Any__Output } from '../../../google/protobuf/Any';
|
||||
import type { Timestamp as _google_protobuf_Timestamp, Timestamp__Output as _google_protobuf_Timestamp__Output } from '../../../google/protobuf/Timestamp';
|
||||
import type { UpdateFailureState as _envoy_admin_v3_UpdateFailureState, UpdateFailureState__Output as _envoy_admin_v3_UpdateFailureState__Output } from '../../../envoy/admin/v3/UpdateFailureState';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus, ClientResourceStatus__Output as _envoy_admin_v3_ClientResourceStatus__Output } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
|
||||
/**
|
||||
* [#next-free-field: 6]
|
||||
|
@ -25,7 +25,7 @@ export interface _envoy_admin_v3_EndpointsConfigDump_DynamicEndpointConfig {
|
|||
'last_updated'?: (_google_protobuf_Timestamp | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The *error_state* field contains the rejected version of this particular
|
||||
* The ``error_state`` field contains the rejected version of this particular
|
||||
* resource along with the reason and timestamp. For successfully updated or
|
||||
* acknowledged resource, this field should be empty.
|
||||
* [#not-implemented-hide:]
|
||||
|
@ -35,7 +35,7 @@ export interface _envoy_admin_v3_EndpointsConfigDump_DynamicEndpointConfig {
|
|||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus | keyof typeof _envoy_admin_v3_ClientResourceStatus);
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ export interface _envoy_admin_v3_EndpointsConfigDump_DynamicEndpointConfig__Outp
|
|||
'last_updated': (_google_protobuf_Timestamp__Output | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The *error_state* field contains the rejected version of this particular
|
||||
* The ``error_state`` field contains the rejected version of this particular
|
||||
* resource along with the reason and timestamp. For successfully updated or
|
||||
* acknowledged resource, this field should be empty.
|
||||
* [#not-implemented-hide:]
|
||||
|
@ -68,7 +68,7 @@ export interface _envoy_admin_v3_EndpointsConfigDump_DynamicEndpointConfig__Outp
|
|||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status': (keyof typeof _envoy_admin_v3_ClientResourceStatus);
|
||||
'client_status': (_envoy_admin_v3_ClientResourceStatus__Output);
|
||||
}
|
||||
|
||||
export interface _envoy_admin_v3_EndpointsConfigDump_StaticEndpointConfig {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump.proto
|
||||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump_shared.proto
|
||||
|
||||
import type { Any as _google_protobuf_Any, Any__Output as _google_protobuf_Any__Output } from '../../../google/protobuf/Any';
|
||||
import type { Timestamp as _google_protobuf_Timestamp, Timestamp__Output as _google_protobuf_Timestamp__Output } from '../../../google/protobuf/Timestamp';
|
||||
import type { UpdateFailureState as _envoy_admin_v3_UpdateFailureState, UpdateFailureState__Output as _envoy_admin_v3_UpdateFailureState__Output } from '../../../envoy/admin/v3/UpdateFailureState';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus, ClientResourceStatus__Output as _envoy_admin_v3_ClientResourceStatus__Output } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
|
||||
/**
|
||||
* Describes a dynamically loaded listener via the LDS API.
|
||||
|
@ -35,7 +35,7 @@ export interface _envoy_admin_v3_ListenersConfigDump_DynamicListener {
|
|||
'draining_state'?: (_envoy_admin_v3_ListenersConfigDump_DynamicListenerState | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The *error_state* field contains the rejected version of this particular
|
||||
* The ``error_state`` field contains the rejected version of this particular
|
||||
* resource along with the reason and timestamp. For successfully updated or
|
||||
* acknowledged resource, this field should be empty.
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ export interface _envoy_admin_v3_ListenersConfigDump_DynamicListener {
|
|||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus | keyof typeof _envoy_admin_v3_ClientResourceStatus);
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ export interface _envoy_admin_v3_ListenersConfigDump_DynamicListener__Output {
|
|||
'draining_state': (_envoy_admin_v3_ListenersConfigDump_DynamicListenerState__Output | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The *error_state* field contains the rejected version of this particular
|
||||
* The ``error_state`` field contains the rejected version of this particular
|
||||
* resource along with the reason and timestamp. For successfully updated or
|
||||
* acknowledged resource, this field should be empty.
|
||||
*/
|
||||
|
@ -86,7 +86,7 @@ export interface _envoy_admin_v3_ListenersConfigDump_DynamicListener__Output {
|
|||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status': (keyof typeof _envoy_admin_v3_ClientResourceStatus);
|
||||
'client_status': (_envoy_admin_v3_ClientResourceStatus__Output);
|
||||
}
|
||||
|
||||
export interface _envoy_admin_v3_ListenersConfigDump_DynamicListenerState {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump.proto
|
||||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump_shared.proto
|
||||
|
||||
import type { Any as _google_protobuf_Any, Any__Output as _google_protobuf_Any__Output } from '../../../google/protobuf/Any';
|
||||
import type { Timestamp as _google_protobuf_Timestamp, Timestamp__Output as _google_protobuf_Timestamp__Output } from '../../../google/protobuf/Timestamp';
|
||||
import type { UpdateFailureState as _envoy_admin_v3_UpdateFailureState, UpdateFailureState__Output as _envoy_admin_v3_UpdateFailureState__Output } from '../../../envoy/admin/v3/UpdateFailureState';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus, ClientResourceStatus__Output as _envoy_admin_v3_ClientResourceStatus__Output } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
|
||||
/**
|
||||
* [#next-free-field: 6]
|
||||
|
@ -25,7 +25,7 @@ export interface _envoy_admin_v3_RoutesConfigDump_DynamicRouteConfig {
|
|||
'last_updated'?: (_google_protobuf_Timestamp | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The *error_state* field contains the rejected version of this particular
|
||||
* The ``error_state`` field contains the rejected version of this particular
|
||||
* resource along with the reason and timestamp. For successfully updated or
|
||||
* acknowledged resource, this field should be empty.
|
||||
* [#not-implemented-hide:]
|
||||
|
@ -35,7 +35,7 @@ export interface _envoy_admin_v3_RoutesConfigDump_DynamicRouteConfig {
|
|||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus | keyof typeof _envoy_admin_v3_ClientResourceStatus);
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ export interface _envoy_admin_v3_RoutesConfigDump_DynamicRouteConfig__Output {
|
|||
'last_updated': (_google_protobuf_Timestamp__Output | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The *error_state* field contains the rejected version of this particular
|
||||
* The ``error_state`` field contains the rejected version of this particular
|
||||
* resource along with the reason and timestamp. For successfully updated or
|
||||
* acknowledged resource, this field should be empty.
|
||||
* [#not-implemented-hide:]
|
||||
|
@ -68,7 +68,7 @@ export interface _envoy_admin_v3_RoutesConfigDump_DynamicRouteConfig__Output {
|
|||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status': (keyof typeof _envoy_admin_v3_ClientResourceStatus);
|
||||
'client_status': (_envoy_admin_v3_ClientResourceStatus__Output);
|
||||
}
|
||||
|
||||
export interface _envoy_admin_v3_RoutesConfigDump_StaticRouteConfig {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump.proto
|
||||
// Original file: deps/envoy-api/envoy/admin/v3/config_dump_shared.proto
|
||||
|
||||
import type { Any as _google_protobuf_Any, Any__Output as _google_protobuf_Any__Output } from '../../../google/protobuf/Any';
|
||||
import type { Timestamp as _google_protobuf_Timestamp, Timestamp__Output as _google_protobuf_Timestamp__Output } from '../../../google/protobuf/Timestamp';
|
||||
import type { UpdateFailureState as _envoy_admin_v3_UpdateFailureState, UpdateFailureState__Output as _envoy_admin_v3_UpdateFailureState__Output } from '../../../envoy/admin/v3/UpdateFailureState';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
import type { ClientResourceStatus as _envoy_admin_v3_ClientResourceStatus, ClientResourceStatus__Output as _envoy_admin_v3_ClientResourceStatus__Output } from '../../../envoy/admin/v3/ClientResourceStatus';
|
||||
|
||||
/**
|
||||
* [#next-free-field: 7]
|
||||
|
@ -29,7 +29,7 @@ export interface _envoy_admin_v3_ScopedRoutesConfigDump_DynamicScopedRouteConfig
|
|||
'last_updated'?: (_google_protobuf_Timestamp | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The *error_state* field contains the rejected version of this particular
|
||||
* The ``error_state`` field contains the rejected version of this particular
|
||||
* resource along with the reason and timestamp. For successfully updated or
|
||||
* acknowledged resource, this field should be empty.
|
||||
* [#not-implemented-hide:]
|
||||
|
@ -39,7 +39,7 @@ export interface _envoy_admin_v3_ScopedRoutesConfigDump_DynamicScopedRouteConfig
|
|||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus | keyof typeof _envoy_admin_v3_ClientResourceStatus);
|
||||
'client_status'?: (_envoy_admin_v3_ClientResourceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,7 @@ export interface _envoy_admin_v3_ScopedRoutesConfigDump_DynamicScopedRouteConfig
|
|||
'last_updated': (_google_protobuf_Timestamp__Output | null);
|
||||
/**
|
||||
* Set if the last update failed, cleared after the next successful update.
|
||||
* The *error_state* field contains the rejected version of this particular
|
||||
* The ``error_state`` field contains the rejected version of this particular
|
||||
* resource along with the reason and timestamp. For successfully updated or
|
||||
* acknowledged resource, this field should be empty.
|
||||
* [#not-implemented-hide:]
|
||||
|
@ -76,7 +76,7 @@ export interface _envoy_admin_v3_ScopedRoutesConfigDump_DynamicScopedRouteConfig
|
|||
* The client status of this resource.
|
||||
* [#not-implemented-hide:]
|
||||
*/
|
||||
'client_status': (keyof typeof _envoy_admin_v3_ClientResourceStatus);
|
||||
'client_status': (_envoy_admin_v3_ClientResourceStatus__Output);
|
||||
}
|
||||
|
||||
export interface _envoy_admin_v3_ScopedRoutesConfigDump_InlineScopedRouteConfigs {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue