aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-opfs-async-proxy.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-12-08 04:19:38 +0000
committerstephan <stephan@noemail.net>2022-12-08 04:19:38 +0000
commitab8b22a03d033adaa61f82e5c080de64c8200549 (patch)
treea2b2665e41f228740fd37bc63e6b37d60e381b39 /ext/wasm/api/sqlite3-opfs-async-proxy.js
parent1eb1b59b893efb2fd4244d0116beb3c7db250d48 (diff)
downloadsqlite-ab8b22a03d033adaa61f82e5c080de64c8200549.tar.gz
sqlite-ab8b22a03d033adaa61f82e5c080de64c8200549.zip
Remove some dead JS code and tweak some docs.
FossilOrigin-Name: 0ee495452c014680697aa9035c245024df127a52d1820ab0e02580a015d96ecb
Diffstat (limited to 'ext/wasm/api/sqlite3-opfs-async-proxy.js')
-rw-r--r--ext/wasm/api/sqlite3-opfs-async-proxy.js27
1 files changed, 6 insertions, 21 deletions
diff --git a/ext/wasm/api/sqlite3-opfs-async-proxy.js b/ext/wasm/api/sqlite3-opfs-async-proxy.js
index 339ec126d..1456ae08d 100644
--- a/ext/wasm/api/sqlite3-opfs-async-proxy.js
+++ b/ext/wasm/api/sqlite3-opfs-async-proxy.js
@@ -13,7 +13,7 @@
A Worker which manages asynchronous OPFS handles on behalf of a
synchronous API which controls it via a combination of Worker
messages, SharedArrayBuffer, and Atomics. It is the asynchronous
- counterpart of the API defined in sqlite3-api-opfs.js.
+ counterpart of the API defined in sqlite3-vfs-opfs.js.
Highly indebted to:
@@ -343,16 +343,6 @@ const installAsyncProxy = function(self){
const affirmNotRO = function(opName,fh){
if(fh.readOnly) toss(opName+"(): File is read-only: "+fh.filenameAbs);
};
- const affirmLocked = function(opName,fh){
- //if(!fh.syncHandle) toss(opName+"(): File does not have a lock: "+fh.filenameAbs);
- /**
- Currently a no-op, as speedtest1 triggers xRead() without a
- lock (that seems like a bug but it's currently uninvestigated).
- This means, however, that some OPFS VFS routines may trigger
- acquisition of a lock but never let it go until xUnlock() is
- called (which it likely won't be if xLock() was not called).
- */
- };
/**
We track 2 different timers: the "metrics" timer records how much
@@ -393,7 +383,6 @@ const installAsyncProxy = function(self){
*/
let flagAsyncShutdown = false;
-
/**
Asynchronous wrappers for sqlite3_vfs and sqlite3_io_methods
methods, as well as helpers like mkdir(). Maintenance reminder:
@@ -427,11 +416,11 @@ const installAsyncProxy = function(self){
},
xAccess: async (filename)=>{
mTimeStart('xAccess');
- /* OPFS cannot support the full range of xAccess() queries sqlite3
- calls for. We can essentially just tell if the file is
- accessible, but if it is it's automatically writable (unless
- it's locked, which we cannot(?) know without trying to open
- it). OPFS does not have the notion of read-only.
+ /* OPFS cannot support the full range of xAccess() queries
+ sqlite3 calls for. We can essentially just tell if the file
+ is accessible, but if it is then it's automatically writable
+ (unless it's locked, which we cannot(?) know without trying
+ to open it). OPFS does not have the notion of read-only.
The return semantics of this function differ from sqlite3's
xAccess semantics because we are limited in what we can
@@ -519,7 +508,6 @@ const installAsyncProxy = function(self){
let rc = 0;
wTimeStart('xFileSize');
try{
- affirmLocked('xFileSize',fh);
const sz = await (await getSyncHandle(fh,'xFileSize')).getSize();
state.s11n.serialize(Number(sz));
}catch(e){
@@ -615,7 +603,6 @@ const installAsyncProxy = function(self){
let rc = 0, nRead;
const fh = __openFiles[fid];
try{
- affirmLocked('xRead',fh);
wTimeStart('xRead');
nRead = (await getSyncHandle(fh,'xRead')).read(
fh.sabView.subarray(0, n),
@@ -659,7 +646,6 @@ const installAsyncProxy = function(self){
const fh = __openFiles[fid];
wTimeStart('xTruncate');
try{
- affirmLocked('xTruncate',fh);
affirmNotRO('xTruncate', fh);
await (await getSyncHandle(fh,'xTruncate')).truncate(size);
}catch(e){
@@ -696,7 +682,6 @@ const installAsyncProxy = function(self){
const fh = __openFiles[fid];
wTimeStart('xWrite');
try{
- affirmLocked('xWrite',fh);
affirmNotRO('xWrite', fh);
rc = (
n === (await getSyncHandle(fh,'xWrite'))