TGrid - TypeScript Grid Computing Framework
I've found a much better solution for implementing the OON by realizing the true Grid Computing through the RFC. TGrid is a new framework for the solution. Therefore, TGrid will replace this Samchon Framework and continue developing the OON.
import { WebServer, WebAcceptor } from "tgrid/protocols/web"; import { CompositeCalculator } from "../../providers/Calculator"; async function main(): Promise<void> { let server: WebServer = new WebServer(); await server.open(10102, async (acceptor: WebAcceptor) => { await acceptor.accept(new CompositeCalculator()); }); } main();import { WebConnector } from "tgrid/protocols/web/WebConnector"; import { Driver } from "tgrid/components/Driver"; import { ICalculator } from "../../controllers/ICalculator"; async function main(): Promise<void> { //---- // CONNECTION //---- let connector: WebConnector = new WebConnector(); await connector.connect("ws://127.0.0.1:10102"); //---- // CALL REMOTE FUNCTIONS //---- // GET DRIVER let calc: Driver<ICalculator> = connector.getDriver<ICalculator>(); // FUNCTIONS IN THE ROOT SCOPE console.log("1 + 6 =", await calc.plus(1, 6)); console.log("7 * 2 =", await calc.multiplies(7, 2)); // FUNCTIONS IN AN OBJECT (SCIENTIFIC) console.log("3 ^ 4 =", await calc.scientific.pow(3, 4)); console.log("log (2, 32) =", await calc.scientific.log(2, 32)); try { // TO CATCH EXCEPTION IS STILL POSSIBLE await calc.scientific.sqrt(-4); } catch (err) { console.log("SQRT (-4) -> Error:", err.message); } // FUNCTIONS IN AN OBJECT (STATISTICS) console.log("Mean (1, 2, 3, 4) =", await calc.statistics.mean(1, 2, 3, 4)); console.log("Stdev. (1, 2, 3, 4) =", await calc.statistics.stdev(1, 2, 3, 4)); //---- // TERMINATE //---- await connector.close(); } main();1 + 6 = 7 7 * 2 = 14 3 ^ 4 = 81 log (2, 32) = 5 SQRT (-4) -> Error: Negative value on sqaure. Mean (1, 2, 3, 4) = 2.5 Stdev. (1, 2, 3, 4) = 1.118033988749895
Samchon Framework is an OON (Object-Oriented Network) framework. You can compose network systems within framework of the Object-Oriented.
Whether how the network system is enormous and complicate, the system nodes, they're just objects in the Samchon Framework. Define objects who represent the system nodes and deliver message by calling methods from objects to objects. That's all.
I repeat, Samchon is an OON (Object-Oriented Network) framework, composing a network system within framework of the Object-Oriented. It means that even modulization is possible and it's called System Templates. You can maximize the reusability with the modulization, System Templates.
When you need a cloud system, then take a System Template named Cloud Service. When you need a distributed processings system, then take the Distributed System. If you should implement a specific network system and the network system will be used repeatedly, then modulize it to be one of the System Templates.
Below System Templates are basically provided in the Samchon Framework:
- Cloud Service: Cloud Server Template
- External System: A template for 1: N composite relationship's network system.
- Parallel System: Parallel Processing System Template.
- Distributed System: Distributed Processing System Template.
TypeScript-STL, interaction with TypeScript and C++
The best solution, for integrating and migrating a system built by different languages (TypeScript and C++), is to sharing same designs and grammers. Those designs and grammers are unitifed, then any other solution can't be better. Samchon Framework provides the best solution.
Unifying designs, it can be come true by utilizing the Object-Oriented Network paradigm with Samchon Framework. Unifying grammer, it also can be done by using the TypeScript-STL, a sub-project who migrated C++'s STL (Standard Template Library) to TypeScript. You can use STL's containers and algorithms in TypeScript with the TypeScript-STL. Thus, you can unify not only designs but also grammers, algorithms and even data structures with the TypeScript-STL.
If you're planning to build a cloud solution, then I sugguest you to follow such step:
- Fast Implementation 1. Cloud Application with TypeScript & HTML 2. Cloud Service with TypeScripty & NodeJS
- Performance Improvement 1. Heavy processes, distribute them to C++ systems. 2. Migrate Cloud server from TypeScript to C++ gradually.
# Install NPM module.
npm install --save samchon
Installs Samchon-Framework from NPM module and imports the definition.
/// <reference types="samchon" />
import samchon = require("samchon");
Samchon Framework is a header only project. Linkages like LIB, DLL or SO are not required at all. Just include header files what you want. However, notice that, Samchon Framework has two dependencies you should install.
#include <samchon/library.hpp>
#include <samchon/protocol.hpp>
#include <samchon/templates/service.hpp>
#include <samchon/templates/external.hpp>
# include <samchon/templates/parallel.hpp>
# include <samchon/templates/distributed.hpp>
- Class Diagrams
- Conceptual Diagram
- Sequence Diagram
- v2.0
- v1.0