]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Minor cleanups in the opfs-sahpool pause/unpause API demo. opfs-sahpool-pause
authorstephan <stephan@noemail.net>
Fri, 31 Jan 2025 17:47:47 +0000 (17:47 +0000)
committerstephan <stephan@noemail.net>
Fri, 31 Jan 2025 17:47:47 +0000 (17:47 +0000)
FossilOrigin-Name: e205cdc468e02eefdeb8d391d921aa2d4d28a8b7b87036d6d937a9928261a413

ext/wasm/api/sqlite3-worker1-promiser.c-pp.js
ext/wasm/tests/opfs/sahpool/sahpool-pausing.js
manifest
manifest.uuid

index 55e497ead55c3592e340abf412c679512808cb35..c043fd14867a007f8982f6fb7b0bd98119fe578b 100644 (file)
@@ -335,8 +335,8 @@ sqlite3Worker1Promiser.v2 = function(config){
 /**
   When built as a module, we export sqlite3Worker1Promiser.v2()
   instead of sqlite3Worker1Promise() because (A) its interface is more
-  conventional for ESM usage and (B) the ESM option export option for
-  this API did not exist until v2 was created, so there's no backwards
+  conventional for ESM usage and (B) the ESM export option for this
+  API did not exist until v2 was created, so there's no backwards
   incompatibility.
 */
 export default sqlite3Worker1Promiser.v2;
index 6a4cfbc9f2d423353f67b25566b7f4a94023653b..1aa98d3cb3b91d75527d807e1ecf2727402b1945 100644 (file)
 
   These tests are specific to the opfs-sahpool VFS and are limited to
   demonstrating its pause/unpause capabilities.
+
+  Most of this file is infrastructure for displaying results to the
+  user. Search for runTests() to find where the work actually starts.
 */
 'use strict';
-(function(self){
+(function(){
   let logClass;
 
   const mapToString = (v)=>{
@@ -35,7 +38,6 @@
     return JSON.stringify(v,undefined,2);
   };
   const normalizeArgs = (args)=>args.map(mapToString);
-  console.log("Running in the UI thread.");
   const logTarget = document.querySelector('#test-output');
   logClass = function(cssClass,...args){
     const ln = document.createElement('div');
@@ -78,8 +80,6 @@
     throw new Error(args.join(' '));
   };
 
-  const nextHandlerQueue = [];
-
   const endOfWork = (passed=true)=>{
     const eH = document.querySelector('#color-target');
     const eT = document.querySelector('title');
@@ -95,6 +95,8 @@
     }
   };
 
+  const nextHandlerQueue = [];
+
   const nextHandler = function(workerId,...msg){
     log(workerId,...msg);
     (nextHandlerQueue.shift())();
     W.postMessage({type:msgType});
   };
 
-  const runTriangleOfDeath = function(W1, W2){
+  /**
+     Run a series of operations on an sahpool db spanning two workers.
+     This would arguably be more legible with Promises, but creating a
+     Promise-based communication channel for this purpose is left as
+     an exercise for the reader. An example of such a proxy can be
+     found in the SQLite source tree:
+
+     https://sqlite.org/src/file/ext/wasm/api/sqlite3-worker1-promiser.c-pp.js
+  */
+  const runPyramidOfDoom = function(W1, W2){
     postThen(W1, 'vfs-acquire', function(){
       postThen(W1, 'db-init', function(){
         postThen(W1, 'db-query', function(){
   };
 
   const runTests = function(){
-    log("Running sahpool pausing tests...");
+    log("Running opfs-sahpool pausing tests...");
     const wjs = 'sahpool-worker.js?sqlite3.dir=../../../jswasm';
     const W1 = new Worker(wjs+'&workerId=w1'),
           W2 = new Worker(wjs+'&workerId=w2');
         case 'initialized':
           log(data.workerId, ': Worker initialized',...data.payload);
           if( 2===++initCount ){
-            runTriangleOfDeath(W1, W2);
+            runPyramidOfDoom(W1, W2);
           }
           break;
       }
   };
 
   runTests();
-})(globalThis);
+})();
index 8ee72d5491b85128574094a4c663c1fc4a74d938..eef00b8912daafd4cec8ba43f35b5d081be8d1ff 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\sconventional\slicense\sheader\sto\ssahpool-worker.js\sand\scorrect\sthe\sdate\son\sthe\sheader\sin\ssahpool-pausing.js.
-D 2025-01-31T16:34:52.960
+C Minor\scleanups\sin\sthe\sopfs-sahpool\spause/unpause\sAPI\sdemo.
+D 2025-01-31T17:47:47.173
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@@ -649,7 +649,7 @@ F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 4878cf2a19577093ea82b505f0b05214
 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 9b86ca2d8276cf919fbc9ba2a10e9786033b64f92c2db844d951804dee6c4b4e
 F ext/wasm/api/sqlite3-vtab-helper.c-pp.js e809739d71e8b35dfe1b55d24d91f02d04239e6aef7ca1ea92a15a29e704f616
 F ext/wasm/api/sqlite3-wasm.c 83f5e9f998e9fa4261eb84e9f092210e3ffe03895119f5ded0429eb34ab9d2be
-F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 46f303ba8ddd1b2f0a391798837beddfa72e8c897038c8047eda49ce7d5ed46b
+F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc65debfe43b81fc39fb25c40ad0cc1946bd82580fbf644351107b544d6177ee
 F ext/wasm/api/sqlite3-worker1.c-pp.js 5e8706c2c4af2a57fbcdc02f4e7ef79869971bc21bb8ede777687786ce1c92d5
 F ext/wasm/batch-runner-sahpool.html e9a38fdeb36a13eac7b50241dfe7ae066fe3f51f5c0b0151e7baee5fce0d07a7
 F ext/wasm/batch-runner-sahpool.js 54a3ac228e6c4703fe72fb65c897e19156263a51fe9b7e21d2834a45e876aabd
@@ -701,7 +701,7 @@ F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471
 F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
 F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
 F ext/wasm/tests/opfs/sahpool/index.html be736567fd92d3ecb9754c145755037cbbd2bca01385e2732294b53f4c842328
-F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js 780952b64dcde74ced1bb74813c0f995b689130f93d0a589995c78a783ec88ac
+F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36e0f6991460fff0cb7c15079454679a4e2
 F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61
 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702
 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
@@ -2212,8 +2212,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 09570c55a23e5af76dd2153a5b28a493f498d7d4a08b0089f3074d0a2c5d3d29
-R bfbe4fbf82db0e350871f46cfbfa28ef
+P f7c3026b0d2e33cc4e3b906810d860b155b1ff714bbe4e1eb9ee392122217efa
+R d3225c8561b09d79116dc329da2feefd
 U stephan
-Z d959934b83791a6e7fb628c4c0368bb3
+Z 1cb85d7c9b9ce473d92184ec221c275c
 # Remove this line to create a well-formed Fossil manifest.
index 071eb4c7ef95b9fbd2f4b83e1e191046b6750740..abe785492ffa46832ac43460d30ab58e4e408c77 100644 (file)
@@ -1 +1 @@
-f7c3026b0d2e33cc4e3b906810d860b155b1ff714bbe4e1eb9ee392122217efa
+e205cdc468e02eefdeb8d391d921aa2d4d28a8b7b87036d6d937a9928261a413