Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch opfs-sahpool-pause Excluding Merge-Ins
This is equivalent to a diff from 56b618da90 to e205cdc468
2025-02-20
| ||
04:14 | Add the pause/unpause capability to the opfs-sahpool VFS, as discussed in forum thread fe8cdb8431c. Summary: this gives clients a way to eke some degree of multi-page/tab/Worker concurrency out of this VFS but requires that coordination to be implemented client-side, e.g. via a SharedWorker or WebLocks. (check-in: b5dbd52195 user: stephan tags: trunk) | |
2025-01-31
| ||
17:47 | Minor cleanups in the opfs-sahpool pause/unpause API demo. (Closed-Leaf check-in: e205cdc468 user: stephan tags: opfs-sahpool-pause) | |
16:34 | Add the conventional license header to sahpool-worker.js and correct the date on the header in sahpool-pausing.js. (check-in: f7c3026b0d user: stephan tags: opfs-sahpool-pause) | |
13:32 | Three new options to sqlite3_db_config(): ATTACH_CREATE, ATTACH_WRITE, and COMMENTS. (check-in: 325e547a21 user: drh tags: trunk) | |
12:39 | Merge trunk into opfs-sahpool-pause branch. (check-in: 775a547eca user: stephan tags: opfs-sahpool-pause) | |
12:30 | Minor wasm-specific doc touchups. (check-in: 56b618da90 user: stephan tags: trunk) | |
11:45 | Correct a typo in tool/emcc.sh.in which could cause all of the configure-time work to locate the emcc binary to go unused. Reported in forum post feb325cdde5b6f37. (check-in: f66efd5b53 user: stephan tags: trunk) | |
Changes to ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js.
︙ | |||
497 498 499 500 501 502 503 | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | - + - - - - - - - - - - - - | /* Current number of in-use files from pool. */ getFileCount(){return this.#mapFilenameToSAH.size} /* Returns an array of the names of all currently-opened client-specified filenames. */ getFileNames(){ const rc = []; |
︙ | |||
553 554 555 556 557 558 559 | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | - - + + + - - - - - + + + + + + + + + - + | this.#availableSAH.delete(ah); ++nRm; } return nRm; } /** |
︙ | |||
828 829 830 831 832 833 834 | 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 | - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | return this.#mapFilenameToSAH.get(path); } /** Removes this object's sqlite3_vfs registration and shuts down this object, releasing all handles, mappings, and whatnot, including deleting its data directory. There is currently no |
︙ | |||
979 980 981 982 983 984 985 986 987 988 989 990 991 992 | 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | + + + + | importDb(name, bytes){ return this.#p.importDb(name,bytes) } async wipeFiles(){ return this.#p.reset(true) } unlink(filename){ return this.#p.deletePath(filename) } async removeVfs(){ return this.#p.removeVfs() } pauseVfs(){ this.#p.pauseVfs(); return this; } async unpauseVfs(){ return this.#p.unpauseVfs().then(()=>this); } isPaused(){ return this.#p.isPaused() } }/* class OpfsSAHPoolUtil */; /** Returns a resolved Promise if the current environment has a "fully-sync" SAH impl, else a rejected Promise. */ |
︙ | |||
1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 | 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | The SQLite VFS name under which this pool's VFS is registered. - [async] void wipeFiles() Clears all client-defined state of all SAHs and makes all of them available for re-use by the pool. Results are undefined if any such handles are currently in use, e.g. by an sqlite3 db. APIs specific to the "pause" capability (added in version 3.49): Summary: "pausing" the VFS disassociates it from SQLite and relinquishes its SAHs so that they may be opened by another instance of this VFS (running in a separate tab/page or Worker). "Unpausing" it takes back control, if able. - pauseVfs() "Pauses" this VFS by unregistering it from SQLite and relinquishing all open SAHs, leaving the associated files intact. This enables pages/tabs to coordinate semi-concurrent usage of this VFS. If this object is already paused, this is a no-op. Returns this object. Throws if SQLite has any opened file handles hosted by this VFS. If this function throws due to open file handles then it has no side effects. If the OPFS API throws while closing handles then the VFS is left in an undefined state. - isPaused() Returns true if this VFS is paused, else false. - [async] unpauseVfs() Restores the VFS to an active state after having called pauseVfs() on it. This is a no-op if the VFS is not paused. The returned Promise resolves to this object on success. A rejected Promise means there was a problem reacquiring the SAH handles (possibly because they're in use by another instance or have since been removed). Generically speaking, there is recovery strategy for that type of error, but if the problem is simply that the OPFS files are locked, then a later attempt to unpause it, made after the concurrent instance releases the SAHs, may recover from the situation. */ sqlite3.installOpfsSAHPoolVfs = async function(options=Object.create(null)){ options = Object.assign(Object.create(null), optionDefaults, (options||{})); const vfsName = options.name; if(options.$testThrowPhase1){ throw options.$testThrowPhase1; } |
︙ |
Changes to ext/wasm/api/sqlite3-worker1-promiser.c-pp.js.
︙ | |||
331 332 333 334 335 336 337 | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | - - + + | original: sqlite3Worker1Promiser }); //#if target=es6-module /** When built as a module, we export sqlite3Worker1Promiser.v2() instead of sqlite3Worker1Promise() because (A) its interface is more |
Changes to ext/wasm/index.html.
︙ | |||
114 115 116 117 118 119 120 121 122 123 124 125 126 127 | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | + + + + | sqlite3_vfs OPFS proxy using SharedArrayBuffer and the Atomics APIs to regulate communication between the synchronous sqlite3_vfs interface and the async OPFS impl. </li> <li><a href='tests/opfs/concurrency/index.html'>OPFS concurrency</a> tests using multiple workers. </li> <li><a href='tests/opfs/sahpool/index.html'>OPFS SAHPool cooperative semi-concurrency</a> demonstrates usage of the OPFS SAHPool VFS's "pause" feature to coordinate access to a database. </li> </ul> </li> <li><strong>WASMFS</strong>-specific tests which require that the WASMFS build is available on this server (it is not by default) and that this server emits the COOP/COEP headers. <ul> |
︙ |
Changes to ext/wasm/tester1.c-pp.js.
︙ | |||
3150 3151 3152 3153 3154 3155 3156 | 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 | - + + + + + + + + + + + + + + + + + + | .assert( 'wal'===db.selectValue('pragma journal_mode') || wasm.compileOptionUsed('OMIT_WAL') ); db.close(); T.assert(1 === u1.getFileCount()); db = new u2.OpfsSAHPoolDb(dbName); |
︙ |
Added ext/wasm/tests/opfs/sahpool/index.html.
|
Added ext/wasm/tests/opfs/sahpool/sahpool-pausing.js.