Commit Graph

206 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire bbe7b344ec Merge branch 'nextgen' into nextgen_queue_remove 2023-05-04 09:47:51 +02:00
Tristan B. Velloza Kildaire e0977837af Merge branch 'master' into nextgen 2023-05-04 09:47:39 +02:00
Tristan B. Velloza Kildaire 79432cef6c
Enable CI for `nextgen` branch
- Run CI tests for any pull requests being made to the `nextgen` branch
2023-05-04 09:46:46 +02:00
Tristan B. Velloza Kildaire b283ebcdfc Merge branch 'nextgen' into nextgen_queue_remove 2023-05-04 09:46:15 +02:00
Tristan B. Velloza Kildaire 89fce3bae9 Unit tests
- Added a TODO
2023-05-04 09:45:26 +02:00
Tristan B. Velloza Kildaire 798acba4aa Manager
- Implemented `releaseQueue(Queue)`
- Implemented `releaseQueue_nothrow(Queue)`

Unit tests

- Added unit test for `releaseQueue(Queue)`
2023-05-04 09:45:06 +02:00
Tristan B. Velloza Kildaire abe64f7701 Manager
- Added a TODO for the future `removeQueue(Queue)` and `removeQueu_nothrow(Queue)`
2023-05-03 23:10:45 +02:00
Tristan B. Velloza Kildaire 1437895669
Merge pull request #6 from deavmi/nextgen_river
Bformat+River upgrade
2023-04-30 19:42:09 +02:00
Tristan B. Velloza Kildaire 10e230ea2f Merge branch 'nextgen' into nextgen_river 2023-04-30 19:36:50 +02:00
Tristan B. Velloza Kildaire 8d3534b216 Merge branch 'master' into nextgen 2023-04-30 19:34:27 +02:00
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 c43ed31ca9
Update README.md 2023-04-30 19:24:24 +02:00
Tristan B. Velloza Kildaire fb36497bda
Create d.yml 2023-04-30 19:23:22 +02:00
Tristan B. Velloza Kildaire 97ecbd86bb Watcher
- Documented method `shutdown()`
2023-04-07 12:27:14 +02:00
Tristan B. Velloza Kildaire b10807e279 Package
- Removed whitespace
2023-04-07 12:23:35 +02:00
Tristan B. Velloza Kildaire 19742d9276 Queue
- Docuemneted `getId()`
- Documented the `Queue` class
- Documented fields `event`, `queue` and `queueLock`
2023-04-07 12:22:51 +02:00
Tristan B. Velloza Kildaire 6e972b6cc5 Watcher
- Documented module `tristanable.manager.watcher`
2023-04-07 12:19:19 +02:00
Tristan B. Velloza Kildaire 97e72e09f0 Watcher
- Added documentation to the constructor for `Watcher`
2023-04-07 12:18:20 +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 3bda88267b Exceptions
- Added missing documentation
- Fixed the message generation of the exception's message
2023-04-07 12:14:02 +02:00
Tristan B. Velloza Kildaire 07d47551ae Exceptions
- Documented `ErrorType` and all its members
- Documented `TristanableException`
2023-04-06 15:46:34 +02:00
Tristan B. Velloza Kildaire 79fee5bd7e Watcher
- Documented unittest as it is a great example of how to sue tristanable
2023-04-06 13:40:38 +02:00
Tristan B. Velloza Kildaire f811273818 Unit test
- Sleep a little longer for profiling tests
2023-04-06 13:18:20 +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 2fa77e639f Queue
- Added documentation for the constructor `this(ulong)`
- Fixed issue #5

Unit tests

- The `==` operator on strings does some normalization stuff which results in differing byte sequences and therefore inequality (see the `"Cucumber 😳️"` case), therefore casting to `byte[]`
- Send another message tagged with `69`
- Fixed comment for server code sending tagged `42` message
- Call `manager.stop()` right at the end of the unit test
2023-04-06 12:28:54 +02:00
Tristan B. Velloza Kildaire 62b16de596 Watcher
- Added stub `shutdown()` method that is intended to be called by `Manager` (package-level accessible)

Unit tests

- Sleep for 4 seconds instead of 2 before the server sends the two tagged messages
- Send a messae tagged with tag `42` before that of the one tagged with `69`
- Register a queue with tag `42`
- Remove `WaitingThread`, we now receive both tagged messages (`42` and `69`) on the unittest thread
- Added assertion to ensure the tagged message of `69` is indeed received correctly (tag AND payload)
2023-04-06 08:57:52 +02:00
Tristan B. Velloza Kildaire 9f07c06e15 Package (`manager`)
- Import the `Config` type and the `defaultConfig()` function
2023-04-06 08:51:47 +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 62cc615be3 Config
- Make the default configuration generated more explicit in `defaultConfig`
- Remove initialization in `Config` (would be `false` in any case)
2023-04-06 08:49:44 +02:00
Tristan B. Velloza Kildaire af4eed748f Config
- Added new module `config`
- Added new type `Config` which is used for configuring an instance of `Manager`
- Added `defaultConfig()` which returns the default `Config` instance used
2023-04-06 08:49:02 +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 cf62054eb8 Encoding
- Added module-level documentation

Exceptions

- Added module-level documentation

Queue

- Added module-level documentation

Package (`tristanable.manager`)

- Added module-level documentation
2023-04-05 08:47:51 +02:00
Tristan B. Velloza Kildaire 41ebb30754 Exceptions
- Removed unused enum member `QueueExists` of enum `ErrorType`
2023-04-05 08:46:17 +02:00
Tristan B. Velloza Kildaire c6568a566c Package
- Removed completed TODO
2023-04-05 08:45:48 +02:00
Tristan B. Velloza Kildaire c6611fc26b Watcher
- Deleted old module that was unused
2023-04-05 08:44:10 +02:00
Tristan B. Velloza Kildaire 1336a37d13 Unit test (Watcher)
- Unit test for watcher works
2023-04-05 08:40:09 +02:00
Tristan B. Velloza Kildaire f7565b6de2 Manager
- Clean up I guess
2023-04-05 08:39:50 +02:00
Tristan B. Velloza Kildaire 883949e555 Queue
- Added entrance and exit debugs for `dequeue()`
2023-04-05 08:39:35 +02:00
Tristan B. Velloza Kildaire c2e034715d Queue
- Replaced now-completed TODO with an actual comment in `dequeue()`
2023-04-05 08:33:48 +02:00
Tristan B. Velloza Kildaire eecb9fef02 Queue
- Added imports for `std.stdio` and `to` from `std.conv` to be imported when compiling in `unittest` mode
- Added documentation to `enqueue(TaggedMessage)`
- Implemented `enqueue(TaggedMessage)` using libsnooze
- Added documentation for `dequeue()`
- Implemented `dequeue()` using libsnooze
2023-04-05 08:33:08 +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 8cf731089e Encoding
- Implemented `toString()` in `TaggedMessage`
2023-03-30 18:26:34 +02:00
Tristan B. Velloza Kildaire 4c530dd7cd - Removed `QueueItem` 2023-03-30 13:36:54 +02:00
Tristan B. Velloza Kildaire 409dacd4da Queue
- The actual queue is now an `SList!(TaggedMessage)`
- Added a stub method `enqueue(TaggedMessage)`
- Updated the stub method `dequeue()` which returns a `TaggedMessage` now
2023-03-30 13:35:09 +02:00
Tristan B. Velloza Kildaire 0d94ed0c83 Exceptions
- Added new member `NO_DEFAULT_QUEUE` to enum `ErrorType`
2023-03-30 13:33:17 +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