-
Notifications
You must be signed in to change notification settings - Fork 4
Overview
Rehan Iftikhar edited this page Nov 4, 2011
·
5 revisions
-
Client: The
Clientis responsible for create newTaskobjects and sending them theIntake -
Task: A
Taskis the central unit of work in Engine.js. ATaskcontains a context, user code, and run-time variable bindings. -
Intake: The
Intakeis responsible for accepting incomingTaskmessages from many clients and forwarding them to manyCylinders -
Cylinder: When a
Cylinderis created it starts its ownPiston(in a separate process). When aCylinderreceives aTaskit starts an execution timer and sends theTaskto itsPistonfor evaluation. When thePistonreturns a result theCylinderforwards it to theExhaust- If the execution timer finishes before a response from the
Pistonis received, thePistonprocess is killed and an error is sent back to theClient(via theExhaust).
- If the execution timer finishes before a response from the
-
Piston: The
Pistonis responsible for creating a code sandbox from the receivedTaskmessage’s context and run-time variable bindings. ThePistonthen runs the user-code against the sandbox and returns the results to its parent Cylinder. -
Exhaust: The
ExhaustreceivesTaskresult messages from manyCylindersand forwards then back to the appropriateClient.
+------------+ +------------+
-----| | | |
+------+ | | Cylinder |<---->| Piston |
| Task +-+ +------------+ +------------+ | | | | |
+------+ | | | | | | +------------+ +------------+
+---+ Client +----+ +--->----| Intake |-->-+ |
+------+ | | | | | | | | | +------------+ +------------+
| Task +-+ +------------+ | | +------------+ | | | | | |
+------+ | | (1) +-->---+ | Cylinder |<---->+ Piston |
(n) +-----+ | | | | |
| | +--<---+ +------------+ +------------+
+------------+ | | +------------+ | |
+------+ | | | | | | | | +------------+ +------------+
| Task +-----+ Client +----+ +---<----| Exhaust +-<--+ | | | | |
+------+ | | | | | | Cylinder |<---->+ Piston |
+------------+ +------------+ | | | | |
(n) (1) | +------------+ +------------+
|
| +------------+ +------------+
| | | | |
+----| Cylinder |<---->| Piston |
| | | |
+------------+ +------------+
(n)