UNPKG

4.89 kBTypeScriptView Raw
1import { ChannelCredentials } from './channel-credentials';
2import { ChannelOptions } from './channel-options';
3import { Metadata } from './metadata';
4import { CallConfig } from './resolver';
5import { ServerSurfaceCall } from './server-call';
6import { ConnectivityState } from './connectivity-state';
7import { ChannelRef } from './channelz';
8import { LoadBalancingCall } from './load-balancing-call';
9import { CallCredentials } from './call-credentials';
10import { Call, StatusObject } from './call-interface';
11import { Deadline } from './deadline';
12import { ResolvingCall } from './resolving-call';
13import { RetryingCall } from './retrying-call';
14import { BaseSubchannelWrapper, SubchannelInterface } from './subchannel-interface';
15interface NoneConfigResult {
16 type: 'NONE';
17}
18interface SuccessConfigResult {
19 type: 'SUCCESS';
20 config: CallConfig;
21}
22interface ErrorConfigResult {
23 type: 'ERROR';
24 error: StatusObject;
25}
26type GetConfigResult = NoneConfigResult | SuccessConfigResult | ErrorConfigResult;
27declare class ChannelSubchannelWrapper extends BaseSubchannelWrapper implements SubchannelInterface {
28 private channel;
29 private refCount;
30 private subchannelStateListener;
31 constructor(childSubchannel: SubchannelInterface, channel: InternalChannel);
32 ref(): void;
33 unref(): void;
34}
35export declare class InternalChannel {
36 private readonly credentials;
37 private readonly options;
38 private resolvingLoadBalancer;
39 private subchannelPool;
40 private connectivityState;
41 private currentPicker;
42 /**
43 * Calls queued up to get a call config. Should only be populated before the
44 * first time the resolver returns a result, which includes the ConfigSelector.
45 */
46 private configSelectionQueue;
47 private pickQueue;
48 private connectivityStateWatchers;
49 private defaultAuthority;
50 private filterStackFactory;
51 private target;
52 /**
53 * This timer does not do anything on its own. Its purpose is to hold the
54 * event loop open while there are any pending calls for the channel that
55 * have not yet been assigned to specific subchannels. In other words,
56 * the invariant is that callRefTimer is reffed if and only if pickQueue
57 * is non-empty.
58 */
59 private callRefTimer;
60 private configSelector;
61 /**
62 * This is the error from the name resolver if it failed most recently. It
63 * is only used to end calls that start while there is no config selector
64 * and the name resolver is in backoff, so it should be nulled if
65 * configSelector becomes set or the channel state becomes anything other
66 * than TRANSIENT_FAILURE.
67 */
68 private currentResolutionError;
69 private retryBufferTracker;
70 private keepaliveTime;
71 private wrappedSubchannels;
72 private readonly channelzEnabled;
73 private originalTarget;
74 private channelzRef;
75 private channelzTrace;
76 private callTracker;
77 private childrenTracker;
78 constructor(target: string, credentials: ChannelCredentials, options: ChannelOptions);
79 private getChannelzInfo;
80 private trace;
81 private callRefTimerRef;
82 private callRefTimerUnref;
83 private removeConnectivityStateWatcher;
84 private updateState;
85 throttleKeepalive(newKeepaliveTime: number): void;
86 removeWrappedSubchannel(wrappedSubchannel: ChannelSubchannelWrapper): void;
87 doPick(metadata: Metadata, extraPickInfo: {
88 [key: string]: string;
89 }): import("./picker").PickResult;
90 queueCallForPick(call: LoadBalancingCall): void;
91 getConfig(method: string, metadata: Metadata): GetConfigResult;
92 queueCallForConfig(call: ResolvingCall): void;
93 createLoadBalancingCall(callConfig: CallConfig, method: string, host: string, credentials: CallCredentials, deadline: Deadline): LoadBalancingCall;
94 createRetryingCall(callConfig: CallConfig, method: string, host: string, credentials: CallCredentials, deadline: Deadline): RetryingCall;
95 createInnerCall(callConfig: CallConfig, method: string, host: string, credentials: CallCredentials, deadline: Deadline): Call;
96 createResolvingCall(method: string, deadline: Deadline, host: string | null | undefined, parentCall: ServerSurfaceCall | null, propagateFlags: number | null | undefined): ResolvingCall;
97 close(): void;
98 getTarget(): string;
99 getConnectivityState(tryToConnect: boolean): ConnectivityState;
100 watchConnectivityState(currentState: ConnectivityState, deadline: Date | number, callback: (error?: Error) => void): void;
101 /**
102 * Get the channelz reference object for this channel. The returned value is
103 * garbage if channelz is disabled for this channel.
104 * @returns
105 */
106 getChannelzRef(): ChannelRef;
107 createCall(method: string, deadline: Deadline, host: string | null | undefined, parentCall: ServerSurfaceCall | null, propagateFlags: number | null | undefined): Call;
108}
109export {};