@viberaven/sessions 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +5 -1
- package/README.md +16 -0
- package/THIRD_PARTY_NOTICES +1 -1
- package/package.json +4 -2
- package/runtime-infn/engine/frozen/runtime/engine-host.mjs +390 -0
- package/runtime-infn/engine/frozen/runtime/engine-logs/static-layout.json +21357 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/amcheck.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/auth_delay.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/auto_explain.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/basebackup_to_shell.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/basic_archive.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/bloom.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/btree_gin.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/btree_gist.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-5L4W4HOZ.js +3 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-C56CJGL3.js +6 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-CMNLZGEJ.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-DAMXLPQW.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-EZSFBMVG.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-GS6VKQIC.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-OCWZREWN.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-UQDQKWPM.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-YFZE77YQ.js +9 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/citext.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/amcheck.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/auto_explain.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/bloom.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/btree_gin.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/btree_gist.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/citext.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/cube.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/dict_int.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/dict_xsyn.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/earthdistance.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/file_fdw.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/fuzzystrmatch.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/hstore.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/intarray.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/isn.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/lo.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/ltree.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/moddatetime.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pageinspect.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_buffercache.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_freespacemap.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_stat_statements.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_surgery.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_trgm.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_visibility.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_walinspect.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pgcrypto.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/seg.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/tablefunc.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/tcn.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/tsm_system_rows.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/tsm_system_time.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/unaccent.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/uuid_ossp.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/cube.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/dblink.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/dict_int.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/dict_xsyn.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/earthdistance.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/file_fdw.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/fs/base.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/fs/memfs-frontend.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/fs/memfs2opfs.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/fs/nodefs.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/fs/opfs-ahp.js +4 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/fuzzystrmatch.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/hstore.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/index.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/initdb.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/initdb.wasm +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/intagg.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/intarray.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/isn.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/live/index.js +134 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/lo.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/ltree.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/node-postgres/index.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/oid2name.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pageinspect.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/passwordcheck.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pg_buffercache.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pg_freespacemap.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pg_logicalinspect.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pg_overexplain.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pg_prewarm.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pg_stat_statements.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pg_surgery.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pg_trgm.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pg_visibility.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pg_walinspect.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pgcrypto.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pglite.data +37614 -8
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pglite.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pglite.wasm +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pgrowlocks.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/pgstattuple.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/postgres_fdw.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/seg.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/spi.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/tablefunc.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/tcn.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/templating.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/test_decoding.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/tsm_system_rows.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/tsm_system_time.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/unaccent.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/uuid-ossp.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/vacuumlo.tar.gz +0 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/worker/index.js +2 -0
- package/runtime-infn/engine/frozen/runtime/pglite/packages/pglite/dist/xml2.tar.gz +0 -0
- package/runtime-infn/race/pin.mjs +12 -0
- package/runtime-infn/runtime-manifest.json +580 -0
- package/runtime-infn/wait/initial-image.tgz +0 -0
- package/runtime-infn/wait/wire.mjs +39 -0
- package/runtime-infnprod/engine/frozen/runtime/engine-host.mjs +391 -0
- package/runtime-infnprod/engine/frozen/runtime/engine-logs/static-layout.json +21357 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/amcheck.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/auth_delay.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/auto_explain.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/basebackup_to_shell.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/basic_archive.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/bloom.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/btree_gin.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/btree_gist.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-5L4W4HOZ.js +3 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-C56CJGL3.js +6 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-CMNLZGEJ.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-DAMXLPQW.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-EZSFBMVG.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-GS6VKQIC.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-OCWZREWN.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-UQDQKWPM.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/chunk-YFZE77YQ.js +9 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/citext.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/amcheck.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/auto_explain.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/bloom.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/btree_gin.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/btree_gist.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/citext.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/cube.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/dict_int.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/dict_xsyn.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/earthdistance.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/file_fdw.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/fuzzystrmatch.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/hstore.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/intarray.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/isn.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/lo.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/ltree.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/moddatetime.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pageinspect.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_buffercache.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_freespacemap.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_stat_statements.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_surgery.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_trgm.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_visibility.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pg_walinspect.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/pgcrypto.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/seg.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/tablefunc.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/tcn.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/tsm_system_rows.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/tsm_system_time.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/unaccent.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/contrib/uuid_ossp.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/cube.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/dblink.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/dict_int.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/dict_xsyn.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/earthdistance.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/file_fdw.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/fs/base.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/fs/memfs-frontend.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/fs/memfs2opfs.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/fs/nodefs.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/fs/opfs-ahp.js +4 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/fuzzystrmatch.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/hstore.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/index.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/initdb.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/initdb.wasm +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/intagg.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/intarray.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/isn.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/live/index.js +134 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/lo.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/ltree.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/node-postgres/index.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/oid2name.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pageinspect.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/passwordcheck.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pg_buffercache.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pg_freespacemap.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pg_logicalinspect.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pg_overexplain.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pg_prewarm.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pg_stat_statements.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pg_surgery.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pg_trgm.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pg_visibility.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pg_walinspect.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pgcrypto.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pglite.data +37614 -8
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pglite.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pglite.wasm +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pgrowlocks.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/pgstattuple.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/postgres_fdw.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/seg.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/spi.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/tablefunc.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/tcn.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/templating.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/test_decoding.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/tsm_system_rows.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/tsm_system_time.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/unaccent.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/uuid-ossp.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/vacuumlo.tar.gz +0 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/worker/index.js +2 -0
- package/runtime-infnprod/engine/frozen/runtime/pglite/packages/pglite/dist/xml2.tar.gz +0 -0
- package/runtime-infnprod/race/pin.mjs +12 -0
- package/runtime-infnprod/runtime-manifest.json +581 -0
- package/runtime-infnprod/wait/initial-image.tgz +0 -0
- package/runtime-infnprod/wait/wire.mjs +39 -0
- package/src/index.d.ts +6 -1
- package/src/index.mjs +9 -8
- package/src/runtime-integrity.mjs +24 -1
package/NOTICE
CHANGED
|
@@ -12,7 +12,11 @@ database implementation. See LICENSE and licenses/PostgreSQL.txt.
|
|
|
12
12
|
The shipped engine is a modified PGlite/PostgreSQL build. Modifications implement
|
|
13
13
|
independent backend contexts, shared-kernel integration, scheduling, lifecycle,
|
|
14
14
|
signal handling and JSPI suspension at the operating-system boundary. The
|
|
15
|
-
|
|
15
|
+
INFN and INFNPROD builds also expose opt-in suspension at in-function SQL
|
|
16
|
+
boundaries. Their prebuilt assets are retained in runtime-infn/ and
|
|
17
|
+
runtime-infnprod/.
|
|
18
|
+
|
|
19
|
+
The modified generated runtime assets are pglite.wasm, pglite.js and the corresponding
|
|
16
20
|
PGlite runtime chunks; runtime/engine/frozen/runtime/engine-host.mjs and the wire/pin helpers provide
|
|
17
21
|
VibeRaven's host. No engine compilation or source modification is performed by
|
|
18
22
|
this package's build or swap scripts. Copies in runtime/ retain the exact approved
|
package/README.md
CHANGED
|
@@ -114,6 +114,22 @@ The minimal package slot is a subset of the original qualified runtime inputs:
|
|
|
114
114
|
- PostgreSQL 18.6; 113 unchanged runtime files. The omitted inputs include private
|
|
115
115
|
validation adapters, source patches, sourcemaps and unused CJS artifacts.
|
|
116
116
|
|
|
117
|
+
Node callers can pass `runtime: 'l4' | 'infn' | 'infnprod'` to `createHost` and
|
|
118
|
+
select the same runtime in `loadExtensions(names, runtime)`. Node and browser
|
|
119
|
+
default to L4. Check a Node runtime's manifest with `verifyRuntimeVersion(runtime)`.
|
|
120
|
+
The INFN builds park at in-function boundaries only when the host's
|
|
121
|
+
`spiBoundaries(pid, site)` callback returns `true`. The caller advances a parked
|
|
122
|
+
backend with `host.resumeSPI(pid)`.
|
|
123
|
+
|
|
124
|
+
| Runtime | SHA-256 |
|
|
125
|
+
| --- | --- |
|
|
126
|
+
| `infn` | `d3ae894be3080a1c3fd50cf7ddd9f46774829aed000c8db89bc44eae9c9a1493` |
|
|
127
|
+
| `infnprod` | `62b3d9f13596860b86ef9ce3a3328993a1d32bcaa36c2b9aac02609b69559773` |
|
|
128
|
+
|
|
129
|
+
The two candidates are byte-for-byte portable build slots. Each ships its own
|
|
130
|
+
manifest and dependency closure. `npm run verify:runtime` checks all three slots
|
|
131
|
+
and runs before `npm pack`. CLI `race --deep` selects `infnprod`.
|
|
132
|
+
|
|
117
133
|
## Limitations
|
|
118
134
|
|
|
119
135
|
Tests cover supplied SQL, inputs and bounded statement issue orders. They do not
|
package/THIRD_PARTY_NOTICES
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viberaven/sessions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Several real PostgreSQL 18.6 sessions in one PGlite WebAssembly instance for concurrency tests and replay. Part of VibeRaven.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"tag": "next"
|
|
16
16
|
},
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
18
|
+
"node": ">=20"
|
|
19
19
|
},
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
"files": [
|
|
38
38
|
"src",
|
|
39
39
|
"runtime",
|
|
40
|
+
"runtime-infn",
|
|
41
|
+
"runtime-infnprod",
|
|
40
42
|
"dist/browser.mjs",
|
|
41
43
|
"LICENSE",
|
|
42
44
|
"NOTICE",
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import {PGlite} from './pglite/packages/pglite/dist/index.js';
|
|
4
|
+
import {simpleQuery,startup,parseWire} from '../../../wait/wire.mjs';
|
|
5
|
+
|
|
6
|
+
export class BackendStartExit extends Error {
|
|
7
|
+
constructor(status,bytes){super('backend exited during startup');this.status=status;this.bytes=bytes;}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function hasFatalResponse(bytes){
|
|
11
|
+
for(let o=0;o+5<=bytes.length;){
|
|
12
|
+
const n=bytes.readInt32BE(o+1),end=o+1+n;assert(n>=4&&end<=bytes.length,'invalid startup response');
|
|
13
|
+
if(bytes[o]===69){
|
|
14
|
+
const fields={};let p=o+5;
|
|
15
|
+
while(p<end&&bytes[p]){const key=String.fromCharCode(bytes[p++]),q=bytes.indexOf(0,p);assert(q>=p&&q<end);fields[key]=bytes.toString('utf8',p,q);p=q+1;}
|
|
16
|
+
if((fields.V??fields.S)==='FATAL')return true;
|
|
17
|
+
}
|
|
18
|
+
o=end;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// One Wasm instance. Only the OS boundary schedules work. Shared memory and
|
|
24
|
+
// PostgreSQL's own lock queues determine which parked continuations can run.
|
|
25
|
+
export class EngineHost {
|
|
26
|
+
static async create(options={}) {
|
|
27
|
+
assert.equal(typeof WebAssembly.Suspending,'function','JSPI host required');
|
|
28
|
+
const h=new EngineHost();
|
|
29
|
+
h.options=options;h.layout=JSON.parse(fs.readFileSync(new URL('./engine-logs/static-layout.json',import.meta.url)));
|
|
30
|
+
h.spans=h.layout.spans.map((s,i)=>({...s,key:'main:'+i}));h.initial=new Map();
|
|
31
|
+
h.backends=new Map();h.signals=new Map();h.parked=new Map();h.jobs=[];h.log=[];h.waits=[];
|
|
32
|
+
h.busy=false;h.scheduled=false;h.active=null;h.switches=0;h.nextSlot=2;h.freeSlots=[];h.timers=new Map();
|
|
33
|
+
h.parkingObservers=new Map();h.operations=new Map();h.failure=null;h.startups=1;h.syncMailbox=[];h.checkpointTickets=new Map();h.nextCheckpointTicket=1;
|
|
34
|
+
h.failureNotification=new Promise(resolve=>{h.reportFailure=resolve;});
|
|
35
|
+
h.descriptorOwners=new Map();h.asyncEntries=new Set();h.osActivations=new Set();h.synchronousDepth=0;h.quantumDeadline=0;
|
|
36
|
+
h.event=event=>{h.log.push(event);if(process.env.L2_EVENT_LOG)fs.appendFileSync(process.env.L2_EVENT_LOG,JSON.stringify(event)+'\n');};
|
|
37
|
+
const extension={name:'contexts',setup:async(pg,opts)=>({emscriptenOpts:{...opts,postRun:[...(opts.postRun??[]),m=>{
|
|
38
|
+
h.mod=m;
|
|
39
|
+
const files=m.FS,create=files.createStream,close=files.closeStream;
|
|
40
|
+
files.createStream=function(...args){const stream=create.apply(this,args);h.descriptorOwners.set(stream.fd,{pid:h.active??42,stream});return stream;};
|
|
41
|
+
files.closeStream=function(fd){h.descriptorOwners.delete(fd);return close.call(this,fd);};
|
|
42
|
+
for(const stream of files.streams)if(stream)h.descriptorOwners.set(stream.fd,{pid:42,stream});
|
|
43
|
+
m.sessionsOwnFd=(pid,fd)=>{
|
|
44
|
+
const stream=files.streams[fd];assert(stream,'missing transferred descriptor');h.descriptorOwners.set(fd,{pid,stream});
|
|
45
|
+
};
|
|
46
|
+
const original=m.callMain;
|
|
47
|
+
m.callMain=args=>{
|
|
48
|
+
if(!h.pristine){
|
|
49
|
+
h.event({event:'bootstrap-main',mode:args[0]??''});
|
|
50
|
+
if(args[0]==='--single'){
|
|
51
|
+
h.pristine=h.capture();for(const [k,v]of h.pristine)h.initial.set(k,v);
|
|
52
|
+
}
|
|
53
|
+
h.active=42;
|
|
54
|
+
if(!h.backends.has(42))h.backends.set(42,{pid:42,image:h.capture(),sp:m.stackSave(),slot:1});
|
|
55
|
+
assert(!h.operations.has(42),'overlapping bootstrap entry');
|
|
56
|
+
h.busy=true;const bootstrap={bootstrap:true};h.operations.set(42,bootstrap);
|
|
57
|
+
return Promise.resolve().then(()=>original(args)).finally(()=>{
|
|
58
|
+
h.save();h.operations.delete(42);h.busy=false;h.kick();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return original(args);
|
|
62
|
+
};
|
|
63
|
+
m.attachDsoLoaded=(name,start,size)=>{
|
|
64
|
+
if(!size||h.spans.some(s=>s.key==='dso:'+name))return;
|
|
65
|
+
const span={key:'dso:'+name,start,size};h.spans.push(span);h.initial.set(span.key,m.HEAPU8.slice(start,start+size));
|
|
66
|
+
};
|
|
67
|
+
for(const d of m.attachDsos??[])m.attachDsoLoaded(d.name,d.start,d.size);
|
|
68
|
+
m.attachSignal=(pid,sig)=>{
|
|
69
|
+
h.event({event:'signal-send',source:h.active,pid,sig});
|
|
70
|
+
const target=pid===0?h.active:Math.abs(pid);
|
|
71
|
+
if(!h.backends.has(target))return -1;
|
|
72
|
+
if(sig){if(target===h.active)h.deliver(sig);else h.signal(target,sig);}return 0;
|
|
73
|
+
};
|
|
74
|
+
m.sessionsWait=(latch,timeout)=>h.sleep(latch,timeout);
|
|
75
|
+
m.sessionsCanYield=()=>h.canYield();
|
|
76
|
+
m.sessionsYield=()=>h.sleep(0,0,true);
|
|
77
|
+
m.sessionsSPIEnabled=()=>!h.synchronousDepth&&h.asyncEntries.has(h.active)&&
|
|
78
|
+
!h.osActivations.has(h.active)&&h.options.spiBoundaries?.(h.active)===true;
|
|
79
|
+
m.sessionsSPIPark=()=>h.sleep(0,-1,true,'spi');
|
|
80
|
+
m.sessionsTimer=(which,sec,usec)=>h.timer(which,sec,usec);
|
|
81
|
+
m.sessionsSync=(tag,size,type)=>h.syncRequest(tag,size,type);
|
|
82
|
+
m.sessionsNextSync=(tag,size,type)=>h.nextSyncRequest(tag,size,type);
|
|
83
|
+
m.sessionsCheckpointStart=flags=>h.startCheckpoint(flags);
|
|
84
|
+
m.sessionsCheckpointWait=ticket=>h.waitCheckpoint(ticket);
|
|
85
|
+
m.sessionsCheckpointRelease=ticket=>h.releaseCheckpoint(ticket);
|
|
86
|
+
}]}})};
|
|
87
|
+
h.db=await PGlite.create({...options,children:undefined,
|
|
88
|
+
extensions:{...options.extensions,contexts:extension},
|
|
89
|
+
startParams:[...PGlite.defaultStartParams,'-c','shared_memory_type=sysv','-c','dynamic_shared_memory_type=sysv',...(options.extraStartParams??[])],
|
|
90
|
+
onStderr:text=>{h.log.push({event:'stderr',text});options.onStderr?.(text);},
|
|
91
|
+
onStdout:text=>{h.log.push({event:'stdout',text});options.onStdout?.(text);}});
|
|
92
|
+
assert(h.pristine&&h.mod,'initial private image unavailable');
|
|
93
|
+
h.active=42;h.backends.set(42,{pid:42,image:h.capture(),sp:h.mod.stackSave(),slot:1});
|
|
94
|
+
h.log.push({event:'backend-ready',pid:42});
|
|
95
|
+
for(const pid of options.children??[])await h.attach(pid);
|
|
96
|
+
return h;
|
|
97
|
+
}
|
|
98
|
+
capture(){return new Map(this.spans.map(s=>[s.key,this.mod.HEAPU8.slice(s.start,s.start+s.size)]));}
|
|
99
|
+
restore(image){for(const s of this.spans){const b=image.get(s.key)??this.initial.get(s.key);assert(b,'uninitialized DSO image');this.mod.HEAPU8.set(b,s.start);}}
|
|
100
|
+
save(){if(this.active!==null){const b=this.backends.get(this.active);assert(b);b.image=this.capture();b.sp=this.mod.stackSave();}}
|
|
101
|
+
select(pid){
|
|
102
|
+
assert(this.backends.has(pid),'unknown backend');
|
|
103
|
+
if(this.active!==pid){this.save();const b=this.backends.get(pid);this.restore(b.image);this.mod.stackRestore(b.sp);this.active=pid;this.switches++;}
|
|
104
|
+
const signals=this.signals.get(pid);this.signals.delete(pid);
|
|
105
|
+
if(signals)for(const sig of signals)this.deliver(sig);
|
|
106
|
+
}
|
|
107
|
+
deliver(sig){
|
|
108
|
+
this.event({event:'signal-deliver',pid:this.active,sig});this.synchronousDepth++;
|
|
109
|
+
try{if(sig===14)this.mod._pgl_sessions_alarm();else this.mod._pgl_sessions_deliver(sig);}
|
|
110
|
+
finally{this.synchronousDepth--;}
|
|
111
|
+
}
|
|
112
|
+
canYield(){
|
|
113
|
+
if(this.synchronousDepth||!this.asyncEntries.has(this.active))return false;
|
|
114
|
+
const now=Date.now();if(now<this.quantumDeadline)return false;
|
|
115
|
+
this.quantumDeadline=now+4;return true;
|
|
116
|
+
}
|
|
117
|
+
schedule(pid,work,interrupt=false){
|
|
118
|
+
if(this.failure)return Promise.reject(this.failure);
|
|
119
|
+
return new Promise((resolve,reject)=>{this.jobs.push({pid,work,resolve,reject,interrupt});this.kick();});
|
|
120
|
+
}
|
|
121
|
+
kick(){if(!this.scheduled){this.scheduled=true;queueMicrotask(()=>{this.scheduled=false;this.pump();});}}
|
|
122
|
+
pump(){
|
|
123
|
+
if(this.busy||this.failure)return;
|
|
124
|
+
for(const [pid,w]of this.parked){
|
|
125
|
+
if(!w.queued&&(w.kind==='spi'?w.released:w.kind==='service'?(w.notified||w.request.done):(w.timedOut||this.latchSet(w)))){w.queued=true;this.jobs.push({pid,wake:w});}
|
|
126
|
+
}
|
|
127
|
+
const index=this.jobs.findIndex(j=>j.wake||j.interrupt||!this.operations.has(j.pid));
|
|
128
|
+
if(index<0)return;
|
|
129
|
+
const [job]=this.jobs.splice(index,1);
|
|
130
|
+
if(!this.backends.has(job.pid)&&job.interrupt){job.resolve?.();this.kick();return;}
|
|
131
|
+
if(job.wake){
|
|
132
|
+
const w=job.wake;if(this.parked.get(job.pid)!==w){this.kick();return;}
|
|
133
|
+
this.busy=true;this.select(job.pid);this.mod.stackRestore(w.sp);this.parked.delete(job.pid);
|
|
134
|
+
clearTimeout(w.timeoutHandle);w.returned=true;
|
|
135
|
+
if(w.kind==='service'){
|
|
136
|
+
assert.equal(w.request.waiter,w);w.request.waiter=null;
|
|
137
|
+
this.event({event:'service-wake',pid:job.pid,ticket:w.request.ticket,done:w.request.done});
|
|
138
|
+
w.resolve(w.request.done?1:0);
|
|
139
|
+
}else if(w.kind==='spi'){
|
|
140
|
+
this.event({event:'spi-resume',pid:job.pid});
|
|
141
|
+
w.resolve();
|
|
142
|
+
}else{
|
|
143
|
+
w.returnedSet=this.latchSet(w);
|
|
144
|
+
this.event({event:'wake',pid:job.pid,latch:w.latch,latchSet:w.returnedSet,timedOut:!!w.timedOut});
|
|
145
|
+
w.resolve(w.returnedSet?1:0);
|
|
146
|
+
}
|
|
147
|
+
// Ownership remains with the resumed C activation until it sleeps again
|
|
148
|
+
// or its exported entry completes. Never resolve two C stacks together.
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this.busy=true;
|
|
152
|
+
if(!job.interrupt)this.operations.set(job.pid,job);
|
|
153
|
+
try{this.select(job.pid);}catch(e){job.reject(e);this.fail(e);return;}
|
|
154
|
+
Promise.resolve().then(job.work).then(job.resolve,job.reject).finally(()=>{
|
|
155
|
+
if(!job.interrupt)this.operations.delete(job.pid);
|
|
156
|
+
if(!this.options.oneSession||this.backends.size>1)this.save();
|
|
157
|
+
this.busy=false;this.kick();
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
fail(error){
|
|
161
|
+
if(this.failure)return;
|
|
162
|
+
this.failure=error;for(const j of this.jobs.splice(0))j.reject?.(error);
|
|
163
|
+
for(const timer of this.timers.values())clearTimeout(timer);this.timers.clear();
|
|
164
|
+
for(const parked of this.parked.values())clearTimeout(parked.timeoutHandle);
|
|
165
|
+
// A fatal host error is not a resume permission. Leave C continuations
|
|
166
|
+
// parked and notify the owning runner, which records the failed engine.
|
|
167
|
+
this.reportFailure(error);
|
|
168
|
+
}
|
|
169
|
+
latchSet(w){
|
|
170
|
+
if(!w.latch)return false;
|
|
171
|
+
if(this.active!==w.pid){
|
|
172
|
+
const span=this.spans.find(s=>w.latch>=s.start&&w.latch+4<=s.start+s.size);
|
|
173
|
+
if(span){
|
|
174
|
+
const b=this.backends.get(w.pid).image.get(span.key)??this.initial.get(span.key);
|
|
175
|
+
return new DataView(b.buffer,b.byteOffset+w.latch-span.start,4).getInt32(0,true)!==0;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return new DataView(this.mod.HEAPU8.buffer).getInt32(w.latch,true)!==0;
|
|
179
|
+
}
|
|
180
|
+
sleep(latch,timeout,cooperative=false,kind=cooperative?'yield':latch?'latch':'timer'){
|
|
181
|
+
const pid=this.active;assert(this.busy&&this.backends.has(pid));assert(!this.parked.has(pid));
|
|
182
|
+
if(latch&&new DataView(this.mod.HEAPU8.buffer).getInt32(latch,true)!==0)return Promise.resolve(1);
|
|
183
|
+
return new Promise(resolve=>{
|
|
184
|
+
const osService=this.osActivations.has(pid);
|
|
185
|
+
const w={pid,latch,timeout,cooperative,osService,kind,sp:this.mod.stackSave(),resolve,queued:false};
|
|
186
|
+
this.parked.set(pid,w);if(!cooperative&&!osService)this.waits.push(w);this.save();this.busy=false;
|
|
187
|
+
this.event({event:kind==='spi'?'spi-park':cooperative?'yield':'park',pid,latch,timeout});
|
|
188
|
+
if(timeout>=0)w.timeoutHandle=setTimeout(()=>{w.timedOut=true;this.kick();},timeout);
|
|
189
|
+
if(!cooperative&&!osService){
|
|
190
|
+
for(const notify of this.parkingObservers.get(pid)??[])notify(w);
|
|
191
|
+
this.parkingObservers.delete(pid);this.onWait?.(w);
|
|
192
|
+
}
|
|
193
|
+
this.kick();
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
resumeSPI(pid){
|
|
197
|
+
const waiter=this.parked.get(pid);
|
|
198
|
+
assert(waiter?.kind==='spi'&&!waiter.released,'no resumable SPI boundary');
|
|
199
|
+
waiter.released=true;this.kick();
|
|
200
|
+
}
|
|
201
|
+
waitUntilParked(pid){
|
|
202
|
+
if(this.parked.has(pid)&&!this.parked.get(pid).cooperative&&!this.parked.get(pid).osService)return Promise.resolve(this.parked.get(pid));
|
|
203
|
+
return Promise.race([new Promise(resolve=>{const a=this.parkingObservers.get(pid)??[];a.push(resolve);this.parkingObservers.set(pid,a);}),this.failureNotification.then(e=>{throw e;})]);
|
|
204
|
+
}
|
|
205
|
+
timer(which,sec,usec){
|
|
206
|
+
if(which!==0)return -1;
|
|
207
|
+
const pid=this.active;if(pid===null)return 0;
|
|
208
|
+
clearTimeout(this.timers.get(pid));this.timers.delete(pid);
|
|
209
|
+
const ms=sec*1000+usec/1000;
|
|
210
|
+
this.event({event:'timer-arm',pid,milliseconds:ms});
|
|
211
|
+
if(ms>0){
|
|
212
|
+
const handle=setTimeout(()=>{
|
|
213
|
+
this.timers.delete(pid);
|
|
214
|
+
this.event({event:'timer-fire',pid});
|
|
215
|
+
if(this.backends.has(pid))this.signal(pid,14);
|
|
216
|
+
},Math.max(1,ms));this.timers.set(pid,handle);
|
|
217
|
+
}
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
startCheckpoint(flags){
|
|
221
|
+
const owner=this.active,ticket=this.nextCheckpointTicket++;
|
|
222
|
+
assert(ticket>0&&ticket<0x7fffffff,'checkpoint ticket ceiling');
|
|
223
|
+
assert(owner!==42&&this.backends.has(owner),'checkpoint requester outside backend lifetime');
|
|
224
|
+
const request={ticket,owner,flags,done:false,waiter:null};this.checkpointTickets.set(ticket,request);
|
|
225
|
+
this.event({event:'checkpoint-request',pid:owner,ticket,flags});
|
|
226
|
+
this.schedule(42,()=>this.runCheckpoint(request)).then(()=>{
|
|
227
|
+
request.done=true;this.event({event:'checkpoint-complete',ticket});this.kick();
|
|
228
|
+
},cause=>this.fail(new Error('checkpoint coordinator failed',{cause})));
|
|
229
|
+
return ticket;
|
|
230
|
+
}
|
|
231
|
+
async runCheckpoint(request){
|
|
232
|
+
const m=this.mod,sp=m.stackSave();this.asyncEntries.add(42);this.osActivations.add(42);
|
|
233
|
+
try{assert.equal(await m._pgl_sessions_checkpoint_request(request.flags),1,'checkpoint coordinator did not complete');}
|
|
234
|
+
finally{this.osActivations.delete(42);this.asyncEntries.delete(42);m.stackRestore(sp);}
|
|
235
|
+
}
|
|
236
|
+
waitCheckpoint(ticket){
|
|
237
|
+
const request=this.checkpointTickets.get(ticket),pid=this.active;
|
|
238
|
+
assert(request&&request.owner===pid,'invalid checkpoint waiter');
|
|
239
|
+
assert(this.busy&&!this.parked.has(pid)&&!request.waiter,'overlapping checkpoint waiter');
|
|
240
|
+
if(request.done)return Promise.resolve(1);
|
|
241
|
+
return new Promise(resolve=>{
|
|
242
|
+
const w={kind:'service',pid,request,sp:this.mod.stackSave(),resolve,queued:false,notified:false};
|
|
243
|
+
request.waiter=w;this.parked.set(pid,w);this.save();this.busy=false;
|
|
244
|
+
this.event({event:'service-park',pid,ticket});this.kick();
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
releaseCheckpoint(ticket){
|
|
248
|
+
const request=this.checkpointTickets.get(ticket);
|
|
249
|
+
assert(request&&request.owner===this.active&&!request.waiter,'invalid checkpoint ticket release');
|
|
250
|
+
this.checkpointTickets.delete(ticket);this.event({event:'checkpoint-release',ticket,done:request.done});
|
|
251
|
+
// The scheduled kernel request owns its own reference and continues even
|
|
252
|
+
// when native CHECK_FOR_INTERRUPTS unwinds its abandoned caller.
|
|
253
|
+
}
|
|
254
|
+
nextSyncRequest(tag,size,type){
|
|
255
|
+
assert.equal(this.active,42,'sync mailbox consumed outside coordinator');
|
|
256
|
+
const request=this.syncMailbox[0];if(!request)return 0;
|
|
257
|
+
assert.equal(size,request.bytes.length,'FileTag ABI mismatch');
|
|
258
|
+
this.mod.HEAPU8.set(request.bytes,tag);new DataView(this.mod.HEAPU8.buffer).setInt32(type,request.type,true);
|
|
259
|
+
this.syncMailbox.shift();return 1;
|
|
260
|
+
}
|
|
261
|
+
syncRequest(tag,size,type){
|
|
262
|
+
const caller=this.active;
|
|
263
|
+
assert(this.backends.has(42)&&this.backends.has(caller)&&caller!==42,'sync service outside backend lifetime');
|
|
264
|
+
assert(Number.isInteger(size)&&size>0&&size<=256,'invalid FileTag size');
|
|
265
|
+
this.syncMailbox.push({bytes:this.mod.HEAPU8.slice(tag,tag+size),type});
|
|
266
|
+
// A live coordinator consumes its mailbox only from the native Absorb
|
|
267
|
+
// boundary. Never reenter its suspended checkpoint activation.
|
|
268
|
+
if(this.operations.has(42)||this.parked.has(42))return 1;
|
|
269
|
+
this.synchronousDepth++;
|
|
270
|
+
try{this.select(42);assert.equal(this.mod._pgl_sessions_absorb_sync_service(),1,'sync mailbox registration failed');return 1;}
|
|
271
|
+
catch(cause){const error=new Error('sync coordinator failed',{cause});this.fail(error);throw error;}
|
|
272
|
+
finally{this.select(caller);this.synchronousDepth--;}
|
|
273
|
+
}
|
|
274
|
+
signal(pid,sig){
|
|
275
|
+
if(!this.backends.has(pid))return;
|
|
276
|
+
const signals=this.signals.get(pid)??new Set();signals.add(sig);this.signals.set(pid,signals);
|
|
277
|
+
// Idle and parked backends both receive the real C signal handler with
|
|
278
|
+
// their own private globals selected. It sets the real latch/interrupts.
|
|
279
|
+
this.schedule(pid,()=>this.serviceIdle(pid),true).catch(e=>this.fail(e));
|
|
280
|
+
}
|
|
281
|
+
async serviceIdle(pid){
|
|
282
|
+
const waiter=this.parked.get(pid);
|
|
283
|
+
if(waiter?.kind==='service'){waiter.notified=true;this.kick();return;}
|
|
284
|
+
if(this.operations.has(pid)||waiter)return;
|
|
285
|
+
const m=this.mod,sp=m.stackSave(),io=this.io(Buffer.alloc(0),bytes=>this.onAsyncData?.(pid,bytes));
|
|
286
|
+
const operation={idle:true};this.operations.set(pid,operation);let exit;
|
|
287
|
+
this.asyncEntries.add(pid);
|
|
288
|
+
try{await m._pgl_sessions_idle_interrupt();}
|
|
289
|
+
catch(e){if(e.status===undefined||!hasFatalResponse(Buffer.concat(io.output)))throw e;exit=e.status;}
|
|
290
|
+
finally{this.asyncEntries.delete(pid);this.operations.delete(pid);io.finish();m.stackRestore(sp);}
|
|
291
|
+
if(exit!==undefined){this.retire(pid);this.onBackendExit?.({pid,status:exit});}
|
|
292
|
+
}
|
|
293
|
+
io(input,onData){
|
|
294
|
+
const m=this.mod;let offset=0;const output=[];
|
|
295
|
+
const read=m.addFunction((ptr,n)=>{const len=Math.min(n,input.length-offset);m.HEAPU8.set(input.subarray(offset,offset+len),ptr);offset+=len;return len;},'ipi');
|
|
296
|
+
const write=m.addFunction((ptr,n)=>{const b=Buffer.from(m.HEAPU8.slice(ptr,ptr+n));output.push(b);onData?.(b);return n;},'ipi');
|
|
297
|
+
const lookup=name=>{const v=this.layout.inputs.find(x=>x.input.endsWith('.'+name));assert(v,'missing IO shim section');return v.start;};
|
|
298
|
+
const view=new DataView(m.HEAPU8.buffer),readAddr=lookup('pgl_read'),writeAddr=lookup('pgl_write');
|
|
299
|
+
const oldRead=view.getUint32(readAddr,true),oldWrite=view.getUint32(writeAddr,true);
|
|
300
|
+
m._pgl_set_rw_cbs(read,write);
|
|
301
|
+
return {output,get remaining(){return input.length-offset;},finish(){m._pgl_set_rw_cbs(oldRead,oldWrite);m.removeFunction(read);m.removeFunction(write);}};
|
|
302
|
+
}
|
|
303
|
+
async attach(pid,packet=startup('l2-backend')){
|
|
304
|
+
assert(!this.backends.has(pid));
|
|
305
|
+
const slot=this.freeSlots.pop()??this.nextSlot++;
|
|
306
|
+
const path='/tmp/l2-child-'+pid;
|
|
307
|
+
await this.schedule(42,()=>{
|
|
308
|
+
const m=this.mod,sp=m.stackSave(),p=m.stringToUTF8OnStack(path);
|
|
309
|
+
try{assert.equal(m._pgl_sessions_prepare_child(slot,p,pid),0,'child serialization failed');}finally{m.stackRestore(sp);}
|
|
310
|
+
});
|
|
311
|
+
// Create the stack before restoring the clean child-private template. The
|
|
312
|
+
// allocator and virtual filesystem remain shared, as they do in WAIT.
|
|
313
|
+
await this.schedule(42,()=>{
|
|
314
|
+
const stack=this.mod._pgl_sessions_stack();assert(stack>0);const sp=stack+8*1024*1024;
|
|
315
|
+
this.backends.set(pid,{pid,slot,stack,sp,image:new Map(this.pristine)});
|
|
316
|
+
});
|
|
317
|
+
return this.schedule(pid,async()=>{
|
|
318
|
+
const m=this.mod,b=this.backends.get(pid);m._pgl_setPGliteActive(1);m._pgl_sessions_setpid(pid);m.stackRestore(b.sp);
|
|
319
|
+
const io=this.io(packet);let exit;
|
|
320
|
+
try{exit=await m.callMain(['--forkchild=backend',path]);}
|
|
321
|
+
finally{m.stackRestore(b.sp);io.finish();}
|
|
322
|
+
const bytes=Buffer.concat(io.output),response=parseWire(bytes);
|
|
323
|
+
if(exit!==99&&hasFatalResponse(bytes)){
|
|
324
|
+
this.retire(pid);throw new BackendStartExit(exit,bytes);
|
|
325
|
+
}
|
|
326
|
+
assert.equal(exit,99,JSON.stringify(response));assert(!response.results.some(x=>x.error),JSON.stringify(response));
|
|
327
|
+
this.log.push({event:'child-entry',pid,slot,exit,startup:response});return bytes;
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
raw(pid,input,onData){
|
|
331
|
+
return this.schedule(pid,async()=>{
|
|
332
|
+
const m=this.mod,sp=m.stackSave(),io=this.io(input,onData);let exit;
|
|
333
|
+
this.asyncEntries.add(pid);
|
|
334
|
+
try {
|
|
335
|
+
while(io.remaining>0||m._pq_buffer_remaining_data()>0){
|
|
336
|
+
try{await m._PostgresMainLoopOnce();}
|
|
337
|
+
catch(e){
|
|
338
|
+
m.stackRestore(sp);
|
|
339
|
+
if(e.status===100){this.synchronousDepth++;try{m._PostgresMainLongJmp();}finally{this.synchronousDepth--;}continue;}
|
|
340
|
+
if(e.status===undefined||!hasFatalResponse(Buffer.concat(io.output)))throw e;
|
|
341
|
+
exit=e.status;break;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if(exit===undefined){m._PostgresSendReadyForQueryIfNecessary();m._pgl_pq_flush();}
|
|
345
|
+
} finally {this.asyncEntries.delete(pid);io.finish();m.stackRestore(sp);}
|
|
346
|
+
const bytes=Buffer.concat(io.output);this.onProtocol?.({pid,bytes});
|
|
347
|
+
if(exit!==undefined){this.retire(pid);this.onBackendExit?.({pid,status:exit});}
|
|
348
|
+
return bytes;
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
async query(pid,sql){const bytes=await this.raw(pid,simpleQuery(sql));return parseWire(bytes);}
|
|
352
|
+
retire(pid){
|
|
353
|
+
const m=this.mod,b=this.backends.get(pid);assert(b&&pid!==42&&this.active===pid,'retirement outside backend');
|
|
354
|
+
clearTimeout(this.timers.get(pid));this.timers.delete(pid);this.signals.delete(pid);this.parkingObservers.delete(pid);this.asyncEntries.delete(pid);
|
|
355
|
+
assert(!this.parked.has(pid),'retiring a suspended backend');
|
|
356
|
+
for(const [ticket,request]of this.checkpointTickets)if(request.owner===pid){assert(!request.waiter,'retiring a live checkpoint waiter');this.checkpointTickets.delete(ticket);this.event({event:'checkpoint-owner-exit',ticket,done:request.done});}
|
|
357
|
+
const releasedAllocations=m._pgl_sessions_cleanup_memory();let closedDescriptors=0;
|
|
358
|
+
for(const [fd,owner]of [...this.descriptorOwners])if(owner.pid===pid){
|
|
359
|
+
if(m.FS.streams[fd]===owner.stream){m.FS.close(owner.stream);closedDescriptors++;}
|
|
360
|
+
else this.descriptorOwners.delete(fd);
|
|
361
|
+
}
|
|
362
|
+
this.log.push({event:'backend-closed',pid,slot:b.slot,releasedAllocations,closedDescriptors});
|
|
363
|
+
this.save();this.active=null;this.backends.delete(pid);
|
|
364
|
+
const release=()=>{
|
|
365
|
+
assert.equal(m._pgl_sessions_release_child(b.slot),0,'backend slot not safely retired');
|
|
366
|
+
m._free(b.stack);this.freeSlots.push(b.slot);
|
|
367
|
+
};
|
|
368
|
+
if(this.operations.has(42)||this.parked.has(42))this.schedule(42,release).catch(e=>this.fail(e));
|
|
369
|
+
else{this.select(42);release();}
|
|
370
|
+
}
|
|
371
|
+
async disconnect(pid){
|
|
372
|
+
if(!this.backends.has(pid)||pid===42)return;
|
|
373
|
+
const waiter=this.parked.get(pid);
|
|
374
|
+
if(waiter)this.signal(pid,2);
|
|
375
|
+
if(waiter?.kind==='spi'&&!waiter.released)this.resumeSPI(pid);
|
|
376
|
+
await this.schedule(pid,async()=>{
|
|
377
|
+
const m=this.mod,b=this.backends.get(pid),sp=m.stackSave(),io=this.io(Buffer.from([88,0,0,0,4]));
|
|
378
|
+
m._pgl_setPGliteActive(0);
|
|
379
|
+
try{await m._PostgresMainLoopOnce();}catch(e){if(e.status!==0)throw e;}
|
|
380
|
+
finally{io.finish();m.stackRestore(sp);m._pgl_setPGliteActive(1);}
|
|
381
|
+
this.retire(pid);
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
async close(){
|
|
385
|
+
for(const pid of [...this.backends.keys()].filter(p=>p!==42))await this.disconnect(pid);
|
|
386
|
+
for(const t of this.timers.values())clearTimeout(t);this.timers.clear();
|
|
387
|
+
await this.schedule(42,()=>this.db.close());
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
export const createHost=options=>EngineHost.create(options);
|