@fluidframework/test-utils 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.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/.eslintrc.js +8 -10
- package/README.md +41 -11
- package/api-extractor.json +2 -2
- package/dist/DriverWrappers.d.ts.map +1 -1
- package/dist/DriverWrappers.js.map +1 -1
- package/dist/TestConfigs.d.ts.map +1 -1
- package/dist/TestConfigs.js +3 -2
- package/dist/TestConfigs.js.map +1 -1
- package/dist/TestSummaryUtils.d.ts +15 -4
- package/dist/TestSummaryUtils.d.ts.map +1 -1
- package/dist/TestSummaryUtils.js +23 -17
- package/dist/TestSummaryUtils.js.map +1 -1
- package/dist/containerUtils.d.ts +1 -2
- package/dist/containerUtils.d.ts.map +1 -1
- package/dist/containerUtils.js +4 -2
- package/dist/containerUtils.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/loaderContainerTracker.d.ts.map +1 -1
- package/dist/loaderContainerTracker.js +37 -27
- package/dist/loaderContainerTracker.js.map +1 -1
- package/dist/localCodeLoader.d.ts.map +1 -1
- package/dist/localCodeLoader.js.map +1 -1
- package/dist/localLoader.d.ts.map +1 -1
- package/dist/localLoader.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js.map +1 -1
- package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
- package/dist/testContainerRuntimeFactory.js +2 -1
- package/dist/testContainerRuntimeFactory.js.map +1 -1
- package/dist/testFluidObject.d.ts.map +1 -1
- package/dist/testFluidObject.js +7 -3
- package/dist/testFluidObject.js.map +1 -1
- package/dist/testObjectProvider.d.ts +4 -1
- package/dist/testObjectProvider.d.ts.map +1 -1
- package/dist/testObjectProvider.js +28 -11
- package/dist/testObjectProvider.js.map +1 -1
- package/dist/timeoutUtils.d.ts.map +1 -1
- package/dist/timeoutUtils.js +4 -3
- package/dist/timeoutUtils.js.map +1 -1
- package/package.json +66 -55
- package/prettier.config.cjs +1 -1
- package/src/DriverWrappers.ts +40 -37
- package/src/TestConfigs.ts +9 -7
- package/src/TestSummaryUtils.ts +113 -119
- package/src/containerUtils.ts +20 -18
- package/src/index.ts +24 -25
- package/src/interfaces.ts +10 -7
- package/src/loaderContainerTracker.ts +627 -565
- package/src/localCodeLoader.ts +85 -77
- package/src/localLoader.ts +24 -24
- package/src/packageVersion.ts +1 -1
- package/src/retry.ts +31 -25
- package/src/testContainerRuntimeFactory.ts +59 -56
- package/src/testFluidObject.ts +168 -152
- package/src/testObjectProvider.ts +445 -384
- package/src/timeoutUtils.ts +174 -154
- package/tsconfig.json +9 -16
|
@@ -45,7 +45,8 @@ class LoaderContainerTracker {
|
|
|
45
45
|
*/
|
|
46
46
|
addContainer(container) {
|
|
47
47
|
// ignore summarizer
|
|
48
|
-
if (!container.deltaManager.clientDetails.capabilities.interactive &&
|
|
48
|
+
if (!container.deltaManager.clientDetails.capabilities.interactive &&
|
|
49
|
+
!this.syncSummarizerClients) {
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
52
|
// don't add container that is already tracked
|
|
@@ -90,15 +91,15 @@ class LoaderContainerTracker {
|
|
|
90
91
|
});
|
|
91
92
|
container.deltaManager.inbound.on("push", (message) => {
|
|
92
93
|
// Received the no op back, update the record if we are tracking
|
|
93
|
-
if ((0, driver_utils_1.canBeCoalescedByService)(message)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
if ((0, driver_utils_1.canBeCoalescedByService)(message) &&
|
|
95
|
+
message.clientId === container.clientId &&
|
|
96
|
+
record.trailingNoOps !== 0 &&
|
|
97
|
+
record.startTrailingNoOps <= message.clientSequenceNumber) {
|
|
97
98
|
// NoOp might have coalesced and skipped ahead some sequence number
|
|
98
99
|
// update the record and skip ahead as well
|
|
99
100
|
const oldStartTrailingNoOps = record.startTrailingNoOps;
|
|
100
101
|
record.startTrailingNoOps = message.clientSequenceNumber + 1;
|
|
101
|
-
record.trailingNoOps -=
|
|
102
|
+
record.trailingNoOps -= record.startTrailingNoOps - oldStartTrailingNoOps;
|
|
102
103
|
}
|
|
103
104
|
});
|
|
104
105
|
container.on("disconnected", () => {
|
|
@@ -195,17 +196,21 @@ class LoaderContainerTracker {
|
|
|
195
196
|
}
|
|
196
197
|
else {
|
|
197
198
|
// Wait for all the containers to be saved
|
|
199
|
+
debugWait(`Waiting container to be saved ${dirtyContainers.map(
|
|
198
200
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
199
|
-
|
|
201
|
+
(c) => this.containers.get(c).index)}`);
|
|
200
202
|
waitingSequenceNumberSynchronized = false;
|
|
201
|
-
await Promise.all(dirtyContainers.map(async (c) => Promise.race([
|
|
203
|
+
await Promise.all(dirtyContainers.map(async (c) => Promise.race([
|
|
204
|
+
(0, timeoutUtils_1.timeoutPromise)((resolve) => c.once("saved", () => resolve()), {
|
|
202
205
|
errorMsg: "Timeout on waiting a container to be saved",
|
|
203
206
|
}),
|
|
204
207
|
new Promise((resolve) => c.once("closed", resolve)),
|
|
205
208
|
])));
|
|
206
209
|
}
|
|
207
210
|
// yield a turn to allow side effect of the ops we just processed execute before we check again
|
|
208
|
-
await new Promise((resolve) => {
|
|
211
|
+
await new Promise((resolve) => {
|
|
212
|
+
setTimeout(resolve, 0);
|
|
213
|
+
});
|
|
209
214
|
}
|
|
210
215
|
// Pause all container that was resumed
|
|
211
216
|
// don't call pause if resumed is empty and pause everything, which is not what we want
|
|
@@ -233,7 +238,8 @@ class LoaderContainerTracker {
|
|
|
233
238
|
const quorum = container.getQuorum();
|
|
234
239
|
quorum.getMembers().forEach((client, clientId) => {
|
|
235
240
|
// ignore summarizer
|
|
236
|
-
if (!client.client.details.capabilities.interactive &&
|
|
241
|
+
if (!client.client.details.capabilities.interactive &&
|
|
242
|
+
!this.syncSummarizerClients) {
|
|
237
243
|
return;
|
|
238
244
|
}
|
|
239
245
|
if (!openedClientId.includes(clientId)) {
|
|
@@ -274,8 +280,8 @@ class LoaderContainerTracker {
|
|
|
274
280
|
}
|
|
275
281
|
(0, common_utils_1.assert)("clientSequenceNumber" in deltaManager, "no clientSequenceNumber");
|
|
276
282
|
(0, common_utils_1.assert)("clientSequenceNumberObserved" in deltaManager, "no clientSequenceNumber");
|
|
277
|
-
return deltaManager.clientSequenceNumber ===
|
|
278
|
-
deltaManager.clientSequenceNumberObserved + trailingNoOps;
|
|
283
|
+
return (deltaManager.clientSequenceNumber ===
|
|
284
|
+
deltaManager.clientSequenceNumberObserved + trailingNoOps);
|
|
279
285
|
});
|
|
280
286
|
if (!isClientSequenceNumberSynchronized) {
|
|
281
287
|
return false;
|
|
@@ -412,7 +418,9 @@ class LoaderContainerTracker {
|
|
|
412
418
|
}
|
|
413
419
|
while (resumed.some((queue) => !queue.idle)) {
|
|
414
420
|
debugWait("Wait until queue is idle");
|
|
415
|
-
await new Promise((resolve) => {
|
|
421
|
+
await new Promise((resolve) => {
|
|
422
|
+
setTimeout(resolve, 0);
|
|
423
|
+
});
|
|
416
424
|
}
|
|
417
425
|
// Make sure all the op that we sent out are acked first
|
|
418
426
|
// This is no op if we are processing incoming
|
|
@@ -442,9 +450,9 @@ class LoaderContainerTracker {
|
|
|
442
450
|
}
|
|
443
451
|
};
|
|
444
452
|
const inHandler = (message) => {
|
|
445
|
-
if (!(0, driver_utils_1.canBeCoalescedByService)(message)
|
|
446
|
-
|
|
447
|
-
|
|
453
|
+
if (!(0, driver_utils_1.canBeCoalescedByService)(message) &&
|
|
454
|
+
message.clientId === container.clientId &&
|
|
455
|
+
inflightTracker.get(container) === message.clientSequenceNumber) {
|
|
448
456
|
inflightTracker.delete(container);
|
|
449
457
|
}
|
|
450
458
|
};
|
|
@@ -472,8 +480,7 @@ class LoaderContainerTracker {
|
|
|
472
480
|
let address = "";
|
|
473
481
|
// contents comes in the wire as JSON string ("push" event)
|
|
474
482
|
// But already parsed when apply ("op" event)
|
|
475
|
-
let contents = typeof msgContents === "string" ?
|
|
476
|
-
JSON.parse(msgContents) : msgContents;
|
|
483
|
+
let contents = typeof msgContents === "string" ? JSON.parse(msgContents) : msgContents;
|
|
477
484
|
while (contents !== undefined && contents !== null) {
|
|
478
485
|
if (((_a = contents.contents) === null || _a === void 0 ? void 0 : _a.address) !== undefined) {
|
|
479
486
|
address += `/${contents.contents.address}`;
|
|
@@ -499,19 +506,22 @@ class LoaderContainerTracker {
|
|
|
499
506
|
debugOp(`${index}: ADD: clientId: ${container.clientId}`);
|
|
500
507
|
container.deltaManager.outbound.on("op", (messages) => {
|
|
501
508
|
for (const msg of messages) {
|
|
502
|
-
debugOp(`${index}: OUT: `
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
509
|
+
debugOp(`${index}: OUT: ` +
|
|
510
|
+
`cli: ${msg.clientSequenceNumber.toString().padStart(3)} ` +
|
|
511
|
+
`rsq: ${msg.referenceSequenceNumber.toString().padStart(3)} ` +
|
|
512
|
+
`${msg.type} ${getContentsString(msg.type, msg.contents)}`);
|
|
506
513
|
}
|
|
507
514
|
});
|
|
508
515
|
const getInboundHandler = (type) => {
|
|
509
516
|
return (msg) => {
|
|
510
|
-
const clientSeq = msg.clientId === container.clientId
|
|
511
|
-
`cli: ${msg.clientSequenceNumber.toString().padStart(3)}`
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
517
|
+
const clientSeq = msg.clientId === container.clientId
|
|
518
|
+
? `cli: ${msg.clientSequenceNumber.toString().padStart(3)}`
|
|
519
|
+
: " ";
|
|
520
|
+
debugOp(`${index}: ${type}: seq: ${msg.sequenceNumber.toString().padStart(3)} ` +
|
|
521
|
+
`${clientSeq} min: ${msg.minimumSequenceNumber
|
|
522
|
+
.toString()
|
|
523
|
+
.padStart(3)} ` +
|
|
524
|
+
`${msg.type} ${getContentsString(msg.type, msg.contents)}`);
|
|
515
525
|
};
|
|
516
526
|
};
|
|
517
527
|
container.deltaManager.inbound.on("push", getInboundHandler("IN "));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaderContainerTracker.js","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAsD;AAGtD,+DAAuE;AACvE,+EAAgH;AAChH,mCAAgC;AAEhC,iDAA8D;AAE9D,MAAM,OAAO,GAAG,aAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpC,MAAM,SAAS,GAAG,aAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAkBvC,MAAa,sBAAsB;IAI/B,YAA6B,wBAAiC,KAAK;QAAtC,0BAAqB,GAArB,qBAAqB,CAAiB;QAHlD,eAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC7D,uBAAkB,GAAW,CAAC,CAAC;IAE+B,CAAC;IAEvE;;;OAGG;IACI,GAAG,CAAiC,MAAkB;QACzD,oFAAoF;QACpF,MAAM,KAAK,GAAG,CAA0B,EAA2B,EAAE,EAAE;YACnE,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,OAAO,KAAK,EAAE,GAAG,IAAS,EAAE,EAAE;gBAC1B,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;gBACzC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;gBAC7B,OAAO,SAAS,CAAC;YACrB,CAAC,CAAC;QACN,CAAC,CAAC;QACF,sDAAsD;QACtD,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,CAAC,uBAAuB,GAAG,KAAK,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACvE,MAAM,CAAC,sCAAsC,GAA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C,CAAC,CAAC;SACN;IACL,CAAC;IAED;;;;OAIG;IACK,aAAa,CAAC,UAAwB;QAC1C,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QACpG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACtE,CAAC;CACJ;AA3iBD,wDA2iBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IContainer, IDeltaQueue, IHostLoader } from \"@fluidframework/container-definitions\";\nimport { Container } from \"@fluidframework/container-loader\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils\";\nimport { IDocumentMessage, ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { debug } from \"./debug\";\nimport { IOpProcessingController } from \"./testObjectProvider\";\nimport { timeoutAwait, timeoutPromise } from \"./timeoutUtils\";\n\nconst debugOp = debug.extend(\"ops\");\nconst debugWait = debug.extend(\"wait\");\n\ninterface ContainerRecord {\n // A short number for debug output\n index: number;\n\n // LoaderContainerTracker paused state\n paused: boolean;\n\n // Tracking trailing no-op that may or may be acked by the server so we can discount them\n // See issue #5629\n startTrailingNoOps: number;\n trailingNoOps: number;\n\n // Track last proposal to ensure no unresolved proposal\n lastProposal: number;\n}\n\nexport class LoaderContainerTracker implements IOpProcessingController {\n private readonly containers = new Map<IContainer, ContainerRecord>();\n private lastProposalSeqNum: number = 0;\n\n constructor(private readonly syncSummarizerClients: boolean = false) {}\n\n /**\n * Add a loader to start to track any container created from them\n * @param loader - loader to start tracking any container created.\n */\n public add<LoaderType extends IHostLoader>(loader: LoaderType) {\n // TODO: Expose Loader API to able to intercept container creation (See issue #5114)\n const patch = <T, C extends IContainer>(fn: (...args) => Promise<C>) => {\n const boundFn = fn.bind(loader);\n return async (...args: T[]) => {\n const container = await boundFn(...args);\n this.addContainer(container);\n return container;\n };\n };\n /* eslint-disable @typescript-eslint/unbound-method */\n loader.resolve = patch(loader.resolve);\n loader.createDetachedContainer = patch(loader.createDetachedContainer);\n loader.rehydrateDetachedContainerFromSnapshot = patch(loader.rehydrateDetachedContainerFromSnapshot);\n /* eslint-enable @typescript-eslint/unbound-method */\n }\n\n /**\n * Utility function to add container to be tracked.\n *\n * @param container - container to add\n */\n private addContainer(container: IContainer) {\n // ignore summarizer\n if (!container.deltaManager.clientDetails.capabilities.interactive && !this.syncSummarizerClients) { return; }\n\n // don't add container that is already tracked\n if (this.containers.has(container)) { return; }\n\n const record = {\n index: this.containers.size,\n paused: false,\n startTrailingNoOps: 0,\n trailingNoOps: 0,\n lastProposal: 0,\n };\n this.containers.set(container, record);\n this.trackTrailingNoOps(container, record);\n this.trackLastProposal(container);\n this.setupTrace(container, record.index);\n }\n\n /**\n * Keep track of the trailing NoOp that was sent so we can discount them in the clientSequenceNumber tracking.\n * The server might coalesce them with other ops, or a single NoOp, or delay it if it don't think it is necessary.\n *\n * @param container - the container to track\n * @param record - the record to update the trailing op information\n */\n private trackTrailingNoOps(container: IContainer, record: ContainerRecord) {\n container.deltaManager.outbound.on(\"op\", (messages) => {\n for (const msg of messages) {\n if (canBeCoalescedByService(msg)) {\n // Track the NoOp that was sent.\n if (record.trailingNoOps === 0) {\n // record the starting sequence number of the trailing no ops if we haven't been tracking yet.\n record.startTrailingNoOps = msg.clientSequenceNumber;\n }\n record.trailingNoOps++;\n } else {\n // Other ops has been sent. We would like to see those ack'ed, so no more need to track NoOps\n record.trailingNoOps = 0;\n }\n }\n });\n\n container.deltaManager.inbound.on(\"push\", (message) => {\n // Received the no op back, update the record if we are tracking\n if (canBeCoalescedByService(message)\n && message.clientId === (container as Container).clientId\n && record.trailingNoOps !== 0\n && record.startTrailingNoOps <= message.clientSequenceNumber\n ) {\n // NoOp might have coalesced and skipped ahead some sequence number\n // update the record and skip ahead as well\n const oldStartTrailingNoOps = record.startTrailingNoOps;\n record.startTrailingNoOps = message.clientSequenceNumber + 1;\n record.trailingNoOps -= (record.startTrailingNoOps - oldStartTrailingNoOps);\n }\n });\n\n container.on(\"disconnected\", () => {\n // reset on disconnect.\n record.trailingNoOps = 0;\n });\n }\n\n private trackLastProposal(container: IContainer) {\n container.on(\"codeDetailsProposed\", (value, proposal) => {\n if (proposal.sequenceNumber > this.lastProposalSeqNum) {\n this.lastProposalSeqNum = proposal.sequenceNumber;\n }\n });\n }\n\n /**\n * Reset the tracker, closing all containers and stop tracking them.\n */\n public reset() {\n this.lastProposalSeqNum = 0;\n for (const container of this.containers.keys()) {\n container.close();\n }\n this.containers.clear();\n\n // REVIEW: do we need to unpatch the loaders?\n }\n\n /**\n * Ensure all tracked containers are synchronized\n */\n public async ensureSynchronized(...containers: IContainer[]): Promise<void> {\n await this.processSynchronized(undefined, ...containers);\n }\n\n /**\n * Ensure all tracked containers are synchronized with a time limit\n */\n public async ensureSynchronizedWithTimeout?(timeoutDuration: number | undefined, ...containers: IContainer[]) {\n await this.processSynchronized(timeoutDuration, ...containers);\n }\n\n /**\n * Make sure all the tracked containers are synchronized.\n *\n * No isDirty (non-readonly) containers\n *\n * No extra clientId in quorum of any container that is not tracked and still opened.\n *\n * - i.e. no pending Join/Leave message.\n *\n * No unresolved proposal (minSeqNum \\>= lastProposalSeqNum)\n *\n * lastSequenceNumber of all container is the same\n *\n * clientSequenceNumberObserved is the same as clientSequenceNumber sent\n *\n * - this overlaps with !isDirty, but include task scheduler ops.\n *\n * - Trailing NoOp is tracked and don't count as pending ops.\n */\n private async processSynchronized(timeoutDuration: number | undefined, ...containers: IContainer[]) {\n const resumed = this.resumeProcessing(...containers);\n\n let waitingSequenceNumberSynchronized = false;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const containersToApply = this.getContainers(containers);\n if (containersToApply.length === 0) { break; }\n\n // Ignore readonly dirty containers, because it can't sent up and nothing can be done about it being dirty\n const dirtyContainers = containersToApply.filter((c) => {\n const { deltaManager, isDirty } = c;\n return deltaManager.readOnlyInfo.readonly !== true && isDirty;\n });\n if (dirtyContainers.length === 0) {\n // Wait for all the leave messages\n const pendingClients = this.getPendingClients(containersToApply);\n if (pendingClients.length === 0) {\n if (this.isSequenceNumberSynchronized(containersToApply)) {\n // done, we are in sync\n break;\n }\n if (!waitingSequenceNumberSynchronized) {\n // Only write it out once\n waitingSequenceNumberSynchronized = true;\n debugWait(\"Waiting for sequence number synchronized\");\n await timeoutAwait(this.waitForAnyInboundOps(containersToApply), {\n errorMsg: \"Timeout on waiting for sequence number synchronized\",\n });\n }\n } else {\n waitingSequenceNumberSynchronized = false;\n await timeoutAwait(this.waitForPendingClients(pendingClients), {\n errorMsg: \"Timeout on waiting for pending join or leave op\",\n });\n }\n } else {\n // Wait for all the containers to be saved\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n debugWait(`Waiting container to be saved ${dirtyContainers.map((c) => this.containers.get(c)!.index)}`);\n waitingSequenceNumberSynchronized = false;\n await Promise.all(dirtyContainers.map(async (c) => Promise.race(\n [timeoutPromise(\n (resolve) => c.once(\"saved\", () => resolve()),\n {\n errorMsg: \"Timeout on waiting a container to be saved\",\n },\n ),\n new Promise((resolve) => c.once(\"closed\", resolve)),\n ],\n )));\n }\n\n // yield a turn to allow side effect of the ops we just processed execute before we check again\n await new Promise<void>((resolve) => { setTimeout(resolve, 0); });\n }\n\n // Pause all container that was resumed\n // don't call pause if resumed is empty and pause everything, which is not what we want\n if (resumed.length !== 0) {\n await timeoutAwait(this.pauseProcessing(...resumed), {\n errorMsg: \"Timeout on waiting for pausing all resumed containers\",\n });\n }\n\n debugWait(\"Synchronized\");\n }\n\n /**\n * Utility to calculate the set of clientId per container in quorum that is NOT associated with\n * any container we tracked, indicating there is a pending join or leave op that we need to wait.\n *\n * @param containersToApply - the set of containers to check\n */\n private getPendingClients(containersToApply: IContainer[]) {\n // All the clientId we track should be a superset of the quorum, otherwise, we are missing\n // leave messages\n const openedDocuments = Array.from(this.containers.keys()).filter((c) => !c.closed);\n const openedClientId = openedDocuments.map((container) => (container as Container).clientId);\n\n const pendingClients: [IContainer, Set<string>][] = [];\n containersToApply.forEach((container) => {\n const pendingClientId = new Set<string>();\n const quorum = container.getQuorum();\n quorum.getMembers().forEach((client, clientId) => {\n // ignore summarizer\n if (!client.client.details.capabilities.interactive && !this.syncSummarizerClients) { return; }\n if (!openedClientId.includes(clientId)) {\n pendingClientId.add(clientId);\n }\n });\n\n if (pendingClientId.size !== 0) {\n pendingClients.push([container, pendingClientId]);\n }\n });\n return pendingClients;\n }\n\n /**\n * Utility to check synchronization based on sequence number\n * See ensureSynchronized for more detail\n *\n * @param containersToApply - the set of containers to check\n */\n private isSequenceNumberSynchronized(containersToApply: IContainer[]) {\n // clientSequenceNumber check detects ops in flight, both on the wire and in the outbound queue\n // We need both client sequence number and isDirty check because:\n // - Currently isDirty flag ignores ops for task scheduler, so we need the client sequence number check\n // - But isDirty flags include ops during forceReadonly and disconnected, because we don't submit\n // the ops in the first place, clientSequenceNumber is not assigned\n\n const isClientSequenceNumberSynchronized = containersToApply.every((container) => {\n if (container.deltaManager.readOnlyInfo.readonly === true) {\n // Ignore readonly container. the clientSeqNum and clientSeqNumObserved might be out of sync\n // because we transition to readonly when outbound is not empty or the in transit op got lost\n return true;\n }\n // Note that in read only mode, the op won't be submitted\n let deltaManager = (container.deltaManager as any);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const { trailingNoOps } = this.containers.get(container)!;\n // Back-compat: clientSequenceNumber & clientSequenceNumberObserved moved to ConnectionManager in 0.53\n if (!(\"clientSequenceNumber\" in deltaManager)) {\n deltaManager = deltaManager.connectionManager;\n }\n assert(\"clientSequenceNumber\" in deltaManager, \"no clientSequenceNumber\");\n assert(\"clientSequenceNumberObserved\" in deltaManager, \"no clientSequenceNumber\");\n return deltaManager.clientSequenceNumber ===\n (deltaManager.clientSequenceNumberObserved as number) + trailingNoOps;\n });\n\n if (!isClientSequenceNumberSynchronized) {\n return false;\n }\n\n const minSeqNum = containersToApply[0].deltaManager.minimumSequenceNumber;\n if (minSeqNum < this.lastProposalSeqNum) {\n // There is an unresolved proposal\n return false;\n }\n\n // Check to see if all the container has process the same number of ops.\n const seqNum = containersToApply[0].deltaManager.lastSequenceNumber;\n return containersToApply.every((c) => c.deltaManager.lastSequenceNumber === seqNum);\n }\n\n /**\n * Utility to wait for any clientId in quorum that is NOT associated with any container we\n * tracked, indicating there is a pending join or leave op that we need to wait.\n *\n * Note that this function doesn't account for container that got added after we started waiting\n *\n * @param containersToApply - the set of containers to wait for any inbound ops for\n */\n private async waitForPendingClients(pendingClients: [IContainer, Set<string>][]) {\n const unconnectedClients =\n Array.from(this.containers.keys()).filter((c) => !c.closed && !(c as Container).connected);\n return Promise.all(pendingClients.map(async ([container, pendingClientId]) => {\n return new Promise<void>((resolve) => {\n const cleanup = () => {\n unconnectedClients.forEach((c) => c.off(\"connected\", handler));\n container.getQuorum().off(\"removeMember\", handler);\n };\n const handler = (clientId: string) => {\n pendingClientId.delete(clientId);\n if (pendingClientId.size === 0) {\n cleanup();\n resolve();\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const index = this.containers.get(container)!.index;\n debugWait(`${index}: Waiting for pending clients ${Array.from(pendingClientId.keys())}`);\n unconnectedClients.forEach((c) => c.on(\"connected\", handler));\n container.getQuorum().on(\"removeMember\", handler);\n container.on(\"closed\", () => {\n cleanup();\n resolve();\n });\n });\n }));\n }\n\n /**\n * Utility to wait for any inbound ops from a set of containers\n * @param containersToApply - the set of containers to wait for any inbound ops for\n */\n private async waitForAnyInboundOps(containersToApply: IContainer[]) {\n return new Promise<void>((resolve) => {\n const handler = () => {\n containersToApply.map((c) => {\n c.deltaManager.inbound.off(\"push\", handler);\n });\n resolve();\n };\n containersToApply.map((c) => {\n c.deltaManager.inbound.on(\"push\", handler);\n });\n });\n }\n\n /**\n * Resume all queue activities on all paused tracked containers and return them\n */\n public resumeProcessing(...containers: IContainer[]) {\n const resumed: IContainer[] = [];\n const containersToApply = this.getContainers(containers);\n for (const container of containersToApply) {\n const record = this.containers.get(container);\n if (record?.paused === true) {\n debugWait(`${record.index}: container resumed`);\n container.deltaManager.inbound.resume();\n container.deltaManager.outbound.resume();\n resumed.push(container);\n record.paused = false;\n }\n }\n return resumed;\n }\n\n /**\n * Pause all queue activities on the containers given, or all tracked containers\n * Any containers given that is not tracked will be ignored.\n */\n public async pauseProcessing(...containers: IContainer[]) {\n const pauseP: Promise<void>[] = [];\n const containersToApply = this.getContainers(containers);\n for (const container of containersToApply) {\n const record = this.containers.get(container);\n if (record !== undefined && !record.paused) {\n debugWait(`${record.index}: container paused`);\n pauseP.push(container.deltaManager.inbound.pause());\n pauseP.push(container.deltaManager.outbound.pause());\n record.paused = true;\n }\n }\n await Promise.all(pauseP);\n }\n\n /**\n * Pause all queue activities on all tracked containers, and resume only\n * inbound to process ops until it is idle. All queues are left in the paused state\n * after the function\n */\n public async processIncoming(...containers: IContainer[]) {\n return this.processQueue(containers, (container) => container.deltaManager.inbound);\n }\n\n /**\n * Pause all queue activities on all tracked containers, and resume only\n * outbound to process ops until it is idle. All queues are left in the paused state\n * after the function\n */\n public async processOutgoing(...containers: IContainer[]) {\n return this.processQueue(containers, (container) => container.deltaManager.outbound);\n }\n\n /**\n * Implementation of processIncoming and processOutgoing\n */\n private async processQueue<U>(containers: IContainer[], getQueue: (container: IContainer) => IDeltaQueue<U>) {\n await this.pauseProcessing(...containers);\n const resumed: IDeltaQueue<U>[] = [];\n\n const containersToApply = this.getContainers(containers);\n const inflightTracker = new Map<IContainer, number>();\n const cleanup: (() => void)[] = [];\n for (const container of containersToApply) {\n const queue = getQueue(container);\n\n // track the outgoing ops (if any) to make sure they make the round trip to at least to the same client\n // to make sure they are sequenced.\n cleanup.push(this.setupInOutTracker(container, inflightTracker));\n queue.resume();\n resumed.push(queue);\n }\n\n while (resumed.some((queue) => !queue.idle)) {\n debugWait(\"Wait until queue is idle\");\n await new Promise<void>((resolve) => { setTimeout(resolve, 0); });\n }\n\n // Make sure all the op that we sent out are acked first\n // This is no op if we are processing incoming\n if (inflightTracker.size) {\n debugWait(\"Wait for inflight ops\");\n do {\n await this.waitForAnyInboundOps(containersToApply);\n } while (inflightTracker.size);\n }\n\n // remove the handlers\n cleanup.forEach((clean) => clean());\n\n await Promise.all(resumed.map(async (queue) => queue.pause()));\n }\n\n /**\n * Utility to set up listener to track the outbound ops until it round trip back\n * Returns a function to remove the handler after it is done.\n *\n * @param container - the container to setup\n * @param inflightTracker - a map to track the clientSequenceNumber per container it expect to get ops back\n */\n private setupInOutTracker(container: IContainer, inflightTracker: Map<IContainer, number>) {\n const outHandler = (messages: IDocumentMessage[]) => {\n for (const message of messages) {\n if (!canBeCoalescedByService(message)) {\n inflightTracker.set(container, message.clientSequenceNumber);\n }\n }\n };\n const inHandler = (message: ISequencedDocumentMessage) => {\n if (!canBeCoalescedByService(message)\n && message.clientId === (container as Container).clientId\n && inflightTracker.get(container) === message.clientSequenceNumber) {\n inflightTracker.delete(container);\n }\n };\n\n container.deltaManager.outbound.on(\"op\", outHandler);\n container.deltaManager.inbound.on(\"push\", inHandler);\n\n return () => {\n container.deltaManager.outbound.off(\"op\", outHandler);\n container.deltaManager.inbound.off(\"push\", inHandler);\n };\n }\n\n /**\n * Setup debug traces for connection and ops\n */\n private setupTrace(container: IContainer, index: number) {\n if (debugOp.enabled) {\n const getContentsString = (type: string, msgContents: any) => {\n try {\n if (type !== MessageType.Operation) {\n if (typeof msgContents === \"string\") { return msgContents; }\n return JSON.stringify(msgContents);\n }\n let address = \"\";\n\n // contents comes in the wire as JSON string (\"push\" event)\n // But already parsed when apply (\"op\" event)\n let contents = typeof msgContents === \"string\" ?\n JSON.parse(msgContents) : msgContents;\n while (contents !== undefined && contents !== null) {\n if (contents.contents?.address !== undefined) {\n address += `/${contents.contents.address}`;\n contents = contents.contents.contents;\n } else if (contents.content?.address !== undefined) {\n address += `/${contents.content.address}`;\n contents = contents.content.contents;\n } else {\n break;\n }\n }\n if (address) {\n return `${address} ${JSON.stringify(contents)}`;\n }\n return JSON.stringify(contents);\n } catch (e: any) {\n return `${e.message}: ${e.stack}`;\n }\n };\n debugOp(`${index}: ADD: clientId: ${(container as Container).clientId}`);\n container.deltaManager.outbound.on(\"op\", (messages) => {\n for (const msg of messages) {\n debugOp(`${index}: OUT: `\n + `cli: ${msg.clientSequenceNumber.toString().padStart(3)} `\n + `rsq: ${msg.referenceSequenceNumber.toString().padStart(3)} `\n + `${msg.type} ${getContentsString(msg.type, msg.contents)}`);\n }\n });\n const getInboundHandler = (type: string) => {\n return (msg: ISequencedDocumentMessage) => {\n const clientSeq = msg.clientId === (container as Container).clientId ?\n `cli: ${msg.clientSequenceNumber.toString().padStart(3)}` : \" \";\n debugOp(`${index}: ${type}: seq: ${msg.sequenceNumber.toString().padStart(3)} `\n + `${clientSeq} min: ${msg.minimumSequenceNumber.toString().padStart(3)} `\n + `${msg.type} ${getContentsString(msg.type, msg.contents)}`);\n };\n };\n container.deltaManager.inbound.on(\"push\", getInboundHandler(\"IN \"));\n container.deltaManager.inbound.on(\"op\", getInboundHandler(\"OP \"));\n container.deltaManager.on(\"connect\", (details) => {\n debugOp(`${index}: CON: clientId: ${details.clientId}`);\n });\n container.deltaManager.on(\"disconnect\", (reason) => {\n debugOp(`${index}: DIS: ${reason}`);\n });\n }\n }\n\n /**\n * Filter out the opened containers based on param.\n * @param containers - The container to filter to. If the array is empty, it means don't filter and return\n * all open containers.\n */\n private getContainers(containers: IContainer[]) {\n const containersToApply = containers.length === 0 ? Array.from(this.containers.keys()) : containers;\n return containersToApply.filter((container) => !container.closed);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"loaderContainerTracker.js","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":";;;AAAA;;;G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AAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;CACD;AArmBD,wDAqmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IContainer, IDeltaQueue, IHostLoader } from \"@fluidframework/container-definitions\";\nimport { Container } from \"@fluidframework/container-loader\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport { debug } from \"./debug\";\nimport { IOpProcessingController } from \"./testObjectProvider\";\nimport { timeoutAwait, timeoutPromise } from \"./timeoutUtils\";\n\nconst debugOp = debug.extend(\"ops\");\nconst debugWait = debug.extend(\"wait\");\n\ninterface ContainerRecord {\n\t// A short number for debug output\n\tindex: number;\n\n\t// LoaderContainerTracker paused state\n\tpaused: boolean;\n\n\t// Tracking trailing no-op that may or may be acked by the server so we can discount them\n\t// See issue #5629\n\tstartTrailingNoOps: number;\n\ttrailingNoOps: number;\n\n\t// Track last proposal to ensure no unresolved proposal\n\tlastProposal: number;\n}\n\nexport class LoaderContainerTracker implements IOpProcessingController {\n\tprivate readonly containers = new Map<IContainer, ContainerRecord>();\n\tprivate lastProposalSeqNum: number = 0;\n\n\tconstructor(private readonly syncSummarizerClients: boolean = false) {}\n\n\t/**\n\t * Add a loader to start to track any container created from them\n\t * @param loader - loader to start tracking any container created.\n\t */\n\tpublic add<LoaderType extends IHostLoader>(loader: LoaderType) {\n\t\t// TODO: Expose Loader API to able to intercept container creation (See issue #5114)\n\t\tconst patch = <T, C extends IContainer>(fn: (...args) => Promise<C>) => {\n\t\t\tconst boundFn = fn.bind(loader);\n\t\t\treturn async (...args: T[]) => {\n\t\t\t\tconst container = await boundFn(...args);\n\t\t\t\tthis.addContainer(container);\n\t\t\t\treturn container;\n\t\t\t};\n\t\t};\n\t\t/* eslint-disable @typescript-eslint/unbound-method */\n\t\tloader.resolve = patch(loader.resolve);\n\t\tloader.createDetachedContainer = patch(loader.createDetachedContainer);\n\t\tloader.rehydrateDetachedContainerFromSnapshot = patch(\n\t\t\tloader.rehydrateDetachedContainerFromSnapshot,\n\t\t);\n\t\t/* eslint-enable @typescript-eslint/unbound-method */\n\t}\n\n\t/**\n\t * Utility function to add container to be tracked.\n\t *\n\t * @param container - container to add\n\t */\n\tprivate addContainer(container: IContainer) {\n\t\t// ignore summarizer\n\t\tif (\n\t\t\t!container.deltaManager.clientDetails.capabilities.interactive &&\n\t\t\t!this.syncSummarizerClients\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// don't add container that is already tracked\n\t\tif (this.containers.has(container)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = {\n\t\t\tindex: this.containers.size,\n\t\t\tpaused: false,\n\t\t\tstartTrailingNoOps: 0,\n\t\t\ttrailingNoOps: 0,\n\t\t\tlastProposal: 0,\n\t\t};\n\t\tthis.containers.set(container, record);\n\t\tthis.trackTrailingNoOps(container, record);\n\t\tthis.trackLastProposal(container);\n\t\tthis.setupTrace(container, record.index);\n\t}\n\n\t/**\n\t * Keep track of the trailing NoOp that was sent so we can discount them in the clientSequenceNumber tracking.\n\t * The server might coalesce them with other ops, or a single NoOp, or delay it if it don't think it is necessary.\n\t *\n\t * @param container - the container to track\n\t * @param record - the record to update the trailing op information\n\t */\n\tprivate trackTrailingNoOps(container: IContainer, record: ContainerRecord) {\n\t\tcontainer.deltaManager.outbound.on(\"op\", (messages) => {\n\t\t\tfor (const msg of messages) {\n\t\t\t\tif (canBeCoalescedByService(msg)) {\n\t\t\t\t\t// Track the NoOp that was sent.\n\t\t\t\t\tif (record.trailingNoOps === 0) {\n\t\t\t\t\t\t// record the starting sequence number of the trailing no ops if we haven't been tracking yet.\n\t\t\t\t\t\trecord.startTrailingNoOps = msg.clientSequenceNumber;\n\t\t\t\t\t}\n\t\t\t\t\trecord.trailingNoOps++;\n\t\t\t\t} else {\n\t\t\t\t\t// Other ops has been sent. We would like to see those ack'ed, so no more need to track NoOps\n\t\t\t\t\trecord.trailingNoOps = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tcontainer.deltaManager.inbound.on(\"push\", (message) => {\n\t\t\t// Received the no op back, update the record if we are tracking\n\t\t\tif (\n\t\t\t\tcanBeCoalescedByService(message) &&\n\t\t\t\tmessage.clientId === (container as Container).clientId &&\n\t\t\t\trecord.trailingNoOps !== 0 &&\n\t\t\t\trecord.startTrailingNoOps <= message.clientSequenceNumber\n\t\t\t) {\n\t\t\t\t// NoOp might have coalesced and skipped ahead some sequence number\n\t\t\t\t// update the record and skip ahead as well\n\t\t\t\tconst oldStartTrailingNoOps = record.startTrailingNoOps;\n\t\t\t\trecord.startTrailingNoOps = message.clientSequenceNumber + 1;\n\t\t\t\trecord.trailingNoOps -= record.startTrailingNoOps - oldStartTrailingNoOps;\n\t\t\t}\n\t\t});\n\n\t\tcontainer.on(\"disconnected\", () => {\n\t\t\t// reset on disconnect.\n\t\t\trecord.trailingNoOps = 0;\n\t\t});\n\t}\n\n\tprivate trackLastProposal(container: IContainer) {\n\t\tcontainer.on(\"codeDetailsProposed\", (value, proposal) => {\n\t\t\tif (proposal.sequenceNumber > this.lastProposalSeqNum) {\n\t\t\t\tthis.lastProposalSeqNum = proposal.sequenceNumber;\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Reset the tracker, closing all containers and stop tracking them.\n\t */\n\tpublic reset() {\n\t\tthis.lastProposalSeqNum = 0;\n\t\tfor (const container of this.containers.keys()) {\n\t\t\tcontainer.close();\n\t\t}\n\t\tthis.containers.clear();\n\n\t\t// REVIEW: do we need to unpatch the loaders?\n\t}\n\n\t/**\n\t * Ensure all tracked containers are synchronized\n\t */\n\tpublic async ensureSynchronized(...containers: IContainer[]): Promise<void> {\n\t\tawait this.processSynchronized(undefined, ...containers);\n\t}\n\n\t/**\n\t * Ensure all tracked containers are synchronized with a time limit\n\t */\n\tpublic async ensureSynchronizedWithTimeout?(\n\t\ttimeoutDuration: number | undefined,\n\t\t...containers: IContainer[]\n\t) {\n\t\tawait this.processSynchronized(timeoutDuration, ...containers);\n\t}\n\n\t/**\n\t * Make sure all the tracked containers are synchronized.\n\t *\n\t * No isDirty (non-readonly) containers\n\t *\n\t * No extra clientId in quorum of any container that is not tracked and still opened.\n\t *\n\t * - i.e. no pending Join/Leave message.\n\t *\n\t * No unresolved proposal (minSeqNum \\>= lastProposalSeqNum)\n\t *\n\t * lastSequenceNumber of all container is the same\n\t *\n\t * clientSequenceNumberObserved is the same as clientSequenceNumber sent\n\t *\n\t * - this overlaps with !isDirty, but include task scheduler ops.\n\t *\n\t * - Trailing NoOp is tracked and don't count as pending ops.\n\t */\n\tprivate async processSynchronized(\n\t\ttimeoutDuration: number | undefined,\n\t\t...containers: IContainer[]\n\t) {\n\t\tconst resumed = this.resumeProcessing(...containers);\n\n\t\tlet waitingSequenceNumberSynchronized = false;\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tconst containersToApply = this.getContainers(containers);\n\t\t\tif (containersToApply.length === 0) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Ignore readonly dirty containers, because it can't sent up and nothing can be done about it being dirty\n\t\t\tconst dirtyContainers = containersToApply.filter((c) => {\n\t\t\t\tconst { deltaManager, isDirty } = c;\n\t\t\t\treturn deltaManager.readOnlyInfo.readonly !== true && isDirty;\n\t\t\t});\n\t\t\tif (dirtyContainers.length === 0) {\n\t\t\t\t// Wait for all the leave messages\n\t\t\t\tconst pendingClients = this.getPendingClients(containersToApply);\n\t\t\t\tif (pendingClients.length === 0) {\n\t\t\t\t\tif (this.isSequenceNumberSynchronized(containersToApply)) {\n\t\t\t\t\t\t// done, we are in sync\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (!waitingSequenceNumberSynchronized) {\n\t\t\t\t\t\t// Only write it out once\n\t\t\t\t\t\twaitingSequenceNumberSynchronized = true;\n\t\t\t\t\t\tdebugWait(\"Waiting for sequence number synchronized\");\n\t\t\t\t\t\tawait timeoutAwait(this.waitForAnyInboundOps(containersToApply), {\n\t\t\t\t\t\t\terrorMsg: \"Timeout on waiting for sequence number synchronized\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\twaitingSequenceNumberSynchronized = false;\n\t\t\t\t\tawait timeoutAwait(this.waitForPendingClients(pendingClients), {\n\t\t\t\t\t\terrorMsg: \"Timeout on waiting for pending join or leave op\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Wait for all the containers to be saved\n\t\t\t\tdebugWait(\n\t\t\t\t\t`Waiting container to be saved ${dirtyContainers.map(\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t(c) => this.containers.get(c)!.index,\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t\twaitingSequenceNumberSynchronized = false;\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tdirtyContainers.map(async (c) =>\n\t\t\t\t\t\tPromise.race([\n\t\t\t\t\t\t\ttimeoutPromise((resolve) => c.once(\"saved\", () => resolve()), {\n\t\t\t\t\t\t\t\terrorMsg: \"Timeout on waiting a container to be saved\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tnew Promise((resolve) => c.once(\"closed\", resolve)),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// yield a turn to allow side effect of the ops we just processed execute before we check again\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tsetTimeout(resolve, 0);\n\t\t\t});\n\t\t}\n\n\t\t// Pause all container that was resumed\n\t\t// don't call pause if resumed is empty and pause everything, which is not what we want\n\t\tif (resumed.length !== 0) {\n\t\t\tawait timeoutAwait(this.pauseProcessing(...resumed), {\n\t\t\t\terrorMsg: \"Timeout on waiting for pausing all resumed containers\",\n\t\t\t});\n\t\t}\n\n\t\tdebugWait(\"Synchronized\");\n\t}\n\n\t/**\n\t * Utility to calculate the set of clientId per container in quorum that is NOT associated with\n\t * any container we tracked, indicating there is a pending join or leave op that we need to wait.\n\t *\n\t * @param containersToApply - the set of containers to check\n\t */\n\tprivate getPendingClients(containersToApply: IContainer[]) {\n\t\t// All the clientId we track should be a superset of the quorum, otherwise, we are missing\n\t\t// leave messages\n\t\tconst openedDocuments = Array.from(this.containers.keys()).filter((c) => !c.closed);\n\t\tconst openedClientId = openedDocuments.map(\n\t\t\t(container) => (container as Container).clientId,\n\t\t);\n\n\t\tconst pendingClients: [IContainer, Set<string>][] = [];\n\t\tcontainersToApply.forEach((container) => {\n\t\t\tconst pendingClientId = new Set<string>();\n\t\t\tconst quorum = container.getQuorum();\n\t\t\tquorum.getMembers().forEach((client, clientId) => {\n\t\t\t\t// ignore summarizer\n\t\t\t\tif (\n\t\t\t\t\t!client.client.details.capabilities.interactive &&\n\t\t\t\t\t!this.syncSummarizerClients\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!openedClientId.includes(clientId)) {\n\t\t\t\t\tpendingClientId.add(clientId);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (pendingClientId.size !== 0) {\n\t\t\t\tpendingClients.push([container, pendingClientId]);\n\t\t\t}\n\t\t});\n\t\treturn pendingClients;\n\t}\n\n\t/**\n\t * Utility to check synchronization based on sequence number\n\t * See ensureSynchronized for more detail\n\t *\n\t * @param containersToApply - the set of containers to check\n\t */\n\tprivate isSequenceNumberSynchronized(containersToApply: IContainer[]) {\n\t\t// clientSequenceNumber check detects ops in flight, both on the wire and in the outbound queue\n\t\t// We need both client sequence number and isDirty check because:\n\t\t// - Currently isDirty flag ignores ops for task scheduler, so we need the client sequence number check\n\t\t// - But isDirty flags include ops during forceReadonly and disconnected, because we don't submit\n\t\t// the ops in the first place, clientSequenceNumber is not assigned\n\n\t\tconst isClientSequenceNumberSynchronized = containersToApply.every((container) => {\n\t\t\tif (container.deltaManager.readOnlyInfo.readonly === true) {\n\t\t\t\t// Ignore readonly container. the clientSeqNum and clientSeqNumObserved might be out of sync\n\t\t\t\t// because we transition to readonly when outbound is not empty or the in transit op got lost\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t// Note that in read only mode, the op won't be submitted\n\t\t\tlet deltaManager = container.deltaManager as any;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst { trailingNoOps } = this.containers.get(container)!;\n\t\t\t// Back-compat: clientSequenceNumber & clientSequenceNumberObserved moved to ConnectionManager in 0.53\n\t\t\tif (!(\"clientSequenceNumber\" in deltaManager)) {\n\t\t\t\tdeltaManager = deltaManager.connectionManager;\n\t\t\t}\n\t\t\tassert(\"clientSequenceNumber\" in deltaManager, \"no clientSequenceNumber\");\n\t\t\tassert(\"clientSequenceNumberObserved\" in deltaManager, \"no clientSequenceNumber\");\n\t\t\treturn (\n\t\t\t\tdeltaManager.clientSequenceNumber ===\n\t\t\t\t(deltaManager.clientSequenceNumberObserved as number) + trailingNoOps\n\t\t\t);\n\t\t});\n\n\t\tif (!isClientSequenceNumberSynchronized) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst minSeqNum = containersToApply[0].deltaManager.minimumSequenceNumber;\n\t\tif (minSeqNum < this.lastProposalSeqNum) {\n\t\t\t// There is an unresolved proposal\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check to see if all the container has process the same number of ops.\n\t\tconst seqNum = containersToApply[0].deltaManager.lastSequenceNumber;\n\t\treturn containersToApply.every((c) => c.deltaManager.lastSequenceNumber === seqNum);\n\t}\n\n\t/**\n\t * Utility to wait for any clientId in quorum that is NOT associated with any container we\n\t * tracked, indicating there is a pending join or leave op that we need to wait.\n\t *\n\t * Note that this function doesn't account for container that got added after we started waiting\n\t *\n\t * @param containersToApply - the set of containers to wait for any inbound ops for\n\t */\n\tprivate async waitForPendingClients(pendingClients: [IContainer, Set<string>][]) {\n\t\tconst unconnectedClients = Array.from(this.containers.keys()).filter(\n\t\t\t(c) => !c.closed && !(c as Container).connected,\n\t\t);\n\t\treturn Promise.all(\n\t\t\tpendingClients.map(async ([container, pendingClientId]) => {\n\t\t\t\treturn new Promise<void>((resolve) => {\n\t\t\t\t\tconst cleanup = () => {\n\t\t\t\t\t\tunconnectedClients.forEach((c) => c.off(\"connected\", handler));\n\t\t\t\t\t\tcontainer.getQuorum().off(\"removeMember\", handler);\n\t\t\t\t\t};\n\t\t\t\t\tconst handler = (clientId: string) => {\n\t\t\t\t\t\tpendingClientId.delete(clientId);\n\t\t\t\t\t\tif (pendingClientId.size === 0) {\n\t\t\t\t\t\t\tcleanup();\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst index = this.containers.get(container)!.index;\n\t\t\t\t\tdebugWait(\n\t\t\t\t\t\t`${index}: Waiting for pending clients ${Array.from(\n\t\t\t\t\t\t\tpendingClientId.keys(),\n\t\t\t\t\t\t)}`,\n\t\t\t\t\t);\n\t\t\t\t\tunconnectedClients.forEach((c) => c.on(\"connected\", handler));\n\t\t\t\t\tcontainer.getQuorum().on(\"removeMember\", handler);\n\t\t\t\t\tcontainer.on(\"closed\", () => {\n\t\t\t\t\t\tcleanup();\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Utility to wait for any inbound ops from a set of containers\n\t * @param containersToApply - the set of containers to wait for any inbound ops for\n\t */\n\tprivate async waitForAnyInboundOps(containersToApply: IContainer[]) {\n\t\treturn new Promise<void>((resolve) => {\n\t\t\tconst handler = () => {\n\t\t\t\tcontainersToApply.map((c) => {\n\t\t\t\t\tc.deltaManager.inbound.off(\"push\", handler);\n\t\t\t\t});\n\t\t\t\tresolve();\n\t\t\t};\n\t\t\tcontainersToApply.map((c) => {\n\t\t\t\tc.deltaManager.inbound.on(\"push\", handler);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Resume all queue activities on all paused tracked containers and return them\n\t */\n\tpublic resumeProcessing(...containers: IContainer[]) {\n\t\tconst resumed: IContainer[] = [];\n\t\tconst containersToApply = this.getContainers(containers);\n\t\tfor (const container of containersToApply) {\n\t\t\tconst record = this.containers.get(container);\n\t\t\tif (record?.paused === true) {\n\t\t\t\tdebugWait(`${record.index}: container resumed`);\n\t\t\t\tcontainer.deltaManager.inbound.resume();\n\t\t\t\tcontainer.deltaManager.outbound.resume();\n\t\t\t\tresumed.push(container);\n\t\t\t\trecord.paused = false;\n\t\t\t}\n\t\t}\n\t\treturn resumed;\n\t}\n\n\t/**\n\t * Pause all queue activities on the containers given, or all tracked containers\n\t * Any containers given that is not tracked will be ignored.\n\t */\n\tpublic async pauseProcessing(...containers: IContainer[]) {\n\t\tconst pauseP: Promise<void>[] = [];\n\t\tconst containersToApply = this.getContainers(containers);\n\t\tfor (const container of containersToApply) {\n\t\t\tconst record = this.containers.get(container);\n\t\t\tif (record !== undefined && !record.paused) {\n\t\t\t\tdebugWait(`${record.index}: container paused`);\n\t\t\t\tpauseP.push(container.deltaManager.inbound.pause());\n\t\t\t\tpauseP.push(container.deltaManager.outbound.pause());\n\t\t\t\trecord.paused = true;\n\t\t\t}\n\t\t}\n\t\tawait Promise.all(pauseP);\n\t}\n\n\t/**\n\t * Pause all queue activities on all tracked containers, and resume only\n\t * inbound to process ops until it is idle. All queues are left in the paused state\n\t * after the function\n\t */\n\tpublic async processIncoming(...containers: IContainer[]) {\n\t\treturn this.processQueue(containers, (container) => container.deltaManager.inbound);\n\t}\n\n\t/**\n\t * Pause all queue activities on all tracked containers, and resume only\n\t * outbound to process ops until it is idle. All queues are left in the paused state\n\t * after the function\n\t */\n\tpublic async processOutgoing(...containers: IContainer[]) {\n\t\treturn this.processQueue(containers, (container) => container.deltaManager.outbound);\n\t}\n\n\t/**\n\t * Implementation of processIncoming and processOutgoing\n\t */\n\tprivate async processQueue<U>(\n\t\tcontainers: IContainer[],\n\t\tgetQueue: (container: IContainer) => IDeltaQueue<U>,\n\t) {\n\t\tawait this.pauseProcessing(...containers);\n\t\tconst resumed: IDeltaQueue<U>[] = [];\n\n\t\tconst containersToApply = this.getContainers(containers);\n\t\tconst inflightTracker = new Map<IContainer, number>();\n\t\tconst cleanup: (() => void)[] = [];\n\t\tfor (const container of containersToApply) {\n\t\t\tconst queue = getQueue(container);\n\n\t\t\t// track the outgoing ops (if any) to make sure they make the round trip to at least to the same client\n\t\t\t// to make sure they are sequenced.\n\t\t\tcleanup.push(this.setupInOutTracker(container, inflightTracker));\n\t\t\tqueue.resume();\n\t\t\tresumed.push(queue);\n\t\t}\n\n\t\twhile (resumed.some((queue) => !queue.idle)) {\n\t\t\tdebugWait(\"Wait until queue is idle\");\n\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\tsetTimeout(resolve, 0);\n\t\t\t});\n\t\t}\n\n\t\t// Make sure all the op that we sent out are acked first\n\t\t// This is no op if we are processing incoming\n\t\tif (inflightTracker.size) {\n\t\t\tdebugWait(\"Wait for inflight ops\");\n\t\t\tdo {\n\t\t\t\tawait this.waitForAnyInboundOps(containersToApply);\n\t\t\t} while (inflightTracker.size);\n\t\t}\n\n\t\t// remove the handlers\n\t\tcleanup.forEach((clean) => clean());\n\n\t\tawait Promise.all(resumed.map(async (queue) => queue.pause()));\n\t}\n\n\t/**\n\t * Utility to set up listener to track the outbound ops until it round trip back\n\t * Returns a function to remove the handler after it is done.\n\t *\n\t * @param container - the container to setup\n\t * @param inflightTracker - a map to track the clientSequenceNumber per container it expect to get ops back\n\t */\n\tprivate setupInOutTracker(container: IContainer, inflightTracker: Map<IContainer, number>) {\n\t\tconst outHandler = (messages: IDocumentMessage[]) => {\n\t\t\tfor (const message of messages) {\n\t\t\t\tif (!canBeCoalescedByService(message)) {\n\t\t\t\t\tinflightTracker.set(container, message.clientSequenceNumber);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tconst inHandler = (message: ISequencedDocumentMessage) => {\n\t\t\tif (\n\t\t\t\t!canBeCoalescedByService(message) &&\n\t\t\t\tmessage.clientId === (container as Container).clientId &&\n\t\t\t\tinflightTracker.get(container) === message.clientSequenceNumber\n\t\t\t) {\n\t\t\t\tinflightTracker.delete(container);\n\t\t\t}\n\t\t};\n\n\t\tcontainer.deltaManager.outbound.on(\"op\", outHandler);\n\t\tcontainer.deltaManager.inbound.on(\"push\", inHandler);\n\n\t\treturn () => {\n\t\t\tcontainer.deltaManager.outbound.off(\"op\", outHandler);\n\t\t\tcontainer.deltaManager.inbound.off(\"push\", inHandler);\n\t\t};\n\t}\n\n\t/**\n\t * Setup debug traces for connection and ops\n\t */\n\tprivate setupTrace(container: IContainer, index: number) {\n\t\tif (debugOp.enabled) {\n\t\t\tconst getContentsString = (type: string, msgContents: any) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (type !== MessageType.Operation) {\n\t\t\t\t\t\tif (typeof msgContents === \"string\") {\n\t\t\t\t\t\t\treturn msgContents;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn JSON.stringify(msgContents);\n\t\t\t\t\t}\n\t\t\t\t\tlet address = \"\";\n\n\t\t\t\t\t// contents comes in the wire as JSON string (\"push\" event)\n\t\t\t\t\t// But already parsed when apply (\"op\" event)\n\t\t\t\t\tlet contents =\n\t\t\t\t\t\ttypeof msgContents === \"string\" ? JSON.parse(msgContents) : msgContents;\n\t\t\t\t\twhile (contents !== undefined && contents !== null) {\n\t\t\t\t\t\tif (contents.contents?.address !== undefined) {\n\t\t\t\t\t\t\taddress += `/${contents.contents.address}`;\n\t\t\t\t\t\t\tcontents = contents.contents.contents;\n\t\t\t\t\t\t} else if (contents.content?.address !== undefined) {\n\t\t\t\t\t\t\taddress += `/${contents.content.address}`;\n\t\t\t\t\t\t\tcontents = contents.content.contents;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (address) {\n\t\t\t\t\t\treturn `${address} ${JSON.stringify(contents)}`;\n\t\t\t\t\t}\n\t\t\t\t\treturn JSON.stringify(contents);\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\treturn `${e.message}: ${e.stack}`;\n\t\t\t\t}\n\t\t\t};\n\t\t\tdebugOp(`${index}: ADD: clientId: ${(container as Container).clientId}`);\n\t\t\tcontainer.deltaManager.outbound.on(\"op\", (messages) => {\n\t\t\t\tfor (const msg of messages) {\n\t\t\t\t\tdebugOp(\n\t\t\t\t\t\t`${index}: OUT: ` +\n\t\t\t\t\t\t\t`cli: ${msg.clientSequenceNumber.toString().padStart(3)} ` +\n\t\t\t\t\t\t\t`rsq: ${msg.referenceSequenceNumber.toString().padStart(3)} ` +\n\t\t\t\t\t\t\t`${msg.type} ${getContentsString(msg.type, msg.contents)}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t\tconst getInboundHandler = (type: string) => {\n\t\t\t\treturn (msg: ISequencedDocumentMessage) => {\n\t\t\t\t\tconst clientSeq =\n\t\t\t\t\t\tmsg.clientId === (container as Container).clientId\n\t\t\t\t\t\t\t? `cli: ${msg.clientSequenceNumber.toString().padStart(3)}`\n\t\t\t\t\t\t\t: \" \";\n\t\t\t\t\tdebugOp(\n\t\t\t\t\t\t`${index}: ${type}: seq: ${msg.sequenceNumber.toString().padStart(3)} ` +\n\t\t\t\t\t\t\t`${clientSeq} min: ${msg.minimumSequenceNumber\n\t\t\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t\t\t.padStart(3)} ` +\n\t\t\t\t\t\t\t`${msg.type} ${getContentsString(msg.type, msg.contents)}`,\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t};\n\t\t\tcontainer.deltaManager.inbound.on(\"push\", getInboundHandler(\"IN \"));\n\t\t\tcontainer.deltaManager.inbound.on(\"op\", getInboundHandler(\"OP \"));\n\t\t\tcontainer.deltaManager.on(\"connect\", (details) => {\n\t\t\t\tdebugOp(`${index}: CON: clientId: ${details.clientId}`);\n\t\t\t});\n\t\t\tcontainer.deltaManager.on(\"disconnect\", (reason) => {\n\t\t\t\tdebugOp(`${index}: DIS: ${reason}`);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Filter out the opened containers based on param.\n\t * @param containers - The container to filter to. If the array is empty, it means don't filter and return\n\t * all open containers.\n\t */\n\tprivate getContainers(containers: IContainer[]) {\n\t\tconst containersToApply =\n\t\t\tcontainers.length === 0 ? Array.from(this.containers.keys()) : containers;\n\t\treturn containersToApply.filter((container) => !container.closed);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localCodeLoader.d.ts","sourceRoot":"","sources":["../src/localCodeLoader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"localCodeLoader.d.ts","sourceRoot":"","sources":["../src/localCodeLoader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,sBAAsB,EACtB,YAAY,EACZ,gCAAgC,EAChC,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEN,6BAA6B,EAC7B,8BAA8B,EAC9B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,oBAAY,yBAAyB,GAAG,OAAO,CAC9C,sBAAsB,GACrB,6BAA6B,GAC7B,8BAA8B,GAC9B,gCAAgC,CACjC,CAAC;AAGF,oBAAY,eAAe,GAAG,yBAAyB,GAAG,YAAY,CAAC;AAEvE;;;GAGG;AACH,qBAAa,eAAgB,YAAW,kBAAkB;IACzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA8C;gBAG/E,cAAc,EAAE,QAAQ,CAAC,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,EAC9D,cAAc,CAAC,EAAE,wBAAwB;IAmD1C;;;;OAIG;IACU,IAAI,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAe9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localCodeLoader.js","sourceRoot":"","sources":["../src/localCodeLoader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,oDAA4B;AAC5B,uDAAuF;
|
|
1
|
+
{"version":3,"file":"localCodeLoader.js","sourceRoot":"","sources":["../src/localCodeLoader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,oDAA4B;AAC5B,uDAAuF;AAevF,iEAAuE;AAavE;;;GAGG;AACH,MAAa,eAAe;IAG3B,YACC,cAA8D,EAC9D,cAAyC;QAJzB,sBAAiB,GAAG,IAAI,GAAG,EAAmC,CAAC;QAM/E,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE;YACnC,sEAAsE;YACtE,8EAA8E;YAC9E,qGAAqG;YACrG,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACxB,MAAM,KAAK,GACV,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ;gBACjC,CAAC,CAAC,MAAM,CAAC,OAAO;gBAChB,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACvD,IAAI,WAAW,GAAG,KAAK,CAAC,CAAC,CAAiB,CAAC;YAC3C,IAAI,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,MAAK,SAAS,EAAE;gBAC3C,MAAM,WAAW,GAAG,WAAwC,CAAC;gBAE7D,IAAI,WAAW,CAAC,eAAe,KAAK,SAAS,EAAE;oBAC9C,WAAW,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;iBAC3C;qBAAM;oBACN,IAAA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AC;CACD;AA5ED,0CA4EC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport assert from \"assert\";\nimport { ContainerRuntimeFactoryWithDefaultDataStore } from \"@fluidframework/aqueduct\";\nimport {\n\tIProvideRuntimeFactory,\n\tIFluidModule,\n\tIProvideFluidCodeDetailsComparer,\n\tIFluidCodeDetails,\n\tICodeDetailsLoader,\n\tIFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tIContainerRuntimeBase,\n\tIProvideFluidDataStoreFactory,\n\tIProvideFluidDataStoreRegistry,\n} from \"@fluidframework/runtime-definitions\";\nimport { createDataStoreFactory } from \"@fluidframework/runtime-utils\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\n\nexport type SupportedExportInterfaces = Partial<\n\tIProvideRuntimeFactory &\n\t\tIProvideFluidDataStoreFactory &\n\t\tIProvideFluidDataStoreRegistry &\n\t\tIProvideFluidCodeDetailsComparer\n>;\n\n// Represents the entry point for a Fluid container.\nexport type fluidEntryPoint = SupportedExportInterfaces | IFluidModule;\n\n/**\n * A simple code loader that caches a mapping of package name to a Fluid entry point.\n * On load, it retrieves the entry point matching the package name in the given code details.\n */\nexport class LocalCodeLoader implements ICodeDetailsLoader {\n\tprivate readonly fluidPackageCache = new Map<string, IFluidModuleWithDetails>();\n\n\tconstructor(\n\t\tpackageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n\t\truntimeOptions?: IContainerRuntimeOptions,\n\t) {\n\t\tfor (const entry of packageEntries) {\n\t\t\t// Store the entry point against a unique id in the fluidPackageCache.\n\t\t\t// For code details containing a package name, use the package name as the id.\n\t\t\t// For code details containing a Fluid package, create a unique id from the package name and version.\n\t\t\tconst source = entry[0];\n\t\t\tconst pkgId =\n\t\t\t\ttypeof source.package === \"string\"\n\t\t\t\t\t? source.package\n\t\t\t\t\t: `${source.package.name}@${source.package.version}`;\n\t\t\tlet fluidModule = entry[1] as IFluidModule;\n\t\t\tif (fluidModule?.fluidExport === undefined) {\n\t\t\t\tconst maybeExport = fluidModule as SupportedExportInterfaces;\n\n\t\t\t\tif (maybeExport.IRuntimeFactory !== undefined) {\n\t\t\t\t\tfluidModule = { fluidExport: maybeExport };\n\t\t\t\t} else {\n\t\t\t\t\tassert(maybeExport.IFluidDataStoreFactory !== undefined);\n\t\t\t\t\tconst defaultFactory = createDataStoreFactory(\n\t\t\t\t\t\t\"default\",\n\t\t\t\t\t\tmaybeExport.IFluidDataStoreFactory,\n\t\t\t\t\t);\n\t\t\t\t\tconst innerRequestHandler = async (\n\t\t\t\t\t\trequest: IRequest,\n\t\t\t\t\t\truntime: IContainerRuntimeBase,\n\t\t\t\t\t) => runtime.IFluidHandleContext.resolveHandle(request);\n\t\t\t\t\tfluidModule = {\n\t\t\t\t\t\tfluidExport: {\n\t\t\t\t\t\t\t...maybeExport,\n\t\t\t\t\t\t\tIRuntimeFactory: new ContainerRuntimeFactoryWithDefaultDataStore(\n\t\t\t\t\t\t\t\tdefaultFactory,\n\t\t\t\t\t\t\t\t[[defaultFactory.type, Promise.resolve(defaultFactory)]],\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t[innerRequestHandler],\n\t\t\t\t\t\t\t\truntimeOptions,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst runtimeFactory = {\n\t\t\t\tmodule: fluidModule,\n\t\t\t\tdetails: source,\n\t\t\t};\n\n\t\t\tthis.fluidPackageCache.set(pkgId, runtimeFactory);\n\t\t}\n\t}\n\n\t/**\n\t * It finds the entry point for the package name in the given source and return it\n\t * as a Fluid module.\n\t * @param source - Details of where to find chaincode\n\t */\n\tpublic async load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails> {\n\t\t// Get the entry point for from the fluidPackageCache for the given code details.\n\t\t// For code details containing a package name, use the package name as the id.\n\t\t// For code details containing a Fluid package, create a unique id from the package name and version.\n\t\tconst pkdId =\n\t\t\ttypeof source.package === \"string\"\n\t\t\t\t? source.package\n\t\t\t\t: `${source.package.name}@${source.package.version}`;\n\n\t\tconst entryPoint = this.fluidPackageCache.get(pkdId);\n\t\tif (entryPoint === undefined) {\n\t\t\tthrow new Error(`Cannot find package ${pkdId}`);\n\t\t}\n\t\treturn entryPoint;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localLoader.d.ts","sourceRoot":"","sources":["../src/localLoader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"localLoader.d.ts","sourceRoot":"","sources":["../src/localLoader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,UAAU,EACV,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAmB,MAAM,mBAAmB,CAAC;AAErE;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC3B,cAAc,EAAE,QAAQ,CAAC,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,EAC9D,sBAAsB,EAAE,uBAAuB,EAC/C,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACtB,WAAW,CAUb;AAED;;;;;GAKG;AAEH,wBAAsB,wBAAwB,CAC7C,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,WAAW,EACnB,aAAa,EAAE,QAAQ,GACrB,OAAO,CAAC,UAAU,CAAC,CAKrB"}
|
package/dist/localLoader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localLoader.js","sourceRoot":"","sources":["../src/localLoader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,uEAA0D;AAI1D,uDAAqE;AAErE;;;;;;GAMG;AACH,SAAgB,YAAY,
|
|
1
|
+
{"version":3,"file":"localLoader.js","sourceRoot":"","sources":["../src/localLoader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,uEAA0D;AAI1D,uDAAqE;AAErE;;;;;;GAMG;AACH,SAAgB,YAAY,CAC3B,cAA8D,EAC9D,sBAA+C,EAC/C,WAAyB,EACzB,MAA6B,EAC7B,OAAwB;IAExB,MAAM,UAAU,GAAuB,IAAI,iCAAe,CAAC,cAAc,CAAC,CAAC;IAE3E,OAAO,IAAI,yBAAM,CAAC;QACjB,WAAW;QACX,sBAAsB;QACtB,UAAU;QACV,MAAM;QACN,OAAO;KACP,CAAC,CAAC;AACJ,CAAC;AAhBD,oCAgBC;AAED;;;;;GAKG;AAEI,KAAK,UAAU,wBAAwB,CAC7C,MAAyB,EACzB,MAAmB,EACnB,aAAuB;IAEvB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAEtC,OAAO,SAAS,CAAC;AAClB,CAAC;AATD,4DASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tICodeDetailsLoader,\n\tIContainer,\n\tIHostLoader,\n\tILoaderOptions,\n\tIFluidCodeDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IDocumentServiceFactory, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { fluidEntryPoint, LocalCodeLoader } from \"./localCodeLoader\";\n\n/**\n * Creates a loader with the given package entries and driver.\n * @param packageEntries - A list of code details to Fluid entry points.\n * @param documentServiceFactory - the driver factory to use\n * @param urlResolver - the url resolver to use\n * @param options - loader options\n */\nexport function createLoader(\n\tpackageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n\tdocumentServiceFactory: IDocumentServiceFactory,\n\turlResolver: IUrlResolver,\n\tlogger?: ITelemetryBaseLogger,\n\toptions?: ILoaderOptions,\n): IHostLoader {\n\tconst codeLoader: ICodeDetailsLoader = new LocalCodeLoader(packageEntries);\n\n\treturn new Loader({\n\t\turlResolver,\n\t\tdocumentServiceFactory,\n\t\tcodeLoader,\n\t\tlogger,\n\t\toptions,\n\t});\n}\n\n/**\n * Creates a detached Container and attaches it.\n * @param source - The code details used to create the Container.\n * @param loader - The loader to use to initialize the container.\n * @param attachRequest - The request to create new from.\n */\n\nexport async function createAndAttachContainer(\n\tsource: IFluidCodeDetails,\n\tloader: IHostLoader,\n\tattachRequest: IRequest,\n): Promise<IContainer> {\n\tconst container = await loader.createDetachedContainer(source);\n\tawait container.attach(attachRequest);\n\n\treturn container;\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/test-utils";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.3.0
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.3.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/test-utils";
|
|
11
|
-
exports.pkgVersion = "2.0.0-internal.3.0
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.3.2.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/test-utils\";\nexport const pkgVersion = \"2.0.0-internal.3.0
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/test-utils\";\nexport const pkgVersion = \"2.0.0-internal.3.2.0\";\n"]}
|
package/dist/retry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,uDAEb,OAAO,uEAiB3B,CAAC"}
|
package/dist/retry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAqD;AAErD,MAAM,KAAK,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAqD;AAErD,MAAM,KAAK,GAAG,KAAK,EAClB,QAA0B,EAC1B,YAAe,EACf,QAAgB,EAChB,SAAiB,EACJ,EAAE;IACf,KAAK,IAAI,UAAU,GAAG,CAAC,EAAE,UAAU,IAAI,QAAQ,EAAE,UAAU,EAAE,EAAE;QAC9D,IAAI;YACH,MAAM,MAAM,GAAG,MAAM,QAAQ,EAAE,CAAC;YAChC,OAAO,MAAM,CAAC;SACd;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,IAAA,oBAAK,EAAC,UAAU,GAAG,SAAS,CAAC,CAAC;SACpC;KACD;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACI,MAAM,sBAAsB,GAAG,KAAK,EAC1C,QAA0B,EAC1B,KAA4B,EAC5B,YAAe,EACf,QAAQ,GAAG,EAAE,EACb,SAAS,GAAG,EAAE,EACD,EAAE,CACf,KAAK,CACJ,KAAK,IAAI,EAAE;IACV,MAAM,KAAK,GAAG,MAAM,QAAQ,EAAE,CAAC;IAC/B,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;QACjB,OAAO,KAAK,CAAC;KACb;IAED,MAAM,KAAK,CAAC,WAAW,CAAC,CAAC;AAC1B,CAAC,EACD,YAAY,EACZ,QAAQ,EACR,SAAS,CACT,CAAC;AAnBU,QAAA,sBAAsB,0BAmBhC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { delay } from \"@fluidframework/common-utils\";\n\nconst retry = async <T>(\n\tcallback: () => Promise<T>,\n\tdefaultValue: T,\n\tmaxTries: number,\n\tbackOffMs: number,\n): Promise<T> => {\n\tfor (let currentTry = 1; currentTry <= maxTries; currentTry++) {\n\t\ttry {\n\t\t\tconst result = await callback();\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tawait delay(currentTry * backOffMs);\n\t\t}\n\t}\n\n\treturn Promise.resolve(defaultValue);\n};\n\n/**\n * Simple retry mechanism with linear back off to call\n * a function which may eventually return an accepted value.\n *\n * @param callback - the function to execute\n * @param check - the function to check if the value is acceptable\n * @param defaultValue - the default value\n * @param maxTries - maximum number of attempts\n * @param backOffMs - back off between attempts in milliseconds\n * @returns the actual value from the callback when successful or the default value otherwise\n */\nexport const retryWithEventualValue = async <T>(\n\tcallback: () => Promise<T>,\n\tcheck: (value: T) => boolean,\n\tdefaultValue: T,\n\tmaxTries = 20,\n\tbackOffMs = 50,\n): Promise<T> =>\n\tretry(\n\t\tasync () => {\n\t\t\tconst value = await callback();\n\t\t\tif (check(value)) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tthrow Error(\"Not ready\");\n\t\t},\n\t\tdefaultValue,\n\t\tmaxTries,\n\t\tbackOffMs,\n\t);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,
|
|
1
|
+
{"version":3,"file":"testContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EAExB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAA8B,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAG7E;;GAEG;AACH,eAAO,MAAM,iCAAiC,yBACvB,uBAAuB;eAI9B,MAAM,oBACM,sBAAsB,mBACxB,wBAAwB,oBAUvB,qBAAqB,EAAE;cAZlC,MAAM;0BACM,sBAAsB;wBACxB,wBAAwB;yBAUvB,qBAAqB,EAAE;sCAKL,gBAAgB,GAAG,QAAQ,IAAI,CAAC;yCAS7B,gBAAgB,GAAG,QAAQ,IAAI,CAAC;+BAOpE,iBAAiB,YAChB,OAAO,GACf,QAAQ,QAAQ,GAAG,iBAAiB,CAAC;;;;;CAmBzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B;eA3DxB,MAAM,oBACM,sBAAsB,mBACxB,wBAAwB,oBAUvB,qBAAqB,EAAE;cAZlC,MAAM;0BACM,sBAAsB;wBACxB,wBAAwB;yBAUvB,qBAAqB,EAAE;sCAKL,gBAAgB,GAAG,QAAQ,IAAI,CAAC;yCAS7B,gBAAgB,GAAG,QAAQ,IAAI,CAAC;+BAOpE,iBAAiB,YAChB,OAAO,GACf,QAAQ,QAAQ,GAAG,iBAAiB,CAAC;;;;;CAwBoD,CAAC"}
|
|
@@ -29,7 +29,8 @@ const createTestContainerRuntimeFactory = (containerRuntimeCtor) => {
|
|
|
29
29
|
}
|
|
30
30
|
async instantiateFirstTime(runtime) {
|
|
31
31
|
const rootContext = runtime.createDetachedRootDataStore([this.type], "default");
|
|
32
|
-
const rootRuntime = await this.dataStoreFactory.instantiateDataStore(rootContext,
|
|
32
|
+
const rootRuntime = await this.dataStoreFactory.instantiateDataStore(rootContext,
|
|
33
|
+
/* existing */ false);
|
|
33
34
|
await rootContext.attachRuntime(this.dataStoreFactory, rootRuntime);
|
|
34
35
|
}
|
|
35
36
|
async instantiateFromExisting(runtime) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAsE;AAEtE,yEAI2C;AAE3C,
|
|
1
|
+
{"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAsE;AAEtE,yEAI2C;AAE3C,qEAAoG;AAEpG,iEAAqE;AAErE;;GAEG;AACI,MAAM,iCAAiC,GAAG,CAChD,oBAA6C,EAC5C,EAAE;IACH,OAAO,KAAM,SAAQ,oCAAoB;QACxC,YACQ,IAAY,EACZ,gBAAwC,EACxC,iBAA2C;YACjD,cAAc,EAAE;gBACf,sBAAsB,kCAClB,+CAA2B,GAC3B;oBACF,wBAAwB,EAAE,CAAC;iBAC3B,CACD;aACD;SACD,EACM,kBAA2C,EAAE;YAEpD,KAAK,EAAE,CAAC;YAdD,SAAI,GAAJ,IAAI,CAAQ;YACZ,qBAAgB,GAAhB,gBAAgB,CAAwB;YACxC,mBAAc,GAAd,cAAc,CASpB;YACM,oBAAe,GAAf,eAAe,CAA8B;QAGrD,CAAC;QAEM,KAAK,CAAC,oBAAoB,CAAC,OAAyB;YAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;YAChF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CACnE,WAAW;YACX,cAAc,CAAC,KAAK,CACpB,CAAC;YACF,MAAM,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;QACrE,CAAC;QAEM,KAAK,CAAC,uBAAuB,CAAC,OAAyB;YAC7D,yCAAyC;YACzC,oFAAoF;YACpF,MAAM,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC3C,CAAC;QAED,KAAK,CAAC,aAAa,CAClB,OAA0B,EAC1B,QAAiB;YAEjB,MAAM,OAAO,GAAqB,MAAM,oBAAoB,CAAC,IAAI,CAChE,OAAO,EACP;gBACC,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;gBACnD,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACnD,EACD,IAAA,4CAA0B,EACzB,IAAA,qCAA0B,EAAC,SAAS,CAAC,EACrC,GAAG,IAAI,CAAC,eAAe,CACvB,EACD,IAAI,CAAC,cAAc,EACnB,OAAO,CAAC,KAAK,EACb,QAAQ,CACR,CAAC;YAEF,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;AACH,CAAC,CAAC;AA3DW,QAAA,iCAAiC,qCA2D5C;AAEF;;GAEG;AACU,QAAA,2BAA2B,GAAG,IAAA,yCAAiC,EAAC,oCAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultRouteRequestHandler } from \"@fluidframework/aqueduct\";\nimport { IContainerContext, IRuntime } from \"@fluidframework/container-definitions\";\nimport {\n\tContainerRuntime,\n\tIContainerRuntimeOptions,\n\tDefaultSummaryConfiguration,\n} from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { buildRuntimeRequestHandler, RuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils\";\n\n/**\n * Create a container runtime factory class that allows you to set runtime options\n */\nexport const createTestContainerRuntimeFactory = (\n\tcontainerRuntimeCtor: typeof ContainerRuntime,\n) => {\n\treturn class extends RuntimeFactoryHelper {\n\t\tconstructor(\n\t\t\tpublic type: string,\n\t\t\tpublic dataStoreFactory: IFluidDataStoreFactory,\n\t\t\tpublic runtimeOptions: IContainerRuntimeOptions = {\n\t\t\t\tsummaryOptions: {\n\t\t\t\t\tsummaryConfigOverrides: {\n\t\t\t\t\t\t...DefaultSummaryConfiguration,\n\t\t\t\t\t\t...{\n\t\t\t\t\t\t\tinitialSummarizerDelayMs: 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tpublic requestHandlers: RuntimeRequestHandler[] = [],\n\t\t) {\n\t\t\tsuper();\n\t\t}\n\n\t\tpublic async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n\t\t\tconst rootContext = runtime.createDetachedRootDataStore([this.type], \"default\");\n\t\t\tconst rootRuntime = await this.dataStoreFactory.instantiateDataStore(\n\t\t\t\trootContext,\n\t\t\t\t/* existing */ false,\n\t\t\t);\n\t\t\tawait rootContext.attachRuntime(this.dataStoreFactory, rootRuntime);\n\t\t}\n\n\t\tpublic async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n\t\t\t// Validate we can load root data stores.\n\t\t\t// We should be able to load any data store that was created in initializeFirstTime!\n\t\t\tawait runtime.getRootDataStore(\"default\");\n\t\t}\n\n\t\tasync preInitialize(\n\t\t\tcontext: IContainerContext,\n\t\t\texisting: boolean,\n\t\t): Promise<IRuntime & IContainerRuntime> {\n\t\t\tconst runtime: ContainerRuntime = await containerRuntimeCtor.load(\n\t\t\t\tcontext,\n\t\t\t\t[\n\t\t\t\t\t[\"default\", Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t\t[this.type, Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t],\n\t\t\t\tbuildRuntimeRequestHandler(\n\t\t\t\t\tdefaultRouteRequestHandler(\"default\"),\n\t\t\t\t\t...this.requestHandlers,\n\t\t\t\t),\n\t\t\t\tthis.runtimeOptions,\n\t\t\t\tcontext.scope,\n\t\t\t\texisting,\n\t\t\t);\n\n\t\t\treturn runtime;\n\t\t}\n\t};\n};\n\n/**\n * A container runtime factory that allows you to set runtime options\n */\nexport const TestContainerRuntimeFactory = createTestContainerRuntimeFactory(ContainerRuntime);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testFluidObject.d.ts","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"testFluidObject.d.ts","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,YAAY,EAGZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEN,qBAAqB,EAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAa,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAEhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,gBAAgB,EAAE,YAAY;aAyCpD,OAAO,EAAE,sBAAsB;aAC/B,OAAO,EAAE,sBAAsB;aAC/B,OAAO,EAAE,sBAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,iBAAiB;WA3Cf,IAAI,CACvB,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,sBAAsB,EAC/B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EAC5C,QAAQ,EAAE,OAAO;IAQlB,IAAW,gBAAgB,SAE1B;IAED,IAAW,cAAc,SAExB;IAED,IAAW,YAAY,SAEtB;IAED,IAAW,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAEtC;IAEM,IAAI,EAAG,UAAU,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IAEjD;;;;;;OAMG;gBAEc,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,sBAAsB,EAC9B,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC;IAKjE;;;OAGG;IACU,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAehD,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;YAI7C,UAAU;CAcxB;AAED,oBAAY,sBAAsB,GAAG,QAAQ,CAAC,CAAC,MAAM,GAAG,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;AAErF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,sBAAuB,YAAW,sBAAsB;IAYnE,OAAO,CAAC,QAAQ,CAAC,cAAc;aACf,IAAI;IAZrB,IAAW,sBAAsB,SAEhC;IAED;;;;;OAKG;gBAEe,cAAc,EAAE,sBAAsB,EACvC,IAAI,SAA2B;IAGnC,oBAAoB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,qBAAqB,CAAC;CAmDjC"}
|
package/dist/testFluidObject.js
CHANGED
|
@@ -43,7 +43,9 @@ class TestFluidObject {
|
|
|
43
43
|
get IFluidRouter() {
|
|
44
44
|
return this;
|
|
45
45
|
}
|
|
46
|
-
get handle() {
|
|
46
|
+
get handle() {
|
|
47
|
+
return this.innerHandle;
|
|
48
|
+
}
|
|
47
49
|
/**
|
|
48
50
|
* Retrieves a shared object with the given id.
|
|
49
51
|
* @param id - The id of the shared object to retrieve.
|
|
@@ -72,7 +74,7 @@ class TestFluidObject {
|
|
|
72
74
|
});
|
|
73
75
|
this.root.bindToContext();
|
|
74
76
|
}
|
|
75
|
-
this.root = await this.runtime.getChannel("root");
|
|
77
|
+
this.root = (await this.runtime.getChannel("root"));
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
exports.TestFluidObject = TestFluidObject;
|
|
@@ -111,7 +113,9 @@ class TestFluidObjectFactory {
|
|
|
111
113
|
this.factoryEntries = factoryEntries;
|
|
112
114
|
this.type = type;
|
|
113
115
|
}
|
|
114
|
-
get IFluidDataStoreFactory() {
|
|
116
|
+
get IFluidDataStoreFactory() {
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
115
119
|
async instantiateDataStore(context, existing) {
|
|
116
120
|
const dataTypes = new Map();
|
|
117
121
|
// Add SharedMap's factory which will be used to create the root map.
|