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

Migrate to a session based diff manager #371

Merged
merged 17 commits into from Oct 13, 2020

Conversation

JaapRood
Copy link
Contributor

@JaapRood JaapRood commented Sep 29, 2020

Currently, diffs of interactions vs spec happen on-demand, triggered from the UI. A lot of the logic for how to perform diffs and read the results were woven into the route handlers of the local cli-server. This is a first step in moving the diffing to the background and into a more reactive model.

Mostly an exercise in exploring the right interface and model, this PR introduces a Session construct for each local API running against optic, and a SessionDiffs manager, in charge of spawning and managing diff workers for said API. It does so through a generic Diff interface, exposing DiffProgress and DiffQueries interfaces to the route handlers to interact with the diffs with. Results are generally returned as Readable streams that can be piped straight through or manipulated. The existing DiffManager is renamed OnDemandDiff and implements this generic interface, putting it now fully in charge of matters like running the worker, persistence of results, etc.

Behaviour wise, nothing has really changed thus far. It's still the UI starting the diff that's the main trigger for a diff being performed for now. However, this exercise in exploration and refactoring, puts us in a situation where we can implement a longer running, continuous type of diff, that be driven through other triggers. As long as the generic Diff interface is implemented, this can happen without changes to the route handlers or UI side.

@JaapRood JaapRood marked this pull request as ready for review October 13, 2020 10:01
… as it currently breaks through spec changes
preventing unexplained exits from a worker implementation we're about to
retire from holding us back.
@JaapRood JaapRood merged commit 0a1d797 into opticdev:develop Oct 13, 2020
@JaapRood JaapRood deleted the feature/session-diffs branch October 13, 2020 14:33
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.

None yet

2 participants