@ibgib/core-gib 0.1.27 → 0.1.29
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/common/meta-stone/meta-stone-helper.d.mts.map +1 -1
- package/dist/common/meta-stone/meta-stone-helper.mjs +19 -7
- package/dist/common/meta-stone/meta-stone-helper.mjs.map +1 -1
- package/dist/sync/sync-helpers.d.mts +11 -5
- package/dist/sync/sync-helpers.d.mts.map +1 -1
- package/dist/sync/sync-helpers.mjs +33 -9
- package/dist/sync/sync-helpers.mjs.map +1 -1
- package/dist/sync/sync-innerspace-constants.respec.mjs +36 -36
- package/dist/sync/sync-innerspace-constants.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-deep-updates.respec.mjs +5 -3
- package/dist/sync/sync-innerspace-deep-updates.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs +2 -2
- package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-partial-update.respec.mjs +3 -3
- package/dist/sync/sync-innerspace-partial-update.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace.respec.mjs +49 -20
- package/dist/sync/sync-innerspace.respec.mjs.map +1 -1
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts +0 -9
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts.map +1 -1
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs +13 -42
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs.map +1 -1
- package/dist/sync/sync-peer/sync-peer-v1.mjs +2 -2
- package/dist/sync/sync-peer/sync-peer-v1.mjs.map +1 -1
- package/dist/sync/sync-saga-coordinator.d.mts +23 -159
- package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
- package/dist/sync/sync-saga-coordinator.mjs +508 -172
- package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts +12 -17
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts.map +1 -1
- package/dist/sync/sync-types.d.mts +18 -23
- package/dist/sync/sync-types.d.mts.map +1 -1
- package/dist/sync/sync-types.mjs +15 -21
- package/dist/sync/sync-types.mjs.map +1 -1
- package/package.json +1 -1
- package/src/common/meta-stone/meta-stone-helper.mts +17 -7
- package/src/sync/sync-helpers.mts +36 -13
- package/src/sync/sync-innerspace-constants.respec.mts +39 -39
- package/src/sync/sync-innerspace-deep-updates.respec.mts +6 -6
- package/src/sync/sync-innerspace-multiple-timelines.respec.mts +1 -1
- package/src/sync/sync-innerspace-partial-update.respec.mts +2 -2
- package/src/sync/sync-innerspace.respec.mts +20 -19
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mts +11 -58
- package/src/sync/sync-peer/sync-peer-v1.mts +2 -2
- package/src/sync/sync-saga-coordinator.mts +472 -191
- package/src/sync/sync-saga-message/sync-saga-message-types.mts +13 -18
- package/src/sync/sync-types.mts +26 -33
- package/test_output.log +0 -0
- package/tmp.md +170 -62
|
@@ -3,14 +3,9 @@ import { IbGibSpaceAny } from "../witness/space/space-base-v1.mjs";
|
|
|
3
3
|
import { KeystoneIbGib_V1 } from "../keystone/keystone-types.mjs";
|
|
4
4
|
import { KeystoneService_V1 } from "../keystone/keystone-service-v1.mjs";
|
|
5
5
|
import { MetaspaceService } from "../witness/space/metaspace/metaspace-types.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { SyncIbGib_V1, SyncConflictStrategy, SyncOptions, DomainIbGibAnalysisInfo, NextSagaFrameInfo, HandleSagaResponseContextResult } from "./sync-types.mjs";
|
|
8
|
-
import { SyncSagaMessageData_V1, SyncSagaMessageInitData_V1 } from "./sync-saga-message/sync-saga-message-types.mjs";
|
|
6
|
+
import { SyncOptions } from "./sync-types.mjs";
|
|
9
7
|
import { SyncSagaInfo } from "./sync-types.mjs";
|
|
10
|
-
import { SyncPeerWitness } from "./sync-peer/sync-peer-types.mjs";
|
|
11
8
|
import { SyncSagaContextIbGib_V1 } from "./sync-saga-context/sync-saga-context-types.mjs";
|
|
12
|
-
import { SubjectWitness } from "../common/pubsub/subject/subject-types.mjs";
|
|
13
|
-
import { FlatIbGibGraph } from "../common/other/graph-types.mjs";
|
|
14
9
|
/**
|
|
15
10
|
* Orchestrates the synchronization process between two spaces (Source and Destination).
|
|
16
11
|
*
|
|
@@ -25,8 +20,8 @@ import { FlatIbGibGraph } from "../common/other/graph-types.mjs";
|
|
|
25
20
|
* to a specific Saga session, not fixed node identities.
|
|
26
21
|
*/
|
|
27
22
|
export declare class SyncSagaCoordinator {
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
private keystone;
|
|
24
|
+
private lc;
|
|
30
25
|
constructor(keystone: KeystoneService_V1);
|
|
31
26
|
/**
|
|
32
27
|
* Executes a synchronization saga using the Symmetric Sync Protocol.
|
|
@@ -67,11 +62,7 @@ export declare class SyncSagaCoordinator {
|
|
|
67
62
|
identitySecret?: string;
|
|
68
63
|
metaspace: MetaspaceService;
|
|
69
64
|
}): Promise<SyncSagaContextIbGib_V1 | null>;
|
|
70
|
-
|
|
71
|
-
sagaId: string;
|
|
72
|
-
metaspace: MetaspaceService;
|
|
73
|
-
tempSpace: IbGibSpaceAny;
|
|
74
|
-
}): Promise<KeystoneIbGib_V1>;
|
|
65
|
+
private getSessionIdentity;
|
|
75
66
|
/**
|
|
76
67
|
* Drives the FSM loop of the Saga.
|
|
77
68
|
*
|
|
@@ -87,22 +78,7 @@ export declare class SyncSagaCoordinator {
|
|
|
87
78
|
* the NEXT request context.
|
|
88
79
|
* When the Peer responds with data (in the response context), it is resolved and put into `tempSpace`.
|
|
89
80
|
*/
|
|
90
|
-
|
|
91
|
-
initFrame: SyncIbGib_V1;
|
|
92
|
-
/**
|
|
93
|
-
* This is the initial dependency graph of all domain ibgibs passed in
|
|
94
|
-
* to the original {@link sync} call.
|
|
95
|
-
*
|
|
96
|
-
* if we're executing on the sender, this will be populated
|
|
97
|
-
*/
|
|
98
|
-
initDomainGraph: FlatIbGibGraph;
|
|
99
|
-
peer: SyncPeerWitness;
|
|
100
|
-
sessionIdentity?: KeystoneIbGib_V1;
|
|
101
|
-
updates$: SubjectWitness<SyncSagaContextIbGib_V1>;
|
|
102
|
-
metaspace: MetaspaceService;
|
|
103
|
-
localSpace: IbGibSpaceAny;
|
|
104
|
-
tempSpace: IbGibSpaceAny;
|
|
105
|
-
}): Promise<void>;
|
|
81
|
+
private executeSagaLoop;
|
|
106
82
|
/**
|
|
107
83
|
* Helper to get Knowledge Vector for specific domain ibGibs or TJPs.
|
|
108
84
|
* Useful for testing and external validation.
|
|
@@ -115,10 +91,7 @@ export declare class SyncSagaCoordinator {
|
|
|
115
91
|
}): Promise<{
|
|
116
92
|
[tjp: string]: string | null;
|
|
117
93
|
}>;
|
|
118
|
-
|
|
119
|
-
domainIbGibs: IbGib_V1[];
|
|
120
|
-
space: IbGibSpaceAny;
|
|
121
|
-
}): Promise<DomainIbGibAnalysisInfo>;
|
|
94
|
+
private analyzeDomainIbGibs;
|
|
122
95
|
/**
|
|
123
96
|
* Creates the Initial Saga Frame (Init Stage).
|
|
124
97
|
*
|
|
@@ -128,32 +101,14 @@ export declare class SyncSagaCoordinator {
|
|
|
128
101
|
* Generates the first frame containing the Knowledge Vector of the Local Space.
|
|
129
102
|
* This is sent to the Receiver to begin Gap Analysis.
|
|
130
103
|
*/
|
|
131
|
-
|
|
132
|
-
sagaId: string;
|
|
133
|
-
sessionIdentity?: KeystoneIbGib_V1;
|
|
134
|
-
domainIbGibs: IbGib_V1[];
|
|
135
|
-
conflictStrategy: SyncConflictStrategy;
|
|
136
|
-
metaspace: MetaspaceService;
|
|
137
|
-
localSpace: IbGibSpaceAny;
|
|
138
|
-
tempSpace: IbGibSpaceAny;
|
|
139
|
-
}): Promise<{
|
|
140
|
-
initFrame: SyncIbGib_V1;
|
|
141
|
-
initDomainGraph: {
|
|
142
|
-
[addr: string]: IbGib_V1;
|
|
143
|
-
};
|
|
144
|
-
}>;
|
|
104
|
+
private createInitFrame;
|
|
145
105
|
/**
|
|
146
106
|
* Helper to poll for streaming domain payloads and put them in the
|
|
147
107
|
* local {@link tempSpace}.
|
|
148
108
|
*
|
|
149
109
|
* @returns when all {@link expectedAddrs} are done being transmitted.
|
|
150
110
|
*/
|
|
151
|
-
|
|
152
|
-
expectedAddrs: string[];
|
|
153
|
-
pollIntervalMs: number;
|
|
154
|
-
domainPayloadsMap: Map<string, IbGib_V1>;
|
|
155
|
-
tempSpace: IbGibSpaceAny;
|
|
156
|
-
}): Promise<IbGib_V1[]>;
|
|
111
|
+
private pollForDomainPayloads;
|
|
157
112
|
/**
|
|
158
113
|
* This is the heart of the "ping pong" transaction, where we send a context
|
|
159
114
|
*
|
|
@@ -175,27 +130,7 @@ export declare class SyncSagaCoordinator {
|
|
|
175
130
|
*
|
|
176
131
|
* This is a one-off on the receiver.
|
|
177
132
|
*/
|
|
178
|
-
handleResponseSagaContext
|
|
179
|
-
sagaContext: SyncSagaContextIbGib_V1;
|
|
180
|
-
/**
|
|
181
|
-
* This is the initial dependency graph of all domain ibgibs passed in
|
|
182
|
-
* to the original {@link sync} call.
|
|
183
|
-
*
|
|
184
|
-
* if we're executing on the sender, this will be populated
|
|
185
|
-
*/
|
|
186
|
-
initDomainGraph?: FlatIbGibGraph;
|
|
187
|
-
/**
|
|
188
|
-
* Local space relative to the execution context's POV
|
|
189
|
-
*/
|
|
190
|
-
mySpace: IbGibSpaceAny;
|
|
191
|
-
/**
|
|
192
|
-
* Local temp space relative to the execution context's POV
|
|
193
|
-
*/
|
|
194
|
-
myTempSpace: IbGibSpaceAny;
|
|
195
|
-
identity?: KeystoneIbGib_V1;
|
|
196
|
-
identitySecret?: string;
|
|
197
|
-
metaspace: MetaspaceService;
|
|
198
|
-
}): Promise<HandleSagaResponseContextResult>;
|
|
133
|
+
private handleResponseSagaContext;
|
|
199
134
|
/**
|
|
200
135
|
* Handles the `Init` frame.
|
|
201
136
|
*
|
|
@@ -208,24 +143,7 @@ export declare class SyncSagaCoordinator {
|
|
|
208
143
|
* 3. Identifies what Receiver needs (`deltaRequestAddrInfos`).
|
|
209
144
|
* 4. Returns an `Ack` frame containing these lists.
|
|
210
145
|
*/
|
|
211
|
-
|
|
212
|
-
sagaIbGib: SyncIbGib_V1;
|
|
213
|
-
messageData: SyncSagaMessageInitData_V1;
|
|
214
|
-
/**
|
|
215
|
-
* Local space relative to the execution context's POV
|
|
216
|
-
*/
|
|
217
|
-
mySpace: IbGibSpaceAny;
|
|
218
|
-
/**
|
|
219
|
-
* Local temp space relative to the execution context's POV.
|
|
220
|
-
*
|
|
221
|
-
* NOTE: Since this always executes on the receiver's end, this should
|
|
222
|
-
* be the receiver's temp space.
|
|
223
|
-
*/
|
|
224
|
-
myTempSpace: IbGibSpaceAny;
|
|
225
|
-
metaspace: MetaspaceService;
|
|
226
|
-
identity?: KeystoneIbGib_V1;
|
|
227
|
-
identitySecret?: string;
|
|
228
|
-
}): Promise<NextSagaFrameInfo>;
|
|
146
|
+
private handleInitFrame;
|
|
229
147
|
/**
|
|
230
148
|
* Handles the `Ack` frame.
|
|
231
149
|
*
|
|
@@ -241,28 +159,7 @@ export declare class SyncSagaCoordinator {
|
|
|
241
159
|
*
|
|
242
160
|
* Returns a `Delta` frame.
|
|
243
161
|
*/
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* todo: figure out if we need to do something about incoming push offer payload domain ibgibs
|
|
247
|
-
* I'm adding this because we should be checking incoming payloads
|
|
248
|
-
* right? for push offers? This is when the receiver had new ibgibs.
|
|
249
|
-
* Not sure if I need to put this here though...
|
|
250
|
-
*/
|
|
251
|
-
sagaContext: SyncSagaContextIbGib_V1;
|
|
252
|
-
sagaIbGib: SyncIbGib_V1;
|
|
253
|
-
/**
|
|
254
|
-
* This is the initial dependency graph of all domain ibgibs passed in
|
|
255
|
-
* to the original {@link sync} call.
|
|
256
|
-
*
|
|
257
|
-
* if we're executing on the sender, this will be populated
|
|
258
|
-
*/
|
|
259
|
-
initDomainGraph: FlatIbGibGraph;
|
|
260
|
-
mySpace: IbGibSpaceAny;
|
|
261
|
-
myTempSpace: IbGibSpaceAny;
|
|
262
|
-
metaspace: MetaspaceService;
|
|
263
|
-
identity?: KeystoneIbGib_V1;
|
|
264
|
-
}): Promise<NextSagaFrameInfo>;
|
|
265
|
-
private getPayloadsForRequestedInfos;
|
|
162
|
+
private handleAckFrame;
|
|
266
163
|
/**
|
|
267
164
|
* Handles the `Delta` frame.
|
|
268
165
|
*
|
|
@@ -273,53 +170,20 @@ export declare class SyncSagaCoordinator {
|
|
|
273
170
|
* 2. **Fulfillment**: Checks `requests`. If Peer requested data, gathers it and prepares `outgoingPayload`.
|
|
274
171
|
* 3. **Completion**: If no more requests, transitions to `Commit`.
|
|
275
172
|
*/
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
identity?: KeystoneIbGib_V1;
|
|
286
|
-
}): Promise<NextSagaFrameInfo>;
|
|
287
|
-
protected handleCommitFrame({ sagaIbGib, mySpace, myTempSpace, metaspace, identity, }: {
|
|
288
|
-
sagaIbGib: SyncIbGib_V1;
|
|
289
|
-
mySpace: IbGibSpaceAny;
|
|
290
|
-
myTempSpace: IbGibSpaceAny;
|
|
291
|
-
metaspace: MetaspaceService;
|
|
292
|
-
identity?: KeystoneIbGib_V1;
|
|
293
|
-
}): Promise<NextSagaFrameInfo>;
|
|
294
|
-
protected createSyncMsgStone<TStoneData extends SyncSagaMessageData_V1>({ data, localSpace, metaspace, }: {
|
|
295
|
-
data: TStoneData;
|
|
296
|
-
localSpace: IbGibSpaceAny;
|
|
297
|
-
metaspace: MetaspaceService;
|
|
298
|
-
}): Promise<IbGib_V1<TStoneData>>;
|
|
173
|
+
private handleDeltaFrame;
|
|
174
|
+
/**
|
|
175
|
+
* should throw if fails
|
|
176
|
+
*/
|
|
177
|
+
private executeLocalCommit;
|
|
178
|
+
private createCommitFrame;
|
|
179
|
+
private handleCommitFrame;
|
|
180
|
+
private createSyncMsgStone;
|
|
181
|
+
private getPayloadsForRequestedInfos;
|
|
299
182
|
/**
|
|
300
183
|
* Evolves the saga timeline with a new frame.
|
|
301
184
|
*/
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
msgStones: IbGib_V1[];
|
|
306
|
-
localSpace: IbGibSpaceAny;
|
|
307
|
-
metaspace: MetaspaceService;
|
|
308
|
-
/**
|
|
309
|
-
* does NOT evolve the keystone. this should be done by the caller.
|
|
310
|
-
* (NOT IMPLEMENTED YET ANYWAY)
|
|
311
|
-
*/
|
|
312
|
-
sessionIdentity?: KeystoneIbGib_V1;
|
|
313
|
-
}): Promise<SyncIbGib_V1>;
|
|
314
|
-
protected getStageAndPayloadFromFrame({ sagaFrame, space }: {
|
|
315
|
-
sagaFrame: IbGib_V1;
|
|
316
|
-
space: IbGibSpaceAny;
|
|
317
|
-
}): Promise<{
|
|
318
|
-
stage: SyncStage;
|
|
319
|
-
messageData: unknown;
|
|
320
|
-
}>;
|
|
321
|
-
protected sortTimelinesTopologically(timelines: {
|
|
322
|
-
[tjp: string]: IbGib_V1[];
|
|
323
|
-
}): string[];
|
|
185
|
+
private evolveSyncSagaIbGib;
|
|
186
|
+
private getStageAndPayloadFromFrame;
|
|
187
|
+
private sortTimelinesTopologically;
|
|
324
188
|
}
|
|
325
189
|
//# sourceMappingURL=sync-saga-coordinator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-saga-coordinator.d.mts","sourceRoot":"","sources":["../../src/sync/sync-saga-coordinator.mts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAG,MAAM,iCAAiC,CAAC;AAI5D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAEnE,OAA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