@evolu/common 8.16.0 → 8.18.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/dist/src/Bytes.d.ts +31 -14
- package/dist/src/Bytes.d.ts.map +1 -1
- package/dist/src/Bytes.js +48 -8
- package/dist/src/Crypto.d.ts +21 -3
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Crypto.js +18 -2
- package/dist/src/Error.d.ts.map +1 -1
- package/dist/src/Error.js +5 -1
- package/dist/src/Polyfills.d.ts.map +1 -1
- package/dist/src/Polyfills.js +3 -2
- package/dist/src/Task.d.ts +4 -3
- package/dist/src/Task.d.ts.map +1 -1
- package/dist/src/Task.js +4 -3
- package/dist/src/local-first/Db.d.ts.map +1 -1
- package/dist/src/local-first/Db.js +18 -7
- package/dist/src/local-first/Evolu.d.ts +10 -1
- package/dist/src/local-first/Evolu.d.ts.map +1 -1
- package/dist/src/local-first/Evolu.js +5 -1
- package/dist/src/local-first/Owner.d.ts +20 -8
- package/dist/src/local-first/Owner.d.ts.map +1 -1
- package/dist/src/local-first/Owner.js +23 -10
- package/dist/src/local-first/Protocol.d.ts +215 -93
- package/dist/src/local-first/Protocol.d.ts.map +1 -1
- package/dist/src/local-first/Protocol.js +799 -489
- package/dist/src/local-first/Relay.d.ts +9 -1
- package/dist/src/local-first/Relay.d.ts.map +1 -1
- package/dist/src/local-first/Relay.js +41 -36
- package/dist/src/local-first/Schema.d.ts +1 -1
- package/dist/src/local-first/Shared.d.ts +75 -49
- package/dist/src/local-first/Shared.d.ts.map +1 -1
- package/dist/src/local-first/Shared.js +62 -42
- package/dist/src/local-first/Storage.d.ts +80 -18
- package/dist/src/local-first/Storage.d.ts.map +1 -1
- package/dist/src/local-first/Storage.js +20 -4
- package/package.json +1 -1
- package/src/Bytes.test.ts +212 -0
- package/src/Bytes.ts +67 -17
- package/src/Crypto.ts +23 -3
- package/src/Error.ts +5 -1
- package/src/Polyfills.ts +3 -2
- package/src/Task.ts +4 -3
- package/src/local-first/Db.ts +29 -14
- package/src/local-first/Evolu.test.ts +43 -12
- package/src/local-first/Evolu.ts +16 -2
- package/src/local-first/Owner.test.ts +52 -1
- package/src/local-first/Owner.ts +26 -7
- package/src/local-first/Protocol.test.ts +1541 -44
- package/src/local-first/Protocol.ts +1070 -605
- package/src/local-first/Relay.ts +80 -69
- package/src/local-first/Shared.ts +106 -67
- package/src/local-first/Storage.ts +100 -27
|
@@ -34,7 +34,15 @@ export interface RelayConfig extends StorageConfig {
|
|
|
34
34
|
*
|
|
35
35
|
* OwnerId is used rather than short-lived tokens because this only controls
|
|
36
36
|
* relay access, not write permissions. Since all data is encrypted on the
|
|
37
|
-
* relay, OwnerId exposure
|
|
37
|
+
* relay, OwnerId exposure reveals no data.
|
|
38
|
+
*
|
|
39
|
+
* It does allow write-key squatting. The relay stores the first write key
|
|
40
|
+
* presented for an owner, so anyone who learns an OwnerId before the owner's
|
|
41
|
+
* own write key reaches the relay can claim it. The owner then gets
|
|
42
|
+
* {@link ProtocolWriteKeyError} on this relay until the operator deletes the
|
|
43
|
+
* owner's row in `evolu_writeKey`. This callback does not prevent that: it
|
|
44
|
+
* receives only the OwnerId of a connection, which a squatter can name as
|
|
45
|
+
* well, and every message on the connection can name another owner.
|
|
38
46
|
*
|
|
39
47
|
* Owners specify which relays to connect to via `OwnerTransport`. In
|
|
40
48
|
* WebSocket-based implementations, this check occurs before accepting the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Relay.d.ts","sourceRoot":"","sources":["../../../src/local-first/Relay.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Relay.d.ts","sourceRoot":"","sources":["../../../src/local-first/Relay.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,IAAI,EAAyC,MAAM,YAAY,CAAC;AACzE,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,OAAO,EAIR,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAEV,iBAAiB,EACjB,OAAO,EACP,aAAa,EAEd,MAAM,cAAc,CAAC;AAStB,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwFG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CACxB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;QACP,iEAAiE;QACjE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;KAC9B,KACE,SAAS,CAAC,OAAO,CAAC,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,KAAM,SAAQ,eAAe;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,wBAAwB,SAC5B,iBAAiB,GAAG,kBAAkB,cACpC,aAAa,KAAG,OA0LxB,CAAC;AAEJ,eAAO,MAAM,wBAAwB,SAAU,SAAS,KAAG,IAuB1D,CAAC"}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { dedupeArray, filterArray, firstInArray, isNonEmptyArray, mapArray, } from "../Array.js";
|
|
7
7
|
import { assert } from "../Assert.js";
|
|
8
|
-
import {
|
|
8
|
+
import { createUnknownError } from "../Error.js";
|
|
9
|
+
import { err, ok, trySync } from "../Result.js";
|
|
9
10
|
import { sql } from "../Sqlite.js";
|
|
10
11
|
import { createMutexByKey } from "../Task.js";
|
|
11
12
|
import { Name, NonNegativeInt, uint8ArrayToBase64Url } from "../Type.js";
|
|
@@ -40,20 +41,15 @@ export const createRelaySqliteStorage = (deps) => (config) => {
|
|
|
40
41
|
if (isNonEmptyArray(rows)) {
|
|
41
42
|
return deps.timingSafeEqual(rows[0].writeKey, writeKey);
|
|
42
43
|
}
|
|
44
|
+
// When SQLite fails this insert, for example on a full disk, the throw
|
|
45
|
+
// reaches the protocol, which logs it and answers with WriteError,
|
|
46
|
+
// because a boolean has no room for the error.
|
|
43
47
|
deps.sqlite.exec(sql `
|
|
44
48
|
insert into evolu_writeKey (ownerId, writeKey)
|
|
45
49
|
values (${ownerId}, ${writeKey});
|
|
46
50
|
`);
|
|
47
51
|
return true;
|
|
48
52
|
},
|
|
49
|
-
setWriteKey: (ownerId, writeKey) => {
|
|
50
|
-
deps.sqlite.exec(sql `
|
|
51
|
-
insert into evolu_writeKey (ownerId, writeKey)
|
|
52
|
-
values (${ownerId}, ${writeKey})
|
|
53
|
-
on conflict (ownerId) do update
|
|
54
|
-
set writeKey = excluded.writeKey;
|
|
55
|
-
`);
|
|
56
|
-
},
|
|
57
53
|
writeMessages: (ownerIdBytes, messages) => async (run) => {
|
|
58
54
|
const ownerId = ownerIdBytesToOwnerId(ownerIdBytes);
|
|
59
55
|
const uniqueMessagesWithTimestampBytes = dedupeArray(mapArray(messages, (m) => ({
|
|
@@ -61,14 +57,23 @@ export const createRelaySqliteStorage = (deps) => (config) => {
|
|
|
61
57
|
change: m.change,
|
|
62
58
|
})), (message) => uint8ArrayToBase64Url(message.timestamp));
|
|
63
59
|
return run(mutexByOwnerId.withLock(ownerId, async () => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
// SQLite can fail these reads, for example on a corrupt page, and
|
|
61
|
+
// a throw would panic the relay's shared Run.
|
|
62
|
+
const readResult = trySync(() => {
|
|
63
|
+
const existingTimestampsResult = sqliteStorageBase.getExistingTimestamps(ownerIdBytes, mapArray(uniqueMessagesWithTimestampBytes, (m) => m.timestamp));
|
|
64
|
+
const existingTimestampKeys = new Set(mapArray(existingTimestampsResult, uint8ArrayToBase64Url));
|
|
65
|
+
const newMessages = filterArray(uniqueMessagesWithTimestampBytes, (message) => !existingTimestampKeys.has(uint8ArrayToBase64Url(message.timestamp)));
|
|
66
|
+
// Nothing to write
|
|
67
|
+
if (!isNonEmptyArray(newMessages))
|
|
68
|
+
return null;
|
|
69
|
+
const usage = readOwnerUsageOrDefault(deps)(ownerIdBytes, firstInArray(newMessages).timestamp);
|
|
70
|
+
return { newMessages, usage };
|
|
71
|
+
}, createUnknownError);
|
|
72
|
+
if (!readResult.ok)
|
|
73
|
+
return readResult;
|
|
74
|
+
if (readResult.value === null)
|
|
69
75
|
return ok();
|
|
70
|
-
}
|
|
71
|
-
const usage = readOwnerUsageOrDefault(deps)(ownerIdBytes, firstInArray(newMessages).timestamp);
|
|
76
|
+
const { newMessages, usage } = readResult.value;
|
|
72
77
|
const incomingBytes = newMessages.reduce((sum, m) => sum + m.change.length, 0);
|
|
73
78
|
// A sum of lengths can be zero. Throwing here would panic the
|
|
74
79
|
// relay's shared Run.
|
|
@@ -84,22 +89,26 @@ export const createRelaySqliteStorage = (deps) => (config) => {
|
|
|
84
89
|
});
|
|
85
90
|
}
|
|
86
91
|
let { firstTimestamp, lastTimestamp } = usage;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
// SQLite can fail the write, for example on a full disk. The
|
|
93
|
+
// transaction has rolled back, and a throw would panic the relay's
|
|
94
|
+
// shared Run.
|
|
95
|
+
return trySync(() => {
|
|
96
|
+
deps.sqlite.transaction(() => {
|
|
97
|
+
for (const { timestamp, change } of newMessages) {
|
|
98
|
+
let strategy;
|
|
99
|
+
[strategy, firstTimestamp, lastTimestamp] =
|
|
100
|
+
getTimestampInsertStrategy(timestamp, firstTimestamp, lastTimestamp);
|
|
101
|
+
sqliteStorageBase.insertTimestamp(ownerIdBytes, timestamp, strategy);
|
|
102
|
+
deps.sqlite.exec(sql `
|
|
103
|
+
insert into evolu_message
|
|
104
|
+
("ownerId", "timestamp", "change")
|
|
105
|
+
values (${ownerIdBytes}, ${timestamp}, ${change})
|
|
106
|
+
on conflict do nothing;
|
|
107
|
+
`);
|
|
108
|
+
}
|
|
109
|
+
updateOwnerUsage(deps)(ownerIdBytes, newStoredBytes, firstTimestamp, lastTimestamp);
|
|
110
|
+
});
|
|
111
|
+
}, createUnknownError);
|
|
103
112
|
}));
|
|
104
113
|
},
|
|
105
114
|
readDbChange: (ownerId, timestamp) => {
|
|
@@ -119,12 +128,8 @@ export const createRelaySqliteStorage = (deps) => (config) => {
|
|
|
119
128
|
`);
|
|
120
129
|
deps.sqlite.exec(sql `
|
|
121
130
|
delete from evolu_message where ownerId = ${ownerId};
|
|
122
|
-
`);
|
|
123
|
-
deps.sqlite.exec(sql `
|
|
124
|
-
delete from evolu_usage where ownerId = ${ownerId};
|
|
125
131
|
`);
|
|
126
132
|
sqliteStorageBase.deleteOwner(ownerId);
|
|
127
|
-
return ok();
|
|
128
133
|
});
|
|
129
134
|
},
|
|
130
135
|
};
|
|
@@ -192,7 +192,7 @@ export declare const testLocalOnlyEvoluSchema: {
|
|
|
192
192
|
readonly id: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"String", string, string, import("../Type.ts").TypeOfError<"String">, null, import("../Type.ts").TypeOfError<"String">, never, string, true>, "Id", import("../Type.ts").IdError>, "OwnerId", never>;
|
|
193
193
|
readonly encryptionKey: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length32", import("../Type.ts").LengthError<32>>, "EncryptionKey", never>, "OwnerEncryptionKey", never>;
|
|
194
194
|
readonly writeKey: import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length16", import("../Type.ts").LengthError<16>>, "OwnerWriteKey", never>;
|
|
195
|
-
readonly secret: UnionType<readonly [import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length32", import("../Type.ts").LengthError<32
|
|
195
|
+
readonly secret: UnionType<readonly [import("../Type.ts").BrandType<UnionType<readonly [import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length16", import("../Type.ts").LengthError<16>>, import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length20", import("../Type.ts").LengthError<20>>, import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length24", import("../Type.ts").LengthError<24>>, import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length28", import("../Type.ts").LengthError<28>>, import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.ts").ObjectTagError<"Uint8Array">, null, import("../Type.ts").ObjectTagError<"Uint8Array">, never, Uint8Array<ArrayBufferLike>, true>, "Entropy", never>, "Length32", import("../Type.ts").LengthError<32>>]>, "OwnerSecret", never>, import("../Type.ts").LiteralType<null>]>;
|
|
196
196
|
readonly name: UnionType<readonly [import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").BrandType<import("../Type.ts").Type<"String", string, string, import("../Type.ts").TypeOfError<"String">, null, import("../Type.ts").TypeOfError<"String">, never, string, true>, "Trimmed", import("../Type.ts").TrimmedError>, "MinLength1", import("../Type.ts").MinLengthError<1>>, "MaxLength100", import("../Type.ts").MaxLengthError<100>>, import("../Type.ts").LiteralType<null>]>;
|
|
197
197
|
};
|
|
198
198
|
};
|
|
@@ -111,10 +111,10 @@
|
|
|
111
111
|
* whichever instance made it, even one disposed before the database worker
|
|
112
112
|
* answered. When a relay frame stores new messages, the tenant requests a round
|
|
113
113
|
* through each other transport claimed for the owner, so data learned from one
|
|
114
|
-
* relay reaches the others, except through a route that skipped a message
|
|
115
|
-
* described below. A closed transport reconciles
|
|
116
|
-
* replacement leader reconciles every transport again,
|
|
117
|
-
* reporting stored messages may have been lost.
|
|
114
|
+
* relay reaches the others, except through a route that skipped a message it
|
|
115
|
+
* received or could not send, as described below. A closed transport reconciles
|
|
116
|
+
* when it opens, and a replacement leader reconciles every transport again,
|
|
117
|
+
* because a response reporting stored messages may have been lost.
|
|
118
118
|
*
|
|
119
119
|
* Relays omit the sending socket when broadcasting an upload, so the uploader
|
|
120
120
|
* also delivers it as local Broadcast frames to every other tenant with
|
|
@@ -178,17 +178,17 @@
|
|
|
178
178
|
* request, a replacement leader, or storing messages from another transport,
|
|
179
179
|
* unless the route skipped a message. No failed or aborted result has arrived
|
|
180
180
|
* on the route since.
|
|
181
|
-
* - No result that skipped a received message
|
|
182
|
-
* round was last requested through it,
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
* skipped a message.
|
|
181
|
+
* - No result that skipped a received message or a stored change too large to
|
|
182
|
+
* send has arrived on the route since a round was last requested through it,
|
|
183
|
+
* and since that request, no messages have been stored from another
|
|
184
|
+
* transport, directly or through a sibling copy uploaded outside this
|
|
185
|
+
* transport, and no sibling copy has failed to apply or skipped a message.
|
|
186
186
|
*
|
|
187
187
|
* A route is settled when every condition except the last holds, so a complete
|
|
188
188
|
* route is settled too. A settled route that is incomplete has ended its
|
|
189
|
-
* reconciliation, but its relay may offer a message the database skipped,
|
|
190
|
-
*
|
|
191
|
-
* {@link SettledSyncRoute}.
|
|
189
|
+
* reconciliation, but its relay may offer a message the database skipped, the
|
|
190
|
+
* database may store a change too large to send, or messages stored elsewhere
|
|
191
|
+
* may not have reached it; it is published as {@link SettledSyncRoute}.
|
|
192
192
|
*
|
|
193
193
|
* A reconciliation chain ends only with a converged result, a failure, an
|
|
194
194
|
* abort, a dropped frame, or a continuation that finds the socket closed, and
|
|
@@ -207,20 +207,34 @@
|
|
|
207
207
|
* while the database worker creates a round is logged there and fails the
|
|
208
208
|
* round's routes with `SyncFailed` without a retry. A mutation that throws is
|
|
209
209
|
* rolled back and reported as an {@link UnknownError} to the tab that made it,
|
|
210
|
-
* or to every tab when its Evolu instance was disposed first.
|
|
211
|
-
* SQLite
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
210
|
+
* or to every tab when its Evolu instance was disposed first. A received batch
|
|
211
|
+
* SQLite fails to store, for example on a full disk, is rolled back and fails
|
|
212
|
+
* its route with an `UnknownError`. Other unexpected SQLite exceptions remain
|
|
213
|
+
* unsupported and can panic the database worker. A frame the relay silently
|
|
214
|
+
* drops, such as invalid data, leaves the count above zero until the liveness
|
|
215
|
+
* rule below replaces the socket.
|
|
216
|
+
*
|
|
217
|
+
* A result that skipped a message records the error on the route as its
|
|
218
|
+
* `skippedError`, without ending its chain, so it requests no round. A message
|
|
219
|
+
* is skipped in two cases:
|
|
220
|
+
*
|
|
221
|
+
* - The relay offers a message the database could not decrypt, verify, or decode.
|
|
222
|
+
* The relay offers it again in every round through the route until the
|
|
223
|
+
* database stores a message with that timestamp.
|
|
224
|
+
* - The database stores a change it cannot send, a
|
|
225
|
+
* {@link ProtocolChangeTooLargeError}: one saved before `maxMutationSize`
|
|
226
|
+
* existed, or a crafted one received from a relay. Every route through a
|
|
227
|
+
* relay that lacks it skips it on every sync, so each such route stays
|
|
228
|
+
* settled.
|
|
229
|
+
*
|
|
230
|
+
* The messages received elsewhere that the last condition names request no
|
|
231
|
+
* round through such a route, even while a requested round checks it again,
|
|
232
|
+
* because each round would download every skipped message again, or skip again
|
|
233
|
+
* a change too large to send. The next round that an explicit request, a
|
|
234
|
+
* reopen, a replacement leader, or a failure sends through the route reconciles
|
|
235
|
+
* them. So while the database stores a change too large to send, messages from
|
|
236
|
+
* other relays reach a route only through such a round, for example after a
|
|
237
|
+
* reconnect or {@link Evolu.requestSync}.
|
|
224
238
|
*
|
|
225
239
|
* ### Liveness
|
|
226
240
|
*
|
|
@@ -273,7 +287,7 @@ import type { BroadcastChannel, SharedWorker as CommonSharedWorker, CreateBroadc
|
|
|
273
287
|
import type { DbWorkerInit, UnsupportedDbVersionError } from "./Db.ts";
|
|
274
288
|
import type { DevicePersistence } from "./Evolu.ts";
|
|
275
289
|
import type { Owner, OwnerId, SyncOwner } from "./Owner.ts";
|
|
276
|
-
import { type ApplyProtocolMessageAsClientResult, type ProtocolError, type ProtocolInvalidDataError, type ProtocolMessage, type ProtocolTimestampMismatchError } from "./Protocol.ts";
|
|
290
|
+
import { type ApplyProtocolMessageAsClientResult, type ProtocolChangeTooLargeError, type ProtocolError, type ProtocolInvalidDataError, type ProtocolMessage, type ProtocolTimestampMismatchError } from "./Protocol.ts";
|
|
277
291
|
import { type Patch, type Query, type RowsByQueryMap } from "./Query.ts";
|
|
278
292
|
import { type MutationChange } from "./Schema.ts";
|
|
279
293
|
import type { CrdtMessage, StorageWriteMessagesError } from "./Storage.ts";
|
|
@@ -499,8 +513,9 @@ export interface ReadonlySyncTenantOwner extends Typed<"Readonly"> {
|
|
|
499
513
|
}
|
|
500
514
|
/**
|
|
501
515
|
* One database's use of one owner through one transport: `Pending` until its
|
|
502
|
-
* reconciliation ends, then `Complete`, or `Settled` while
|
|
503
|
-
*
|
|
516
|
+
* reconciliation ends, then `Complete`, or `Settled` while it skips a change:
|
|
517
|
+
* one its relay offers that the database could not store, or one the database
|
|
518
|
+
* stores but cannot send. See Synchronization completion in this module's
|
|
504
519
|
* documentation.
|
|
505
520
|
*/
|
|
506
521
|
export type SyncRoute = PendingSyncRoute | SettledSyncRoute | CompleteSyncRoute;
|
|
@@ -519,9 +534,12 @@ export interface PendingSyncRoute extends Typed<"Pending"> {
|
|
|
519
534
|
*/
|
|
520
535
|
readonly failure: SyncRouteError | null;
|
|
521
536
|
/**
|
|
522
|
-
* The first change skipped in the latest reply that skipped one, or null.
|
|
523
|
-
* relay offers
|
|
524
|
-
* stores a change with that timestamp.
|
|
537
|
+
* The first change skipped in the latest reply that skipped one, or null. A
|
|
538
|
+
* change the relay offers is offered again in every round through the route
|
|
539
|
+
* until this database stores a change with that timestamp. A
|
|
540
|
+
* {@link ProtocolChangeTooLargeError} is a change this database stores but
|
|
541
|
+
* cannot send, which every route through a relay that lacks it skips on every
|
|
542
|
+
* sync.
|
|
525
543
|
*/
|
|
526
544
|
readonly skippedError: SyncRouteError | null;
|
|
527
545
|
/** When the route last became complete, or null. */
|
|
@@ -535,10 +553,15 @@ export interface PendingSyncRoute extends Typed<"Pending"> {
|
|
|
535
553
|
readonly lastReceivedAt: Millis | null;
|
|
536
554
|
}
|
|
537
555
|
/**
|
|
538
|
-
* A route whose reconciliation ended
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
* {@link
|
|
556
|
+
* A route whose reconciliation ended with a skipped change, so it is
|
|
557
|
+
* incomplete: its relay offers a change the database could not store, or the
|
|
558
|
+
* database stores a change it cannot send, a
|
|
559
|
+
* {@link ProtocolChangeTooLargeError}. Changes stored from other relays request
|
|
560
|
+
* no round through it; the next round requested through it, such as by
|
|
561
|
+
* {@link Evolu.requestSync} or a reopen, checks it again. Every route through a
|
|
562
|
+
* relay that lacks a change too large to send skips it on every sync, so those
|
|
563
|
+
* routes stay settled, and messages from other relays reach them only through
|
|
564
|
+
* such rounds.
|
|
542
565
|
*/
|
|
543
566
|
export interface SettledSyncRoute extends Typed<"Settled"> {
|
|
544
567
|
readonly transportId: SyncTransportId;
|
|
@@ -570,17 +593,19 @@ export interface CompleteSyncRoute extends Typed<"Complete"> {
|
|
|
570
593
|
*
|
|
571
594
|
* It is the error itself, so it carries its details, such as the expected and
|
|
572
595
|
* actual timestamps of a {@link ProtocolTimestampMismatchError}. A skipped
|
|
573
|
-
* message adds {@link DecryptWithXChaCha20Poly1305Error}
|
|
574
|
-
* {@link
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
596
|
+
* message adds {@link DecryptWithXChaCha20Poly1305Error} and
|
|
597
|
+
* {@link ProtocolChangeTooLargeError}. A {@link ProtocolInvalidDataError} leaves
|
|
598
|
+
* out its data, which can be a whole frame. An {@link UnknownError} means SQLite
|
|
599
|
+
* failed to store received messages, for example on a full disk. `WriteFailed`
|
|
600
|
+
* means a `writeMessages` call that threw, logged by the protocol, and
|
|
601
|
+
* `SyncFailed` means a logged failure while creating a round or reconciling
|
|
602
|
+
* ranges.
|
|
578
603
|
*/
|
|
579
604
|
export type SyncRouteError = (Exclude<ProtocolError, ProtocolInvalidDataError> | (Omit<ProtocolInvalidDataError, "data" | "error"> & {
|
|
580
605
|
readonly error: UnknownError;
|
|
581
606
|
}) | StorageWriteMessagesError | (Omit<DecryptWithXChaCha20Poly1305Error, "error"> & {
|
|
582
607
|
readonly error: UnknownError;
|
|
583
|
-
}) | Typed<"WriteFailed"> | Typed<"SyncFailed">) & {
|
|
608
|
+
}) | ProtocolChangeTooLargeError | Typed<"WriteFailed"> | Typed<"SyncFailed">) & {
|
|
584
609
|
readonly at: Millis;
|
|
585
610
|
};
|
|
586
611
|
/**
|
|
@@ -608,10 +633,10 @@ export interface RelaySyncState {
|
|
|
608
633
|
* - `Synced`: a relay is up to date, and none syncs.
|
|
609
634
|
* - `Offline`: every relay is disconnected. Evolu keeps reconnecting, up to 30
|
|
610
635
|
* seconds apart, so `Offline` can briefly outlast the outage.
|
|
611
|
-
* - `Error`: a relay failed
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
* that change.
|
|
636
|
+
* - `Error`: a relay failed, a relay offers a change this database skipped, or
|
|
637
|
+
* this database stores a change too large to send. `error` is the newest
|
|
638
|
+
* failure, or without one, the newest skipped change: a failure stops syncing
|
|
639
|
+
* through its relay, while a skipped change leaves out only that change.
|
|
615
640
|
*
|
|
616
641
|
* Evolu stores changes in the local database before they sync, so sync needs no
|
|
617
642
|
* UI while it works: show nothing for `NoRelays`, `Syncing`, and `Synced`. An
|
|
@@ -1037,10 +1062,11 @@ export type DbWorkerQueuedResponse = {
|
|
|
1037
1062
|
readonly ownerId: OwnerId;
|
|
1038
1063
|
readonly didWriteMessages: boolean;
|
|
1039
1064
|
/**
|
|
1040
|
-
* The first error of a
|
|
1041
|
-
* storing the rest, or
|
|
1065
|
+
* The first error of a message the DbWorker skipped, or null: a
|
|
1066
|
+
* received one it did not store while storing the rest, or a stored
|
|
1067
|
+
* change too large to send. It does not end the round.
|
|
1042
1068
|
*/
|
|
1043
|
-
readonly skippedError: DecryptWithXChaCha20Poly1305Error | ProtocolInvalidDataError | ProtocolTimestampMismatchError | null;
|
|
1069
|
+
readonly skippedError: DecryptWithXChaCha20Poly1305Error | ProtocolInvalidDataError | ProtocolTimestampMismatchError | ProtocolChangeTooLargeError | null;
|
|
1044
1070
|
readonly result: Result<ApplyProtocolMessageAsClientResult, ProtocolError | StorageWriteMessagesError | AbortError>;
|
|
1045
1071
|
};
|
|
1046
1072
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shared.d.ts","sourceRoot":"","sources":["../../../src/local-first/Shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiQG;AAEH,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAC;AAQrB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,YAA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,CAAC,YAAY,EACjB,iCAAiC,GACjC,wBAAwB,GACxB,8BAA8B,GAC9B,2BAA2B,GAC3B,IAAI,CAAC;QACT,QAAQ,CAAC,MAAM,EAAE,MAAM,CACrB,kCAAkC,EAClC,aAAa,GAAG,yBAAyB,GAAG,UAAU,CACvD,CAAC;KACH,CAAC;CACP,CAAC;AAEN;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACjE;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,GACvC,yBAAyB,GACzB,uBAAuB,GACvB,kBAAkB,GAClB,oBAAoB,GACpB,cAAc,CAAC;AAqRjB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,SAEnB,gBAAgB,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,KAC5D,IAAI,CAAC,oBAAoB,EAAE,KAAK,EAAE,gBAAgB,CAygBpD,CAAC"}
|
|
@@ -111,10 +111,10 @@
|
|
|
111
111
|
* whichever instance made it, even one disposed before the database worker
|
|
112
112
|
* answered. When a relay frame stores new messages, the tenant requests a round
|
|
113
113
|
* through each other transport claimed for the owner, so data learned from one
|
|
114
|
-
* relay reaches the others, except through a route that skipped a message
|
|
115
|
-
* described below. A closed transport reconciles
|
|
116
|
-
* replacement leader reconciles every transport again,
|
|
117
|
-
* reporting stored messages may have been lost.
|
|
114
|
+
* relay reaches the others, except through a route that skipped a message it
|
|
115
|
+
* received or could not send, as described below. A closed transport reconciles
|
|
116
|
+
* when it opens, and a replacement leader reconciles every transport again,
|
|
117
|
+
* because a response reporting stored messages may have been lost.
|
|
118
118
|
*
|
|
119
119
|
* Relays omit the sending socket when broadcasting an upload, so the uploader
|
|
120
120
|
* also delivers it as local Broadcast frames to every other tenant with
|
|
@@ -178,17 +178,17 @@
|
|
|
178
178
|
* request, a replacement leader, or storing messages from another transport,
|
|
179
179
|
* unless the route skipped a message. No failed or aborted result has arrived
|
|
180
180
|
* on the route since.
|
|
181
|
-
* - No result that skipped a received message
|
|
182
|
-
* round was last requested through it,
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
* skipped a message.
|
|
181
|
+
* - No result that skipped a received message or a stored change too large to
|
|
182
|
+
* send has arrived on the route since a round was last requested through it,
|
|
183
|
+
* and since that request, no messages have been stored from another
|
|
184
|
+
* transport, directly or through a sibling copy uploaded outside this
|
|
185
|
+
* transport, and no sibling copy has failed to apply or skipped a message.
|
|
186
186
|
*
|
|
187
187
|
* A route is settled when every condition except the last holds, so a complete
|
|
188
188
|
* route is settled too. A settled route that is incomplete has ended its
|
|
189
|
-
* reconciliation, but its relay may offer a message the database skipped,
|
|
190
|
-
*
|
|
191
|
-
* {@link SettledSyncRoute}.
|
|
189
|
+
* reconciliation, but its relay may offer a message the database skipped, the
|
|
190
|
+
* database may store a change too large to send, or messages stored elsewhere
|
|
191
|
+
* may not have reached it; it is published as {@link SettledSyncRoute}.
|
|
192
192
|
*
|
|
193
193
|
* A reconciliation chain ends only with a converged result, a failure, an
|
|
194
194
|
* abort, a dropped frame, or a continuation that finds the socket closed, and
|
|
@@ -207,20 +207,34 @@
|
|
|
207
207
|
* while the database worker creates a round is logged there and fails the
|
|
208
208
|
* round's routes with `SyncFailed` without a retry. A mutation that throws is
|
|
209
209
|
* rolled back and reported as an {@link UnknownError} to the tab that made it,
|
|
210
|
-
* or to every tab when its Evolu instance was disposed first.
|
|
211
|
-
* SQLite
|
|
212
|
-
*
|
|
213
|
-
*
|
|
210
|
+
* or to every tab when its Evolu instance was disposed first. A received batch
|
|
211
|
+
* SQLite fails to store, for example on a full disk, is rolled back and fails
|
|
212
|
+
* its route with an `UnknownError`. Other unexpected SQLite exceptions remain
|
|
213
|
+
* unsupported and can panic the database worker. A frame the relay silently
|
|
214
|
+
* drops, such as invalid data, leaves the count above zero until the liveness
|
|
215
|
+
* rule below replaces the socket.
|
|
214
216
|
*
|
|
215
|
-
* A result that skipped a
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
217
|
+
* A result that skipped a message records the error on the route as its
|
|
218
|
+
* `skippedError`, without ending its chain, so it requests no round. A message
|
|
219
|
+
* is skipped in two cases:
|
|
220
|
+
*
|
|
221
|
+
* - The relay offers a message the database could not decrypt, verify, or decode.
|
|
222
|
+
* The relay offers it again in every round through the route until the
|
|
223
|
+
* database stores a message with that timestamp.
|
|
224
|
+
* - The database stores a change it cannot send, a
|
|
225
|
+
* {@link ProtocolChangeTooLargeError}: one saved before `maxMutationSize`
|
|
226
|
+
* existed, or a crafted one received from a relay. Every route through a
|
|
227
|
+
* relay that lacks it skips it on every sync, so each such route stays
|
|
228
|
+
* settled.
|
|
229
|
+
*
|
|
230
|
+
* The messages received elsewhere that the last condition names request no
|
|
231
|
+
* round through such a route, even while a requested round checks it again,
|
|
232
|
+
* because each round would download every skipped message again, or skip again
|
|
233
|
+
* a change too large to send. The next round that an explicit request, a
|
|
234
|
+
* reopen, a replacement leader, or a failure sends through the route reconciles
|
|
235
|
+
* them. So while the database stores a change too large to send, messages from
|
|
236
|
+
* other relays reach a route only through such a round, for example after a
|
|
237
|
+
* reconnect or {@link Evolu.requestSync}.
|
|
224
238
|
*
|
|
225
239
|
* ### Liveness
|
|
226
240
|
*
|
|
@@ -842,8 +856,9 @@ export const initSharedWorker = (self) => async (run) => {
|
|
|
842
856
|
};
|
|
843
857
|
// Held while this worker runs. Its DbWorkers stop once they can take it,
|
|
844
858
|
// because a Dispose posted right before this worker closes can be lost, as
|
|
845
|
-
// in Firefox. Taken
|
|
846
|
-
//
|
|
859
|
+
// in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=2077609). Taken
|
|
860
|
+
// before the build lock, so nothing delays the end of starting once that
|
|
861
|
+
// lock is held.
|
|
847
862
|
disposer.use(await run.ok(acquireLeaderLock(workerId)));
|
|
848
863
|
// Released after every tenant is disposed and has told its DbWorker to
|
|
849
864
|
// stop. Earlier releases take the same lock in their leader tab; see
|
|
@@ -1588,7 +1603,8 @@ const createEvoluTenant = ({ name, consoleLevel, sqliteSchema, encryptionKey, },
|
|
|
1588
1603
|
!hasQueuedWrite;
|
|
1589
1604
|
// Settling drops the failure, so the next one requests a round
|
|
1590
1605
|
// again. A route with a skip it is not rechecking settles without
|
|
1591
|
-
// completing, because its relay may offer the skipped message
|
|
1606
|
+
// completing, because its relay may offer the skipped message, the
|
|
1607
|
+
// database may store a change too large to send, or the relay may
|
|
1592
1608
|
// lack messages stored elsewhere.
|
|
1593
1609
|
const pending = routeToPending(route.progress);
|
|
1594
1610
|
route.progress =
|
|
@@ -1684,11 +1700,12 @@ const createEvoluTenant = ({ name, consoleLevel, sqliteSchema, encryptionKey, },
|
|
|
1684
1700
|
route.lastReceivedAt = now;
|
|
1685
1701
|
// A skipped message is recorded as the route's skip, not a
|
|
1686
1702
|
// failure, and does not end the round, whose response below is
|
|
1687
|
-
// still sent, so it requests no round. The relay offers
|
|
1688
|
-
//
|
|
1689
|
-
//
|
|
1690
|
-
//
|
|
1691
|
-
//
|
|
1703
|
+
// still sent, so it requests no round. The relay offers a message
|
|
1704
|
+
// the database could not store again in every later round, and
|
|
1705
|
+
// every round skips a stored change too large to send again, so
|
|
1706
|
+
// the route stays incomplete until a round requested through it
|
|
1707
|
+
// settles without skipping a message and without messages stored
|
|
1708
|
+
// elsewhere since that request.
|
|
1692
1709
|
if (skippedError !== null)
|
|
1693
1710
|
route.progress = {
|
|
1694
1711
|
...routeToPending(route.progress),
|
|
@@ -1712,12 +1729,14 @@ const createEvoluTenant = ({ name, consoleLevel, sqliteSchema, encryptionKey, },
|
|
|
1712
1729
|
}
|
|
1713
1730
|
else if (failure !== null || skippedError !== null) {
|
|
1714
1731
|
// A sibling's copy comes from this worker, not from a relay, so no
|
|
1715
|
-
// route shows its failure.
|
|
1716
|
-
//
|
|
1717
|
-
//
|
|
1718
|
-
//
|
|
1719
|
-
//
|
|
1720
|
-
//
|
|
1732
|
+
// route shows its failure. SQLite can fail to store it, for example
|
|
1733
|
+
// on a full disk, which returns an UnknownError. It is a Broadcast,
|
|
1734
|
+
// which carries no relay error, so any other error or a skip means
|
|
1735
|
+
// a bug, such as databases holding different keys for the owner.
|
|
1736
|
+
// Each is reported as an unexpected failure. A Failed result was
|
|
1737
|
+
// logged, which reports it already. An error is the failure, which
|
|
1738
|
+
// is never an abort, and like a route, the report leaves out its
|
|
1739
|
+
// frame.
|
|
1721
1740
|
const unexpected = error !== null ? failure : skippedError;
|
|
1722
1741
|
if (unexpected !== null)
|
|
1723
1742
|
deps.postConsoleEntryOrError({
|
|
@@ -1806,9 +1825,10 @@ const createEvoluTenant = ({ name, consoleLevel, sqliteSchema, encryptionKey, },
|
|
|
1806
1825
|
* `except`, after messages from elsewhere were stored or a sibling copy was
|
|
1807
1826
|
* not fully stored. Rounds toward the same transport coalesce whatever
|
|
1808
1827
|
* their source. A route that skipped a message gets none, because its relay
|
|
1809
|
-
* would offer that message again
|
|
1810
|
-
*
|
|
1811
|
-
*
|
|
1828
|
+
* would offer that message again or the round would skip a stored change
|
|
1829
|
+
* too large to send again. A route rechecking one stops rechecking, because
|
|
1830
|
+
* its round may have read the database before this event. A later requested
|
|
1831
|
+
* round through such a route reconciles it.
|
|
1812
1832
|
*/
|
|
1813
1833
|
const requestRoundsForReceivedMessages = (ownerId, { except, afterQueuedWrites, }) => {
|
|
1814
1834
|
const keys = [];
|