Skip to content
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

feat: read from the local store if available #185

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

KSXGitHub
Copy link
Contributor

@KSXGitHub KSXGitHub commented Nov 6, 2023

resolves #179

NOTE: this PR doesn't have test

Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Attention: 68 lines in your changes are missing coverage. Please review.

Comparison is base (6b00165) 87.11% compared to head (5240951) 85.35%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #185      +/-   ##
==========================================
- Coverage   87.11%   85.35%   -1.76%     
==========================================
  Files          56       56              
  Lines        2824     2882      +58     
==========================================
  Hits         2460     2460              
- Misses        364      422      +58     
Files Coverage Δ
crates/store-dir/src/cas_file.rs 66.66% <5.00%> (-30.90%) ⬇️
crates/store-dir/src/index_file.rs 53.70% <0.00%> (-39.85%) ⬇️
...package-manager/src/install_package_by_snapshot.rs 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Nov 6, 2023

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00      8.1±0.17ms   534.0 KB/sec    1.01      8.2±0.14ms   530.6 KB/sec

Copy link

github-actions bot commented Nov 6, 2023

Integrated-Benchmark Report (Linux)

Scenario: Frozen Lockfile

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 168.3 ± 17.8 148.7 213.6 1.06 ± 0.14
pacquet@main 158.1 ± 12.6 139.9 179.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.16825778996923077,
      "stddev": 0.017766973659097223,
      "median": 0.1695753222,
      "user": 0.06857247230769231,
      "system": 0.09759384615384614,
      "min": 0.1487157452,
      "max": 0.2136408212,
      "times": [
        0.1809370282,
        0.1695753222,
        0.1527291172,
        0.2136408212,
        0.1521913082,
        0.1487157452,
        0.1704968392,
        0.1587148262,
        0.1758703372,
        0.1526788442,
        0.1775016632,
        0.1571481612,
        0.1771512562
      ],
      "exit_codes": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.1581380815076923,
      "stddev": 0.012571168685366469,
      "median": 0.1606728522,
      "user": 0.06710147230769231,
      "system": 0.10010415384615384,
      "min": 0.13988491919999999,
      "max": 0.1793517002,
      "times": [
        0.1793517002,
        0.1522446632,
        0.1657439302,
        0.13988491919999999,
        0.1719861572,
        0.1443337282,
        0.1606728522,
        0.1536287562,
        0.1672633442,
        0.1443176292,
        0.1663551302,
        0.1438228212,
        0.1661894282
      ],
      "exit_codes": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ]
    }
  ]
}

Copy link
Member

@zkochan zkochan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnpm also verifies the actual content of the file in the store. If the content was mutate, the mutate files are removed and the package is redownloaded to the store. This can be done in a separate PR but then let's not forget about it.

.to_hex();
assert!(
matches!(algorithm, Algorithm::Sha512 | Algorithm::Sha1),
"Only Sha1 and Sha512 are supported. {algorithm} isn't",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For files in the index only sha512 is supported. sha1 is supported for the tarball integrity because old packages in the registry have only sha1 checksum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read from local cache (store dir).
2 participants