mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
feat: add some skeleton classes
This commit is contained in:
parent
2e28c4eea8
commit
554815cbb0
1
src/call-credentials.ts
Normal file
1
src/call-credentials.ts
Normal file
@ -0,0 +1 @@
|
||||
export class CallCredentials {}
|
||||
14
src/call-stream.ts
Normal file
14
src/call-stream.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import * as stream from 'stream';
|
||||
import { Status } from './constants';
|
||||
|
||||
/**
|
||||
* This class represents a duplex stream associated with a single gRPC call.
|
||||
*/
|
||||
export class CallStream extends stream.Duplex {
|
||||
/**
|
||||
* Cancels the call associated with this stream with a given status.
|
||||
*/
|
||||
cancelWithStatus(status: Status) {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
20
src/channel-credentials.ts
Normal file
20
src/channel-credentials.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { CallCredentials } from './call-credentials';
|
||||
|
||||
/**
|
||||
* A class that contains credentials for communicating over a channel.
|
||||
*/
|
||||
export class ChannelCredentials {
|
||||
private constructor() {}
|
||||
|
||||
static createSsl(rootCerts: Buffer, privateKey?: Buffer, certChain?: Buffer) : ChannelCredentials {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
static createInsecure() : ChannelCredentials {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
compose(callCredentials: CallCredentials) : ChannelCredentials {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
25
src/channel.ts
Normal file
25
src/channel.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { CallStream } from './call-stream';
|
||||
import { ChannelCredentials } from './channel-credentials';
|
||||
import { Metadata } from './metadata';
|
||||
|
||||
/**
|
||||
* An interface that contains options used when initializing a Channel instance.
|
||||
*/
|
||||
export interface ChannelOptions {}
|
||||
|
||||
/**
|
||||
* A class that represents a communication channel to a server specified by a given address.
|
||||
*/
|
||||
export class Channel {
|
||||
constructor(address: string, credentials?: ChannelCredentials, options?: ChannelOptions) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
createStream(methodName: string, metadata: Metadata) : CallStream {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
close() {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
19
src/constants.ts
Normal file
19
src/constants.ts
Normal file
@ -0,0 +1,19 @@
|
||||
export enum Status {
|
||||
OK = 0,
|
||||
CANCELLED,
|
||||
UNKNOWN,
|
||||
INVALID_ARGUMENT,
|
||||
DEADLINE_EXCEEDED,
|
||||
NOT_FOUND,
|
||||
ALREADY_EXISTS,
|
||||
PERMISSION_DENIED,
|
||||
RESOURCE_EXHAUSTED,
|
||||
FAILED_PRECONDITION,
|
||||
ABORTED,
|
||||
OUT_OF_RANGE,
|
||||
UNIMPLEMENTED,
|
||||
INTERNAL,
|
||||
UNAVAILABLE,
|
||||
DATA_LOSS,
|
||||
UNAUTHENTICATED
|
||||
}
|
||||
1
src/metadata.ts
Normal file
1
src/metadata.ts
Normal file
@ -0,0 +1 @@
|
||||
export class Metadata {}
|
||||
Loading…
x
Reference in New Issue
Block a user