opfs_worker library

The dedicated worker of the OPFS storage, as a library.

dart run cloud_firestore_dart_sqlite:setup_web compiles an entry point that calls runOpfsWorker to JavaScript; you only need this library to build the worker another way:

import 'package:cloud_firestore_dart_sqlite/opfs_worker.dart';

void main() => runOpfsWorker();

Compile it with dart compile js -O2, also when the page itself is compiled with dart2wasm.

Functions

isTransientError({required int resultCode, required String sql, required bool isQuery, required bool wasInTransaction, required bool isInTransaction, bool? fileChanged}) → bool
Whether a statement that failed with resultCode may be run again: the error may go away on its own and nothing of the statement can have been stored. See the header of this file. fileChanged is whether the file change counter of the database differs from before the statement, for a statement that may commit (null when it was not checked).
runOpfsWorker({VirtualFileSystem wrapFileSystem(VirtualFileSystem opfs)?}) → void
Serves the messages of the page. wrapFileSystem wraps the OPFS file system before SQLite uses it (the tests inject I/O errors with it).