Open sunjay opened 7 years ago
Some very rough and early notes about plugins, async and the overall multiprocessed architecture.
Image worker's new design should support several things in addition to what has already been stated:
- multithreading support so each action is taken in a different thread
future
-based API- action cancellation (kill the thread or cancel the future)
- progress (by adding a bunch of code to the image crate behind a feature gate)
- multiple "contexts" that represent the projects being worked on
All the async stuff should be decoupled from everything else so this is testable.
For implementing progress, we want to add it to the image crate without impacting other people's performance.
Submit an RFC issue to the image crate and describe the approach.
Could be worthwhile to look at using a futures::stream. Instead of having the image processing functions return a synchronous result.
There could be an
async
feature that adds_async
versions of all image operations. These would return futures or streams. In async mode, image operations would run in their own thread. Cancellation should be possible.When a
progress
feature is enabled, async functions would return streams that yield an enum representing a change in progress or the final result. Otherwise just a future is necessary. It's possible that people may always want progress in which case we don't need to implement the two feature gates like that. It may be useful to implement the progress struct behind the gate anyway just in case.The progress should be modelled using a struct that requires a "total amount of work" (usize) when being constructed. Instances of that struct provide a method to progress which should allow the progress to go up or down but never over 100% or under 0%. If those invariants are not met in development mode, panic. If those invariants are not met in release mode just round to the nearest value.
If the progress feature is not available, the progress struct should be empty and its methods should all be implemented as empty so that it does not impact anyone's performance.
The progress feature depends on the async feature.
This stuff is based on a tweet about plugins as components. I haven't figured it out fully yet but I want to keep considering that instead of just going with plain plugins.
It would be really cool if the UI plugin architecture could be completely agnostic of the technologies and frameworks being used in the Rhino UI. These technologies (currently react/redux) will likely change or grow or break in the future. It would be cool if the UI plugin framework was so flexible that you could run the plugins in a webworker and simply pass data around.
This is a new architecture for the backend of Rhino. It does not need to be implemented before 1.0.0 because it will not change existing functionality at all. It will however provide the following benefits:
This is heavily inspired by this awesome talk about the xi editor.
Resources:
Proposed Actions:
man 7 unix
, environment variables (for sharing host/port info), etc.Use GraphQL