@automerge/automerge-repo 1.0.19 → 1.1.0-alpha.13
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 +12 -7
- package/dist/AutomergeUrl.js +2 -2
- package/dist/DocHandle.d.ts +6 -5
- package/dist/DocHandle.d.ts.map +1 -1
- package/dist/DocHandle.js +7 -7
- package/dist/RemoteHeadsSubscriptions.d.ts +42 -0
- package/dist/RemoteHeadsSubscriptions.d.ts.map +1 -0
- package/dist/RemoteHeadsSubscriptions.js +284 -0
- package/dist/Repo.d.ts +29 -2
- package/dist/Repo.d.ts.map +1 -1
- package/dist/Repo.js +168 -9
- package/dist/helpers/debounce.js +1 -1
- package/dist/helpers/pause.d.ts.map +1 -1
- package/dist/helpers/pause.js +2 -0
- package/dist/helpers/throttle.js +1 -1
- package/dist/helpers/withTimeout.d.ts.map +1 -1
- package/dist/helpers/withTimeout.js +2 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/network/NetworkAdapter.d.ts +15 -1
- package/dist/network/NetworkAdapter.d.ts.map +1 -1
- package/dist/network/NetworkAdapter.js +3 -1
- package/dist/network/NetworkSubsystem.d.ts +4 -2
- package/dist/network/NetworkSubsystem.d.ts.map +1 -1
- package/dist/network/NetworkSubsystem.js +13 -7
- package/dist/network/messages.d.ts +68 -35
- package/dist/network/messages.d.ts.map +1 -1
- package/dist/network/messages.js +9 -7
- package/dist/storage/StorageSubsystem.d.ts +5 -3
- package/dist/storage/StorageSubsystem.d.ts.map +1 -1
- package/dist/storage/StorageSubsystem.js +23 -5
- package/dist/storage/keyHash.d.ts.map +1 -1
- package/dist/storage/types.d.ts +4 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/synchronizer/CollectionSynchronizer.d.ts +2 -2
- package/dist/synchronizer/CollectionSynchronizer.d.ts.map +1 -1
- package/dist/synchronizer/CollectionSynchronizer.js +9 -3
- package/dist/synchronizer/DocSynchronizer.d.ts.map +1 -1
- package/dist/synchronizer/DocSynchronizer.js +20 -17
- package/dist/synchronizer/Synchronizer.d.ts +12 -3
- package/dist/synchronizer/Synchronizer.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/AutomergeUrl.ts +2 -2
- package/src/DocHandle.ts +10 -9
- package/src/RemoteHeadsSubscriptions.ts +375 -0
- package/src/Repo.ts +241 -16
- package/src/helpers/debounce.ts +1 -1
- package/src/helpers/pause.ts +4 -0
- package/src/helpers/throttle.ts +1 -1
- package/src/helpers/withTimeout.ts +2 -0
- package/src/index.ts +3 -1
- package/src/network/NetworkAdapter.ts +19 -2
- package/src/network/NetworkSubsystem.ts +21 -9
- package/src/network/messages.ts +88 -50
- package/src/storage/StorageSubsystem.ts +30 -7
- package/src/storage/keyHash.ts +2 -0
- package/src/storage/types.ts +3 -0
- package/src/synchronizer/CollectionSynchronizer.ts +13 -5
- package/src/synchronizer/DocSynchronizer.ts +27 -27
- package/src/synchronizer/Synchronizer.ts +13 -3
- package/test/DocHandle.test.ts +0 -17
- package/test/RemoteHeadsSubscriptions.test.ts +353 -0
- package/test/Repo.test.ts +108 -17
- package/test/StorageSubsystem.test.ts +29 -7
- package/test/helpers/waitForMessages.ts +22 -0
- package/test/remoteHeads.test.ts +260 -0
- package/.eslintrc +0 -28
package/README.md
CHANGED
|
@@ -45,6 +45,10 @@ A `Repo` exposes these methods:
|
|
|
45
45
|
networks.
|
|
46
46
|
- `delete(docId: DocumentId)`
|
|
47
47
|
Deletes the local copy of a document from the local cache and local storage. _This does not currently delete the document from any other peers_.
|
|
48
|
+
- `import(binary: Uint8Array)`
|
|
49
|
+
Imports a document binary (from `export()` or `Automerge.save(doc)`) into the repo, returning a new handle
|
|
50
|
+
- `export(docId: DocumentId)`
|
|
51
|
+
Exports the document. Returns a Promise containing either the Uint8Array of the document or undefined if the document is currently unavailable. See the [Automerge binary format spec](https://automerge.org/automerge-binary-format-spec/) for more details on the shape of the Uint8Array.
|
|
48
52
|
- `.on("document", ({handle: DocHandle}) => void)`
|
|
49
53
|
Registers a callback to be fired each time a new document is loaded or created.
|
|
50
54
|
- `.on("delete-document", ({handle: DocHandle}) => void)`
|
|
@@ -64,7 +68,7 @@ the document.
|
|
|
64
68
|
|
|
65
69
|
A `DocHandle` also emits these events:
|
|
66
70
|
|
|
67
|
-
- `change({handle: DocHandle, patches: Patch[], patchInfo: PatchInfo})`
|
|
71
|
+
- `change({handle: DocHandle, patches: Patch[], patchInfo: PatchInfo})`
|
|
68
72
|
Called whenever the document changes, the handle's .doc
|
|
69
73
|
- `delete`
|
|
70
74
|
Called when the document is deleted locally.
|
|
@@ -85,11 +89,12 @@ network adapter:
|
|
|
85
89
|
const repo = new Repo({
|
|
86
90
|
network: [new BroadcastChannelNetworkAdapter()],
|
|
87
91
|
storage: new IndexedDBStorageAdapter(),
|
|
88
|
-
sharePolicy: async (peerId: PeerId, documentId: DocumentId) => true // this is the default
|
|
92
|
+
sharePolicy: async (peerId: PeerId, documentId: DocumentId) => true, // this is the default
|
|
89
93
|
})
|
|
90
94
|
```
|
|
91
95
|
|
|
92
96
|
### Share Policy
|
|
97
|
+
|
|
93
98
|
The share policy is used to determine which document in your repo should be _automatically_ shared with other peers. **The default setting is to share all documents with all peers.**
|
|
94
99
|
|
|
95
100
|
> **Warning**
|
|
@@ -99,7 +104,6 @@ You can override this by providing a custom share policy. The function should re
|
|
|
99
104
|
|
|
100
105
|
The share policy will not stop a document being _requested_ by another peer by its `DocumentId`.
|
|
101
106
|
|
|
102
|
-
```ts
|
|
103
107
|
## Starting the demo app
|
|
104
108
|
|
|
105
109
|
```bash
|
|
@@ -272,7 +276,8 @@ you'll need to manually copy the `rootDocId` value between the browsers.)
|
|
|
272
276
|
Originally authored by Peter van Hardenberg.
|
|
273
277
|
|
|
274
278
|
With gratitude for contributions by:
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
+
|
|
280
|
+
- Herb Caudill
|
|
281
|
+
- Jeremy Rose
|
|
282
|
+
- Alex Currie-Clark
|
|
283
|
+
- Dylan Mackenzie
|
package/dist/AutomergeUrl.js
CHANGED
|
@@ -4,7 +4,7 @@ export const urlPrefix = "automerge:";
|
|
|
4
4
|
/** Given an Automerge URL, returns the DocumentId in both base58check-encoded form and binary form */
|
|
5
5
|
export const parseAutomergeUrl = (url) => {
|
|
6
6
|
const regex = new RegExp(`^${urlPrefix}(\\w+)$`);
|
|
7
|
-
const [
|
|
7
|
+
const [, docMatch] = url.match(regex) || [];
|
|
8
8
|
const documentId = docMatch;
|
|
9
9
|
const binaryDocumentId = documentIdToBinary(documentId);
|
|
10
10
|
if (!binaryDocumentId)
|
|
@@ -21,7 +21,7 @@ export const parseAutomergeUrl = (url) => {
|
|
|
21
21
|
* Throws on invalid input.
|
|
22
22
|
*/
|
|
23
23
|
export const stringifyAutomergeUrl = (arg) => {
|
|
24
|
-
|
|
24
|
+
const documentId = arg instanceof Uint8Array || typeof arg === "string"
|
|
25
25
|
? arg
|
|
26
26
|
: "documentId" in arg
|
|
27
27
|
? arg.documentId
|
package/dist/DocHandle.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as A from "@automerge/automerge/next";
|
|
|
2
2
|
import { EventEmitter } from "eventemitter3";
|
|
3
3
|
import { StateValue } from "xstate";
|
|
4
4
|
import type { AutomergeUrl, DocumentId, PeerId } from "./types.js";
|
|
5
|
+
import { StorageId } from "./storage/types.js";
|
|
5
6
|
/** DocHandle is a wrapper around a single Automerge document that lets us
|
|
6
7
|
* listen for changes and notify the network and storage of new changes.
|
|
7
8
|
*
|
|
@@ -73,12 +74,12 @@ export declare class DocHandle<T>//
|
|
|
73
74
|
* @hidden
|
|
74
75
|
* */
|
|
75
76
|
update(callback: (doc: A.Doc<T>) => A.Doc<T>): void;
|
|
76
|
-
/** `setRemoteHeads` is called by the doc
|
|
77
|
+
/** `setRemoteHeads` is called by the repo either when a doc handle changes or we receive new remote heads
|
|
77
78
|
* @hidden
|
|
78
79
|
*/
|
|
79
|
-
setRemoteHeads(
|
|
80
|
-
/** Returns the heads of the
|
|
81
|
-
getRemoteHeads(
|
|
80
|
+
setRemoteHeads(storageId: StorageId, heads: A.Heads): void;
|
|
81
|
+
/** Returns the heads of the storageId */
|
|
82
|
+
getRemoteHeads(storageId: StorageId): A.Heads | undefined;
|
|
82
83
|
/** `change` is called by the repo when the document is changed locally */
|
|
83
84
|
change(callback: A.ChangeFn<T>, options?: A.ChangeOptions<T>): void;
|
|
84
85
|
/** Make a change as if the document were at `heads`
|
|
@@ -156,7 +157,7 @@ export interface DocHandleOutboundEphemeralMessagePayload<T> {
|
|
|
156
157
|
data: Uint8Array;
|
|
157
158
|
}
|
|
158
159
|
export interface DocHandleRemoteHeadsPayload {
|
|
159
|
-
|
|
160
|
+
storageId: StorageId;
|
|
160
161
|
heads: A.Heads;
|
|
161
162
|
}
|
|
162
163
|
export interface DocHandleSyncStatePayload {
|
package/dist/DocHandle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocHandle.d.ts","sourceRoot":"","sources":["../src/DocHandle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,2BAA2B,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EASL,UAAU,EAEX,MAAM,QAAQ,CAAA;AAMf,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"DocHandle.d.ts","sourceRoot":"","sources":["../src/DocHandle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,2BAA2B,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EASL,UAAU,EAEX,MAAM,QAAQ,CAAA;AAMf,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,YAAY,CA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sD;;IAEtD,6EAA6E;;IAE7E,gCAAgC;;IAEhC,kDAAkD;;IAElD,4EAA4E;;CAEpE,CAAA;AACV,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA;AAkBxE,eAAO,MAAM,KAAK;;;;;;;;;;;CAWR,CAAA;AA8CV,eAAO,MACL,IAAI,UACJ,OAAO,aACP,gBAAgB,qBAChB,UAAU,gBACV,KAAK,WACL,OAAO,aACP,WAAW,eACE,CAAA"}
|
package/dist/DocHandle.js
CHANGED
|
@@ -270,16 +270,16 @@ export class DocHandle//
|
|
|
270
270
|
payload: { callback },
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
|
-
/** `setRemoteHeads` is called by the doc
|
|
273
|
+
/** `setRemoteHeads` is called by the repo either when a doc handle changes or we receive new remote heads
|
|
274
274
|
* @hidden
|
|
275
275
|
*/
|
|
276
|
-
setRemoteHeads(
|
|
277
|
-
this.#remoteHeads[
|
|
278
|
-
this.emit("remote-heads", {
|
|
276
|
+
setRemoteHeads(storageId, heads) {
|
|
277
|
+
this.#remoteHeads[storageId] = heads;
|
|
278
|
+
this.emit("remote-heads", { storageId, heads });
|
|
279
279
|
}
|
|
280
|
-
/** Returns the heads of the
|
|
281
|
-
getRemoteHeads(
|
|
282
|
-
return this.#remoteHeads[
|
|
280
|
+
/** Returns the heads of the storageId */
|
|
281
|
+
getRemoteHeads(storageId) {
|
|
282
|
+
return this.#remoteHeads[storageId];
|
|
283
283
|
}
|
|
284
284
|
/** `change` is called by the repo when the document is changed locally */
|
|
285
285
|
change(callback, options = {}) {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { next as A } from "@automerge/automerge";
|
|
2
|
+
import { EventEmitter } from "eventemitter3";
|
|
3
|
+
import { DocumentId, PeerId } from "./types.js";
|
|
4
|
+
import { RemoteHeadsChanged, RemoteSubscriptionControlMessage } from "./network/messages.js";
|
|
5
|
+
import { StorageId } from "./index.js";
|
|
6
|
+
export type RemoteHeadsSubscriptionEventPayload = {
|
|
7
|
+
documentId: DocumentId;
|
|
8
|
+
storageId: StorageId;
|
|
9
|
+
remoteHeads: A.Heads;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
};
|
|
12
|
+
export type NotifyRemoteHeadsPayload = {
|
|
13
|
+
targetId: PeerId;
|
|
14
|
+
documentId: DocumentId;
|
|
15
|
+
storageId: StorageId;
|
|
16
|
+
heads: A.Heads;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
};
|
|
19
|
+
type RemoteHeadsSubscriptionEvents = {
|
|
20
|
+
"remote-heads-changed": (payload: RemoteHeadsSubscriptionEventPayload) => void;
|
|
21
|
+
"change-remote-subs": (payload: {
|
|
22
|
+
peers: PeerId[];
|
|
23
|
+
add?: StorageId[];
|
|
24
|
+
remove?: StorageId[];
|
|
25
|
+
}) => void;
|
|
26
|
+
"notify-remote-heads": (payload: NotifyRemoteHeadsPayload) => void;
|
|
27
|
+
};
|
|
28
|
+
export declare class RemoteHeadsSubscriptions extends EventEmitter<RemoteHeadsSubscriptionEvents> {
|
|
29
|
+
#private;
|
|
30
|
+
subscribeToRemotes(remotes: StorageId[]): void;
|
|
31
|
+
unsubscribeFromRemotes(remotes: StorageId[]): void;
|
|
32
|
+
handleControlMessage(control: RemoteSubscriptionControlMessage): void;
|
|
33
|
+
/** A peer we are not directly connected to has changed their heads */
|
|
34
|
+
handleRemoteHeads(msg: RemoteHeadsChanged): void;
|
|
35
|
+
/** A peer we are directly connected to has updated their heads */
|
|
36
|
+
handleImmediateRemoteHeadsChanged(documentId: DocumentId, storageId: StorageId, heads: A.Heads): void;
|
|
37
|
+
addGenerousPeer(peerId: PeerId): void;
|
|
38
|
+
removePeer(peerId: PeerId): void;
|
|
39
|
+
subscribePeerToDoc(peerId: PeerId, documentId: DocumentId): void;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=RemoteHeadsSubscriptions.d.ts.map
|
|
@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,SAAS,EAAE;IAkBvC,sBAAsB,CAAC,OAAO,EAAE,SAAS,EAAE;IAsB3C,oBAAoB,CAAC,OAAO,EAAE,gCAAgC;IA0E9D,sEAAsE;IACtE,iBAAiB,CAAC,GAAG,EAAE,kBAAkB;IAgDzC,kEAAkE;IAClE,iCAAiC,CAC/B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,CAAC,CAAC,KAAK;IAgChB,eAAe,CAAC,MAAM,EAAE,MAAM;IAwB9B,UAAU,CAAC,MAAM,EAAE,MAAM;IA2BzB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU;CAoE1D"}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { EventEmitter } from "eventemitter3";
|
|
2
|
+
import debug from "debug";
|
|
3
|
+
export class RemoteHeadsSubscriptions extends EventEmitter {
|
|
4
|
+
// Storage IDs we have received remote heads from
|
|
5
|
+
#knownHeads = new Map();
|
|
6
|
+
// Storage IDs we have subscribed to via Repo.subscribeToRemoteHeads
|
|
7
|
+
#ourSubscriptions = new Set();
|
|
8
|
+
// Storage IDs other peers have subscribed to by sending us a control message
|
|
9
|
+
#theirSubscriptions = new Map();
|
|
10
|
+
// Peers we will always share remote heads with even if they are not subscribed
|
|
11
|
+
#generousPeers = new Set();
|
|
12
|
+
// Documents each peer has open, we need this information so we only send remote heads of documents that the peer knows
|
|
13
|
+
#subscribedDocsByPeer = new Map();
|
|
14
|
+
#log = debug("automerge-repo:remote-heads-subscriptions");
|
|
15
|
+
subscribeToRemotes(remotes) {
|
|
16
|
+
this.#log("subscribeToRemotes", remotes);
|
|
17
|
+
const remotesToAdd = [];
|
|
18
|
+
for (const remote of remotes) {
|
|
19
|
+
if (!this.#ourSubscriptions.has(remote)) {
|
|
20
|
+
this.#ourSubscriptions.add(remote);
|
|
21
|
+
remotesToAdd.push(remote);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (remotesToAdd.length > 0) {
|
|
25
|
+
this.emit("change-remote-subs", {
|
|
26
|
+
add: remotesToAdd,
|
|
27
|
+
peers: Array.from(this.#generousPeers),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
unsubscribeFromRemotes(remotes) {
|
|
32
|
+
this.#log("subscribeToRemotes", remotes);
|
|
33
|
+
const remotesToRemove = [];
|
|
34
|
+
for (const remote of remotes) {
|
|
35
|
+
if (this.#ourSubscriptions.has(remote)) {
|
|
36
|
+
this.#ourSubscriptions.delete(remote);
|
|
37
|
+
if (!this.#theirSubscriptions.has(remote)) {
|
|
38
|
+
remotesToRemove.push(remote);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (remotesToRemove.length > 0) {
|
|
43
|
+
this.emit("change-remote-subs", {
|
|
44
|
+
remove: remotesToRemove,
|
|
45
|
+
peers: Array.from(this.#generousPeers),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
handleControlMessage(control) {
|
|
50
|
+
const remotesToAdd = [];
|
|
51
|
+
const remotesToRemove = [];
|
|
52
|
+
const addedRemotesWeKnow = [];
|
|
53
|
+
this.#log("handleControlMessage", control);
|
|
54
|
+
if (control.add) {
|
|
55
|
+
for (const remote of control.add) {
|
|
56
|
+
let theirSubs = this.#theirSubscriptions.get(remote);
|
|
57
|
+
if (this.#ourSubscriptions.has(remote) || theirSubs) {
|
|
58
|
+
addedRemotesWeKnow.push(remote);
|
|
59
|
+
}
|
|
60
|
+
if (!theirSubs) {
|
|
61
|
+
theirSubs = new Set();
|
|
62
|
+
this.#theirSubscriptions.set(remote, theirSubs);
|
|
63
|
+
if (!this.#ourSubscriptions.has(remote)) {
|
|
64
|
+
remotesToAdd.push(remote);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
theirSubs.add(control.senderId);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (control.remove) {
|
|
71
|
+
for (const remote of control.remove) {
|
|
72
|
+
const theirSubs = this.#theirSubscriptions.get(remote);
|
|
73
|
+
if (theirSubs) {
|
|
74
|
+
theirSubs.delete(control.senderId);
|
|
75
|
+
// if no one is subscribed anymore remove remote
|
|
76
|
+
if (theirSubs.size == 0 && !this.#ourSubscriptions.has(remote)) {
|
|
77
|
+
remotesToRemove.push(remote);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (remotesToAdd.length > 0 || remotesToRemove.length > 0) {
|
|
83
|
+
this.emit("change-remote-subs", {
|
|
84
|
+
peers: Array.from(this.#generousPeers),
|
|
85
|
+
add: remotesToAdd,
|
|
86
|
+
remove: remotesToRemove,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// send all our stored heads of documents the peer knows for the remotes they've added
|
|
90
|
+
for (const remote of addedRemotesWeKnow) {
|
|
91
|
+
const subscribedDocs = this.#subscribedDocsByPeer.get(control.senderId);
|
|
92
|
+
if (subscribedDocs) {
|
|
93
|
+
for (const documentId of subscribedDocs) {
|
|
94
|
+
const knownHeads = this.#knownHeads.get(documentId);
|
|
95
|
+
if (!knownHeads) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const lastHeads = knownHeads.get(remote);
|
|
99
|
+
if (lastHeads) {
|
|
100
|
+
this.emit("notify-remote-heads", {
|
|
101
|
+
targetId: control.senderId,
|
|
102
|
+
documentId,
|
|
103
|
+
heads: lastHeads.heads,
|
|
104
|
+
timestamp: lastHeads.timestamp,
|
|
105
|
+
storageId: remote,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/** A peer we are not directly connected to has changed their heads */
|
|
113
|
+
handleRemoteHeads(msg) {
|
|
114
|
+
this.#log("handleRemoteHeads", msg);
|
|
115
|
+
const changedHeads = this.#changedHeads(msg);
|
|
116
|
+
// Emit a remote-heads-changed event to update local dochandles
|
|
117
|
+
for (const event of changedHeads) {
|
|
118
|
+
if (this.#ourSubscriptions.has(event.storageId)) {
|
|
119
|
+
this.emit("remote-heads-changed", event);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Notify generous peers of these changes regardless of if they are subscribed to us
|
|
123
|
+
for (const event of changedHeads) {
|
|
124
|
+
for (const peer of this.#generousPeers) {
|
|
125
|
+
// don't emit event to sender if sender is a generous peer
|
|
126
|
+
if (peer === msg.senderId) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
this.emit("notify-remote-heads", {
|
|
130
|
+
targetId: peer,
|
|
131
|
+
documentId: event.documentId,
|
|
132
|
+
heads: event.remoteHeads,
|
|
133
|
+
timestamp: event.timestamp,
|
|
134
|
+
storageId: event.storageId,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Notify subscribers of these changes
|
|
139
|
+
for (const event of changedHeads) {
|
|
140
|
+
const theirSubs = this.#theirSubscriptions.get(event.storageId);
|
|
141
|
+
if (theirSubs) {
|
|
142
|
+
for (const peerId of theirSubs) {
|
|
143
|
+
if (this.#isPeerSubscribedToDoc(peerId, event.documentId)) {
|
|
144
|
+
this.emit("notify-remote-heads", {
|
|
145
|
+
targetId: peerId,
|
|
146
|
+
documentId: event.documentId,
|
|
147
|
+
heads: event.remoteHeads,
|
|
148
|
+
timestamp: event.timestamp,
|
|
149
|
+
storageId: event.storageId,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/** A peer we are directly connected to has updated their heads */
|
|
157
|
+
handleImmediateRemoteHeadsChanged(documentId, storageId, heads) {
|
|
158
|
+
this.#log("handleLocalHeadsChanged", documentId, storageId, heads);
|
|
159
|
+
const remote = this.#knownHeads.get(documentId);
|
|
160
|
+
const timestamp = Date.now();
|
|
161
|
+
if (!remote) {
|
|
162
|
+
this.#knownHeads.set(documentId, new Map([[storageId, { heads, timestamp }]]));
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
const docRemote = remote.get(storageId);
|
|
166
|
+
if (!docRemote || docRemote.timestamp < Date.now()) {
|
|
167
|
+
remote.set(storageId, { heads, timestamp: Date.now() });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const theirSubs = this.#theirSubscriptions.get(storageId);
|
|
171
|
+
if (theirSubs) {
|
|
172
|
+
for (const peerId of theirSubs) {
|
|
173
|
+
if (this.#isPeerSubscribedToDoc(peerId, documentId)) {
|
|
174
|
+
this.emit("notify-remote-heads", {
|
|
175
|
+
targetId: peerId,
|
|
176
|
+
documentId: documentId,
|
|
177
|
+
heads: heads,
|
|
178
|
+
timestamp: timestamp,
|
|
179
|
+
storageId: storageId,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
addGenerousPeer(peerId) {
|
|
186
|
+
this.#log("addGenerousPeer", peerId);
|
|
187
|
+
this.#generousPeers.add(peerId);
|
|
188
|
+
if (this.#ourSubscriptions.size > 0) {
|
|
189
|
+
this.emit("change-remote-subs", {
|
|
190
|
+
add: Array.from(this.#ourSubscriptions),
|
|
191
|
+
peers: [peerId],
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
for (const [documentId, remote] of this.#knownHeads) {
|
|
195
|
+
for (const [storageId, { heads, timestamp }] of remote) {
|
|
196
|
+
this.emit("notify-remote-heads", {
|
|
197
|
+
targetId: peerId,
|
|
198
|
+
documentId: documentId,
|
|
199
|
+
heads: heads,
|
|
200
|
+
timestamp: timestamp,
|
|
201
|
+
storageId: storageId,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
removePeer(peerId) {
|
|
207
|
+
this.#log("removePeer", peerId);
|
|
208
|
+
const remotesToRemove = [];
|
|
209
|
+
this.#generousPeers.delete(peerId);
|
|
210
|
+
this.#subscribedDocsByPeer.delete(peerId);
|
|
211
|
+
for (const [storageId, peerIds] of this.#theirSubscriptions) {
|
|
212
|
+
if (peerIds.has(peerId)) {
|
|
213
|
+
peerIds.delete(peerId);
|
|
214
|
+
if (peerIds.size == 0) {
|
|
215
|
+
remotesToRemove.push(storageId);
|
|
216
|
+
this.#theirSubscriptions.delete(storageId);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (remotesToRemove.length > 0) {
|
|
221
|
+
this.emit("change-remote-subs", {
|
|
222
|
+
remove: remotesToRemove,
|
|
223
|
+
peers: Array.from(this.#generousPeers),
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
subscribePeerToDoc(peerId, documentId) {
|
|
228
|
+
let subscribedDocs = this.#subscribedDocsByPeer.get(peerId);
|
|
229
|
+
if (!subscribedDocs) {
|
|
230
|
+
subscribedDocs = new Set();
|
|
231
|
+
this.#subscribedDocsByPeer.set(peerId, subscribedDocs);
|
|
232
|
+
}
|
|
233
|
+
subscribedDocs.add(documentId);
|
|
234
|
+
const remoteHeads = this.#knownHeads.get(documentId);
|
|
235
|
+
if (remoteHeads) {
|
|
236
|
+
for (const [storageId, lastHeads] of remoteHeads) {
|
|
237
|
+
const subscribedPeers = this.#theirSubscriptions.get(storageId);
|
|
238
|
+
if (subscribedPeers && subscribedPeers.has(peerId)) {
|
|
239
|
+
this.emit("notify-remote-heads", {
|
|
240
|
+
targetId: peerId,
|
|
241
|
+
documentId,
|
|
242
|
+
heads: lastHeads.heads,
|
|
243
|
+
timestamp: lastHeads.timestamp,
|
|
244
|
+
storageId,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
#isPeerSubscribedToDoc(peerId, documentId) {
|
|
251
|
+
const subscribedDocs = this.#subscribedDocsByPeer.get(peerId);
|
|
252
|
+
return subscribedDocs && subscribedDocs.has(documentId);
|
|
253
|
+
}
|
|
254
|
+
/** Returns the (document, storageId) pairs which have changed after processing msg */
|
|
255
|
+
#changedHeads(msg) {
|
|
256
|
+
const changedHeads = [];
|
|
257
|
+
const { documentId, newHeads } = msg;
|
|
258
|
+
for (const [storageId, { heads, timestamp }] of Object.entries(newHeads)) {
|
|
259
|
+
if (!this.#ourSubscriptions.has(storageId) &&
|
|
260
|
+
!this.#theirSubscriptions.has(storageId)) {
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
let remote = this.#knownHeads.get(documentId);
|
|
264
|
+
if (!remote) {
|
|
265
|
+
remote = new Map();
|
|
266
|
+
this.#knownHeads.set(documentId, remote);
|
|
267
|
+
}
|
|
268
|
+
const docRemote = remote.get(storageId);
|
|
269
|
+
if (docRemote && docRemote.timestamp >= timestamp) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
remote.set(storageId, { timestamp, heads });
|
|
274
|
+
changedHeads.push({
|
|
275
|
+
documentId,
|
|
276
|
+
storageId: storageId,
|
|
277
|
+
remoteHeads: heads,
|
|
278
|
+
timestamp,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return changedHeads;
|
|
283
|
+
}
|
|
284
|
+
}
|
package/dist/Repo.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { EventEmitter } from "eventemitter3";
|
|
2
2
|
import { DocHandle } from "./DocHandle.js";
|
|
3
|
-
import { NetworkAdapter } from "./network/NetworkAdapter.js";
|
|
3
|
+
import { NetworkAdapter, type PeerMetadata } from "./network/NetworkAdapter.js";
|
|
4
4
|
import { NetworkSubsystem } from "./network/NetworkSubsystem.js";
|
|
5
5
|
import { StorageAdapter } from "./storage/StorageAdapter.js";
|
|
6
6
|
import { StorageSubsystem } from "./storage/StorageSubsystem.js";
|
|
7
|
+
import { StorageId } from "./storage/types.js";
|
|
7
8
|
import type { AnyDocumentId, DocumentId, PeerId } from "./types.js";
|
|
8
9
|
/** A Repo is a collection of documents with networking, syncing, and storage capabilities. */
|
|
9
10
|
/** The `Repo` is the main entry point of this library
|
|
@@ -25,11 +26,15 @@ export declare class Repo extends EventEmitter<RepoEvents> {
|
|
|
25
26
|
/** By default, we share generously with all peers. */
|
|
26
27
|
/** @hidden */
|
|
27
28
|
sharePolicy: SharePolicy;
|
|
28
|
-
|
|
29
|
+
/** maps peer id to to persistence information (storageId, isEphemeral), access by collection synchronizer */
|
|
30
|
+
/** @hidden */
|
|
31
|
+
peerMetadataByPeerId: Record<PeerId, PeerMetadata>;
|
|
32
|
+
constructor({ storage, network, peerId, sharePolicy, isEphemeral, enableRemoteHeadsGossiping, }: RepoConfig);
|
|
29
33
|
/** Returns all the handles we have cached. */
|
|
30
34
|
get handles(): Record<DocumentId, DocHandle<any>>;
|
|
31
35
|
/** Returns a list of all connected peer ids */
|
|
32
36
|
get peers(): PeerId[];
|
|
37
|
+
getStorageIdOfPeer(peerId: PeerId): StorageId | undefined;
|
|
33
38
|
/**
|
|
34
39
|
* Creates a new document and returns a handle to it. The initial value of the document is
|
|
35
40
|
* an empty object `{}`. Its documentId is generated by the system. we emit a `document` event
|
|
@@ -62,10 +67,28 @@ export declare class Repo extends EventEmitter<RepoEvents> {
|
|
|
62
67
|
delete(
|
|
63
68
|
/** The url or documentId of the handle to delete */
|
|
64
69
|
id: AnyDocumentId): void;
|
|
70
|
+
/**
|
|
71
|
+
* Exports a document to a binary format.
|
|
72
|
+
* @param id - The url or documentId of the handle to export
|
|
73
|
+
*
|
|
74
|
+
* @returns Promise<Uint8Array | undefined> - A Promise containing the binary document,
|
|
75
|
+
* or undefined if the document is unavailable.
|
|
76
|
+
*/
|
|
77
|
+
export(id: AnyDocumentId): Promise<Uint8Array | undefined>;
|
|
78
|
+
/**
|
|
79
|
+
* Imports document binary into the repo.
|
|
80
|
+
* @param binary - The binary to import
|
|
81
|
+
*/
|
|
82
|
+
import<T>(binary: Uint8Array): DocHandle<T>;
|
|
83
|
+
subscribeToRemotes: (remotes: StorageId[]) => void;
|
|
84
|
+
storageId: () => Promise<StorageId | undefined>;
|
|
65
85
|
}
|
|
66
86
|
export interface RepoConfig {
|
|
67
87
|
/** Our unique identifier */
|
|
68
88
|
peerId?: PeerId;
|
|
89
|
+
/** Indicates whether other peers should persist the sync state of this peer.
|
|
90
|
+
* Sync state is only persisted for non-ephemeral peers */
|
|
91
|
+
isEphemeral?: boolean;
|
|
69
92
|
/** A storage adapter can be provided, or not */
|
|
70
93
|
storage?: StorageAdapter;
|
|
71
94
|
/** One or more network adapters must be provided */
|
|
@@ -75,6 +98,10 @@ export interface RepoConfig {
|
|
|
75
98
|
* all peers). A server only syncs documents that a peer explicitly requests by ID.
|
|
76
99
|
*/
|
|
77
100
|
sharePolicy?: SharePolicy;
|
|
101
|
+
/**
|
|
102
|
+
* Whether to enable the experimental remote heads gossiping feature
|
|
103
|
+
*/
|
|
104
|
+
enableRemoteHeadsGossiping?: boolean;
|
|
78
105
|
}
|
|
79
106
|
/** A function that determines whether we should share a document with a peer
|
|
80
107
|
*
|
package/dist/Repo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repo.d.ts","sourceRoot":"","sources":["../src/Repo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAM5C,OAAO,EAAE,SAAS,EAAiC,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"Repo.d.ts","sourceRoot":"","sources":["../src/Repo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAM5C,OAAO,EAAE,SAAS,EAAiC,MAAM,gBAAgB,CAAA;AAIzE,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA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