UNPKG

tgrid

Version:

Grid Computing Framework for TypeScript

73 lines (72 loc) 2.55 kB
import { Communicator } from "../../components/Communicator"; /** * Basic Connector. * * The `ConnectorBase` is an abstract communicator class, who can connect to remote server who * interacts with clients using the RFC (Remote Function Call). * * Also, when declaring this {@link ConnectorBase} type, you've to define two template arguments, * *Header* and *Provider*. The *Header* type represents an initial data gotten from the remote * client after the connection. I hope you and client not to omit it and utilize it as an * activation tool to enhance security. * * The second template argument *Provider* represents the features provided for the remote client. * If you don't have any plan to provide any feature to the remote client, just declare it as * `null`. * * @template Header Type of the header containing initial data. * @template Provider Type of additional features provided for the remote system. * @template Remote Type of features supported by remote system, used for {@link getDriver} function. * @author Jeongho Nam - https://github.com/samchon */ export declare abstract class ConnectorBase<Header, Provider extends object | null, Remote extends object | null> extends Communicator<Provider, Remote> { /** * @hidden */ private readonly header_; /** * @hidden */ protected state_: ConnectorBase.State; /** * Initializer Constructor. * * @param header An object containing initialization data like activation. * @param provider An object providing features for remote system. */ constructor(header: Header, provider: Provider); /** * Header containing initialization data like activation. */ get header(): Header; /** * Get state. * * Get current state of connection state with the worker server. * * List of values are such like below: * * - `NONE`: This instance is newly created, but did nothing yet. * - `CONNECTING`: The `connect` method is on running. * - `OPEN`: The connection is online. * - `CLOSING`: The `close` method is on running. * - `CLOSED`: The connection is offline. */ get state(): ConnectorBase.State; /** * @hidden */ protected inspectReady(method: string): Error | null; } export declare namespace ConnectorBase { /** * Current state type of connector. */ const enum State { NONE = -1, CONNECTING = 0, OPEN = 1, CLOSING = 2, CLOSED = 3 } }