mirror of
https://github.com/deavmi/tristanable.git
synced 2024-09-21 23:02:53 +02:00
- Moved Watcher
and Manager
modules to their own package
- Ensured `Watcher`'s constructor is package-level accessible only Manager - The constructor now creates an instance of `Watcher` - Added a `start()` method which calls `watcher.start()`
This commit is contained in:
parent
88432ab8d5
commit
ed68bf7cd6
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Management of a tristanable instance
|
* Management of a tristanable instance
|
||||||
*/
|
*/
|
||||||
module tristanable.manager;
|
module tristanable.manager.manager;
|
||||||
|
|
||||||
import std.socket;
|
import std.socket;
|
||||||
import tristanable.queue : Queue;
|
import tristanable.queue : Queue;
|
||||||
import core.sync.mutex : Mutex;
|
import core.sync.mutex : Mutex;
|
||||||
import tristanable.watcher : Watcher;
|
import tristanable.manager.watcher : Watcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a provided socket by spawning
|
* Manages a provided socket by spawning
|
||||||
@ -49,6 +49,14 @@ public class Manager
|
|||||||
{
|
{
|
||||||
this.socket = socket;
|
this.socket = socket;
|
||||||
this.queuesLock = new Mutex();
|
this.queuesLock = new Mutex();
|
||||||
|
this.watcher = new Watcher(this, socket);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: comment
|
||||||
|
// Starts the watcher
|
||||||
|
public void start()
|
||||||
|
{
|
||||||
|
watcher.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
source/tristanable/manager/package.d
Normal file
3
source/tristanable/manager/package.d
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module tristanable.manager;
|
||||||
|
|
||||||
|
public import tristanable.manager.manager : Manager;
|
@ -1,7 +1,7 @@
|
|||||||
module tristanable.watcher;
|
module tristanable.manager.watcher;
|
||||||
|
|
||||||
import core.thread : Thread;
|
import core.thread : Thread;
|
||||||
import tristanable.manager : Manager;
|
import tristanable.manager.manager : Manager;
|
||||||
import std.socket;
|
import std.socket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,7 +27,7 @@ public class Watcher : Thread
|
|||||||
// TODO: make package-level in a way such
|
// TODO: make package-level in a way such
|
||||||
// ... that only Manager can access this constructor
|
// ... that only Manager can access this constructor
|
||||||
// TODO: Add constructor doc
|
// TODO: Add constructor doc
|
||||||
this(Manager manager, Socket socket)
|
package this(Manager manager, Socket socket)
|
||||||
{
|
{
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.socket = socket;
|
this.socket = socket;
|
@ -7,7 +7,7 @@ module tristanable;
|
|||||||
* Interface which manages a provided socket
|
* Interface which manages a provided socket
|
||||||
* and enqueuing and dequeuing of queues
|
* and enqueuing and dequeuing of queues
|
||||||
*/
|
*/
|
||||||
public import tristanable.manager : Manager;
|
public import tristanable.manager;
|
||||||
|
|
||||||
// TODO: In future make `QueueItem` just `TaggedMessage`
|
// TODO: In future make `QueueItem` just `TaggedMessage`
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user