mirror of https://github.com/deavmi/tasky.git
Initialize tristanable, add a new tristanable queue on Descriptor registration
This commit is contained in:
parent
d15d4bdb84
commit
21e1b91abc
|
@ -9,18 +9,52 @@ module tasky.engine;
|
||||||
|
|
||||||
import eventy.engine : EvEngine = Engine;
|
import eventy.engine : EvEngine = Engine;
|
||||||
import tasky.jobs : Descriptor;
|
import tasky.jobs : Descriptor;
|
||||||
|
import tristanable;
|
||||||
|
import std.socket : Socket;
|
||||||
|
import core.thread : Thread;
|
||||||
|
|
||||||
public final class Engine
|
public final class Engine : Thread
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Tristanable sub-system
|
||||||
|
*/
|
||||||
|
private Manager tmanager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Eventy sub-system
|
||||||
|
*/
|
||||||
private EvEngine evEngine;
|
private EvEngine evEngine;
|
||||||
|
|
||||||
this()
|
this(Socket socket)
|
||||||
{
|
{
|
||||||
|
/* Set the worker function */
|
||||||
|
super(&worker);
|
||||||
|
|
||||||
|
/* TODO: Check for exceptions */
|
||||||
/* Create a new event engine */
|
/* Create a new event engine */
|
||||||
evEngine = new EvEngine();
|
evEngine = new EvEngine();
|
||||||
evEngine.start();
|
evEngine.start();
|
||||||
|
|
||||||
|
/* TODO: Check for exceptions */
|
||||||
|
/* Create a new tristanable manager */
|
||||||
|
tmanager = new Manager(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Worker thread function which checks the tristanable
|
||||||
|
* queues for whichever has messages on them and then
|
||||||
|
* dispatches a job-response for them via eventy
|
||||||
|
*/
|
||||||
|
private void worker()
|
||||||
|
{
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a Descriptor with tasky
|
* Register a Descriptor with tasky
|
||||||
*/
|
*/
|
||||||
|
@ -31,5 +65,22 @@ public final class Engine
|
||||||
|
|
||||||
/* Add a signal handler that handles said descriptor ID */
|
/* Add a signal handler that handles said descriptor ID */
|
||||||
evEngine.addSignalHandler(desc);
|
evEngine.addSignalHandler(desc);
|
||||||
|
|
||||||
|
/* TODO: Tristanable queue addition here */
|
||||||
|
|
||||||
|
/* Create a new queue for this Job */
|
||||||
|
Queue tQueue = new Queue(desc.getDescriptorClass());
|
||||||
|
|
||||||
|
/* Add the Queue to tristanable */
|
||||||
|
tmanager.addQueue(tQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
/* FIXME: Don't pass in null */
|
||||||
|
Engine e = new Engine(null);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue