Skip to content

Commit

Permalink
use second simdjson parser to be able to load two documents at once
Browse files Browse the repository at this point in the history
  • Loading branch information
dholth committed Nov 13, 2023
1 parent c8d93ae commit 41630e6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions libmamba/src/core/repo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,18 +317,21 @@ namespace mamba
{
for (const auto& [fn, pkg] : packages)
{
if (skip_packages != nullptr && skip_packages->count(std::string(fn)))
if (skip_packages != nullptr && skip_packages->count(std::string(fn))==1)
{
LOG_INFO << "Skip " << fn;
continue;
}

if (remember_packages != nullptr)
{
LOG_INFO << "Store " << fn;
remember_packages->insert(std::string(fn));
}

// packages in the overlay may be null as a deletion marker
if (pkg.type() == dom::element_type::NULL_VALUE) {
if (pkg.type() == simdjson::dom::element_type::NULL_VALUE) {
LOG_INFO << "Skip NULL " << fn;
continue;
}

Expand Down Expand Up @@ -499,13 +502,10 @@ namespace mamba
LOG_INFO << "Reading repodata.json file " << filename << " and overlay " << overlay
<< " for repo " << name() << " using mamba";

// Full index json.
auto parser = simdjson::dom::parser();
// Most packages
const auto repodata = parser.load(filename);

// prefer packages in overlay then fall back to repodata
const auto patch = parser.load(overlay);

// An override for missing package subdir is found in at the top level
auto default_subdir = std::string();
if (auto subdir = repodata.at_pointer("/info/subdir").get_string(); subdir.error())
Expand All @@ -518,6 +518,10 @@ namespace mamba

std::set<std::string> patched_packages;

// Patches to index json. Prefer packages in overlay then fall back to repodata.
auto patch_parser = simdjson::dom::parser();
const auto patch = patch_parser.load(overlay);

if (auto pkgs = patch["packages"].get_object(); !pkgs.error())
{
set_repo_solvables(
Expand Down Expand Up @@ -685,10 +689,12 @@ namespace mamba
{
if (overlay)
{
LOG_INFO << "Overlay passed";
mamba_read_json_plus_overlay(json_file, *overlay);
}
else
{
LOG_INFO << "Overlay not passed";
mamba_read_json(json_file);
}
}
Expand Down

0 comments on commit 41630e6

Please sign in to comment.