diff --git a/packages/grpc-js-core/src/call-stream.ts b/packages/grpc-js-core/src/call-stream.ts index 3a18d473..877978a8 100644 --- a/packages/grpc-js-core/src/call-stream.ts +++ b/packages/grpc-js-core/src/call-stream.ts @@ -19,6 +19,8 @@ export interface CallStreamOptions { flags: number; } +export type CallOptions = Partial; + export interface StatusObject { code: Status; details: string; diff --git a/packages/grpc-js-core/src/channel.ts b/packages/grpc-js-core/src/channel.ts index 13ccab33..51ec1fa5 100644 --- a/packages/grpc-js-core/src/channel.ts +++ b/packages/grpc-js-core/src/channel.ts @@ -3,26 +3,16 @@ import * as http2 from 'http2'; import {checkServerIdentity, SecureContext, PeerCertificate} from 'tls'; import * as url from 'url'; -import {Call} from './call'; import {CallCredentials} from './call-credentials'; import {CallCredentialsFilterFactory} from './call-credentials-filter'; -import {CallStream, CallStreamOptions, Http2CallStream} from './call-stream'; +import {CallOptions, CallStream, CallStreamOptions, Http2CallStream} from './call-stream'; import {ChannelCredentials} from './channel-credentials'; import {CompressionFilterFactory} from './compression-filter'; -import {EmitterAugmentation0} from './events'; import {Status} from './constants'; import {DeadlineFilterFactory} from './deadline-filter'; import {FilterStackFactory} from './filter-stack'; import {Metadata, MetadataObject} from './metadata'; import { MetadataStatusFilterFactory } from './metadata-status-filter'; -import { PropagateFlags } from './index'; - -export type CallOptions = { - // Represents a parent server call. - // For our purposes we only need to know of the 'cancelled' event. - parent?: EmitterAugmentation0<'cancelled'> & EventEmitter; - propagate_flags?: number; -} & Partial; const IDLE_TIMEOUT_MS = 300000; @@ -259,19 +249,6 @@ export class Http2Channel extends EventEmitter implements Channel { let stream: Http2CallStream = new Http2CallStream(methodName, finalOptions, this.filterStackFactory); this.startHttp2Stream(methodName, stream, metadata); - - // handle propagation flags - const propagateFlags = typeof options.propagate_flags === 'number' ? - options.propagate_flags : PropagateFlags.DEFAULTS; - if (options.parent) { - // TODO(kjin): Implement other propagation flags. - if (propagateFlags & PropagateFlags.CANCELLATION) { - options.parent.on('cancelled', () => { - stream.cancelWithStatus(Status.CANCELLED, 'Cancellation propagated from parent call'); - }); - } - } - return stream; } diff --git a/packages/grpc-js-core/src/client.ts b/packages/grpc-js-core/src/client.ts index c14328a9..ecfacccd 100644 --- a/packages/grpc-js-core/src/client.ts +++ b/packages/grpc-js-core/src/client.ts @@ -2,8 +2,8 @@ import {once} from 'lodash'; import {URL} from 'url'; import {ClientDuplexStream, ClientDuplexStreamImpl, ClientReadableStream, ClientReadableStreamImpl, ClientUnaryCall, ClientUnaryCallImpl, ClientWritableStream, ClientWritableStreamImpl, ServiceError} from './call'; -import {CallStream, StatusObject, WriteObject} from './call-stream'; -import {CallOptions, Channel, ChannelOptions, Http2Channel} from './channel'; +import {CallOptions, CallStream, StatusObject, WriteObject} from './call-stream'; +import {Channel, ChannelOptions, Http2Channel} from './channel'; import {ChannelCredentials} from './channel-credentials'; import {Status} from './constants'; import {Metadata} from './metadata'; diff --git a/packages/grpc-js-core/src/constants.ts b/packages/grpc-js-core/src/constants.ts index 3b18d870..a72f3388 100644 --- a/packages/grpc-js-core/src/constants.ts +++ b/packages/grpc-js-core/src/constants.ts @@ -17,11 +17,3 @@ export enum Status { DATA_LOSS, UNAUTHENTICATED } - -export enum PropagateFlags { - DEADLINE = 1, - CENSUS_STATS_CONTEXT = 2, - CENSUS_TRACING_CONTEXT = 4, - CANCELLATION = 8, - DEFAULTS = 65535 -}