@syncular/server-workers 0.8.0 → 0.10.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/README.md +11 -0
- package/dist/realtime-do.js +5 -1
- package/package.json +4 -4
- package/src/realtime-do.ts +5 -1
package/README.md
CHANGED
|
@@ -136,6 +136,17 @@ writes with a coordinating primitive (a DO or a Queue). This mirrors
|
|
|
136
136
|
Postgres's per-partition row lock, achieved by placement rather than a lock
|
|
137
137
|
D1 does not expose. Cross-partition pushes never contend.
|
|
138
138
|
|
|
139
|
+
**Whole-commit validation fails closed without that coordinator.** SPEC §6.8
|
|
140
|
+
must hold serialization from before candidate reads through commit. A plain
|
|
141
|
+
`new D1ServerStorage(env.DB)` therefore rejects a push whenever
|
|
142
|
+
`commitValidator` is configured. The storage created inside
|
|
143
|
+
`SyncularRealtimeHost` opts in because that host is already one
|
|
144
|
+
single-threaded DO per partition. A custom coordinated host may construct
|
|
145
|
+
`new D1ServerStorage(env.DB, { commitValidationSerialized: true })`, but MUST
|
|
146
|
+
never set that assertion in a stateless HTTP Worker. A realtime notifier wakes
|
|
147
|
+
sockets after an HTTP commit; it does not serialize that HTTP write and is not
|
|
148
|
+
sufficient for §6.8 by itself.
|
|
149
|
+
|
|
139
150
|
## Workers realtime — the Durable Object
|
|
140
151
|
|
|
141
152
|
The realtime channel (§8) needs a durable, stateful WebSocket host. On Workers
|
package/dist/realtime-do.js
CHANGED
|
@@ -118,7 +118,11 @@ export class SyncularRealtimeHost {
|
|
|
118
118
|
#swallowHello = new Set();
|
|
119
119
|
constructor(state, db, config) {
|
|
120
120
|
this.#state = state;
|
|
121
|
-
this.#storage = new D1ServerStorage(db
|
|
121
|
+
this.#storage = new D1ServerStorage(db, {
|
|
122
|
+
// This host is one Durable Object per partition, so the §6.8 storage
|
|
123
|
+
// precondition is true for socket rounds handled inside the object.
|
|
124
|
+
commitValidationSerialized: true,
|
|
125
|
+
});
|
|
122
126
|
this.#config = config;
|
|
123
127
|
}
|
|
124
128
|
#getHub() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/server-workers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Cloudflare Workers adapter for the Syncular sync server",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"!dist/**/*.test.d.ts"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@syncular/server": "0.
|
|
49
|
-
"@syncular/server-hono": "0.
|
|
48
|
+
"@syncular/server": "0.10.0",
|
|
49
|
+
"@syncular/server-hono": "0.10.0",
|
|
50
50
|
"hono": "^4.11.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@syncular/core": "0.
|
|
53
|
+
"@syncular/core": "0.10.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/realtime-do.ts
CHANGED
|
@@ -190,7 +190,11 @@ export class SyncularRealtimeHost {
|
|
|
190
190
|
config: RealtimeDOConfig,
|
|
191
191
|
) {
|
|
192
192
|
this.#state = state;
|
|
193
|
-
this.#storage = new D1ServerStorage(db
|
|
193
|
+
this.#storage = new D1ServerStorage(db, {
|
|
194
|
+
// This host is one Durable Object per partition, so the §6.8 storage
|
|
195
|
+
// precondition is true for socket rounds handled inside the object.
|
|
196
|
+
commitValidationSerialized: true,
|
|
197
|
+
});
|
|
194
198
|
this.#config = config;
|
|
195
199
|
}
|
|
196
200
|
|