Skip to content

Conversation

@MarekMracna
Copy link
Collaborator

This PR is focused on type safety and code quality. In particular, it makes these changes:

  1. The monolithic Task is now split into task phases. Methods now take their respective phases which removes the need for validation in many places.
  2. Devices and Tasks are now cached in State, reducing communication with the DB.
  3. Communicator is reworked - its only responsibility now is to relay protocol messages.
  4. The global mutex around State is removed, allowing for concurrent request handling.
  5. Async and locks are removed from tasks and moved to State.
  6. Developer documentation is added in the form of an ARCHITECTURE.md document.
  7. A lot of code is simplified and easier to reason about.

Acknowledgements are moved into the FinishedTask typestate.
This lets us pass around `Task` instances instead of always
hydrating from a task id or task model.
This is a rather big rewrite with these main changes:
- A `RunningTask` now owns its `Communicator`
- `State` caches `Task`s
- The cache is populated lazily
- Refactor and cleanup of adjacent code
This lets several requests to be served in parallel.
The locking granularity is now at Task level.
The structures were basically the same.
Kristian had wanted to merge them already.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant