Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.

feat: read from the local store if available#185

Open
KSXGitHub wants to merge 10 commits into
mainfrom
read-from-local-cache
Open

feat: read from the local store if available#185
KSXGitHub wants to merge 10 commits into
mainfrom
read-from-local-cache

Conversation

@KSXGitHub
Copy link
Copy Markdown
Contributor

@KSXGitHub KSXGitHub commented Nov 6, 2023

resolves #179

NOTE: this PR doesn't have test

@KSXGitHub KSXGitHub requested review from anonrig and zkochan November 6, 2023 12:05
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 6, 2023

Codecov Report

❌ Patch coverage is 1.44928% with 68 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.35%. Comparing base (6b00165) to head (5240951).
⚠️ Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
...package-manager/src/install_package_by_snapshot.rs 0.00% 26 Missing ⚠️
crates/store-dir/src/index_file.rs 0.00% 23 Missing ⚠️
crates/store-dir/src/cas_file.rs 5.00% 19 Missing ⚠️
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     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

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

@github-actions
Copy link
Copy Markdown

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
Copy Markdown
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.

Comment thread crates/store-dir/src/cas_file.rs Outdated
.to_hex();
assert!(
matches!(algorithm, Algorithm::Sha512 | Algorithm::Sha1),
"Only Sha1 and Sha512 are supported. {algorithm} isn't",
Copy link
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read from local cache (store dir).

2 participants