Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc-gcp / build / src / gcp_channel_factory.d.ts
1 /**
2  * @license
3  * Copyright 2018 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 import * as grpc from 'grpc';
19 import { ChannelRef } from './channel_ref';
20 import * as protoRoot from './generated/grpc_gcp';
21 import IAffinityConfig = protoRoot.grpc.gcp.IAffinityConfig;
22 /**
23  * A channel management factory that implements grpc.Channel APIs.
24  */
25 export declare class GcpChannelFactory {
26     private maxSize;
27     private maxConcurrentStreamsLowWatermark;
28     private options;
29     private methodToAffinity;
30     private affinityKeyToChannelRef;
31     private channelRefs;
32     private target;
33     private credentials;
34     /**
35      * @param address The address of the server to connect to.
36      * @param credentials Channel credentials to use when connecting
37      * @param options A map of channel options.
38      */
39     constructor(address: string, credentials: grpc.ChannelCredentials, options: any);
40     private initMethodToAffinityMap;
41     /**
42      * Picks a grpc channel from the pool and wraps it with ChannelRef.
43      * @param affinityKey Affinity key to get the bound channel.
44      * @return Wrapper containing the grpc channel.
45      */
46     getChannelRef(affinityKey?: string): ChannelRef;
47     /**
48      * Get AffinityConfig associated with a certain method.
49      * @param methodName Method name of the request.
50      */
51     getAffinityConfig(methodName: string): IAffinityConfig;
52     /**
53      * Bind channel with affinity key.
54      * @param channelRef ChannelRef instance that contains the grpc channel.
55      * @param affinityKey The affinity key used for binding the channel.
56      */
57     bind(channelRef: ChannelRef, affinityKey: string): void;
58     /**
59      * Unbind channel with affinity key.
60      * @param boundKey Affinity key bound to a channel.
61      */
62     unbind(boundKey?: string): void;
63     /**
64      * Close all channels in the channel pool.
65      */
66     close(): void;
67     getTarget(): string;
68     /**
69      * Get the current connectivity state of the channel pool.
70      * @param tryToConnect If true, the channel will start connecting if it is
71      *     idle. Otherwise, idle channels will only start connecting when a
72      *     call starts.
73      * @return connectivity state of channel pool.
74      */
75     getConnectivityState(tryToConnect: boolean): grpc.connectivityState;
76     /**
77      * Watch for connectivity state changes. Currently This function will throw
78      * not implemented error because the implementation requires lot of work but
79      * has little use cases.
80      * @param currentState The state to watch for transitions from. This should
81      *     always be populated by calling getConnectivityState immediately before.
82      * @param deadline A deadline for waiting for a state change
83      * @param callback Called with no error when the state changes, or with an
84      *     error if the deadline passes without a state change
85      */
86     watchConnectivityState(currentState: grpc.connectivityState, deadline: grpc.Deadline, callback: Function): void;
87     /**
88      * Create a call object. This function will not be called when using
89      * grpc.Client class. But since it's a public function of grpc.Channel,
90      * It needs to be implemented for potential use cases.
91      * @param method The full method string to request.
92      * @param deadline The call deadline.
93      * @param host A host string override for making the request.
94      * @param parentCall A server call to propagate some information from.
95      * @param propagateFlags A bitwise combination of elements of
96      *     {@link grpc.propagate} that indicates what information to propagate
97      *     from parentCall.
98      * @return a grpc call object.
99      */
100     createCall(method: string, deadline: grpc.Deadline, host: string | null, parentCall: grpc.Call | null, propagateFlags: number | null): grpc.Call;
101 }