-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: OPFS VFS using SharedArrayBuffer and Atomic WIP WIP wip Tidyup and fix Seems to work... Experiment with not closing files * OPFS Access Handle Pool VFS WIP Flush experiment relaxed durability mode and benchmarks Update benchmarks * Refactor * Format and tweaks * Exports * Tests * Comments * Tidyup
- Loading branch information
Showing
23 changed files
with
2,093 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { PGlite } from "../dist/index.js"; | ||
import { worker } from "../dist/worker/index.js"; | ||
|
||
worker({ | ||
async init() { | ||
const pg = new PGlite("opfs-ahp://my-test-db2"); | ||
// If you want run any specific setup code for the worker process, you can do it here. | ||
return pg; | ||
}, | ||
}); | ||
|
||
console.log("Worker process started"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script type="module"> | ||
import { PGliteWorker } from "../dist/worker/index.js"; | ||
|
||
console.log("Starting..."); | ||
const start = performance.now(); | ||
const pg = new PGliteWorker( | ||
new Worker(new URL("./opfs-worker.js", import.meta.url), { | ||
type: "module", | ||
}) | ||
); | ||
|
||
console.log("Waiting for ready..."); | ||
await pg.waitReady; | ||
|
||
console.log("Ready! Took", performance.now() - start, "ms"); | ||
|
||
console.log("Creating table..."); | ||
await pg.exec(` | ||
CREATE TABLE IF NOT EXISTS test ( | ||
id SERIAL PRIMARY KEY, | ||
name TEXT | ||
); | ||
`); | ||
|
||
console.log("Inserting data..."); | ||
await pg.exec("INSERT INTO test (name) VALUES ('test');"); | ||
|
||
console.log("Selecting data..."); | ||
const res = await pg.exec(` | ||
SELECT * FROM test; | ||
`); | ||
|
||
console.log(res); | ||
|
||
// Transaction example: | ||
console.log("Transaction example..."); | ||
await pg.transaction(async (tx) => { | ||
await tx.exec("INSERT INTO test (name) VALUES ('test2');"); | ||
await tx.exec("INSERT INTO test (name) VALUES ('test3');"); | ||
}); | ||
|
||
console.log("Selecting data..."); | ||
const res2 = await pg.exec(` | ||
SELECT * FROM test; | ||
`); | ||
|
||
console.log(res2); | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
e915900
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Deployed on https://66aa61d0edad7d0091526e0d--pglite-dev-demos.netlify.app