UNPKG

1.84 kBTypeScriptView Raw
1import { Deserialize, Serialize, ServiceDefinition } from './make-client';
2import { HandleCall } from './server-call';
3import { ServerCredentials } from './server-credentials';
4import { ChannelOptions } from './channel-options';
5import { ServerRef } from './channelz';
6export declare type UntypedHandleCall = HandleCall<any, any>;
7export interface UntypedServiceImplementation {
8 [name: string]: UntypedHandleCall;
9}
10export declare class Server {
11 private http2ServerList;
12 private handlers;
13 private sessions;
14 private started;
15 private options;
16 private readonly channelzEnabled;
17 private channelzRef;
18 private channelzTrace;
19 private callTracker;
20 private listenerChildrenTracker;
21 private sessionChildrenTracker;
22 constructor(options?: ChannelOptions);
23 private getChannelzInfo;
24 private getChannelzSessionInfoGetter;
25 private trace;
26 addProtoService(): never;
27 addService(service: ServiceDefinition, implementation: UntypedServiceImplementation): void;
28 removeService(service: ServiceDefinition): void;
29 bind(port: string, creds: ServerCredentials): never;
30 bindAsync(port: string, creds: ServerCredentials, callback: (error: Error | null, port: number) => void): void;
31 forceShutdown(): void;
32 register<RequestType, ResponseType>(name: string, handler: HandleCall<RequestType, ResponseType>, serialize: Serialize<ResponseType>, deserialize: Deserialize<RequestType>, type: string): boolean;
33 unregister(name: string): boolean;
34 start(): void;
35 tryShutdown(callback: (error?: Error) => void): void;
36 addHttp2Port(): never;
37 /**
38 * Get the channelz reference object for this server. The returned value is
39 * garbage if channelz is disabled for this server.
40 * @returns
41 */
42 getChannelzRef(): ServerRef;
43 private _setupHandlers;
44}