UNPKG

1.47 kBTypeScriptView Raw
1import { ChannelOptions } from './channel-options';
2import { Subchannel } from './subchannel';
3import { SubchannelAddress } from './subchannel-address';
4import { ChannelCredentials } from './channel-credentials';
5import { GrpcUri } from './uri-parser';
6export declare class SubchannelPool {
7 private pool;
8 /**
9 * A timer of a task performing a periodic subchannel cleanup.
10 */
11 private cleanupTimer;
12 /**
13 * A pool of subchannels use for making connections. Subchannels with the
14 * exact same parameters will be reused.
15 */
16 constructor();
17 /**
18 * Unrefs all unused subchannels and cancels the cleanup task if all
19 * subchannels have been unrefed.
20 */
21 unrefUnusedSubchannels(): void;
22 /**
23 * Ensures that the cleanup task is spawned.
24 */
25 ensureCleanupTask(): void;
26 /**
27 * Get a subchannel if one already exists with exactly matching parameters.
28 * Otherwise, create and save a subchannel with those parameters.
29 * @param channelTarget
30 * @param subchannelTarget
31 * @param channelArguments
32 * @param channelCredentials
33 */
34 getOrCreateSubchannel(channelTargetUri: GrpcUri, subchannelTarget: SubchannelAddress, channelArguments: ChannelOptions, channelCredentials: ChannelCredentials): Subchannel;
35}
36/**
37 * Get either the global subchannel pool, or a new subchannel pool.
38 * @param global
39 */
40export declare function getSubchannelPool(global: boolean): SubchannelPool;