Commit Graph

15 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire 64163aed0a - Upgraded to new `bformat` version `4.1.0` and migrated to using `BClient` (unit tests seem to pass) 2023-04-30 19:30:11 +02:00
Tristan B. Velloza Kildaire 1b6dd5d746 Manager
- Removed now-completed TODO
- Added documentation for `queuesLock`
2023-04-07 12:16:52 +02:00
Tristan B. Velloza Kildaire b7bb3df7c9 Manager
- Added documentation for `start()` and `stop()`
2023-04-07 12:16:13 +02:00
Tristan B. Velloza Kildaire 375a611a82 Watcher
- Added package-level accessible `startWatcher()` method which calls `start()` for us
- Added some debugging prints which will now only be compiled-in during unittest builds
- If the bformat `receiveMessage(Socket, ref byte[])` method fails (returns `false`) then exit the loop, only continue decoding if it is `true`
- Implemented package-level accesible `shutdown()` method

Manager

- `start()` now calls `watcher.startWatcher()` instead of `watcher.start()`
2023-04-06 13:13:38 +02:00
Tristan B. Velloza Kildaire 26e856b7a1 Manager
- Added support for configuring the `Manager`, the constructor now uses the default configuration
- Implemented `registerQueue_nothrow(Queue)` which returns `true` on success, `false` otherwise
- `registerQueue(Queue)` now makes a sub-call to `registerQueue_nothrow(Queue)`
- Implemented `sendMessage(TaggedMessage)`
- Added comment for assertions in unittest
2023-04-06 08:51:32 +02:00
Tristan B. Velloza Kildaire 4632929123 Manager
- Removed empty unittest
2023-04-06 08:29:30 +02:00
Tristan B. Velloza Kildaire 6b13303c9d Manager
- Added unittest for `getUniqueQueue()`
- Typo fix
2023-04-06 08:26:01 +02:00
Tristan B. Velloza Kildaire 63698c0f87 Manager
- Implemented `getUniqueQueue()` which finds an unused tag, makes a `Queue` with said tag, registers it and then returns it
- WIP: `shutdown()` method
2023-04-05 15:35:55 +02:00
Tristan B. Velloza Kildaire f7565b6de2 Manager
- Clean up I guess
2023-04-05 08:39:50 +02:00
Tristan B. Velloza Kildaire 16bbeeece4 Manager
- Added a default queue
- `getQueue(ulong)` now calls `getQueue_nothrow(ulong)` with the same id
- Implemented `getQueue_nothrow(ulong)` which returns the `Queue` if found, `null` otherwise
- Added `getDefaultQueue()` which gets the default queue by calling `getDefaultQueue_nothrow(ulong)` with the same id
- Added `getDefaultQueue_nothrow(ulong)` which returns the default queue as a `Queue` object if it exists, else `null`
- Added `setDefaultQueue(Queue)` which sets the provided queue as the default queue (i.e. the queue where messages tagged with a tag of a queue not registered will be dumped into - if the default queue is set)

Watcher

- Set the worker thread, `watch`, in the constructor
- Added a TODO relating to checking if the socket read succeeded or not
- Added a debug print for the received `TaggedMessage` post-decode
- Extract the tag of the message and find the matching queue (potentially, if it exists)
- If the queue exists then add the `TaggedMessage` to said `Queue`
- If the queue doesn't exist then, get the so-called "Default queue", if it doesn't exist don't do anything, if it does then enqueue the message (the `TaggedMessage`) to said `Queue`

Unit test

- Added a unit test (WIP) for testing the `Manager` and `Watcher` mechanism
- Updated unittest to test the `getQueue_nothrow(ulong)` method
- Added a unit test to test adding a `Queue` with a tag that already exists in a `Queue` registered prior
2023-03-31 11:31:56 +02:00
Tristan B. Velloza Kildaire 06e80eec84 Manager
- Documented `registerQueue(Queue)`
2023-03-30 12:36:52 +02:00
Tristan B. Velloza Kildaire ab07df80ea Manager
- Removed now-completed TODO in `registerQueue(QUeue)`
2023-03-30 12:35:41 +02:00
Tristan B. Velloza Kildaire 99c14bc699 Manager
- Changed from using D's dynamic arrays for the array of `Queue` objects to using an `SList!(T)` where `T` is the `Queue` type
- Implemented `getQueue(ulong)` which returns the `Queue` object with the matching id/tag, else throws an instance of `TristanabaleException`
- Implemented `registerQueue(Queue)` which will attempt to add the provided `Queue` given that a queue does not already exist with the provided queue's id; if that is the case then an instance of `TristanableException` is thrown

Queue

- Made the constructor take in the `ulong` queue ID
- Made the constructor publically accessible
- Implemented `getID()` which returns the `Queue`'s id as a `ulong`
- Removed the static method `newQueue(ulong)`

Unit test

- Added a unit test to test `getQueue(ulong)` when the queue cannot be found
- Added a unit test to test adding a queue and successfully retrieving it
2023-03-29 16:01:34 +02:00
Tristan B. Velloza Kildaire a05bc3e2fd Manager
- Added stub `sendMessage(TaggedMessage)` which will encode into the tristanable format, then wrap into bformat and send over the socket
- Added import for `TaggedMessage` from `tristanable.encoding` module
2023-03-26 18:35:19 +02:00
Tristan B. Velloza Kildaire ed68bf7cd6 - 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()`
2023-03-26 18:31:52 +02:00