diff --git a/source/tasky/engine.d b/source/tasky/engine.d index c5aaffe..b74f6aa 100644 --- a/source/tasky/engine.d +++ b/source/tasky/engine.d @@ -9,18 +9,52 @@ module tasky.engine; import eventy.engine : EvEngine = Engine; 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; - this() + this(Socket socket) { + /* Set the worker function */ + super(&worker); + + /* TODO: Check for exceptions */ /* Create a new event engine */ evEngine = new EvEngine(); 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 */ @@ -31,5 +65,22 @@ public final class Engine /* Add a signal handler that handles said descriptor ID */ 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); + + } }