Merge branch 'master' into proto-loader_type_generator

This commit is contained in:
Michael Lumish 2020-11-24 16:09:40 -08:00
commit 7c5c4e845a
317 changed files with 9119 additions and 1709 deletions

16
.gitmodules vendored
View File

@ -7,15 +7,15 @@
[submodule "packages/proto-loader/deps/googleapis"]
path = packages/proto-loader/deps/googleapis
url = https://github.com/googleapis/googleapis.git
[submodule "packages/grpc-js/deps/envoy-api"]
path = packages/grpc-js/deps/envoy-api
[submodule "packages/grpc-js-xds/deps/envoy-api"]
path = packages/grpc-js-xds/deps/envoy-api
url = https://github.com/envoyproxy/data-plane-api.git
[submodule "packages/grpc-js/deps/udpa"]
path = packages/grpc-js/deps/udpa
[submodule "packages/grpc-js-xds/deps/udpa"]
path = packages/grpc-js-xds/deps/udpa
url = https://github.com/cncf/udpa.git
[submodule "packages/grpc-js/deps/googleapis"]
path = packages/grpc-js/deps/googleapis
[submodule "packages/grpc-js-xds/deps/googleapis"]
path = packages/grpc-js-xds/deps/googleapis
url = https://github.com/googleapis/googleapis.git
[submodule "packages/grpc-js/deps/protoc-gen-validate"]
path = packages/grpc-js/deps/protoc-gen-validate
[submodule "packages/grpc-js-xds/deps/protoc-gen-validate"]
path = packages/grpc-js-xds/deps/protoc-gen-validate
url = https://github.com/envoyproxy/protoc-gen-validate.git

View File

@ -36,6 +36,7 @@ In addition, all channel arguments defined in [this header file](https://github.
- `grpc.default_authority`
- `grpc.keepalive_time_ms`
- `grpc.keepalive_timeout_ms`
- `grpc.keepalive_permit_without_calls`
- `grpc.service_config`
- `grpc.max_concurrent_streams`
- `grpc.initial_reconnect_backoff_ms`

View File

@ -18,28 +18,29 @@
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 protobuf from './packages/proto-loader/gulpfile';
import * as internalTest from './test/gulpfile';
const installAll = gulp.series(jsCore.install, healthCheck.install, protobuf.install, internalTest.install);
const installAll = gulp.series(jsCore.install, healthCheck.install, protobuf.install, internalTest.install, jsXds.install);
const lint = gulp.parallel(jsCore.lint);
const build = gulp.series(jsCore.compile, protobuf.compile);
const build = gulp.series(jsCore.compile, protobuf.compile, jsXds.compile);
const setup = gulp.series(installAll);
const setupPureJSInterop = gulp.series(jsCore.install, protobuf.install, internalTest.install);
const clean = gulp.series(jsCore.clean, protobuf.clean);
const clean = gulp.series(jsCore.clean, protobuf.clean, jsXds.clean);
const cleanAll = gulp.series(jsCore.cleanAll, internalTest.cleanAll, protobuf.cleanAll);
const cleanAll = gulp.series(jsXds.cleanAll, jsCore.cleanAll, internalTest.cleanAll, protobuf.cleanAll);
const nativeTestOnly = gulp.parallel(healthCheck.test);
const nativeTest = gulp.series(build, nativeTestOnly);
const testOnly = gulp.parallel(jsCore.test, nativeTestOnly, protobuf.test);
const testOnly = gulp.parallel(jsCore.test, nativeTestOnly, protobuf.test, jsXds.test);
const test = gulp.series(build, testOnly, internalTest.test);

View File

@ -0,0 +1,3 @@
{
"extends": "./node_modules/gts/"
}

View File

@ -0,0 +1,3 @@
module.exports = {
...require('gts/.prettierrc.json')
}

View File

@ -0,0 +1,24 @@
# @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.2.x.
## Installation
```
npm install @grpc/grpc-js-xds
```
## Usage
```ts
import * as grpcJsXds from '@grpc/grpc-js-xds';
grpcJsXds.register();
// ...get a @grpc/grpc-js Client class as usual
const client = new MyServiceClient('xds:///example.com:123');
```
## Supported Features
- [xDS-Based Global Load Balancing](https://github.com/grpc/proposal/blob/master/A27-xds-global-load-balancing.md)

View File

@ -0,0 +1,78 @@
/*
* 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 gulp from 'gulp';
import * as mocha from 'gulp-mocha';
import * as path from 'path';
import * as execa from 'execa';
import * as semver from 'semver';
Error.stackTraceLimit = Infinity;
const jsCoreDir = __dirname;
const outDir = path.resolve(jsCoreDir, 'build');
const pkgPath = path.resolve(jsCoreDir, 'package.json');
const supportedVersionRange = require(pkgPath).engines.node;
const versionNotSupported = () => {
console.log(`Skipping grpc-js-xds task for Node ${process.version}`);
return () => { return Promise.resolve(); };
};
const identity = (value: any): any => value;
const checkTask = semver.satisfies(process.version, supportedVersionRange) ?
identity : versionNotSupported;
const execNpmVerb = (verb: string, ...args: string[]) =>
execa('npm', [verb, ...args], {cwd: jsCoreDir, stdio: 'inherit'});
const execNpmCommand = execNpmVerb.bind(null, 'run');
const install = checkTask(() => execNpmVerb('install', '--unsafe-perm'));
/**
* Runs tslint on files in src/, with linting rules defined in tslint.json.
*/
const lint = checkTask(() => execNpmCommand('check'));
const cleanFiles = checkTask(() => execNpmCommand('clean'));
const clean = gulp.series(install, cleanFiles);
const cleanAll = gulp.parallel(clean);
/**
* Transpiles TypeScript files in src/ to JavaScript according to the settings
* found in tsconfig.json.
*/
const compile = checkTask(() => execNpmCommand('compile'));
const runTests = checkTask(() => {
return gulp.src(`${outDir}/test/**/*.js`)
.pipe(mocha({reporter: 'mocha-jenkins-reporter',
require: ['ts-node/register']}));
});
const test = gulp.series(install, runTests);
export {
install,
lint,
clean,
cleanAll,
compile,
test
}

View File

@ -0,0 +1,26 @@
// Original file: proto/grpc/testing/messages.proto
/**
* TODO(dgq): Go back to using well-known types once
* https://github.com/grpc/grpc/issues/6980 has been fixed.
* import "google/protobuf/wrappers.proto";
*/
export interface BoolValue {
/**
* The bool value.
*/
'value'?: (boolean);
}
/**
* TODO(dgq): Go back to using well-known types once
* https://github.com/grpc/grpc/issues/6980 has been fixed.
* import "google/protobuf/wrappers.proto";
*/
export interface BoolValue__Output {
/**
* The bool value.
*/
'value': (boolean);
}

View File

@ -0,0 +1,20 @@
// Original file: proto/grpc/testing/messages.proto
/**
* A protobuf representation for grpc status. This is used by test
* clients to specify a status that the server should attempt to return.
*/
export interface EchoStatus {
'code'?: (number);
'message'?: (string);
}
/**
* A protobuf representation for grpc status. This is used by test
* clients to specify a status that the server should attempt to return.
*/
export interface EchoStatus__Output {
'code': (number);
'message': (string);
}

View File

@ -0,0 +1,26 @@
// Original file: proto/grpc/testing/empty.proto
/**
* An empty message that you can re-use to avoid defining duplicated empty
* messages in your project. A typical example is to use it as argument or the
* return value of a service API. For instance:
*
* service Foo {
* rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
* };
*/
export interface Empty {
}
/**
* An empty message that you can re-use to avoid defining duplicated empty
* messages in your project. A typical example is to use it as argument or the
* return value of a service API. For instance:
*
* service Foo {
* rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
* };
*/
export interface Empty__Output {
}

View File

@ -0,0 +1,24 @@
// Original file: proto/grpc/testing/messages.proto
/**
* 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 enum 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,
}

View File

@ -0,0 +1,24 @@
// Original file: proto/grpc/testing/messages.proto
export interface LoadBalancerStatsRequest {
/**
* Request stats for the next num_rpcs sent by client.
*/
'num_rpcs'?: (number);
/**
* If num_rpcs have not completed within timeout_sec, return partial results.
*/
'timeout_sec'?: (number);
}
export interface LoadBalancerStatsRequest__Output {
/**
* Request stats for the next num_rpcs sent by client.
*/
'num_rpcs': (number);
/**
* If num_rpcs have not completed within timeout_sec, return partial results.
*/
'timeout_sec': (number);
}

View File

@ -0,0 +1,40 @@
// Original file: proto/grpc/testing/messages.proto
export interface _grpc_testing_LoadBalancerStatsResponse_RpcsByPeer {
/**
* The number of completed RPCs for each peer.
*/
'rpcs_by_peer'?: ({[key: string]: number});
}
export interface _grpc_testing_LoadBalancerStatsResponse_RpcsByPeer__Output {
/**
* The number of completed RPCs for each peer.
*/
'rpcs_by_peer': ({[key: string]: number});
}
export interface LoadBalancerStatsResponse {
/**
* The number of completed RPCs for each peer.
*/
'rpcs_by_peer'?: ({[key: string]: number});
/**
* The number of RPCs that failed to record a remote peer.
*/
'num_failures'?: (number);
'rpcs_by_method'?: ({[key: string]: _grpc_testing_LoadBalancerStatsResponse_RpcsByPeer});
}
export interface LoadBalancerStatsResponse__Output {
/**
* The number of completed RPCs for each peer.
*/
'rpcs_by_peer': ({[key: string]: number});
/**
* The number of RPCs that failed to record a remote peer.
*/
'num_failures': (number);
'rpcs_by_method'?: ({[key: string]: _grpc_testing_LoadBalancerStatsResponse_RpcsByPeer__Output});
}

View File

@ -0,0 +1,37 @@
// Original file: proto/grpc/testing/test.proto
import * as grpc from '@grpc/grpc-js'
import { LoadBalancerStatsRequest as _grpc_testing_LoadBalancerStatsRequest, LoadBalancerStatsRequest__Output as _grpc_testing_LoadBalancerStatsRequest__Output } from '../../grpc/testing/LoadBalancerStatsRequest';
import { LoadBalancerStatsResponse as _grpc_testing_LoadBalancerStatsResponse, LoadBalancerStatsResponse__Output as _grpc_testing_LoadBalancerStatsResponse__Output } from '../../grpc/testing/LoadBalancerStatsResponse';
/**
* A service used to obtain stats for verifying LB behavior.
*/
export interface LoadBalancerStatsServiceClient extends grpc.Client {
/**
* 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;
/**
* 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;
}
/**
* A service used to obtain stats for verifying LB behavior.
*/
export interface LoadBalancerStatsServiceHandlers extends grpc.UntypedServiceImplementation {
/**
* Gets the backend distribution for RPCs sent by a test client.
*/
GetClientStats(call: grpc.ServerUnaryCall<_grpc_testing_LoadBalancerStatsRequest__Output, _grpc_testing_LoadBalancerStatsResponse>, callback: grpc.sendUnaryData<_grpc_testing_LoadBalancerStatsResponse>): void;
}

View File

@ -0,0 +1,31 @@
// Original file: proto/grpc/testing/messages.proto
import { PayloadType as _grpc_testing_PayloadType } from '../../grpc/testing/PayloadType';
/**
* A block of data, to simply increase gRPC message size.
*/
export interface Payload {
/**
* The type of data in body.
*/
'type'?: (_grpc_testing_PayloadType | keyof typeof _grpc_testing_PayloadType);
/**
* Primary contents of payload.
*/
'body'?: (Buffer | Uint8Array | string);
}
/**
* A block of data, to simply increase gRPC message size.
*/
export interface Payload__Output {
/**
* The type of data in body.
*/
'type': (keyof typeof _grpc_testing_PayloadType);
/**
* Primary contents of payload.
*/
'body': (Buffer);
}

View File

@ -0,0 +1,11 @@
// Original file: proto/grpc/testing/messages.proto
/**
* The type of payload that should be returned.
*/
export enum PayloadType {
/**
* Compressable text format.
*/
COMPRESSABLE = 0,
}

View File

@ -0,0 +1,22 @@
// Original file: proto/grpc/testing/messages.proto
/**
* For reconnect interop test only.
* Server tells client whether its reconnects are following the spec and the
* reconnect backoffs it saw.
*/
export interface ReconnectInfo {
'passed'?: (boolean);
'backoff_ms'?: (number)[];
}
/**
* For reconnect interop test only.
* Server tells client whether its reconnects are following the spec and the
* reconnect backoffs it saw.
*/
export interface ReconnectInfo__Output {
'passed': (boolean);
'backoff_ms': (number)[];
}

View File

@ -0,0 +1,18 @@
// Original file: proto/grpc/testing/messages.proto
/**
* For reconnect interop test only.
* Client tells server what reconnection parameters it used.
*/
export interface ReconnectParams {
'max_reconnect_backoff_ms'?: (number);
}
/**
* For reconnect interop test only.
* Client tells server what reconnection parameters it used.
*/
export interface ReconnectParams__Output {
'max_reconnect_backoff_ms': (number);
}

View File

@ -0,0 +1,40 @@
// Original file: proto/grpc/testing/test.proto
import * as grpc from '@grpc/grpc-js'
import { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
import { ReconnectInfo as _grpc_testing_ReconnectInfo, ReconnectInfo__Output as _grpc_testing_ReconnectInfo__Output } from '../../grpc/testing/ReconnectInfo';
import { ReconnectParams as _grpc_testing_ReconnectParams, ReconnectParams__Output as _grpc_testing_ReconnectParams__Output } from '../../grpc/testing/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;
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;
}
/**
* A service used to control reconnect server.
*/
export interface ReconnectServiceHandlers extends grpc.UntypedServiceImplementation {
Start(call: grpc.ServerUnaryCall<_grpc_testing_ReconnectParams__Output, _grpc_testing_Empty>, callback: grpc.sendUnaryData<_grpc_testing_Empty>): void;
Stop(call: grpc.ServerUnaryCall<_grpc_testing_Empty__Output, _grpc_testing_ReconnectInfo>, callback: grpc.sendUnaryData<_grpc_testing_ReconnectInfo>): void;
}

View File

@ -0,0 +1,47 @@
// Original file: proto/grpc/testing/messages.proto
import { BoolValue as _grpc_testing_BoolValue, BoolValue__Output as _grpc_testing_BoolValue__Output } from '../../grpc/testing/BoolValue';
/**
* Configuration for a particular response.
*/
export interface ResponseParameters {
/**
* Desired payload sizes in responses from the server.
*/
'size'?: (number);
/**
* Desired interval between consecutive responses in the response stream in
* microseconds.
*/
'interval_us'?: (number);
/**
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
*/
'compressed'?: (_grpc_testing_BoolValue);
}
/**
* Configuration for a particular response.
*/
export interface ResponseParameters__Output {
/**
* Desired payload sizes in responses from the server.
*/
'size': (number);
/**
* Desired interval between consecutive responses in the response stream in
* microseconds.
*/
'interval_us': (number);
/**
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
*/
'compressed'?: (_grpc_testing_BoolValue__Output);
}

View File

@ -0,0 +1,106 @@
// Original file: proto/grpc/testing/messages.proto
import { PayloadType as _grpc_testing_PayloadType } from '../../grpc/testing/PayloadType';
import { Payload as _grpc_testing_Payload, Payload__Output as _grpc_testing_Payload__Output } from '../../grpc/testing/Payload';
import { BoolValue as _grpc_testing_BoolValue, BoolValue__Output as _grpc_testing_BoolValue__Output } from '../../grpc/testing/BoolValue';
import { EchoStatus as _grpc_testing_EchoStatus, EchoStatus__Output as _grpc_testing_EchoStatus__Output } from '../../grpc/testing/EchoStatus';
/**
* Unary request.
*/
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);
/**
* Desired payload size in the response from the server.
*/
'response_size'?: (number);
/**
* Optional input payload sent along with the request.
*/
'payload'?: (_grpc_testing_Payload);
/**
* Whether SimpleResponse should include username.
*/
'fill_username'?: (boolean);
/**
* Whether SimpleResponse should include OAuth scope.
*/
'fill_oauth_scope'?: (boolean);
/**
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
*/
'response_compressed'?: (_grpc_testing_BoolValue);
/**
* Whether server should return a given status
*/
'response_status'?: (_grpc_testing_EchoStatus);
/**
* Whether the server should expect this request to be compressed.
*/
'expect_compressed'?: (_grpc_testing_BoolValue);
/**
* Whether SimpleResponse should include server_id.
*/
'fill_server_id'?: (boolean);
/**
* Whether SimpleResponse should include grpclb_route_type.
*/
'fill_grpclb_route_type'?: (boolean);
}
/**
* Unary request.
*/
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);
/**
* Desired payload size in the response from the server.
*/
'response_size': (number);
/**
* Optional input payload sent along with the request.
*/
'payload'?: (_grpc_testing_Payload__Output);
/**
* Whether SimpleResponse should include username.
*/
'fill_username': (boolean);
/**
* Whether SimpleResponse should include OAuth scope.
*/
'fill_oauth_scope': (boolean);
/**
* Whether to request the server to compress the response. This field is
* "nullable" in order to interoperate seamlessly with clients not able to
* implement the full compression tests by introspecting the call to verify
* the response's compression status.
*/
'response_compressed'?: (_grpc_testing_BoolValue__Output);
/**
* Whether server should return a given status
*/
'response_status'?: (_grpc_testing_EchoStatus__Output);
/**
* Whether the server should expect this request to be compressed.
*/
'expect_compressed'?: (_grpc_testing_BoolValue__Output);
/**
* Whether SimpleResponse should include server_id.
*/
'fill_server_id': (boolean);
/**
* Whether SimpleResponse should include grpclb_route_type.
*/
'fill_grpclb_route_type': (boolean);
}

View File

@ -0,0 +1,68 @@
// Original file: proto/grpc/testing/messages.proto
import { Payload as _grpc_testing_Payload, Payload__Output as _grpc_testing_Payload__Output } from '../../grpc/testing/Payload';
import { GrpclbRouteType as _grpc_testing_GrpclbRouteType } from '../../grpc/testing/GrpclbRouteType';
/**
* Unary response, as configured by the request.
*/
export interface SimpleResponse {
/**
* Payload to increase message size.
*/
'payload'?: (_grpc_testing_Payload);
/**
* The user the request came from, for verifying authentication was
* successful when the client expected it.
*/
'username'?: (string);
/**
* OAuth scope.
*/
'oauth_scope'?: (string);
/**
* Server ID. This must be unique among different server instances,
* but the same across all RPC's made to a particular server instance.
*/
'server_id'?: (string);
/**
* gRPCLB Path.
*/
'grpclb_route_type'?: (_grpc_testing_GrpclbRouteType | keyof typeof _grpc_testing_GrpclbRouteType);
/**
* Server hostname.
*/
'hostname'?: (string);
}
/**
* Unary response, as configured by the request.
*/
export interface SimpleResponse__Output {
/**
* Payload to increase message size.
*/
'payload'?: (_grpc_testing_Payload__Output);
/**
* The user the request came from, for verifying authentication was
* successful when the client expected it.
*/
'username': (string);
/**
* OAuth scope.
*/
'oauth_scope': (string);
/**
* Server ID. This must be unique among different server instances,
* but the same across all RPC's made to a particular server instance.
*/
'server_id': (string);
/**
* gRPCLB Path.
*/
'grpclb_route_type': (keyof typeof _grpc_testing_GrpclbRouteType);
/**
* Server hostname.
*/
'hostname': (string);
}

View File

@ -0,0 +1,38 @@
// Original file: proto/grpc/testing/messages.proto
import { Payload as _grpc_testing_Payload, Payload__Output as _grpc_testing_Payload__Output } from '../../grpc/testing/Payload';
import { BoolValue as _grpc_testing_BoolValue, BoolValue__Output as _grpc_testing_BoolValue__Output } from '../../grpc/testing/BoolValue';
/**
* Client-streaming request.
*/
export interface StreamingInputCallRequest {
/**
* Optional input payload sent along with the request.
*/
'payload'?: (_grpc_testing_Payload);
/**
* 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);
}
/**
* Client-streaming request.
*/
export interface StreamingInputCallRequest__Output {
/**
* Optional input payload sent along with the request.
*/
'payload'?: (_grpc_testing_Payload__Output);
/**
* 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);
}

View File

@ -0,0 +1,22 @@
// Original file: proto/grpc/testing/messages.proto
/**
* Client-streaming response.
*/
export interface StreamingInputCallResponse {
/**
* Aggregated size of payloads received from the client.
*/
'aggregated_payload_size'?: (number);
}
/**
* Client-streaming response.
*/
export interface StreamingInputCallResponse__Output {
/**
* Aggregated size of payloads received from the client.
*/
'aggregated_payload_size': (number);
}

View File

@ -0,0 +1,56 @@
// Original file: proto/grpc/testing/messages.proto
import { PayloadType as _grpc_testing_PayloadType } from '../../grpc/testing/PayloadType';
import { ResponseParameters as _grpc_testing_ResponseParameters, ResponseParameters__Output as _grpc_testing_ResponseParameters__Output } from '../../grpc/testing/ResponseParameters';
import { Payload as _grpc_testing_Payload, Payload__Output as _grpc_testing_Payload__Output } from '../../grpc/testing/Payload';
import { EchoStatus as _grpc_testing_EchoStatus, EchoStatus__Output as _grpc_testing_EchoStatus__Output } from '../../grpc/testing/EchoStatus';
/**
* Server-streaming request.
*/
export interface StreamingOutputCallRequest {
/**
* Desired payload type in the response from the server.
* If response_type is RANDOM, the payload from each response in the stream
* 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);
/**
* Configuration for each expected response message.
*/
'response_parameters'?: (_grpc_testing_ResponseParameters)[];
/**
* Optional input payload sent along with the request.
*/
'payload'?: (_grpc_testing_Payload);
/**
* Whether server should return a given status
*/
'response_status'?: (_grpc_testing_EchoStatus);
}
/**
* Server-streaming request.
*/
export interface StreamingOutputCallRequest__Output {
/**
* Desired payload type in the response from the server.
* If response_type is RANDOM, the payload from each response in the stream
* might be of different types. This is to simulate a mixed type of payload
* stream.
*/
'response_type': (keyof typeof _grpc_testing_PayloadType);
/**
* Configuration for each expected response message.
*/
'response_parameters': (_grpc_testing_ResponseParameters__Output)[];
/**
* Optional input payload sent along with the request.
*/
'payload'?: (_grpc_testing_Payload__Output);
/**
* Whether server should return a given status
*/
'response_status'?: (_grpc_testing_EchoStatus__Output);
}

View File

@ -0,0 +1,23 @@
// Original file: proto/grpc/testing/messages.proto
import { Payload as _grpc_testing_Payload, Payload__Output as _grpc_testing_Payload__Output } from '../../grpc/testing/Payload';
/**
* Server-streaming response, as configured by the request and parameters.
*/
export interface StreamingOutputCallResponse {
/**
* Payload to increase response size.
*/
'payload'?: (_grpc_testing_Payload);
}
/**
* Server-streaming response, as configured by the request and parameters.
*/
export interface StreamingOutputCallResponse__Output {
/**
* Payload to increase response size.
*/
'payload'?: (_grpc_testing_Payload__Output);
}

View File

@ -0,0 +1,202 @@
// Original file: proto/grpc/testing/test.proto
import * as grpc from '@grpc/grpc-js'
import { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
import { SimpleRequest as _grpc_testing_SimpleRequest, SimpleRequest__Output as _grpc_testing_SimpleRequest__Output } from '../../grpc/testing/SimpleRequest';
import { SimpleResponse as _grpc_testing_SimpleResponse, SimpleResponse__Output as _grpc_testing_SimpleResponse__Output } from '../../grpc/testing/SimpleResponse';
import { StreamingInputCallRequest as _grpc_testing_StreamingInputCallRequest, StreamingInputCallRequest__Output as _grpc_testing_StreamingInputCallRequest__Output } from '../../grpc/testing/StreamingInputCallRequest';
import { StreamingInputCallResponse as _grpc_testing_StreamingInputCallResponse, StreamingInputCallResponse__Output as _grpc_testing_StreamingInputCallResponse__Output } from '../../grpc/testing/StreamingInputCallResponse';
import { StreamingOutputCallRequest as _grpc_testing_StreamingOutputCallRequest, StreamingOutputCallRequest__Output as _grpc_testing_StreamingOutputCallRequest__Output } from '../../grpc/testing/StreamingOutputCallRequest';
import { StreamingOutputCallResponse as _grpc_testing_StreamingOutputCallResponse, StreamingOutputCallResponse__Output as _grpc_testing_StreamingOutputCallResponse__Output } from '../../grpc/testing/StreamingOutputCallResponse';
/**
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
*/
export interface TestServiceClient extends grpc.Client {
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full duplexing.
*/
FullDuplexCall(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse__Output>;
FullDuplexCall(options?: grpc.CallOptions): grpc.ClientDuplexStream<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse__Output>;
/**
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full duplexing.
*/
fullDuplexCall(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse__Output>;
fullDuplexCall(options?: grpc.CallOptions): grpc.ClientDuplexStream<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse__Output>;
/**
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
*/
HalfDuplexCall(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse__Output>;
HalfDuplexCall(options?: grpc.CallOptions): grpc.ClientDuplexStream<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse__Output>;
/**
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
*/
halfDuplexCall(metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse__Output>;
halfDuplexCall(options?: grpc.CallOptions): grpc.ClientDuplexStream<_grpc_testing_StreamingOutputCallRequest, _grpc_testing_StreamingOutputCallResponse__Output>;
/**
* 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_StreamingInputCallResponse__Output>;
StreamingInputCall(metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallResponse__Output>;
StreamingInputCall(options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallResponse__Output>;
StreamingInputCall(callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallResponse__Output>;
/**
* 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_StreamingInputCallResponse__Output>;
streamingInputCall(metadata: grpc.Metadata, callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallResponse__Output>;
streamingInputCall(options: grpc.CallOptions, callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallResponse__Output>;
streamingInputCall(callback: (error?: grpc.ServiceError, result?: _grpc_testing_StreamingInputCallResponse__Output) => void): grpc.ClientWritableStream<_grpc_testing_StreamingInputCallResponse__Output>;
/**
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
*/
StreamingOutputCall(argument: _grpc_testing_StreamingOutputCallRequest, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_grpc_testing_StreamingOutputCallResponse__Output>;
StreamingOutputCall(argument: _grpc_testing_StreamingOutputCallRequest, options?: grpc.CallOptions): grpc.ClientReadableStream<_grpc_testing_StreamingOutputCallResponse__Output>;
/**
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
*/
streamingOutputCall(argument: _grpc_testing_StreamingOutputCallRequest, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_grpc_testing_StreamingOutputCallResponse__Output>;
streamingOutputCall(argument: _grpc_testing_StreamingOutputCallRequest, options?: grpc.CallOptions): grpc.ClientReadableStream<_grpc_testing_StreamingOutputCallResponse__Output>;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
}
/**
* A simple service to test the various types of RPCs and experiment with
* performance with various types of payload.
*/
export interface TestServiceHandlers extends grpc.UntypedServiceImplementation {
/**
* 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(call: grpc.ServerUnaryCall<_grpc_testing_SimpleRequest__Output, _grpc_testing_SimpleResponse>, callback: grpc.sendUnaryData<_grpc_testing_SimpleResponse>): void;
/**
* One empty request followed by one empty response.
*/
EmptyCall(call: grpc.ServerUnaryCall<_grpc_testing_Empty__Output, _grpc_testing_Empty>, callback: grpc.sendUnaryData<_grpc_testing_Empty>): void;
/**
* A sequence of requests with each request served by the server immediately.
* As one request could lead to multiple responses, this interface
* demonstrates the idea of full duplexing.
*/
FullDuplexCall(call: grpc.ServerDuplexStream<_grpc_testing_StreamingOutputCallRequest__Output, _grpc_testing_StreamingOutputCallResponse>): void;
/**
* A sequence of requests followed by a sequence of responses.
* The server buffers all the client requests and then serves them in order. A
* stream of responses are returned to the client when the server starts with
* first request.
*/
HalfDuplexCall(call: grpc.ServerDuplexStream<_grpc_testing_StreamingOutputCallRequest__Output, _grpc_testing_StreamingOutputCallResponse>): void;
/**
* A sequence of requests followed by one response (streamed upload).
* The server returns the aggregated size of client payload as the result.
*/
StreamingInputCall(call: grpc.ServerReadableStream<_grpc_testing_StreamingInputCallRequest__Output, _grpc_testing_StreamingInputCallResponse>, callback: grpc.sendUnaryData<_grpc_testing_StreamingInputCallResponse>): void;
/**
* One request followed by a sequence of responses (streamed download).
* The server returns the payload with client desired type and sizes.
*/
StreamingOutputCall(call: grpc.ServerWritableStream<_grpc_testing_StreamingOutputCallRequest__Output, _grpc_testing_StreamingOutputCallResponse>): void;
/**
* One request followed by one response.
*/
UnaryCall(call: grpc.ServerUnaryCall<_grpc_testing_SimpleRequest__Output, _grpc_testing_SimpleResponse>, callback: grpc.sendUnaryData<_grpc_testing_SimpleResponse>): void;
/**
* The test server will not implement this method. It will be used
* to test the behavior when clients call unimplemented methods.
*/
UnimplementedCall(call: grpc.ServerUnaryCall<_grpc_testing_Empty__Output, _grpc_testing_Empty>, callback: grpc.sendUnaryData<_grpc_testing_Empty>): void;
}

View File

@ -0,0 +1,38 @@
// Original file: proto/grpc/testing/test.proto
import * as grpc from '@grpc/grpc-js'
import { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
/**
* A simple service NOT implemented at servers so clients can test for
* that case.
*/
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;
/**
* 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;
}
/**
* A simple service NOT implemented at servers so clients can test for
* that case.
*/
export interface UnimplementedServiceHandlers extends grpc.UntypedServiceImplementation {
/**
* A call that no server should implement
*/
UnimplementedCall(call: grpc.ServerUnaryCall<_grpc_testing_Empty__Output, _grpc_testing_Empty>, callback: grpc.sendUnaryData<_grpc_testing_Empty>): void;
}

View File

@ -0,0 +1,38 @@
// Original file: proto/grpc/testing/test.proto
import * as grpc from '@grpc/grpc-js'
import { 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;
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;
}
/**
* A service to remotely control health status of an xDS test server.
*/
export interface XdsUpdateHealthServiceHandlers extends grpc.UntypedServiceImplementation {
SetNotServing(call: grpc.ServerUnaryCall<_grpc_testing_Empty__Output, _grpc_testing_Empty>, callback: grpc.sendUnaryData<_grpc_testing_Empty>): void;
SetServing(call: grpc.ServerUnaryCall<_grpc_testing_Empty__Output, _grpc_testing_Empty>, callback: grpc.sendUnaryData<_grpc_testing_Empty>): void;
}

View File

@ -0,0 +1,60 @@
import * as grpc from '@grpc/grpc-js';
import { ServiceDefinition, EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
import { LoadBalancerStatsServiceClient as _grpc_testing_LoadBalancerStatsServiceClient } from './grpc/testing/LoadBalancerStatsService';
import { ReconnectServiceClient as _grpc_testing_ReconnectServiceClient } from './grpc/testing/ReconnectService';
import { TestServiceClient as _grpc_testing_TestServiceClient } from './grpc/testing/TestService';
import { UnimplementedServiceClient as _grpc_testing_UnimplementedServiceClient } from './grpc/testing/UnimplementedService';
import { XdsUpdateHealthServiceClient as _grpc_testing_XdsUpdateHealthServiceClient } from './grpc/testing/XdsUpdateHealthService';
type ConstructorArguments<Constructor> = Constructor extends new (...args: infer Args) => any ? Args: never;
type SubtypeConstructor<Constructor, Subtype> = {
new(...args: ConstructorArguments<Constructor>): Subtype;
};
export interface ProtoGrpcType {
grpc: {
testing: {
BoolValue: MessageTypeDefinition
EchoStatus: MessageTypeDefinition
Empty: MessageTypeDefinition
GrpclbRouteType: EnumTypeDefinition
LoadBalancerStatsRequest: MessageTypeDefinition
LoadBalancerStatsResponse: MessageTypeDefinition
/**
* A service used to obtain stats for verifying LB behavior.
*/
LoadBalancerStatsService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_LoadBalancerStatsServiceClient> & { service: ServiceDefinition }
Payload: MessageTypeDefinition
PayloadType: EnumTypeDefinition
ReconnectInfo: MessageTypeDefinition
ReconnectParams: MessageTypeDefinition
/**
* A service used to control reconnect server.
*/
ReconnectService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_ReconnectServiceClient> & { service: ServiceDefinition }
ResponseParameters: MessageTypeDefinition
SimpleRequest: MessageTypeDefinition
SimpleResponse: MessageTypeDefinition
StreamingInputCallRequest: MessageTypeDefinition
StreamingInputCallResponse: MessageTypeDefinition
StreamingOutputCallRequest: MessageTypeDefinition
StreamingOutputCallResponse: MessageTypeDefinition
/**
* 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 }
/**
* A simple service NOT implemented at servers so clients can test for
* that case.
*/
UnimplementedService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_UnimplementedServiceClient> & { service: ServiceDefinition }
/**
* A service to remotely control health status of an xDS test server.
*/
XdsUpdateHealthService: SubtypeConstructor<typeof grpc.Client, _grpc_testing_XdsUpdateHealthServiceClient> & { service: ServiceDefinition }
}
}
}

View File

@ -0,0 +1,253 @@
/*
* 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 { TestServiceClient } from './generated/grpc/testing/TestService';
import { LoadBalancerStatsResponse } from './generated/grpc/testing/LoadBalancerStatsResponse';
import * as yargs from 'yargs';
import { LoadBalancerStatsServiceHandlers } from './generated/grpc/testing/LoadBalancerStatsService';
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;
const REQUEST_TIMEOUT_SEC = 20;
const VERBOSITY = Number.parseInt(process.env.NODE_XDS_INTEROP_VERBOSITY ?? '0');
interface CallEndNotifier {
onCallSucceeded(peerName: string): void;
onCallFailed(message: string): void;
}
class CallSubscriber {
private callsStarted = 0;
private callsSucceededByPeer: {[key: string]: number} = {};
private callsSucceeded = 0;
private callsFinished = 0;
private failureMessageCount: Map<string, number> = new Map<string, number>();
constructor(private callGoal: number, private onFinished: () => void) {}
addCallStarted(): void {
if (VERBOSITY >= 2) {
console.log('Call started');
}
this.callsStarted += 1;
}
private maybeOnFinished() {
if (this.callsFinished == this.callGoal) {
this.onFinished();
}
}
addCallSucceeded(peerName: string): void {
if (VERBOSITY >= 2) {
console.log(`Call to ${peerName} succeeded`);
}
if (peerName in this.callsSucceededByPeer) {
this.callsSucceededByPeer[peerName] += 1;
} else {
this.callsSucceededByPeer[peerName] = 1;
}
this.callsSucceeded += 1;
this.callsFinished += 1;
this.maybeOnFinished();
}
addCallFailed(message: string): void {
if (VERBOSITY >= 2) {
console.log(`Call failed with message ${message}`);
}
this.callsFinished += 1;
this.failureMessageCount.set(message, (this.failureMessageCount.get(message) ?? 0) + 1);
this.maybeOnFinished();
}
needsMoreCalls(): boolean {
return this.callsStarted < this.callGoal;
}
getFinalStats(): LoadBalancerStatsResponse {
if (VERBOSITY >= 1) {
console.log(`Out of a total of ${this.callGoal} calls requested, ${this.callsFinished} finished. ${this.callsSucceeded} succeeded`);
for (const [message, count] of this.failureMessageCount) {
console.log(`${count} failed with the message ${message}`);
}
}
return {
rpcs_by_peer: this.callsSucceededByPeer,
num_failures: this.callsStarted - this.callsSucceeded
};
}
}
class CallStatsTracker {
private subscribers: CallSubscriber[] = [];
getCallStats(callCount: number, timeoutSec: number): Promise<LoadBalancerStatsResponse> {
return new Promise((resolve, reject) => {
let finished = false;
const subscriber = new CallSubscriber(callCount, () => {
if (!finished) {
finished = true;
resolve(subscriber.getFinalStats());
}
});
setTimeout(() => {
if (!finished) {
finished = true;
this.subscribers.splice(this.subscribers.indexOf(subscriber), 1);
resolve(subscriber.getFinalStats());
}
}, timeoutSec * 1000)
this.subscribers.push(subscriber);
})
}
startCall(): CallEndNotifier {
const callSubscribers = this.subscribers.slice();
for (const subscriber of callSubscribers) {
subscriber.addCallStarted();
if (!subscriber.needsMoreCalls()) {
this.subscribers.splice(this.subscribers.indexOf(subscriber), 1);
}
}
return {
onCallSucceeded: (peerName: string) => {
for (const subscriber of callSubscribers) {
subscriber.addCallSucceeded(peerName);
}
},
onCallFailed: (message: string) => {
for (const subscriber of callSubscribers) {
subscriber.addCallFailed(message);
}
}
}
}
}
function sendConstantQps(client: TestServiceClient, qps: number, failOnFailedRpcs: boolean, callStatsTracker: CallStatsTracker) {
let anyCallSucceeded: boolean = false;
setInterval(() => {
const notifier = callStatsTracker.startCall();
let gotMetadata: boolean = false;
let hostname: string | null = null;
let completed: boolean = false;
let completedWithError: boolean = false;
const deadline = new Date();
deadline.setSeconds(deadline.getSeconds() + REQUEST_TIMEOUT_SEC);
const call = client.emptyCall({}, {deadline}, (error, value) => {
if (error) {
if (failOnFailedRpcs && anyCallSucceeded) {
console.error('A call failed after a call succeeded');
process.exit(1);
}
completed = true;
completedWithError = true;
notifier.onCallFailed(error.message);
} else {
anyCallSucceeded = true;
if (gotMetadata) {
if (hostname === null) {
notifier.onCallFailed('Hostname omitted from call metadata');
} else {
notifier.onCallSucceeded(hostname);
}
}
}
});
call.on('metadata', (metadata) => {
hostname = (metadata.get('hostname') as string[])[0] ?? null;
gotMetadata = true;
if (completed && !completedWithError) {
if (hostname === null) {
notifier.onCallFailed('Hostname omitted from call metadata');
} else {
notifier.onCallSucceeded(hostname);
}
}
})
}, 1000/qps);
}
function main() {
const argv = yargs
.string(['fail_on_failed_rpcs', 'server', 'stats_port'])
.number(['num_channels', 'qps'])
.require(['qps', 'server', 'stats_port'])
.default('num_channels', 1)
.argv;
console.log('Starting xDS interop client. Args: ', argv);
const callStatsTracker = new CallStatsTracker();
for (let i = 0; i < argv.num_channels; i++) {
/* The 'unique' channel argument is there solely to ensure that the
* 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',
callStatsTracker);
}
const loadBalancerStatsServiceImpl: LoadBalancerStatsServiceHandlers = {
GetClientStats: (call, callback) => {
console.log(`Received stats request with num_rpcs=${call.request.num_rpcs} and timeout_sec=${call.request.num_rpcs}`);
callStatsTracker.getCallStats(call.request.num_rpcs, call.request.timeout_sec).then((value) => {
console.log(`Sending stats response: ${JSON.stringify(value)}`);
callback(null, value);
}, (error) => {
callback({code: grpc.status.ABORTED, details: 'Call stats collection failed'});
});
}
}
const server = new grpc.Server();
server.addService(loadedProto.grpc.testing.LoadBalancerStatsService.service, loadBalancerStatsServiceImpl);
server.bindAsync(`0.0.0.0:${argv.stats_port}`, grpc.ServerCredentials.createInsecure(), (error, port) => {
if (error) {
throw error;
}
console.log(`Starting stats service server bound to port ${port}`);
server.start();
});
}
if (require.main === module) {
main();
}

View File

@ -0,0 +1,53 @@
{
"name": "@grpc/grpc-js-xds",
"version": "1.0.0",
"description": "Plugin for @grpc/grpc-js. Adds the xds:// URL scheme and associated features.",
"main": "build/src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"check": "gts check",
"clean": "gts clean",
"compile": "tsc",
"fix": "gts fix",
"prepare": "npm run compile",
"pretest": "npm run compile",
"posttest": "npm run check",
"generate-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --json --includeComments --includeDirs deps/envoy-api/ deps/udpa/ deps/googleapis/ deps/protoc-gen-validate/ -O src/generated/ --grpcLib @grpc/grpc-js envoy/service/discovery/v2/ads.proto envoy/service/load_stats/v2/lrs.proto envoy/api/v2/listener.proto envoy/api/v2/route.proto envoy/api/v2/cluster.proto envoy/api/v2/endpoint.proto envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.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"
},
"repository": {
"type": "git",
"url": "git+https://github.com/grpc/grpc-node.git"
},
"keywords": [
"grpc"
],
"author": {
"name": "Google Inc."
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/grpc/grpc-node/issues"
},
"homepage": "https://github.com/grpc/grpc-node#readme",
"devDependencies": {
"@grpc/grpc-js": "file:../grpc-js",
"gts": "^2.0.2",
"typescript": "^3.8.3",
"@types/gulp": "^4.0.6",
"@types/gulp-mocha": "0.0.32",
"@types/mocha": "^5.2.6",
"@types/node": "^13.11.1",
"@types/yargs": "^15.0.5",
"yargs": "^15.4.1"
},
"dependencies": {
"@grpc/proto-loader": "^0.6.0-pre14"
},
"peerDependencies": {
"@grpc/grpc-js": "~1.2.0"
},
"engines": {
"node": ">=10.10.0"
}
}

View File

@ -0,0 +1,28 @@
// 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.
syntax = "proto3";
package grpc.testing;
// An empty message that you can re-use to avoid defining duplicated empty
// messages in your project. A typical example is to use it as argument or the
// return value of a service API. For instance:
//
// service Foo {
// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
// };
//
message Empty {}

View File

@ -0,0 +1,214 @@
// Copyright 2015-2016 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.
// Message definitions to be used by integration test service definitions.
syntax = "proto3";
package grpc.testing;
// TODO(dgq): Go back to using well-known types once
// https://github.com/grpc/grpc/issues/6980 has been fixed.
// import "google/protobuf/wrappers.proto";
message BoolValue {
// The bool value.
bool value = 1;
}
// The type of payload that should be returned.
enum PayloadType {
// Compressable text format.
COMPRESSABLE = 0;
}
// A block of data, to simply increase gRPC message size.
message Payload {
// The type of data in body.
PayloadType type = 1;
// Primary contents of payload.
bytes body = 2;
}
// A protobuf representation for grpc status. This is used by test
// clients to specify a status that the server should attempt to return.
message EchoStatus {
int32 code = 1;
string message = 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.
enum 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;
}
// Unary request.
message SimpleRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
PayloadType response_type = 1;
// Desired payload size in the response from the server.
int32 response_size = 2;
// Optional input payload sent along with the request.
Payload payload = 3;
// Whether SimpleResponse should include username.
bool fill_username = 4;
// Whether SimpleResponse should include OAuth scope.
bool fill_oauth_scope = 5;
// Whether to request the server to compress the response. This field is
// "nullable" in order to interoperate seamlessly with clients not able to
// implement the full compression tests by introspecting the call to verify
// the response's compression status.
BoolValue response_compressed = 6;
// Whether server should return a given status
EchoStatus response_status = 7;
// Whether the server should expect this request to be compressed.
BoolValue expect_compressed = 8;
// Whether SimpleResponse should include server_id.
bool fill_server_id = 9;
// Whether SimpleResponse should include grpclb_route_type.
bool fill_grpclb_route_type = 10;
}
// Unary response, as configured by the request.
message SimpleResponse {
// Payload to increase message size.
Payload payload = 1;
// The user the request came from, for verifying authentication was
// successful when the client expected it.
string username = 2;
// OAuth scope.
string oauth_scope = 3;
// Server ID. This must be unique among different server instances,
// but the same across all RPC's made to a particular server instance.
string server_id = 4;
// gRPCLB Path.
GrpclbRouteType grpclb_route_type = 5;
// Server hostname.
string hostname = 6;
}
// Client-streaming request.
message StreamingInputCallRequest {
// Optional input payload sent along with the request.
Payload payload = 1;
// 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.
BoolValue expect_compressed = 2;
// Not expecting any payload from the response.
}
// Client-streaming response.
message StreamingInputCallResponse {
// Aggregated size of payloads received from the client.
int32 aggregated_payload_size = 1;
}
// Configuration for a particular response.
message ResponseParameters {
// Desired payload sizes in responses from the server.
int32 size = 1;
// Desired interval between consecutive responses in the response stream in
// microseconds.
int32 interval_us = 2;
// Whether to request the server to compress the response. This field is
// "nullable" in order to interoperate seamlessly with clients not able to
// implement the full compression tests by introspecting the call to verify
// the response's compression status.
BoolValue compressed = 3;
}
// Server-streaming request.
message StreamingOutputCallRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, the payload from each response in the stream
// might be of different types. This is to simulate a mixed type of payload
// stream.
PayloadType response_type = 1;
// Configuration for each expected response message.
repeated ResponseParameters response_parameters = 2;
// Optional input payload sent along with the request.
Payload payload = 3;
// Whether server should return a given status
EchoStatus response_status = 7;
}
// Server-streaming response, as configured by the request and parameters.
message StreamingOutputCallResponse {
// Payload to increase response size.
Payload payload = 1;
}
// For reconnect interop test only.
// Client tells server what reconnection parameters it used.
message ReconnectParams {
int32 max_reconnect_backoff_ms = 1;
}
// For reconnect interop test only.
// Server tells client whether its reconnects are following the spec and the
// reconnect backoffs it saw.
message ReconnectInfo {
bool passed = 1;
repeated int32 backoff_ms = 2;
}
message LoadBalancerStatsRequest {
// Request stats for the next num_rpcs sent by client.
int32 num_rpcs = 1;
// If num_rpcs have not completed within timeout_sec, return partial results.
int32 timeout_sec = 2;
}
message LoadBalancerStatsResponse {
message RpcsByPeer {
// The number of completed RPCs for each peer.
map<string, int32> rpcs_by_peer = 1;
}
// The number of completed RPCs for each peer.
map<string, int32> rpcs_by_peer = 1;
// The number of RPCs that failed to record a remote peer.
int32 num_failures = 2;
map<string, RpcsByPeer> rpcs_by_method = 3;
}

View File

@ -0,0 +1,92 @@
// Copyright 2015-2016 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.
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
syntax = "proto3";
import "grpc/testing/empty.proto";
import "grpc/testing/messages.proto";
package grpc.testing;
// A simple service to test the various types of RPCs and experiment with
// performance with various types of payload.
service TestService {
// One empty request followed by one empty response.
rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty);
// One request followed by one response.
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
// 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.
rpc CacheableUnaryCall(SimpleRequest) returns (SimpleResponse);
// One request followed by a sequence of responses (streamed download).
// The server returns the payload with client desired type and sizes.
rpc StreamingOutputCall(StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
// A sequence of requests followed by one response (streamed upload).
// The server returns the aggregated size of client payload as the result.
rpc StreamingInputCall(stream StreamingInputCallRequest)
returns (StreamingInputCallResponse);
// A sequence of requests with each request served by the server immediately.
// As one request could lead to multiple responses, this interface
// demonstrates the idea of full duplexing.
rpc FullDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
// A sequence of requests followed by a sequence of responses.
// The server buffers all the client requests and then serves them in order. A
// stream of responses are returned to the client when the server starts with
// first request.
rpc HalfDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
// The test server will not implement this method. It will be used
// to test the behavior when clients call unimplemented methods.
rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty);
}
// A simple service NOT implemented at servers so clients can test for
// that case.
service UnimplementedService {
// A call that no server should implement
rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty);
}
// A service used to control reconnect server.
service ReconnectService {
rpc Start(grpc.testing.ReconnectParams) returns (grpc.testing.Empty);
rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo);
}
// A service used to obtain stats for verifying LB behavior.
service LoadBalancerStatsService {
// Gets the backend distribution for RPCs sent by a test client.
rpc GetClientStats(LoadBalancerStatsRequest)
returns (LoadBalancerStatsResponse) {}
}
// A service to remotely control health status of an xDS test server.
service XdsUpdateHealthService {
rpc SetServing(grpc.testing.Empty) returns (grpc.testing.Empty);
rpc SetNotServing(grpc.testing.Empty) returns (grpc.testing.Empty);
}

View File

@ -0,0 +1,67 @@
#!/bin/bash
# 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.
cd $(dirname $0)/..
base=$(pwd)
# Install NVM
cd ~
export NVM_DIR=`pwd`/.nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash
# Load NVM
. $NVM_DIR/nvm.sh
nvm install 12
set -exu -o pipefail
[[ -f /VERSION ]] && cat /VERSION
# Make nvm available to the subprocess that the python script spawns
echo "source $NVM_DIR/nvm.sh" > ~/.profile
echo "source $NVM_DIR/nvm.sh" > ~/.shrc
export ENV=~/.shrc
cd $base/../grpc-js
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
npm install
cd ../../..
git clone -b master --single-branch --depth=1 https://github.com/grpc/grpc.git
grpc/tools/run_tests/helper_scripts/prep_xds.sh
GRPC_NODE_TRACE=xds_client,xds_resolver,cds_balancer,eds_balancer,priority,weighted_target,round_robin,resolving_load_balancer,subchannel,keepalive,dns_resolver \
GRPC_NODE_VERBOSITY=DEBUG \
NODE_XDS_INTEROP_VERBOSITY=1 \
python3 grpc/tools/run_tests/run_xds_tests.py \
--test_case="backends_restart,change_backend_service,gentle_failover,ping_pong,remove_instance_group,round_robin,secondary_locality_gets_no_requests_on_partial_primary_failure,secondary_locality_gets_requests_on_primary_failure" \
--project_id=grpc-testing \
--source_image=projects/grpc-testing/global/images/xds-test-server-2 \
--path_to_server_binary=/java_server/grpc-java/interop-testing/build/install/grpc-interop-testing/bin/xds-test-server \
--gcp_suffix=$(date '+%s') \
--verbose \
--client_cmd="$(which node) grpc-node/packages/grpc-js-xds/build/interop/xds-interop-client \
--server=xds:///{server_uri} \
--stats_port={stats_port} \
--qps={qps} \
{fail_on_failed_rpc} \
{rpcs_to_send} \
{metadata_to_send}"

View File

@ -1,4 +1,4 @@
import * as grpc from '../index';
import * as grpc from '@grpc/grpc-js';
import { ServiceDefinition, EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
import { AggregatedDiscoveryServiceClient as _envoy_service_discovery_v2_AggregatedDiscoveryServiceClient } from './envoy/service/discovery/v2/AggregatedDiscoveryService';
@ -6,7 +6,7 @@ import { AggregatedDiscoveryServiceClient as _envoy_service_discovery_v2_Aggrega
type ConstructorArguments<Constructor> = Constructor extends new (...args: infer Args) => any ? Args: never;
type SubtypeConstructor<Constructor, Subtype> = {
new(...args: ConstructorArguments<Constructor>): Subtype;
}
};
export interface ProtoGrpcType {
envoy: {

View File

@ -1,11 +1,11 @@
import * as grpc from '../index';
import * as grpc from '@grpc/grpc-js';
import { ServiceDefinition, EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
type ConstructorArguments<Constructor> = Constructor extends new (...args: infer Args) => any ? Args: never;
type SubtypeConstructor<Constructor, Subtype> = {
new(...args: ConstructorArguments<Constructor>): Subtype;
}
};
export interface ProtoGrpcType {
envoy: {

View File

@ -1,11 +1,11 @@
import * as grpc from '../index';
import * as grpc from '@grpc/grpc-js';
import { ServiceDefinition, EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
type ConstructorArguments<Constructor> = Constructor extends new (...args: infer Args) => any ? Args: never;
type SubtypeConstructor<Constructor, Subtype> = {
new(...args: ConstructorArguments<Constructor>): Subtype;
}
};
export interface ProtoGrpcType {
envoy: {

View File

@ -0,0 +1,204 @@
// Original file: deps/envoy-api/envoy/api/v2/scoped_route.proto
export interface _envoy_api_v2_ScopedRouteConfiguration_Key_Fragment {
/**
* A string to match against.
*/
'string_key'?: (string);
'type'?: "string_key";
}
export interface _envoy_api_v2_ScopedRouteConfiguration_Key_Fragment__Output {
/**
* A string to match against.
*/
'string_key'?: (string);
'type': "string_key";
}
/**
* Specifies a key which is matched against the output of the
* :ref:`scope_key_builder<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scope_key_builder>`
* specified in the HttpConnectionManager. The matching is done per HTTP
* request and is dependent on the order of the fragments contained in the
* Key.
*/
export interface _envoy_api_v2_ScopedRouteConfiguration_Key {
/**
* The ordered set of fragments to match against. The order must match the
* fragments in the corresponding
* :ref:`scope_key_builder<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scope_key_builder>`.
*/
'fragments'?: (_envoy_api_v2_ScopedRouteConfiguration_Key_Fragment)[];
}
/**
* Specifies a key which is matched against the output of the
* :ref:`scope_key_builder<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scope_key_builder>`
* specified in the HttpConnectionManager. The matching is done per HTTP
* request and is dependent on the order of the fragments contained in the
* Key.
*/
export interface _envoy_api_v2_ScopedRouteConfiguration_Key__Output {
/**
* The ordered set of fragments to match against. The order must match the
* fragments in the corresponding
* :ref:`scope_key_builder<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scope_key_builder>`.
*/
'fragments': (_envoy_api_v2_ScopedRouteConfiguration_Key_Fragment__Output)[];
}
/**
* Specifies a routing scope, which associates a
* :ref:`Key<envoy_api_msg_ScopedRouteConfiguration.Key>` to a
* :ref:`envoy_api_msg_RouteConfiguration` (identified by its resource name).
*
* The HTTP connection manager builds up a table consisting of these Key to
* RouteConfiguration mappings, and looks up the RouteConfiguration to use per
* request according to the algorithm specified in the
* :ref:`scope_key_builder<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scope_key_builder>`
* assigned to the HttpConnectionManager.
*
* For example, with the following configurations (in YAML):
*
* HttpConnectionManager config:
*
* .. code::
*
* ...
* scoped_routes:
* name: foo-scoped-routes
* scope_key_builder:
* fragments:
* - header_value_extractor:
* name: X-Route-Selector
* element_separator: ,
* element:
* separator: =
* key: vip
*
* ScopedRouteConfiguration resources (specified statically via
* :ref:`scoped_route_configurations_list<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scoped_route_configurations_list>`
* or obtained dynamically via SRDS):
*
* .. code::
*
* (1)
* name: route-scope1
* route_configuration_name: route-config1
* key:
* fragments:
* - string_key: 172.10.10.20
*
* (2)
* name: route-scope2
* route_configuration_name: route-config2
* key:
* fragments:
* - string_key: 172.20.20.30
*
* A request from a client such as:
*
* .. code::
*
* GET / HTTP/1.1
* Host: foo.com
* X-Route-Selector: vip=172.10.10.20
*
* would result in the routing table defined by the `route-config1`
* RouteConfiguration being assigned to the HTTP request/stream.
*/
export interface ScopedRouteConfiguration {
/**
* The name assigned to the routing scope.
*/
'name'?: (string);
/**
* The resource name to use for a :ref:`envoy_api_msg_DiscoveryRequest` to an
* RDS server to fetch the :ref:`envoy_api_msg_RouteConfiguration` associated
* with this scope.
*/
'route_configuration_name'?: (string);
/**
* The key to match against.
*/
'key'?: (_envoy_api_v2_ScopedRouteConfiguration_Key);
}
/**
* Specifies a routing scope, which associates a
* :ref:`Key<envoy_api_msg_ScopedRouteConfiguration.Key>` to a
* :ref:`envoy_api_msg_RouteConfiguration` (identified by its resource name).
*
* The HTTP connection manager builds up a table consisting of these Key to
* RouteConfiguration mappings, and looks up the RouteConfiguration to use per
* request according to the algorithm specified in the
* :ref:`scope_key_builder<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scope_key_builder>`
* assigned to the HttpConnectionManager.
*
* For example, with the following configurations (in YAML):
*
* HttpConnectionManager config:
*
* .. code::
*
* ...
* scoped_routes:
* name: foo-scoped-routes
* scope_key_builder:
* fragments:
* - header_value_extractor:
* name: X-Route-Selector
* element_separator: ,
* element:
* separator: =
* key: vip
*
* ScopedRouteConfiguration resources (specified statically via
* :ref:`scoped_route_configurations_list<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scoped_route_configurations_list>`
* or obtained dynamically via SRDS):
*
* .. code::
*
* (1)
* name: route-scope1
* route_configuration_name: route-config1
* key:
* fragments:
* - string_key: 172.10.10.20
*
* (2)
* name: route-scope2
* route_configuration_name: route-config2
* key:
* fragments:
* - string_key: 172.20.20.30
*
* A request from a client such as:
*
* .. code::
*
* GET / HTTP/1.1
* Host: foo.com
* X-Route-Selector: vip=172.10.10.20
*
* would result in the routing table defined by the `route-config1`
* RouteConfiguration being assigned to the HTTP request/stream.
*/
export interface ScopedRouteConfiguration__Output {
/**
* The name assigned to the routing scope.
*/
'name': (string);
/**
* The resource name to use for a :ref:`envoy_api_msg_DiscoveryRequest` to an
* RDS server to fetch the :ref:`envoy_api_msg_RouteConfiguration` associated
* with this scope.
*/
'route_configuration_name': (string);
/**
* The key to match against.
*/
'key'?: (_envoy_api_v2_ScopedRouteConfiguration_Key__Output);
}

Some files were not shown because too many files have changed in this diff Show More