Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nextgen: Tristanable v2 #4

Merged
merged 82 commits into from
Oct 2, 2023
Merged

Nextgen: Tristanable v2 #4

merged 82 commits into from
Oct 2, 2023

Conversation

deavmi
Copy link
Owner

@deavmi deavmi commented Mar 29, 2023

deavmi added 22 commits March 26, 2023 12:19
- Fixed typos in `README.md`
- Added new logo (source included)
- Added public imports along with comments per each

Encoding

- Added a stub class, `TaggedMessage`, for encoding and decoding the tristanable byte payload

Exceptions

- Added `TristanableException` exception type along with the `Error` enum sub-type

Manager

- Added stub code for `Manager` to manage the queues and socket

Queue

- Added stub class representing a queue with a tag (`Queue`)

QueueItem

- Added stub class `QueueItem` which represents an item that is enqueued/dequeued onto a `Queue`

Watcher

- Added stub class `Watcher` which will manage the socket reading-wise
- Added field `watcher` of type `Watcher`
- Added constructor which takes in an instance of `Manager` and an instance of `Socket`
- Added unit test TODO
- 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()`
- 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
- Added an import for `TaggedMessage` from module `tristanable.encoding`
- Added stub class `TaggedMessage`
- Added constructor, static decoder (unimplemented), `encoder (implemented), getters and setters
- Added module `tristanable.encoding`
- Added parameter-less (default) constructor marked as `private` to `TaggedMessage`
- Added decoding support in `decode(byte[])` which will return a new instance of `TaggedMessage`
- Added a unit test to test encoding and decoding
- Added documentation for fields `tag` and `data`
- Added documentation for both constructors
- Added documentation for `getPayload()`, `getTag()`, `setPayload(byte[])` and `setTag(ulong)`
- Added import for `bformat` and `encoding` module
- Documented `watch()`
- Added `bformat` read-and-decode `receiveMessage(Socket, ref byte[])` call followed by a `TaggedMessage.decode(byte[])` call
- Moved TODO below already completed code

Exceptions

- Renamed `Error` to `ErrorType`
- Constructing a new `TristanableException` will now store the passed in `ErrorType`
- Added `getError()` to `TristanableException` which returns the stored `ErrorType`
- Added two new memebrs to enum `ErrorType`, namely `QUEUE_NOT_FOUND` and `QUEUE_ALREADY_EXISTS`
- 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
- Fixed up the `exceptions` module import
@deavmi deavmi self-assigned this Mar 29, 2023
@deavmi deavmi added the enhancement New feature or request label Mar 29, 2023
@deavmi deavmi changed the title Nextgen Nextgen: Tristanable v3 Mar 29, 2023
@deavmi deavmi changed the title Nextgen: Tristanable v3 Nextgen: Tristanable v2 Mar 29, 2023
deavmi added 4 commits March 30, 2023 12:35
- Removed now-completed TODO in `registerQueue(QUeue)`
- Documented `registerQueue(Queue)`
- Added new member `NO_DEFAULT_QUEUE` to enum `ErrorType`
- The actual queue is now an `SList!(TaggedMessage)`
- Added a stub method `enqueue(TaggedMessage)`
- Updated the stub method `dequeue()` which returns a `TaggedMessage` now
deavmi added 28 commits April 7, 2023 12:18
- Added documentation to the constructor for `Watcher`
- Documented module `tristanable.manager.watcher`
- Docuemneted `getId()`
- Documented the `Queue` class
- Documented fields `event`, `queue` and `queueLock`
- Removed whitespace
- Documented method `shutdown()`
- Added a TODO for the future `removeQueue(Queue)` and `removeQueu_nothrow(Queue)`
- Implemented `releaseQueue(Queue)`
- Implemented `releaseQueue_nothrow(Queue)`

Unit tests

- Added unit test for `releaseQueue(Queue)`
- Added a TODO
- Now requires a minimum version of `libsnooze` of at least `
1.0.0-beta`
- Be specific, catch `FatalException` in `enqueue(TaggedMessage)`
- Be specific, catch `InterruptedException` and `FatalException` seperately
- Added enum members `DEQUEUE_FAILED` and `ENQUEUE_FAILED` to `ErrorType` enum
- `enqueue(TaggedMessage)` can now throw a `TristanableException` if a `FataException` with `libsnooze` occurrs
- `dequeue()` can now throw a `TristanableException` if a `FatalException` occurs during the call to `wait()` on `libsnooze`
- Required minimum version of `bformat`, `4.1.0`
- Upgraded `libsnooze` to version `1.3.0-beta`
* Dub

- Removed `libsnooze` dependency

* Queue

- Removed `libsnooze` imports

* Queue

- Added mutex+condition variable

* Queue

- Removed old `ensure()` call

* Queue

- Switched one thing over to mutex+condvar

* Queue

- Switched to using condition variable
- Added configurable slumber interval
- Removed TODOs which are irrevevant for now
- Removed `TListener` references

Everything else

- Removed reference to old/duplicate `queue.d` module
* Dub

- Added `niknaks` package with a minimum version of `v0.3.0`

* Encoding

- Switched to niknaks for `decode()`

* Encoding

- `encode()` now uses niknaks
- Added testing for default queue
@deavmi deavmi merged commit b24c336 into master Oct 2, 2023
2 checks passed
@deavmi
Copy link
Owner Author

deavmi commented Oct 2, 2023

Honestly looks good to me, I will keep the issue open and work from there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant