-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #351 from evoluhq/opfs-sahpool
Opfs sahpool
- Loading branch information
Showing
37 changed files
with
1,543 additions
and
1,304 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@evolu/common": major | ||
--- | ||
|
||
Add Config name property and remove LocalStorage support. | ||
|
||
It's a breaking change only because PlatformName was restricted. There is no change in sync protocol so that all data can be safely restored. |
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,5 @@ | ||
--- | ||
"@evolu/common-react": patch | ||
--- | ||
|
||
Update peer dependencies |
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,7 @@ | ||
--- | ||
"@evolu/react-native": major | ||
--- | ||
|
||
The new SQLite database filename | ||
|
||
It's configurable by the Config name property now. |
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,15 @@ | ||
--- | ||
"@evolu/common-web": major | ||
--- | ||
|
||
6x faster update, 2x faster sync, and no COOP/COEP headers | ||
|
||
Sync is 2x faster because Evolu doesn't create sync messages for createdAt and updatedAt columns anymore. They are inferred from the sync message timestamp instead. This change also made updates 2x faster. | ||
|
||
@evolu/common-web is roughly 3x faster because we switched from OPFS via sqlite3_vfs to OPFS SyncAccessHandle Pool VFS. | ||
|
||
The "opfs-sahpool" also does not require COOP/COEP HTTP headers (and associated restrictions), and it works on all major browsers released since March 2023. | ||
|
||
This change was challenging because, by default, the "opfs-sahpool" does not support multiple simultaneous connections and can be instantiated only within a web worker and only within one tab of the same origin. Evolu uses Web Locks and BroadcastChannel to re-enable multiple tabs functionality. | ||
|
||
It's a breaking change because we had to remove support for LocalStore. Fortunately, we don't need it anymore, and without LocalStorare, Evolu can support separated SQLite instances. |
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,5 @@ | ||
--- | ||
"@evolu/server": patch | ||
--- | ||
|
||
Update peer dependencies |
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,10 @@ | ||
--- | ||
"@evolu/common": patch | ||
"@evolu/common-react": patch | ||
"@evolu/common-web": patch | ||
"@evolu/react": patch | ||
"@evolu/react-native": patch | ||
"@evolu/server": patch | ||
--- | ||
|
||
Update peer dependencies |
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 |
---|---|---|
@@ -1,10 +1,42 @@ | ||
import { DbWorkerInput } from "@evolu/common"; | ||
import { dbWorker } from "./DbWorker.js"; | ||
import { | ||
ConfigLive, | ||
DbWorker, | ||
DbWorkerCommonLive, | ||
DbWorkerInput, | ||
NanoIdGeneratorLive, | ||
} from "@evolu/common"; | ||
import * as Effect from "effect/Effect"; | ||
import * as Layer from "effect/Layer"; | ||
import { Bip39Live, DbWorkerLockLive } from "./PlatformLive.js"; | ||
import { SqliteLive } from "./SqliteLive.js"; | ||
import { SyncWorkerLive } from "./SyncWorkerLive.js"; | ||
|
||
dbWorker.onMessage = (output): void => { | ||
postMessage(output); | ||
}; | ||
let dbWorker: DbWorker | null = null; | ||
|
||
onmessage = (e: MessageEvent<DbWorkerInput>): void => { | ||
if (dbWorker == null) { | ||
if (e.data._tag !== "init") throw new Error("init must be called first"); | ||
dbWorker = Effect.provide( | ||
DbWorker, | ||
DbWorkerCommonLive.pipe( | ||
Layer.provide( | ||
Layer.mergeAll( | ||
SqliteLive, | ||
Bip39Live, | ||
SyncWorkerLive, | ||
DbWorkerLockLive, | ||
), | ||
), | ||
Layer.provide( | ||
Layer.merge(NanoIdGeneratorLive, ConfigLive(e.data.config)), | ||
), | ||
), | ||
).pipe(Effect.runSync); | ||
|
||
dbWorker.onMessage = (output): void => { | ||
postMessage(output); | ||
}; | ||
} | ||
|
||
dbWorker.postMessage(e.data); | ||
}; |
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.