-
Notifications
You must be signed in to change notification settings - Fork 22
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
⚠️ Remove variable sources and make Deppy accept a slice of variables instead #160
⚠️ Remove variable sources and make Deppy accept a slice of variables instead #160
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #160 +/- ##
==========================================
- Coverage 65.52% 63.90% -1.63%
==========================================
Files 11 11
Lines 496 482 -14
==========================================
- Hits 325 308 -17
- Misses 152 155 +3
Partials 19 19 ☔ View full report in Codecov by Sentry. |
// Solution is returned by the Solver when the internal solver executed successfully. | ||
// A successful execution of the solver can still end in an error when no solution can | ||
// be found. | ||
type Solution struct { | ||
err error | ||
selection map[deppy.Identifier]deppy.Variable | ||
variables []deppy.Variable | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can get rid of Solution
completely (not in this PR). I do not see a lot of value in it.
And probably replace DeppySolver
wrapper around internal package by exporting what we currently have in internal pacakge (with some modifications and also not in this PR).
This comment is for me to look into whether it makes sense and create issues for this.
Edit: created #161 for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Structuring the logic to be helpers in generating the inputs to and consuming the outputs of the solver library sounds like a really good idea - lets folks use as much of or as little of this helpful logic as they need and doesn't bind them to what we happen to have or not to have wrapped at some moment in time.
f8dc17f
to
7cf6aaa
Compare
if solutionOpts.addVariablesToSolution { | ||
solution.variables = vars | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously variables were generated by a varaible soruce. So for cases where the calling code for some reason needed to access input variables - we had an option to add them into the Solution
struct. Since now the calling code provides input variables - this seems like pointless option. So I removed it.
@@ -141,26 +116,6 @@ var _ = Describe("Entity", func() { | |||
})) | |||
}) | |||
|
|||
It("should add all variables to solution if option is given", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer have this option.
Expect(err).ToNot(HaveOccurred()) | ||
Expect(solution.Error()).To(HaveOccurred()) | ||
}) | ||
|
||
It("should return peripheral errors", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer have a variable soruce to fail
|
Signed-off-by: Mikalai Radchuk <[email protected]>
7cf6aaa
to
e027f4d
Compare
e027f4d
to
517368d
Compare
Instead of a variable source make Deppy accept a slice of variables as an input. Signed-off-by: Mikalai Radchuk <[email protected]>
517368d
to
792c624
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes look great and will make it easier to use, thanks @m1kola !
af7d9eb
Instead of a variable source make Deppy accept a slice of variables as an input.
Closes #153