-
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
Client
is responsible for create newTask
objects and sending them theIntake
-
Task: A
Task
is the central unit of work in Engine.js. ATask
contains a context, user code, and run-time variable bindings. -
Intake: The
Intake
is responsible for accepting incomingTask
messages from many clients and forwarding them to manyCylinders
-
Cylinder: When a
Cylinder
is created it starts its ownPiston
(in a separate process). When aCylinder
receives aTask
it starts an execution timer and sends theTask
to itsPiston
for evaluation. When thePiston
returns a result theCylinder
forwards it to theExhaust
- If the execution timer finishes before a response from the
Piston
is received, thePiston
process is killed and an error is sent back to theClient
(via theExhaust
).
- If the execution timer finishes before a response from the
-
Piston: The
Piston
is responsible for creating a code sandbox from the receivedTask
message’s context and run-time variable bindings. ThePiston
then runs the user-code against the sandbox and returns the results to its parent Cylinder. -
Exhaust: The
Exhaust
receivesTask
result messages from manyCylinders
and 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)