Skip to content

Commit

Permalink
Add context
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Dec 18, 2024
1 parent c443c50 commit 9565eca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/internal/partial_solution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ pub(crate) struct PartialSolution<DP: DependencyProvider> {
/// Store for all known package decisions and package derivations.
///
/// "assignment" refers to both packages with decisions and package with only derivations and
/// no decision yet.
/// no decision yet. We combine this in a single index map, where different sections (of
/// indexes) contain package with different level of information, and make a decision moves a
/// package from the derivations sections to the decisions section.
///
/// `[..current_decision_level]`: Packages that have had a decision made, sorted by the
/// `decision_level`. The section is can be seen as the partial solution, it contains a
/// mapping from package name to decided version. The sorting makes it very efficient to
/// extract the solution, and to backtrack to a particular decision level. The
/// `AssignmentsIntersection` is always a `Decision`.
///
/// `[changed_this_decision_level..]`: Packages that are dependencies of some other package,
/// `[prioritize_decision_level..]`: Packages that are dependencies of some other package,
/// but have not yet been decided. The `AssignmentsIntersection` is always a `Derivations`, the
/// derivations store the obligations from the decided packages. This section has two
/// subsections to optimize the number of `prioritize` calls:
Expand Down Expand Up @@ -280,7 +282,7 @@ impl<DP: DependencyProvider> PartialSolution<DP> {
*t = t.intersection(&dated_derivation.accumulated_intersection);
dated_derivation.accumulated_intersection = t.clone();
if t.is_positive() {
// we can use `swap_indices` to make `changed_this_decision_level` only go down by 1
// we can use `swap_indices` to make `prioritize_decision_level` only go down by 1
// but the copying is slower then the larger search
self.prioritize_decision_level =
std::cmp::min(self.prioritize_decision_level, idx);
Expand Down

0 comments on commit 9565eca

Please sign in to comment.