1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Refactor opfs-sahpool to support multiple instances, each with a separate VFS name and directory.

FossilOrigin-Name: d036eaf6ac60c576428db40f015733c5d5425f7d613194fd8d9d4d98659077c4
This commit is contained in:
stephan
2023-07-18 12:09:16 +00:00
parent 99d4a2db46
commit dec4cea24c
4 changed files with 430 additions and 394 deletions

View File

@ -56,18 +56,26 @@
"speedtest1.wasm", ...cliFlagsArray, dbFile
];
App.logBuffer.length = 0;
const ndxSahPool = argv.indexOf('opfs-sahpool');
const realSahName = 'opfs-sahpool-speedtest1';
if(ndxSahPool>0){
argv[ndxSahPool] = realSahName;
log("Updated argv for opfs-sahpool: --vfs",realSahName);
}
mPost('run-start', [...argv]);
if(App.sqlite3.installOpfsSAHPoolVfs
&& !App.sqlite3.$SAHPoolUtil
&& cliFlagsArray.indexOf('opfs-sahpool')>=0){
log("Installing opfs-sahpool...");
&& ndxSahPool>0){
log("Installing opfs-sahpool as",realSahName,"...");
await App.sqlite3.installOpfsSAHPoolVfs({
directory: '.speedtest1-sahpool',
name: realSahName,
initialCapacity: 3,
clearOnInit: true
clearOnInit: true,
verbosity: 2
}).then(PoolUtil=>{
log("opfs-sahpool successfully installed.");
log("opfs-sahpool successfully installed as",realSahName);
App.sqlite3.$SAHPoolUtil = PoolUtil;
//console.log("sqlite3.oo1.OpfsSAHPoolDb =", App.sqlite3.oo1.OpfsSAHPoolDb);
});
}
App.wasm.xCall('wasm_main', argv.length,