Build service abstraction around Objects
#1392
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This new service is the only code that mutates
Objects
, and it only does so through events. Those events can later be accessed and used to recreate any intermediate state. This should help with building better debugging tools (#1385), and barely complicates the code that was previously usingObjects
directly!This has the side effect of turning validation errors into panics, for the time being. This is fine for now, as it matches how validation errors are used so far pretty well. It also enables a lot of simplifications, which I'm going to realize in follow-up pull requests.
My mid-term plan for validation is to decouple it from object insertion and move it into a service. This will enable geometry to be generated despite validation errors (which is good, because the user needs to see what's wrong; not just be confronted with an error message and no result). It will also allow any future debugging tools to provide better insight into exactly where and how these validation errors were generated.
Close #1387