@ibgib/core-gib 0.1.23 → 0.1.26
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/other/graph-helper.d.mts +17 -0
- package/dist/common/other/graph-helper.d.mts.map +1 -1
- package/dist/common/other/graph-helper.mjs +44 -0
- package/dist/common/other/graph-helper.mjs.map +1 -1
- package/dist/common/other/ibgib-helper.d.mts +1 -1
- package/dist/common/other/ibgib-helper.d.mts.map +1 -1
- package/dist/common/other/ibgib-helper.mjs.map +1 -1
- package/dist/sync/graft-info/graft-info-helpers.mjs +2 -2
- package/dist/sync/graft-info/graft-info-helpers.mjs.map +1 -1
- package/dist/sync/sync-conflict.respec.mjs +10 -15
- package/dist/sync/sync-conflict.respec.mjs.map +1 -1
- package/dist/sync/sync-constants.d.mts +1 -0
- package/dist/sync/sync-constants.d.mts.map +1 -1
- package/dist/sync/sync-constants.mjs +1 -0
- package/dist/sync/sync-constants.mjs.map +1 -1
- package/dist/sync/sync-helpers.d.mts +5 -0
- package/dist/sync/sync-helpers.d.mts.map +1 -1
- package/dist/sync/sync-helpers.mjs +37 -1
- package/dist/sync/sync-helpers.mjs.map +1 -1
- package/dist/sync/sync-innerspace-constants.respec.mjs +10 -12
- package/dist/sync/sync-innerspace-constants.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-deep-updates.respec.mjs +10 -12
- package/dist/sync/sync-innerspace-deep-updates.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-dest-ahead.respec.mjs +10 -12
- package/dist/sync/sync-innerspace-dest-ahead.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs +9 -12
- package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-partial-update.respec.mjs +9 -14
- package/dist/sync/sync-innerspace-partial-update.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace.respec.mjs +9 -12
- package/dist/sync/sync-innerspace.respec.mjs.map +1 -1
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.d.mts +2 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.d.mts.map +1 -1
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs +4 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs.map +1 -1
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts +24 -13
- 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 +176 -76
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs.map +1 -1
- package/dist/sync/sync-peer/sync-peer-types.d.mts +29 -6
- package/dist/sync/sync-peer/sync-peer-types.d.mts.map +1 -1
- package/dist/sync/sync-peer/sync-peer-v1.d.mts +38 -55
- package/dist/sync/sync-peer/sync-peer-v1.d.mts.map +1 -1
- package/dist/sync/sync-peer/sync-peer-v1.mjs +111 -244
- package/dist/sync/sync-peer/sync-peer-v1.mjs.map +1 -1
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts +32 -1
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts.map +1 -1
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs +96 -7
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs.map +1 -1
- package/dist/sync/sync-saga-coordinator.d.mts +59 -13
- package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
- package/dist/sync/sync-saga-coordinator.mjs +446 -304
- package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts +51 -6
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts.map +1 -1
- package/dist/sync/sync-types.d.mts +35 -10
- package/dist/sync/sync-types.d.mts.map +1 -1
- package/dist/sync/sync-types.mjs +1 -2
- package/dist/sync/sync-types.mjs.map +1 -1
- package/package.json +1 -1
- package/src/common/other/graph-helper.mts +53 -0
- package/src/common/other/ibgib-helper.mts +1 -1
- package/src/sync/graft-info/graft-info-helpers.mts +3 -3
- package/src/sync/sync-conflict.respec.mts +10 -17
- package/src/sync/sync-constants.mts +1 -0
- package/src/sync/sync-helpers.mts +47 -7
- package/src/sync/sync-innerspace-constants.respec.mts +10 -12
- package/src/sync/sync-innerspace-deep-updates.respec.mts +10 -12
- package/src/sync/sync-innerspace-dest-ahead.respec.mts +10 -12
- package/src/sync/sync-innerspace-multiple-timelines.respec.mts +9 -12
- package/src/sync/sync-innerspace-partial-update.respec.mts +9 -14
- package/src/sync/sync-innerspace.respec.mts +9 -12
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mts +7 -0
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mts +200 -75
- package/src/sync/sync-peer/sync-peer-types.mts +35 -11
- package/src/sync/sync-peer/sync-peer-v1.mts +154 -257
- package/src/sync/sync-saga-context/sync-saga-context-helpers.mts +90 -13
- package/src/sync/sync-saga-coordinator.mts +536 -356
- package/src/sync/sync-saga-message/sync-saga-message-types.mts +56 -4
- package/src/sync/sync-types.mts +46 -13
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
ifWeMight
|
|
11
11
|
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
12
12
|
const maam = `[${import.meta.url}]`, sir = maam;
|
|
13
|
-
import { delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
13
|
+
import { clone, delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
14
14
|
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
15
15
|
|
|
16
16
|
import { SyncSagaCoordinator } from './sync-saga-coordinator.mjs';
|
|
@@ -27,6 +27,7 @@ import { IbGibData_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
|
27
27
|
import { fnObs } from '../common/pubsub/observer/observer-helper.mjs';
|
|
28
28
|
import { getDependencyGraph } from '../common/other/graph-helper.mjs';
|
|
29
29
|
import { ErrorIbGib_V1 } from '../common/error/error-types.mjs';
|
|
30
|
+
import { SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs';
|
|
30
31
|
|
|
31
32
|
interface TestData extends IbGibData_V1 {
|
|
32
33
|
text?: string;
|
|
@@ -112,7 +113,7 @@ await respecfully(sir, `Sync Conflict Resolution`, async () => {
|
|
|
112
113
|
|
|
113
114
|
const resGetDest = await getFromSpace({ space: destSpace, addr: getIbGibAddr({ ibGib: v1_Common }) });
|
|
114
115
|
if (!resGetDest.success || !resGetDest.ibGibs || resGetDest.ibGibs.length === 0) {
|
|
115
|
-
throw new Error(`Failed to retrieve v1_Dest from destSpace. (E:
|
|
116
|
+
throw new Error(`Failed to retrieve v1_Dest from destSpace. (E: 40c67811eba14f729880a46dcbb65126)`);
|
|
116
117
|
}
|
|
117
118
|
const v1_Dest = resGetDest.ibGibs[0];
|
|
118
119
|
|
|
@@ -152,22 +153,14 @@ await respecfully(sir, `Sync Conflict Resolution`, async () => {
|
|
|
152
153
|
const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
153
154
|
const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// const peer = new SyncPeerInnerspace_V1({
|
|
158
|
-
// senderSpace: sourceSpace,
|
|
159
|
-
// // No senderTempSpace - sync() creates its own internally
|
|
160
|
-
// receiverSpace: destSpace,
|
|
161
|
-
// receiverCoordinator,
|
|
162
|
-
// receiverMetaspace: metaspace,
|
|
163
|
-
// receiverTempSpace: 0 as any, // placeholder this is wrong // just to get to compile
|
|
164
|
-
// senderTempSpace: 0 as any, // placeholder this is wrong // just to get to compile
|
|
165
|
-
// }, {
|
|
166
|
-
// classname: SyncPeerInnerspace_V1.name,
|
|
167
|
-
// });
|
|
168
|
-
const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
|
|
156
|
+
const peer = new SyncPeerInnerspace_V1(clone(SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1));
|
|
169
157
|
await peer.initialized;
|
|
170
|
-
await peer.
|
|
158
|
+
await peer.initializeSender({
|
|
159
|
+
senderSpace: sourceSpace, // "Client"
|
|
160
|
+
receiverSpace: destSpace, // "Server"
|
|
161
|
+
receiverCoordinator,
|
|
162
|
+
receiverMetaspace: metaspace,
|
|
163
|
+
});
|
|
171
164
|
|
|
172
165
|
// Verify Receiver has correct KV (Pre-Sync Check)
|
|
173
166
|
// This ensures the conflict precondition exists.
|
|
@@ -7,9 +7,10 @@ import { GLOBAL_LOG_A_LOT } from "../core-constants.mjs";
|
|
|
7
7
|
import { SYNC_ATOM, SYNC_MSG_REL8N_NAME } from "./sync-constants.mjs";
|
|
8
8
|
import { isValidSyncConflictStrategy, SYNC_CONFLICT_STRATEGY_VALID_VALUES, SyncData_V1, SyncIb_V1, SyncIbGib_V1, SyncSagaFrameDependencyGraph } from "./sync-types.mjs";
|
|
9
9
|
import { IbGibSpaceAny } from "../witness/space/space-base-v1.mjs";
|
|
10
|
-
import { getFromSpace } from "../witness/space/space-helper.mjs";
|
|
10
|
+
import { getFromSpace, putInSpace } from "../witness/space/space-helper.mjs";
|
|
11
11
|
import { IbGibSpaceResultData, IbGibSpaceResultIbGib, IbGibSpaceResultRel8ns } from "../witness/space/space-types.mjs";
|
|
12
12
|
import { KeystoneIbGib_V1 } from "../keystone/keystone-types.mjs";
|
|
13
|
+
import { isDna, isPrimitive } from "@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs";
|
|
13
14
|
|
|
14
15
|
const logalot = GLOBAL_LOG_A_LOT;
|
|
15
16
|
|
|
@@ -80,7 +81,7 @@ export async function getTempSpaceName(): Promise<string> {
|
|
|
80
81
|
|
|
81
82
|
/**
|
|
82
83
|
* UNTESTED
|
|
83
|
-
*
|
|
84
|
+
*
|
|
84
85
|
* Checks if an {@link olderAddr} is the address of a past frame in the ibgib
|
|
85
86
|
* with {@link newerAddr}.
|
|
86
87
|
*/
|
|
@@ -89,8 +90,8 @@ export async function isPastFrame({
|
|
|
89
90
|
newerAddr,
|
|
90
91
|
space,
|
|
91
92
|
}: {
|
|
92
|
-
olderAddr: string,
|
|
93
|
-
newerAddr: string,
|
|
93
|
+
olderAddr: string,
|
|
94
|
+
newerAddr: string,
|
|
94
95
|
space: IbGibSpaceAny,
|
|
95
96
|
}): Promise<boolean> {
|
|
96
97
|
const lc = `[${isPastFrame.name}]`;
|
|
@@ -148,15 +149,15 @@ export async function isPastFrame({
|
|
|
148
149
|
|
|
149
150
|
/**
|
|
150
151
|
* Gets a shallow dependency graph for a Sync Saga Frame.
|
|
151
|
-
*
|
|
152
|
+
*
|
|
152
153
|
* DOES NOT GET THE ENTIRE DEPENDENCY FRAME (INCLUDING PAST).
|
|
153
|
-
*
|
|
154
|
+
*
|
|
154
155
|
* Unlike standard `getDependencyGraph`, this does NOT traverse `ancestor` (history) or `past`.
|
|
155
156
|
* It only retrieves the *content* of the current frame:
|
|
156
157
|
* 1. The Frame itself.
|
|
157
158
|
* 2. The Message Stone(s) (`rel8ns.msg`).
|
|
158
159
|
* 3. The Identity(s) (`rel8ns.identity`).
|
|
159
|
-
*
|
|
160
|
+
*
|
|
160
161
|
* This is used for efficient transmission of the "Current Step" without re-sending the entire history.
|
|
161
162
|
*/
|
|
162
163
|
export async function getSyncSagaFrameDependencyGraph({
|
|
@@ -280,3 +281,42 @@ export async function validateSyncSagaFrame({
|
|
|
280
281
|
if (logalot) { console.log(`${lc} complete.`); }
|
|
281
282
|
}
|
|
282
283
|
}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
export async function putInSpace_dnasThenNonDnas({
|
|
287
|
+
ibGibs,
|
|
288
|
+
space,
|
|
289
|
+
}: {
|
|
290
|
+
ibGibs: IbGib_V1[],
|
|
291
|
+
space: IbGibSpaceAny,
|
|
292
|
+
}): Promise<void> {
|
|
293
|
+
const lc = `[${putInSpace_dnasThenNonDnas.name}]`;
|
|
294
|
+
try {
|
|
295
|
+
if (logalot) { console.log(`${lc} starting... (I: aa3ab828402836b3914800a8ffa1b826)`); }
|
|
296
|
+
|
|
297
|
+
const payload_Dnas: IbGib_V1[] = [];
|
|
298
|
+
const payload_NonDnas: IbGib_V1[] = [];
|
|
299
|
+
|
|
300
|
+
for (const ibGib of ibGibs) {
|
|
301
|
+
// never store primitives
|
|
302
|
+
if (isPrimitive({ ibGib })) { continue; }
|
|
303
|
+
|
|
304
|
+
if (isDna({ ibGib })) {
|
|
305
|
+
payload_Dnas.push(ibGib);
|
|
306
|
+
} else {
|
|
307
|
+
payload_NonDnas.push(ibGib);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// dnas are the simplest and we store those first...
|
|
312
|
+
await putInSpace({ ibGibs: payload_Dnas, isDna: true, space, });
|
|
313
|
+
|
|
314
|
+
// then put all non-dnas ("regular" ibgibs) in the space
|
|
315
|
+
await putInSpace({ ibGibs: payload_NonDnas, isDna: false, space, });
|
|
316
|
+
} catch (error) {
|
|
317
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
318
|
+
throw error;
|
|
319
|
+
} finally {
|
|
320
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
321
|
+
}
|
|
322
|
+
}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
respecfully, ifWeMight, iReckon, ifWe
|
|
10
10
|
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
11
11
|
const maam = `[${import.meta.url}]`, sir = maam;
|
|
12
|
-
import { delay } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
12
|
+
import { clone, delay } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
13
13
|
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
14
14
|
import { Factory_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
15
15
|
|
|
@@ -20,6 +20,7 @@ import { InnerSpace_V1 } from '../witness/space/inner-space/inner-space-v1.mjs';
|
|
|
20
20
|
import { DEFAULT_INNER_SPACE_DATA_V1 } from '../witness/space/inner-space/inner-space-types.mjs';
|
|
21
21
|
import { getTestKeystoneServiceHelper } from '../agent-helpers.mjs';
|
|
22
22
|
import { SyncPeerInnerspace_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs';
|
|
23
|
+
import { SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs';
|
|
23
24
|
|
|
24
25
|
const lc = `[sync-innerspace-constants.respec]`;
|
|
25
26
|
|
|
@@ -69,17 +70,14 @@ await respecfully(sir, `Sync Constants (No TJP)`, async () => {
|
|
|
69
70
|
const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
70
71
|
const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// classname: SyncPeerInnerspace_V1.name,
|
|
81
|
-
// });
|
|
82
|
-
const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
|
|
73
|
+
const peer = new SyncPeerInnerspace_V1(clone(SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1));
|
|
74
|
+
await peer.initialized;
|
|
75
|
+
await peer.initializeSender({
|
|
76
|
+
senderSpace: sourceSpace, // "Client"
|
|
77
|
+
receiverSpace: destSpace, // "Server"
|
|
78
|
+
receiverCoordinator,
|
|
79
|
+
receiverMetaspace: metaspace,
|
|
80
|
+
});
|
|
83
81
|
|
|
84
82
|
// 4. Sync C1 (First Pass)
|
|
85
83
|
let resSync = await senderCoordinator.sync({
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ifWeMight
|
|
10
10
|
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
11
11
|
const maam = `[${import.meta.url}]`, sir = maam;
|
|
12
|
-
import { delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
12
|
+
import { clone, delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
13
13
|
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
14
14
|
import { getDependencyGraph } from '../common/other/graph-helper.mjs';
|
|
15
15
|
|
|
@@ -22,6 +22,7 @@ import { mut8Timeline } from '../timeline/timeline-api.mjs';
|
|
|
22
22
|
import { DEFAULT_INNER_SPACE_DATA_V1 } from '../witness/space/inner-space/inner-space-types.mjs';
|
|
23
23
|
import { toDto } from '../common/other/ibgib-helper.mjs';
|
|
24
24
|
import { SyncPeerInnerspace_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs';
|
|
25
|
+
import { SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs';
|
|
25
26
|
|
|
26
27
|
const logalot = true;
|
|
27
28
|
const lc = `[sync-innerspace-deep-updates.respec]`;
|
|
@@ -100,17 +101,14 @@ await respecfully(sir, `Sync InnerSpaces (Deep Updates)`, async () => {
|
|
|
100
101
|
const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
101
102
|
const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// classname: SyncPeerInnerspace_V1.name,
|
|
112
|
-
// });
|
|
113
|
-
const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
|
|
104
|
+
const peer = new SyncPeerInnerspace_V1(clone(SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1));
|
|
105
|
+
await peer.initialized;
|
|
106
|
+
await peer.initializeSender({
|
|
107
|
+
senderSpace: sourceSpace, // "Client"
|
|
108
|
+
receiverSpace: destSpace, // "Server"
|
|
109
|
+
receiverCoordinator,
|
|
110
|
+
receiverMetaspace: metaspace,
|
|
111
|
+
});
|
|
114
112
|
|
|
115
113
|
// 4. Run Sync
|
|
116
114
|
console.log(`${lc} Running Sync...`);
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ifWeMight
|
|
10
10
|
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
11
11
|
const maam = `[${import.meta.url}]`, sir = maam;
|
|
12
|
-
import { delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
12
|
+
import { clone, delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
13
13
|
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
14
14
|
import { getDependencyGraph } from '../common/other/graph-helper.mjs';
|
|
15
15
|
|
|
@@ -22,6 +22,7 @@ import { mut8Timeline } from '../timeline/timeline-api.mjs';
|
|
|
22
22
|
import { DEFAULT_INNER_SPACE_DATA_V1 } from '../witness/space/inner-space/inner-space-types.mjs';
|
|
23
23
|
import { toDto } from '../common/other/ibgib-helper.mjs';
|
|
24
24
|
import { SyncPeerInnerspace_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs';
|
|
25
|
+
import { SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs';
|
|
25
26
|
|
|
26
27
|
const logalot = true;
|
|
27
28
|
const lc = `[sync-innerspace-dest-ahead.respec]`;
|
|
@@ -110,17 +111,14 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
110
111
|
const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
111
112
|
const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
// classname: SyncPeerInnerspace_V1.name
|
|
122
|
-
// });
|
|
123
|
-
const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
|
|
114
|
+
const peer = new SyncPeerInnerspace_V1(clone(SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1));
|
|
115
|
+
await peer.initialized;
|
|
116
|
+
await peer.initializeSender({
|
|
117
|
+
senderSpace: sourceSpace, // "Client"
|
|
118
|
+
receiverSpace: destSpace, // "Server"
|
|
119
|
+
receiverCoordinator,
|
|
120
|
+
receiverMetaspace: metaspace,
|
|
121
|
+
});
|
|
124
122
|
|
|
125
123
|
// 4. Run Sync (Source Pushes V1)
|
|
126
124
|
console.log(`${lc} Running Sync...`);
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ifWeMight
|
|
10
10
|
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
11
11
|
const maam = `[${import.meta.url}]`, sir = maam;
|
|
12
|
-
import { delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
12
|
+
import { clone, delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
13
13
|
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
14
14
|
import { getDependencyGraph } from '../common/other/graph-helper.mjs';
|
|
15
15
|
|
|
@@ -22,6 +22,7 @@ import { mut8Timeline } from '../timeline/timeline-api.mjs';
|
|
|
22
22
|
import { DEFAULT_INNER_SPACE_DATA_V1 } from '../witness/space/inner-space/inner-space-types.mjs';
|
|
23
23
|
import { toDto } from '../common/other/ibgib-helper.mjs';
|
|
24
24
|
import { SyncPeerInnerspace_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs';
|
|
25
|
+
import { SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs';
|
|
25
26
|
|
|
26
27
|
const logalot = true;
|
|
27
28
|
const lc = `[sync-innerspace-multiple-timelines.respec]`;
|
|
@@ -104,18 +105,14 @@ await respecfully(sir, `Sync InnerSpaces (Multiple Timelines)`, async () => {
|
|
|
104
105
|
const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
105
106
|
const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
106
107
|
|
|
107
|
-
|
|
108
|
-
// senderSpace: sourceSpace,
|
|
109
|
-
// receiverSpace: destSpace,
|
|
110
|
-
// receiverCoordinator: receiverCoordinator,
|
|
111
|
-
// receiverMetaspace: metaspace,
|
|
112
|
-
// receiverTempSpace: 0 as any, // just to get to compile
|
|
113
|
-
// senderTempSpace: 0 as any, // just to get to compile
|
|
114
|
-
// }, {
|
|
115
|
-
// classname: SyncPeerInnerspace_V1.name,
|
|
116
|
-
// });
|
|
117
|
-
const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
|
|
108
|
+
const peer = new SyncPeerInnerspace_V1(clone(SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1));
|
|
118
109
|
await peer.initialized;
|
|
110
|
+
await peer.initializeSender({
|
|
111
|
+
senderSpace: sourceSpace, // "Client"
|
|
112
|
+
receiverSpace: destSpace, // "Server"
|
|
113
|
+
receiverCoordinator,
|
|
114
|
+
receiverMetaspace: metaspace,
|
|
115
|
+
});
|
|
119
116
|
|
|
120
117
|
// 4. Run Sync (Push Both)
|
|
121
118
|
console.log(`${lc} Running Sync...`);
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ifWeMight
|
|
10
10
|
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
11
11
|
const maam = `[${import.meta.url}]`, sir = maam;
|
|
12
|
-
import { delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
12
|
+
import { clone, delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
13
13
|
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
14
14
|
import { getDependencyGraph } from '../common/other/graph-helper.mjs';
|
|
15
15
|
|
|
@@ -22,6 +22,7 @@ import { mut8Timeline } from '../timeline/timeline-api.mjs';
|
|
|
22
22
|
import { DEFAULT_INNER_SPACE_DATA_V1 } from '../witness/space/inner-space/inner-space-types.mjs';
|
|
23
23
|
import { toDto } from '../common/other/ibgib-helper.mjs';
|
|
24
24
|
import { SyncPeerInnerspace_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs';
|
|
25
|
+
import { SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs';
|
|
25
26
|
|
|
26
27
|
const logalot = true;
|
|
27
28
|
const lc = `[sync-innerspace-partial-update.respec]`;
|
|
@@ -112,20 +113,14 @@ await respecfully(sir, `Sync InnerSpaces (Partial Update)`, async () => {
|
|
|
112
113
|
const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
113
114
|
const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
// senderSpace: sourceSpace,
|
|
117
|
-
// receiverSpace: destSpace,
|
|
118
|
-
// receiverCoordinator: receiverCoordinator,
|
|
119
|
-
// receiverMetaspace: metaspace,
|
|
120
|
-
// receiverTempSpace: 0 as any, // just to get to compile
|
|
121
|
-
// senderTempSpace: 0 as any, // just to get to compile
|
|
122
|
-
// },
|
|
123
|
-
// {
|
|
124
|
-
// classname: SyncPeerInnerspace_V1.name,
|
|
125
|
-
// }
|
|
126
|
-
// );
|
|
127
|
-
const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
|
|
116
|
+
const peer = new SyncPeerInnerspace_V1(clone(SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1));
|
|
128
117
|
await peer.initialized;
|
|
118
|
+
await peer.initializeSender({
|
|
119
|
+
senderSpace: sourceSpace, // "Client"
|
|
120
|
+
receiverSpace: destSpace, // "Server"
|
|
121
|
+
receiverCoordinator,
|
|
122
|
+
receiverMetaspace: metaspace,
|
|
123
|
+
});
|
|
129
124
|
|
|
130
125
|
// 4. Run Sync (Source Pushes V2)
|
|
131
126
|
console.log(`${lc} Running Sync...`);
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
ifWeMight
|
|
11
11
|
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
12
12
|
const maam = `[${import.meta.url}]`, sir = maam;
|
|
13
|
-
import { delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
13
|
+
import { clone, delay, extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
14
14
|
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
15
15
|
|
|
16
16
|
import { SyncSagaCoordinator } from './sync-saga-coordinator.mjs';
|
|
@@ -23,6 +23,7 @@ import { DEFAULT_INNER_SPACE_DATA_V1 } from '../witness/space/inner-space/inner-
|
|
|
23
23
|
import { toDto } from '../common/other/ibgib-helper.mjs';
|
|
24
24
|
import { fnObs } from '../common/pubsub/observer/observer-helper.mjs';
|
|
25
25
|
import { SyncPeerInnerspace_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs';
|
|
26
|
+
import { SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs';
|
|
26
27
|
|
|
27
28
|
const logalot = true;
|
|
28
29
|
const lc = `[sync-innerspace.respec]`;
|
|
@@ -103,18 +104,14 @@ await respecfully(sir, `Sync InnerSpaces`, async () => {
|
|
|
103
104
|
const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
|
|
104
105
|
|
|
105
106
|
// Peer (The "Network")
|
|
106
|
-
|
|
107
|
-
// senderSpace: sourceSpace, // "Client"
|
|
108
|
-
// receiverSpace: destSpace, // "Server"
|
|
109
|
-
// receiverCoordinator: receiverCoordinator,
|
|
110
|
-
// receiverMetaspace: metaspace,
|
|
111
|
-
// senderTempSpace: 0 as any,
|
|
112
|
-
// receiverTempSpace: 0 as any,
|
|
113
|
-
// }, {
|
|
114
|
-
// classname: SyncPeerInnerspace_V1.name,
|
|
115
|
-
// });
|
|
116
|
-
const peer = new SyncPeerInnerspace_V1(0 as any, 0 as any, 0 as any, 0 as any);
|
|
107
|
+
const peer = new SyncPeerInnerspace_V1(clone(SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1));
|
|
117
108
|
await peer.initialized;
|
|
109
|
+
await peer.initializeSender({
|
|
110
|
+
senderSpace: sourceSpace, // "Client"
|
|
111
|
+
receiverSpace: destSpace, // "Server"
|
|
112
|
+
receiverCoordinator,
|
|
113
|
+
receiverMetaspace: metaspace,
|
|
114
|
+
});
|
|
118
115
|
|
|
119
116
|
// 4. Run Sync
|
|
120
117
|
console.log(`${lc} Running Sync...`);
|
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
* @module sync peer innerspace constants
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { SyncPeerInnerspaceData_V1 } from "./sync-peer-innerspace-types.mjs";
|
|
6
|
+
import { SyncPeerInnerspace_V1 } from "./sync-peer-innerspace-v1.mjs";
|
|
7
|
+
|
|
5
8
|
/**
|
|
6
9
|
* Atom for the sync peer innerspace ibgib.
|
|
7
10
|
*/
|
|
8
11
|
export const SYNC_PEER_INNERSPACE_ATOM = 'sync_peer_innerspace';
|
|
12
|
+
|
|
13
|
+
export const SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1: SyncPeerInnerspaceData_V1 = {
|
|
14
|
+
classname: SyncPeerInnerspace_V1.name,
|
|
15
|
+
}
|