Skip to content

Conversation

@jjerphan
Copy link
Member

No description provided.

@jjerphan jjerphan added the release::enhancements For enhancements PRs or implementing features label May 19, 2025
@jjerphan jjerphan force-pushed the integration-resolvo branch 4 times, most recently from 54d499b to a3c5531 Compare May 22, 2025 10:22
Copy link
Member

@JohanMabille JohanMabille left a 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>;
Copy link
Member

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.

Copy link
Member Author

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];
}
Copy link
Member

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.

@jjerphan jjerphan force-pushed the integration-resolvo branch from a3c5531 to 28f9086 Compare May 28, 2025 13:08
@jjerphan jjerphan force-pushed the integration-resolvo branch from e9c2cf7 to 096c6e5 Compare June 11, 2025 15:05
Copy link
Member

@AntoinePrv AntoinePrv left a 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::resolvo implementation disconnected from the rest of mamba that passes tests similar to libsolv/test_solver.cpp. We can leave leave out anything json related 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 PackageInfo to 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 \
Copy link
Member

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.

Comment on lines +212 to +215
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;
Copy link
Member

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?

Comment on lines +217 to +223
bool has_package(const specs::MatchSpec& spec)
{
auto candidates = get_candidates(
name_pool.alloc(::resolvo::String(spec.name().to_string()))
);
return !candidates.candidates.empty();
}
Copy link
Member

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
Copy link
Member

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.

Comment on lines +72 to +78
[[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>;

Copy link
Member

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!

@jjerphan
Copy link
Member Author

Note that this is completely work in progress, I am trying to have something which works first (while being pulled in many directions).

Refactor Json parsing and PackageInfo to 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.

Yes, this would be useful to also resolve #3954. I think this should be tackled first before all.

jjerphan and others added 20 commits June 25, 2025 10:16
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]>
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]>
jjerphan and others added 28 commits June 25, 2025 10:17
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]>
@jjerphan jjerphan force-pushed the integration-resolvo branch from bbbd192 to 107188f Compare June 25, 2025 08:18
@wolfv
Copy link
Member

wolfv commented Jun 25, 2025

I keep wondering if it wouldn't be easier to just add C++ bindings to rattler at this point ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release::enhancements For enhancements PRs or implementing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants