@@ -64,14 +64,11 @@ const installAsyncProxy = function (self) {
6464 toss ( 'This API requires navigator.storage.getDirectory.' ) ;
6565 }
6666
67- /**
68- * Will hold state copied to this object from the syncronous side of
69- * this API.
70- */
67+ /** Will hold state copied to this object from the syncronous side of this API. */
7168 const state = Object . create ( null ) ;
7269
7370 /**
74- * verbose :
71+ * Verbose :
7572 *
7673 * 0 = no logging output
7774 * 1 = only errors
@@ -135,20 +132,20 @@ const installAsyncProxy = function (self) {
135132 } ;
136133
137134 /**
138- * __openFiles is a map of sqlite3_file pointers (integers) to
139- * metadata related to a given OPFS file handles. The pointers are, in
140- * this side of the interface, opaque file handle IDs provided by the
141- * synchronous part of this constellation. Each value is an object
142- * with a structure demonstrated in the xOpen() impl.
135+ * __openFiles is a map of sqlite3_file pointers (integers) to metadata
136+ * related to a given OPFS file handles. The pointers are, in this side of the
137+ * interface, opaque file handle IDs provided by the synchronous part of this
138+ * constellation. Each value is an object with a structure demonstrated in the
139+ * xOpen() impl.
143140 */
144141 const __openFiles = Object . create ( null ) ;
145142 /**
146143 * __implicitLocks is a Set of sqlite3_file pointers (integers) which were
147- * "auto-locked". i.e. those for which we obtained a sync access
148- * handle without an explicit xLock() call. Such locks will be
149- * released during db connection idle time, whereas a sync access
150- * handle obtained via xLock(), or subsequently xLock()'d after
151- * auto-acquisition, will not be released until xUnlock() is called.
144+ * "auto-locked". i.e. those for which we obtained a sync access handle
145+ * without an explicit xLock() call. Such locks will be released during db
146+ * connection idle time, whereas a sync access handle obtained via xLock(), or
147+ * subsequently xLock()'d after auto-acquisition, will not be released until
148+ * xUnlock() is called.
152149 *
153150 * Maintenance reminder: if we relinquish auto-locks at the end of the
154151 * operation which acquires them, we pay a massive performance
@@ -158,21 +155,21 @@ const installAsyncProxy = function (self) {
158155 const __implicitLocks = new Set ( ) ;
159156
160157 /**
161- * Expects an OPFS file path. It gets resolved, such that ".."
162- * components are properly expanded, and returned. If the 2nd arg is
163- * true, the result is returned as an array of path elements, else an
164- * absolute path string is returned.
158+ * Expects an OPFS file path. It gets resolved, such that ".." components are
159+ * properly expanded, and returned. If the 2nd arg is true, the result is
160+ * returned as an array of path elements, else an absolute path string is
161+ * returned.
165162 */
166163 const getResolvedPath = function ( filename , splitIt ) {
167164 const p = new URL ( filename , 'file://irrelevant' ) . pathname ;
168165 return splitIt ? p . split ( '/' ) . filter ( ( v ) => ! ! v ) : p ;
169166 } ;
170167
171168 /**
172- * Takes the absolute path to a filesystem element. Returns an array
173- * of [handleOfContainingDir, filename]. If the 2nd argument is truthy
174- * then each directory element leading to the file is created along
175- * the way. Throws if any creation or resolution fails.
169+ * Takes the absolute path to a filesystem element. Returns an array of
170+ * [handleOfContainingDir, filename]. If the 2nd argument is truthy then each
171+ * directory element leading to the file is created along the way. Throws if
172+ * any creation or resolution fails.
176173 */
177174 const getDirForFilename = async function f ( absFilename , createDirs = false ) {
178175 const path = getResolvedPath ( absFilename , true ) ;
@@ -187,14 +184,14 @@ const installAsyncProxy = function (self) {
187184 } ;
188185
189186 /**
190- * If the given file-holding object has a sync handle attached to it,
191- * that handle is remove and asynchronously closed. Though it may
192- * sound sensible to continue work as soon as the close() returns
193- * (noting that it's asynchronous), doing so can cause operations
194- * performed soon afterwards, e.g. a call to getSyncHandle() to fail
195- * because they may happen out of order from the close(). OPFS does
196- * not guaranty that the actual order of operations is retained in
197- * such cases. i.e. always "await" on the result of this function.
187+ * If the given file-holding object has a sync handle attached to it, that
188+ * handle is remove and asynchronously closed. Though it may sound sensible to
189+ * continue work as soon as the close() returns (noting that it's
190+ * asynchronous), doing so can cause operations performed soon afterwards,
191+ * e.g. a call to getSyncHandle() to fail because they may happen out of order
192+ * from the close(). OPFS does not guaranty that the actual order of
193+ * operations is retained in such cases. i.e. always "await" on the result of
194+ * this function.
198195 */
199196 const closeSyncHandle = async ( fh ) => {
200197 if ( fh . syncHandle ) {
@@ -239,9 +236,9 @@ const installAsyncProxy = function (self) {
239236 } ;
240237
241238 /**
242- * An experiment in improving concurrency by freeing up implicit locks
243- * sooner. This is known to impact performance dramatically but it has
244- * also shown to improve concurrency considerably.
239+ * An experiment in improving concurrency by freeing up implicit locks sooner.
240+ * This is known to impact performance dramatically but it has also shown to
241+ * improve concurrency considerably.
245242 *
246243 * If fh.releaseImplicitLocks is truthy and fh is in __implicitLocks,
247244 * this routine returns closeSyncHandleNoThrow(), else it is a no-op.
@@ -253,11 +250,11 @@ const installAsyncProxy = function (self) {
253250 } ;
254251
255252 /**
256- * An error class specifically for use with getSyncHandle(), the goal
257- * of which is to eventually be able to distinguish unambiguously
258- * between locking-related failures and other types, noting that we
259- * cannot currently do so because createSyncAccessHandle() does not
260- * define its exceptions in the required level of detail.
253+ * An error class specifically for use with getSyncHandle(), the goal of which
254+ * is to eventually be able to distinguish unambiguously between
255+ * locking-related failures and other types, noting that we cannot currently
256+ * do so because createSyncAccessHandle() does not define its exceptions in
257+ * the required level of detail.
261258 *
262259 * 2022-11-29: according to:
263260 *
@@ -297,9 +294,9 @@ const installAsyncProxy = function (self) {
297294 }
298295 } ;
299296 /**
300- * Returns the sync access handle associated with the given file
301- * handle object (which must be a valid handle object, as created by
302- * xOpen()), lazily opening it if needed.
297+ * Returns the sync access handle associated with the given file handle object
298+ * (which must be a valid handle object, as created by xOpen()), lazily
299+ * opening it if needed.
303300 *
304301 * In order to help alleviate cross-tab contention for a dabase, if
305302 * an exception is thrown while acquiring the handle, this routine
@@ -368,7 +365,7 @@ const installAsyncProxy = function (self) {
368365
369366 /**
370367 * Stores the given value at state.sabOPView[state.opIds.rc] and then
371- * Atomics.notify()'s it.
368+ * Atomics.notify()'s it.
372369 */
373370 const storeAndNotify = ( opName , value ) => {
374371 log ( opName + '() => notify(' , value , ')' ) ;
@@ -382,11 +379,11 @@ const installAsyncProxy = function (self) {
382379 } ;
383380
384381 /**
385- * We track 2 different timers: the "metrics" timer records how much
386- * time we spend performing work. The "wait" timer records how much
387- * time we spend waiting on the underlying OPFS timer. See the calls
388- * to mTimeStart(), mTimeEnd(), wTimeStart(), and wTimeEnd()
389- * throughout this file to see how they're used.
382+ * We track 2 different timers: the "metrics" timer records how much time we
383+ * spend performing work. The "wait" timer records how much time we spend
384+ * waiting on the underlying OPFS timer. See the calls to mTimeStart(),
385+ * mTimeEnd(), wTimeStart(), and wTimeEnd() throughout this file to see how
386+ * they're used.
390387 */
391388 const __mTimer = Object . create ( null ) ;
392389 __mTimer . op = undefined ;
@@ -411,17 +408,17 @@ const installAsyncProxy = function (self) {
411408 ( metrics [ __wTimer . op ] . wait += performance . now ( ) - __wTimer . start ) ;
412409
413410 /**
414- * Gets set to true by the 'opfs-async-shutdown' command to quit the
415- * wait loop. This is only intended for debugging purposes: we cannot
416- * inspect this file's state while the tight waitLoop() is running and
417- * need a way to stop that loop for introspection purposes.
411+ * Gets set to true by the 'opfs-async-shutdown' command to quit the wait
412+ * loop. This is only intended for debugging purposes: we cannot inspect this
413+ * file's state while the tight waitLoop() is running and need a way to stop
414+ * that loop for introspection purposes.
418415 */
419416 let flagAsyncShutdown = false ;
420417
421418 /**
422- * Asynchronous wrappers for sqlite3_vfs and sqlite3_io_methods
423- * methods, as well as helpers like mkdir(). Maintenance reminder:
424- * members are in alphabetical order to simplify finding them.
419+ * Asynchronous wrappers for sqlite3_vfs and sqlite3_io_methods methods, as
420+ * well as helpers like mkdir(). Maintenance reminder: members are in
421+ * alphabetical order to simplify finding them.
425422 */
426423 const vfsAsyncImpls = {
427424 'opfs-async-metrics' : async ( ) => {
@@ -760,8 +757,8 @@ const installAsyncProxy = function (self) {
760757
761758 const initS11n = ( ) => {
762759 /**
763- * ACHTUNG: this code is 100% duplicated in the other half of this
764- * proxy! The documentation is maintained in the "synchronous half".
760+ * ACHTUNG: this code is 100% duplicated in the other half of this proxy!
761+ * The documentation is maintained in the "synchronous half".
765762 */
766763 if ( state . s11n ) return state . s11n ;
767764 const textDecoder = new TextDecoder ( ) ,
0 commit comments