refactor: index the database by path once

model.database.record_at and sha1_at read one cached path index with
normpath keys. They replace records_by_path of resolve.packfiles, the
manifest's own sha1 index, the per-call indexes of regionaudit,
emulatorcheck and hidden_extras, and the linear scan of held_record.
resolve_sha1 drops its by_path argument. A path spelled with ./ or a
doubled slash now finds its record everywhere; the database writes none,
so the output is the same.
This commit is contained in:
Abdessamad Derraz committed 2026-11-20 20:03:26 +01:00
1 parent 1c978f3083
commit 8bc1fcb5db
9 files changed
+55 -60

No files matched your search

+3 -2
View File
@@ -10,7 +10,8 @@ from core.hashing import compute_hashes, parse_hash_list, parse_md5_list
from core.paths import comparable_destination
from core.ziptools import check_inside_zip
from resolve.localfile import resolve_local_file, variant_base_name
from resolve.packfiles import records_by_path, preferred_entries
from model.database import record_at
from resolve.packfiles import preferred_entries
@dataclass
@@ -124,7 +125,7 @@ def _record_at(path: str, db: dict) -> dict | None:
path verify --all and slots.py both take. The index is the pack
resolver's, so one run holds one copy of it.
"""
return records_by_path(db).get(path)
return record_at(db, path)
def content_sha1(path: str, db: dict) -> str | None: