1 | import { ChannelCredentials } from './channel-credentials';
|
2 | import { Metadata } from './metadata';
|
3 | import { ChannelOptions } from './channel-options';
|
4 | import { ConnectivityState } from './connectivity-state';
|
5 | import { GrpcUri } from './uri-parser';
|
6 | import { SubchannelAddress } from './subchannel-address';
|
7 | import { SubchannelRef } from './channelz';
|
8 | import { ConnectivityStateListener, SubchannelInterface } from './subchannel-interface';
|
9 | import { SubchannelCallInterceptingListener } from './subchannel-call';
|
10 | import { SubchannelCall } from './subchannel-call';
|
11 | import { SubchannelConnector } from './transport';
|
12 | export declare class Subchannel {
|
13 | private channelTarget;
|
14 | private subchannelAddress;
|
15 | private options;
|
16 | private credentials;
|
17 | private connector;
|
18 | |
19 |
|
20 |
|
21 |
|
22 | private connectivityState;
|
23 | |
24 |
|
25 |
|
26 | private transport;
|
27 | |
28 |
|
29 |
|
30 |
|
31 | private continueConnecting;
|
32 | |
33 |
|
34 |
|
35 |
|
36 |
|
37 | private stateListeners;
|
38 | private backoffTimeout;
|
39 | private keepaliveTime;
|
40 | |
41 |
|
42 |
|
43 | private refcount;
|
44 | |
45 |
|
46 |
|
47 | private subchannelAddressString;
|
48 | private readonly channelzEnabled;
|
49 | private channelzRef;
|
50 | private channelzTrace;
|
51 | private callTracker;
|
52 | private childrenTracker;
|
53 | private streamTracker;
|
54 | |
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | constructor(channelTarget: GrpcUri, subchannelAddress: SubchannelAddress, options: ChannelOptions, credentials: ChannelCredentials, connector: SubchannelConnector);
|
65 | private getChannelzInfo;
|
66 | private trace;
|
67 | private refTrace;
|
68 | private handleBackoffTimer;
|
69 | /**
|
70 | * Start a backoff timer with the current nextBackoff timeout
|
71 | */
|
72 | private startBackoff;
|
73 | private stopBackoff;
|
74 | private startConnectingInternal;
|
75 | /**
|
76 | * Initiate a state transition from any element of oldStates to the new
|
77 | * state. If the current connectivityState is not in oldStates, do nothing.
|
78 | * @param oldStates The set of states to transition from
|
79 | * @param newState The state to transition to
|
80 | * @returns True if the state changed, false otherwise
|
81 | */
|
82 | private transitionToState;
|
83 | ref(): void;
|
84 | unref(): void;
|
85 | unrefIfOneRef(): boolean;
|
86 | createCall(metadata: Metadata, host: string, method: string, listener: SubchannelCallInterceptingListener): SubchannelCall;
|
87 | /**
|
88 | * If the subchannel is currently IDLE, start connecting and switch to the
|
89 | * CONNECTING state. If the subchannel is current in TRANSIENT_FAILURE,
|
90 | * the next time it would transition to IDLE, start connecting again instead.
|
91 | * Otherwise, do nothing.
|
92 | */
|
93 | startConnecting(): void;
|
94 | /**
|
95 | * Get the subchannel's current connectivity state.
|
96 | */
|
97 | getConnectivityState(): ConnectivityState;
|
98 | /**
|
99 | * Add a listener function to be called whenever the subchannel's
|
100 | * connectivity state changes.
|
101 | * @param listener
|
102 | */
|
103 | addConnectivityStateListener(listener: ConnectivityStateListener): void;
|
104 | /**
|
105 | * Remove a listener previously added with `addConnectivityStateListener`
|
106 | * @param listener A reference to a function previously passed to
|
107 | * `addConnectivityStateListener`
|
108 | */
|
109 | removeConnectivityStateListener(listener: ConnectivityStateListener): void;
|
110 | /**
|
111 | * Reset the backoff timeout, and immediately start connecting if in backoff.
|
112 | */
|
113 | resetBackoff(): void;
|
114 | getAddress(): string;
|
115 | getChannelzRef(): SubchannelRef;
|
116 | getRealSubchannel(): this;
|
117 | realSubchannelEquals(other: SubchannelInterface): boolean;
|
118 | throttleKeepalive(newKeepaliveTime: number): void;
|
119 | }
|