-
Couldn't load subscription status.
- Fork 415
Introduce resolvo #3947
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
base: main
Are you sure you want to change the base?
Introduce resolvo #3947
Conversation
54d499b to
a3c5531
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.
First review, I'll add more comment later.
| class Database; | ||
| } | ||
|
|
||
| using DatabaseVariant = std::variant<libsolv::Database, resolvo::Database>; |
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 a classical inheritance tree (or type erasure) would be more flexible and extensible on the long run than a variant.
I understand this requires further refactoring (up to the APIs used by mamba / micromamba), but I think it is definitely worth doing it. Besides, using abstractions in the higher level should reduce the "common" APIs of the different database classes and simplify the abstraction itself.
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.
Yes, this is temporary for now, and this can later be changed so that the plan from #3387 is implemented.
| ID operator[](T value) | ||
| { | ||
| return value_to_id[value]; | ||
| } |
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 should be consistent with the map API. operator[] returns a reference to an object either already in the map, or inserted. It might be a bit involved to implement such an operator (it would have to return a reference proxy to update both internal maps), so we might skip it for now and just implement find / insert methods.
a3c5531 to
28f9086
Compare
e9c2cf7 to
096c6e5
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.
This is going in the right direction! I only put a few comments on the code for now, because I think we should split the development in successive steps that would be easy to review and merge. For instance, I would
- Focus on an
mamba::solver::resolvoimplementation disconnected from the rest of mamba that passes tests similar tolibsolv/test_solver.cpp. We can leave leave out anythingjsonrelated to start with, or else plug a dirty implementation that uses libsolv under the hood. If some tests are generic enough, we can introduce a provisional generic Solver API to run thoses tests with all possible solvers and configuration. - Refactor Json parsing and
PackageInfoto avoid code-duplication, copies, and exposing private dependencies. I think something with Concept + Composition could help us drastically reduce all the code duplication we already have. Here we can plug some integration tests with data from conda-forge. - Then we can derive a generic API, factory, and plug it into the rest of mamba.
| -D CMAKE_CXX_COMPILER_LAUNCHER=sccache \ | ||
| -D CMAKE_C_COMPILER_LAUNCHER=sccache \ | ||
| -D MAMBA_WARNING_AS_ERROR=ON \ | ||
| -D MAMBA_WARNING_AS_ERROR=OFF \ |
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.
We should remove this before merging.
| bijective_map<::resolvo::NameId, ::resolvo::String> name_pool; | ||
| bijective_map<::resolvo::StringId, ::resolvo::String> string_pool; | ||
| bijective_map<::resolvo::VersionSetId, specs::MatchSpec> version_set_pool; | ||
| bijective_map<::resolvo::SolvableId, specs::PackageInfo> solvable_pool; |
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.
Are we sure we want to publicly exposed members?
| bool has_package(const specs::MatchSpec& spec) | ||
| { | ||
| auto candidates = get_candidates( | ||
| name_pool.alloc(::resolvo::String(spec.name().to_string())) | ||
| ); | ||
| return !candidates.candidates.empty(); | ||
| } |
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.
Nit: separate declaration from definition.
| #include "mamba/solver/resolvo/database.hpp" | ||
| #include "mamba/solver/resolvo/solver.hpp" | ||
|
|
||
| namespace mamba::solver |
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.
It would be nice to keep mamba::solver context-free. There could be an enum to choose the solver, and make a method in the context to compute it from experimental_resolvo_solver.
| [[nodiscard]] static auto from_json( | ||
| const std::string_view& filename, | ||
| simdjson::ondemand::object& pkg, | ||
| const CondaURL& repo_url, | ||
| const std::string& channel_id | ||
| ) -> expected_parse_t<PackageInfo>; | ||
|
|
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.
This ought to be a private helpers somewhere. simdjson is a private dependency and I think it should stay that way.
Perhaps a concept or view-like wrapper could help. On idea I had was to make a PackageInfo template that take a data storage class object. Then there could be simdjson, libsolv, resolvo, and inline std::string... implementations.
Let me know if you want to brainstorm it together, I'd be happy to!
|
Note that this is completely work in progress, I am trying to have something which works first (while being pulled in many directions).
Yes, this would be useful to also resolve #3954. I think this should be tackled first before all. |
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Many changes are required to be able to use hashmaps. Signed-off-by: Julien Jerphanion <[email protected]>
Required to use `std::unordered_map` with custom types. Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Resolve the problem with the locking. Signed-off-by: Julien Jerphanion <[email protected]> Co-authored-by: Wolf Vollprecht <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]> Co-authored-by: Johan Mabille <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]> Co-authored-by: Johan Mabille <[email protected]>
Signed-off-by: Julien Jerphanion <[email protected]>
bbbd192 to
107188f
Compare
|
I keep wondering if it wouldn't be easier to just add C++ bindings to rattler at this point ... |
No description provided.