tgrid
Version:
Grid Computing Framework for TypeScript
31 lines (30 loc) • 1.23 kB
TypeScript
/**
* Common interface for communicators based on `Worker`.
*
* #### Why workers be network systems?
* `Worker` is designed to support thread in JavaScript. However, the `Worker` cannot share
* memory variable at all. The only way to interact with `Worker` and its parent is using
* the `MessagePort` with inter-promised message (IPC, inter-process communication).
*
* - *Worker*, it's a type of *thread* in physical level.
* - *Worker*, it's a type of *process* in logical level.
* - **Worker**, it's same with **network system** in conceptual level.
*
* It seems like network communication, isn't it? That's the reason why TGrid considers
* `Worker` as a remote system and supports RFC (Remote Function Call) in such worker
* environments.
*
* @author Jeongho Nam - https://github.com/samchon
*/
export interface IWorkerSystem {
/**
* Close connection.
*
* Close connection between the remote worker system.
*
* It destroys all RFCs (remote function calls) between this and the remote system
* (through `Driver<Controller>`) that are not returned (completed) yet. The destruction
* causes all incomplete RFCs to throw exceptions.
*/
close(): Promise<void>;
}