@pnpm/store.index
SQLite-backed index for the pnpm content-addressable store
Last updated a month ago by pnpmuser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @pnpm/store.index 
SYNC missed versions from official npm registry.

@pnpm/store.index

SQLite-backed index for the pnpm content-addressable store

Why SQLite instead of individual index files?

Previously, pnpm stored package metadata as individual JSON files under $STORE/index/. Each resolved package had its own file, keyed by its integrity hash. This worked but had several downsides at scale:

  • Filesystem overhead. Every lookup required open / read / close syscalls, and every write needed an atomic write + rename per entry. On repositories with thousands of dependencies the accumulated I/O was significant.

  • Space inefficiency. Small metadata entries still consumed a minimum filesystem block each (typically 4 KiB), wasting space. Storing all entries in a single SQLite database ($STORE/index.db) addresses these issues:

  • Fewer syscalls. Reads and writes go through SQLite's page cache and memory-mapped I/O instead of individual file operations.

  • Space efficiency. Small entries share database pages instead of each occupying a full filesystem block.

  • Batch writes. Multiple entries can be inserted in a single transaction, reducing disk flushes.

Concurrent access

StoreIndex and ReadOnlyStoreIndex coordinate access through SQLite WAL locking. Use ReadOnlyStoreIndex to read a store while other connections write to it. It observes committed updates and may create SQLite sidecar files in the store directory. All processes must use the same local filesystem on the same host; sharing the live WAL database across hosts over a network filesystem is unsupported.

Use ImmutableStoreIndex only for a finalized store that no process will change, such as a store shipped in a read-only image. It creates no sidecar files and is used by frozenStore. Callers that used ReadOnlyStoreIndex for finalized stores on read-only filesystems must switch to ImmutableStoreIndex.

Incomplete node:sqlite

When DatabaseSync.exec is missing, the store index runs its SQL through prepared statements. When DatabaseSync.prepare is missing too, entries are stored in index.fallback. A later pnpm with a complete node:sqlite reads index.db only. frozenStore still requires a connection that can open index.db. The file index does not coordinate concurrent writers.

License

MIT

Current Tags

  • 1101.0.3                                ...           latest (a month ago)

17 Versions

  • 1101.0.3                                ...           a month ago
  • 1101.0.2                                ...           a month ago
  • 1101.0.1                                ...           2 months ago
  • 1101.0.0                                ...           2 months ago
  • 1100.3.3                                ...           2 months ago
  • 1100.3.2                                ...           2 months ago
  • 1100.3.1                                ...           3 months ago
  • 1100.3.0                                ...           3 months ago
  • 1100.2.5                                ...           3 months ago
  • 1100.2.4                                ...           3 months ago
  • 1100.2.3                                ...           4 months ago
  • 1100.2.2                                ...           4 months ago
  • 1100.2.1                                ...           5 months ago
  • 1100.2.0                                ...           5 months ago
  • 1100.1.0                                ...           7 months ago
  • 1100.0.0                                ...           8 months ago
  • 1000.0.0-0                                ...           9 months ago
Maintainers (2)
Downloads
Total 24
Today 0
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 22
Dependencies (4)
Dev Dependencies (4)

© 2010 - cnpmjs.org x YWFE | Home | YWFE