1 |
|
2 | import * as http2 from 'http2';
|
3 | import { Status } from './constants';
|
4 | import { SubchannelCallStatsTracker, Subchannel } from './subchannel';
|
5 | import { InterceptingListener, MessageContext, StatusObject } from './call-interface';
|
6 | export interface SubchannelCall {
|
7 | cancelWithStatus(status: Status, details: string): void;
|
8 | getPeer(): string;
|
9 | sendMessageWithContext(context: MessageContext, message: Buffer): void;
|
10 | startRead(): void;
|
11 | halfClose(): void;
|
12 | getCallNumber(): number;
|
13 | }
|
14 | export interface StatusObjectWithRstCode extends StatusObject {
|
15 | rstCode?: number;
|
16 | }
|
17 | export interface SubchannelCallInterceptingListener extends InterceptingListener {
|
18 | onReceiveStatus(status: StatusObjectWithRstCode): void;
|
19 | }
|
20 | export declare class Http2SubchannelCall implements SubchannelCall {
|
21 | private readonly http2Stream;
|
22 | private readonly callStatsTracker;
|
23 | private readonly listener;
|
24 | private readonly subchannel;
|
25 | private readonly callId;
|
26 | private decoder;
|
27 | private isReadFilterPending;
|
28 | private canPush;
|
29 | |
30 |
|
31 |
|
32 |
|
33 | private readsClosed;
|
34 | private statusOutput;
|
35 | private unpushedReadMessages;
|
36 | private mappedStatusCode;
|
37 | private finalStatus;
|
38 | private disconnectListener;
|
39 | private internalError;
|
40 | constructor(http2Stream: http2.ClientHttp2Stream, callStatsTracker: SubchannelCallStatsTracker, listener: SubchannelCallInterceptingListener, subchannel: Subchannel, callId: number);
|
41 | private outputStatus;
|
42 | private trace;
|
43 | /**
|
44 | * On first call, emits a 'status' event with the given StatusObject.
|
45 | * Subsequent calls are no-ops.
|
46 | * @param status The status of the call.
|
47 | */
|
48 | private endCall;
|
49 | private maybeOutputStatus;
|
50 | private push;
|
51 | private tryPush;
|
52 | private handleTrailers;
|
53 | private destroyHttp2Stream;
|
54 | cancelWithStatus(status: Status, details: string): void;
|
55 | getStatus(): StatusObject | null;
|
56 | getPeer(): string;
|
57 | getCallNumber(): number;
|
58 | startRead(): void;
|
59 | sendMessageWithContext(context: MessageContext, message: Buffer): void;
|
60 | halfClose(): void;
|
61 | }
|