require() and mw.loadData() call LuaEngine::loadPackage() which loads from local files, then if no file is found, from a page on the wiki. We will add external packages to the fallback sequence.
Similarly mw.loadJsonData() currently loads only from a page on the wiki, and this will be extended to also call the package loader.
- Entry point
- Process cache
- Default loader configuration and per-package overrides
- Loader backend:
- Local file loader
- SQL loader
We also need a sandbox loader although that might be integrated with the existing wiki page loading code.
The SQL loader is a file store independent of any particular VCS.
The main difference between this file store and existing stores (like the page store) is that this store can efficiently do atomic updates of many files. The fetcher (T412320) inserts the new texts, and the updater (T412323) links them to a deployment state ID. Marking the state as active is the atomic step and only changes a single row.
The active state ID and the state/content links are per-wiki. The text may be shared across wikis.
The loader gets the active state ID, and this remains consistent for the duration of a parse operation.
Scribunto provides an accelerator blob to the updater (T412323) with a map of module names to file names. The loader loads this blob and uses it to determine whether a module exists and which package and file it is in. The loader asks the file store for the file.
mw.loadJsonData() should probably take a slash-separated file name rather than a dot-separated module name. This file can be requested directly from the file store, without using the accelerator blob.
The entry point is responsible for registering a link in a link table.