Files
ldm0 4e3f174ab1 refactor(profile): simplify imports with a read-only LevelDB parser
Read Chrome localStorage snapshots through moli-leveldb-parser with
zerocopy layouts. Keep the LevelDB engine in test dependencies and port
Chromium reader scenarios with reproducible native fixtures.

Share WAL-aware SQLite snapshots and merge localStorage by origin and
UTF-16 key. Read all sources and required destination files before
replacing cookie or localStorage data.

Validation:
- cargo fmt --all
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo nextest run --no-fail-fast (17573 passed, 13 skipped)
2026-09-15 15:11:52 +08:00
..

Chromium LevelDB fixtures

These closed databases were generated by generate.cc, linked against Chromium's LevelDB revision 7ee830d02b623e8ffe0b95d59a74db1e58da04c5. The generator checks every entry against the native engine's iterator before closing each database. Rust tests independently reconstruct the expected data.

  • chromium/randomized-long-db: the 100,000-operation Harness.RandomizedLongDB workload, fixed seed 301, binary and empty keys, duplicate-key updates, multiple live SSTs, and the final WAL not yet converted into an SST.
  • chromium/recovery: SSTs plus a fragmented WAL with updates, deletes, binary and empty keys/values, and a 120,000-byte replacement value.

The native fixtures use uncompressed tables. The Rust ports exercise both uncompressed and Snappy-compressed data/index blocks, independently of whether the host has a C++ Snappy library installed. Cargo tests read the checked-in fixtures directly; they need no C++ compiler, downloads, or fixture generation.

To regenerate, run from the repository root with an empty scratch directory:

git clone https://chromium.googlesource.com/external/leveldb /tmp/moli-leveldb-fixture-source
git -C /tmp/moli-leveldb-fixture-source checkout 7ee830d02b623e8ffe0b95d59a74db1e58da04c5
cmake -S /tmp/moli-leveldb-fixture-source -B /tmp/moli-leveldb-fixture-build \
  -DCMAKE_BUILD_TYPE=Release -DLEVELDB_BUILD_TESTS=OFF \
  -DLEVELDB_BUILD_BENCHMARKS=OFF -DLEVELDB_INSTALL=OFF
cmake --build /tmp/moli-leveldb-fixture-build
c++ -std=c++17 -O2 moli-leveldb-parser/tests/fixtures/generate.cc \
  -I/tmp/moli-leveldb-fixture-source/include -I/tmp/moli-leveldb-fixture-source \
  /tmp/moli-leveldb-fixture-build/libleveldb.a -pthread \
  -o /tmp/moli-leveldb-fixture-generator
/tmp/moli-leveldb-fixture-generator /tmp/moli-leveldb-fixtures

If CMake detects optional native Snappy, CRC32C or Zstd libraries, link those as well. Inspect the generated contents before replacing chromium/. Background compaction can change file numbers/layout between runs; the expected logical contents are fixed. SHA256SUMS records the checked-in files, not an assertion that regenerated database files must be byte-for-byte identical.

See TESTS.md for upstream sources and port coverage and LICENSE-LevelDB for the upstream license.