UNPKG

grpc-gcp

Version:

Extension for supporting Google Cloud Platform specific features for gRPC.

34 lines (33 loc) 1.48 kB
/** * @license * Copyright 2018 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ import * as grpcType from '@grpc/grpc-js'; import { ChannelRef } from './channel_ref'; import * as protoRoot from './generated/grpc_gcp'; import IAffinityConfig = protoRoot.grpc.gcp.IAffinityConfig; export type GrpcModule = typeof grpcType; export interface GcpChannelFactoryInterface extends grpcType.ChannelInterface { getChannelRef(affinityKey?: string): ChannelRef; getAffinityConfig(methodName: string): IAffinityConfig; bind(channelRef: ChannelRef, affinityKey: string): void; unbind(boundKey?: string): void; shouldRequestDebugHeaders(lastRequested: Date | null): boolean; } export interface GcpChannelFactoryConstructor { new (address: string, credentials: grpcType.ChannelCredentials, options: any): GcpChannelFactoryInterface; } export declare function getGcpChannelFactoryClass(grpc: GrpcModule): GcpChannelFactoryConstructor;