@fluidframework/container-loader 2.0.0-internal.6.3.3 → 2.0.0-internal.7.0.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/CHANGELOG.md +112 -0
- package/dist/catchUpMonitor.d.ts +2 -2
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/connectionManager.d.ts +1 -15
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +90 -82
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionState.js +1 -1
- package/dist/connectionState.js.map +1 -1
- package/dist/connectionStateHandler.js +9 -9
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +21 -2
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +222 -208
- package/dist/container.js.map +1 -1
- package/dist/containerContext.js +16 -16
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +6 -8
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +2 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.d.ts.map +1 -1
- package/dist/debugLogger.js +5 -4
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +87 -90
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.js +14 -14
- package/dist/deltaQueue.js.map +1 -1
- package/dist/loader.d.ts +3 -6
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +19 -84
- package/dist/loader.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/protocol.d.ts +1 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +3 -5
- package/dist/protocol.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/catchUpMonitor.d.ts +2 -2
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/connectionManager.d.ts +1 -15
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +93 -83
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.js +9 -9
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +21 -2
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +223 -209
- package/lib/container.js.map +1 -1
- package/lib/containerContext.js +16 -16
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +6 -8
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +2 -1
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.d.ts.map +1 -1
- package/lib/debugLogger.js +5 -4
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +87 -90
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.js +14 -14
- package/lib/deltaQueue.js.map +1 -1
- package/lib/loader.d.ts +3 -6
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +19 -84
- package/lib/loader.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocol.d.ts +1 -2
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -3
- package/lib/protocol.js.map +1 -1
- package/package.json +25 -19
- package/src/connectionManager.ts +38 -20
- package/src/container.ts +30 -16
- package/src/containerStorageAdapter.ts +0 -6
- package/src/contracts.ts +5 -1
- package/src/debugLogger.ts +1 -0
- package/src/deltaManager.ts +7 -9
- package/src/loader.ts +24 -92
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +2 -6
package/src/container.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
TelemetryEventCategory,
|
|
16
16
|
IRequest,
|
|
17
17
|
IResponse,
|
|
18
|
+
// eslint-disable-next-line import/no-deprecated
|
|
18
19
|
IFluidRouter,
|
|
19
20
|
FluidObject,
|
|
20
21
|
LogLevel,
|
|
@@ -121,7 +122,6 @@ import { ConnectionManager } from "./connectionManager";
|
|
|
121
122
|
import { ConnectionState } from "./connectionState";
|
|
122
123
|
import {
|
|
123
124
|
IProtocolHandler,
|
|
124
|
-
OnlyValidTermValue,
|
|
125
125
|
ProtocolHandler,
|
|
126
126
|
ProtocolHandlerBuilder,
|
|
127
127
|
protocolHandlerShouldProcessSignal,
|
|
@@ -359,7 +359,6 @@ export interface IPendingContainerState {
|
|
|
359
359
|
*/
|
|
360
360
|
savedOps: ISequencedDocumentMessage[];
|
|
361
361
|
url: string;
|
|
362
|
-
term: number;
|
|
363
362
|
clientId?: string;
|
|
364
363
|
}
|
|
365
364
|
|
|
@@ -595,6 +594,10 @@ export class Container
|
|
|
595
594
|
return this._deltaManager.connectionManager.connectionMode;
|
|
596
595
|
}
|
|
597
596
|
|
|
597
|
+
/**
|
|
598
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
599
|
+
*/
|
|
600
|
+
// eslint-disable-next-line import/no-deprecated
|
|
598
601
|
public get IFluidRouter(): IFluidRouter {
|
|
599
602
|
return this;
|
|
600
603
|
}
|
|
@@ -619,7 +622,21 @@ export class Container
|
|
|
619
622
|
}
|
|
620
623
|
|
|
621
624
|
/**
|
|
622
|
-
*
|
|
625
|
+
* Sends signal to runtime (and data stores) to be read-only.
|
|
626
|
+
* Hosts may have read only views, indicating to data stores that no edits are allowed.
|
|
627
|
+
* This is independent from this._readonlyPermissions (permissions) and this.connectionMode
|
|
628
|
+
* (server can return "write" mode even when asked for "read")
|
|
629
|
+
* Leveraging same "readonly" event as runtime & data stores should behave the same in such case
|
|
630
|
+
* as in read-only permissions.
|
|
631
|
+
* But this.active can be used by some DDSes to figure out if ops can be sent
|
|
632
|
+
* (for example, read-only view still participates in code proposals / upgrades decisions)
|
|
633
|
+
*
|
|
634
|
+
* Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour
|
|
635
|
+
* the readonly flag. If ops are generated, they will accumulate locally and not be sent. If
|
|
636
|
+
* there are pending in the outbound queue, it will stop sending until force readonly is
|
|
637
|
+
* cleared.
|
|
638
|
+
*
|
|
639
|
+
* @param readonly - set or clear force readonly.
|
|
623
640
|
*/
|
|
624
641
|
public forceReadonly(readonly: boolean) {
|
|
625
642
|
this._deltaManager.connectionManager.forceReadonly(readonly);
|
|
@@ -1137,7 +1154,6 @@ export class Container
|
|
|
1137
1154
|
snapshotBlobs: this.baseSnapshotBlobs,
|
|
1138
1155
|
savedOps: this.savedOps,
|
|
1139
1156
|
url: this.resolvedUrl.url,
|
|
1140
|
-
term: OnlyValidTermValue,
|
|
1141
1157
|
// no need to save this if there is no pending runtime state
|
|
1142
1158
|
clientId: pendingRuntimeState !== undefined ? this.clientId : undefined,
|
|
1143
1159
|
};
|
|
@@ -1319,6 +1335,9 @@ export class Container
|
|
|
1319
1335
|
);
|
|
1320
1336
|
}
|
|
1321
1337
|
|
|
1338
|
+
/**
|
|
1339
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
1340
|
+
*/
|
|
1322
1341
|
public async request(path: IRequest): Promise<IResponse> {
|
|
1323
1342
|
return PerformanceEvent.timedExecAsync(
|
|
1324
1343
|
this.mc.logger,
|
|
@@ -1537,18 +1556,15 @@ export class Container
|
|
|
1537
1556
|
this.client.details.type === summarizerClientType,
|
|
1538
1557
|
);
|
|
1539
1558
|
|
|
1540
|
-
//
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
// connections to same file) in two ways:
|
|
1547
|
-
// A) creation flow breaks (as one of the clients "sees" file as existing, and hits #2 above)
|
|
1548
|
-
// B) Once file is created, transition from view-only connection to write does not work - some bugs to be fixed.
|
|
1559
|
+
// Except in cases where it has stashed ops or requested by feature gate, the container will connect in "read" mode
|
|
1560
|
+
const mode =
|
|
1561
|
+
this.mc.config.getBoolean("Fluid.Container.ForceWriteConnection") === true ||
|
|
1562
|
+
(pendingLocalState?.savedOps.length ?? 0) > 0
|
|
1563
|
+
? "write"
|
|
1564
|
+
: "read";
|
|
1549
1565
|
const connectionArgs: IConnectionArgs = {
|
|
1550
1566
|
reason: { text: "DocumentOpen" },
|
|
1551
|
-
mode
|
|
1567
|
+
mode,
|
|
1552
1568
|
fetchOpsFromStorage: false,
|
|
1553
1569
|
};
|
|
1554
1570
|
|
|
@@ -1777,7 +1793,6 @@ export class Container
|
|
|
1777
1793
|
private async createDetached(codeDetails: IFluidCodeDetails) {
|
|
1778
1794
|
const attributes: IDocumentAttributes = {
|
|
1779
1795
|
sequenceNumber: detachedContainerRefSeqNumber,
|
|
1780
|
-
term: OnlyValidTermValue,
|
|
1781
1796
|
minimumSequenceNumber: 0,
|
|
1782
1797
|
};
|
|
1783
1798
|
|
|
@@ -1843,7 +1858,6 @@ export class Container
|
|
|
1843
1858
|
return {
|
|
1844
1859
|
minimumSequenceNumber: 0,
|
|
1845
1860
|
sequenceNumber: 0,
|
|
1846
|
-
term: OnlyValidTermValue,
|
|
1847
1861
|
};
|
|
1848
1862
|
}
|
|
1849
1863
|
|
|
@@ -99,12 +99,6 @@ export class ContainerStorageAdapter implements IDocumentStorageService, IDispos
|
|
|
99
99
|
this.addProtocolSummaryIfMissing,
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
// ensure we did not lose that policy in the process of wrapping
|
|
104
|
-
assert(
|
|
105
|
-
storageService.policies?.minBlobSize === this._storageService.policies?.minBlobSize,
|
|
106
|
-
0x0e0 /* "lost minBlobSize policy" */,
|
|
107
|
-
);
|
|
108
102
|
}
|
|
109
103
|
|
|
110
104
|
public loadSnapshotForRehydratingContainer(snapshotTree: ISnapshotTreeWithBlobContents) {
|
package/src/contracts.ts
CHANGED
|
@@ -179,8 +179,12 @@ export interface IConnectionManagerFactoryArgs {
|
|
|
179
179
|
*
|
|
180
180
|
* @param readonly - Whether or not the container is now read-only.
|
|
181
181
|
* `undefined` indicates that user permissions are not yet known.
|
|
182
|
+
* @param readonlyConnectionReason - reason/error if any for the change
|
|
182
183
|
*/
|
|
183
|
-
readonly readonlyChangeHandler: (
|
|
184
|
+
readonly readonlyChangeHandler: (
|
|
185
|
+
readonly?: boolean,
|
|
186
|
+
readonlyConnectionReason?: IConnectionStateChangeReason,
|
|
187
|
+
) => void;
|
|
184
188
|
|
|
185
189
|
/**
|
|
186
190
|
* Called whenever we try to start establishing a new connection.
|
package/src/debugLogger.ts
CHANGED
package/src/deltaManager.ts
CHANGED
|
@@ -50,7 +50,6 @@ import {
|
|
|
50
50
|
IConnectionStateChangeReason,
|
|
51
51
|
} from "./contracts";
|
|
52
52
|
import { DeltaQueue } from "./deltaQueue";
|
|
53
|
-
import { OnlyValidTermValue } from "./protocol";
|
|
54
53
|
import { ThrottlingWarning } from "./error";
|
|
55
54
|
|
|
56
55
|
export interface IConnectionArgs {
|
|
@@ -368,7 +367,7 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
368
367
|
assert(this.connectionManager.connected, 0x238 /* "called only in connected state" */);
|
|
369
368
|
|
|
370
369
|
const pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);
|
|
371
|
-
this.logger.
|
|
370
|
+
this.logger.sendTelemetryEvent({
|
|
372
371
|
...event,
|
|
373
372
|
// This directly tells us if fetching ops is in flight, and thus likely the reason of
|
|
374
373
|
// stalled op processing
|
|
@@ -412,8 +411,12 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
412
411
|
connectHandler: (connection: IConnectionDetailsInternal) =>
|
|
413
412
|
this.connectHandler(connection),
|
|
414
413
|
pongHandler: (latency: number) => this.emit("pong", latency),
|
|
415
|
-
readonlyChangeHandler: (
|
|
416
|
-
|
|
414
|
+
readonlyChangeHandler: (
|
|
415
|
+
readonly?: boolean,
|
|
416
|
+
readonlyConnectionReason?: IConnectionStateChangeReason,
|
|
417
|
+
) => {
|
|
418
|
+
safeRaiseEvent(this, this.logger, "readonly", readonly, readonlyConnectionReason);
|
|
419
|
+
},
|
|
417
420
|
establishConnectionHandler: (reason: IConnectionStateChangeReason) =>
|
|
418
421
|
this.establishingConnection(reason),
|
|
419
422
|
cancelConnectionHandler: (reason: IConnectionStateChangeReason) =>
|
|
@@ -1059,11 +1062,6 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
1059
1062
|
0x267 /* "lastObservedSeqNumber should be updated first" */,
|
|
1060
1063
|
);
|
|
1061
1064
|
|
|
1062
|
-
// Back-compat for older server with no term
|
|
1063
|
-
if (message.term === undefined) {
|
|
1064
|
-
message.term = OnlyValidTermValue;
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
1065
|
if (this.handler === undefined) {
|
|
1068
1066
|
throw new Error("Attempted to process an inbound message without a handler attached");
|
|
1069
1067
|
}
|
package/src/loader.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
ITelemetryBaseLogger,
|
|
19
19
|
FluidObject,
|
|
20
|
+
// eslint-disable-next-line import/no-deprecated
|
|
20
21
|
IFluidRouter,
|
|
21
22
|
IRequest,
|
|
22
23
|
IRequestHeader,
|
|
@@ -45,10 +46,6 @@ import { pkgVersion } from "./packageVersion";
|
|
|
45
46
|
import { ProtocolHandlerBuilder } from "./protocol";
|
|
46
47
|
import { DebugLogger } from "./debugLogger";
|
|
47
48
|
|
|
48
|
-
function canUseCache(request: IRequest): boolean {
|
|
49
|
-
return request.headers?.[LoaderHeader.cache] === true;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
49
|
function ensureResolvedUrlDefined(
|
|
53
50
|
resolved: IResolvedUrl | undefined,
|
|
54
51
|
): asserts resolved is IResolvedUrl {
|
|
@@ -68,29 +65,26 @@ export class RelativeLoader implements ILoader {
|
|
|
68
65
|
/**
|
|
69
66
|
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
|
|
70
67
|
*/
|
|
68
|
+
// eslint-disable-next-line import/no-deprecated
|
|
71
69
|
public get IFluidRouter(): IFluidRouter {
|
|
72
70
|
return this;
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
public async resolve(request: IRequest): Promise<IContainer> {
|
|
76
74
|
if (request.url.startsWith("/")) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
);
|
|
92
|
-
return container;
|
|
93
|
-
}
|
|
75
|
+
ensureResolvedUrlDefined(this.container.resolvedUrl);
|
|
76
|
+
const container = await this.container.clone(
|
|
77
|
+
{
|
|
78
|
+
resolvedUrl: { ...this.container.resolvedUrl },
|
|
79
|
+
version: request.headers?.[LoaderHeader.version] ?? undefined,
|
|
80
|
+
loadMode: request.headers?.[LoaderHeader.loadMode],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
canReconnect: request.headers?.[LoaderHeader.reconnect],
|
|
84
|
+
clientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
return container;
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
if (this.loader === undefined) {
|
|
@@ -151,7 +145,7 @@ export interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComp
|
|
|
151
145
|
* Load the code module (package) that is capable to interact with the document.
|
|
152
146
|
*
|
|
153
147
|
* @param source - Code proposal that articulates the current schema the document is written in.
|
|
154
|
-
* @returns
|
|
148
|
+
* @returns Code module entry point along with the code details associated with it.
|
|
155
149
|
*/
|
|
156
150
|
load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
|
|
157
151
|
}
|
|
@@ -279,6 +273,7 @@ export type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" |
|
|
|
279
273
|
* With an already-resolved container, we can request a component directly, without loading the container again
|
|
280
274
|
* @param container - a resolved container
|
|
281
275
|
* @returns component on the container
|
|
276
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
282
277
|
*/
|
|
283
278
|
export async function requestResolvedObjectFromContainer(
|
|
284
279
|
container: IContainer,
|
|
@@ -291,6 +286,7 @@ export async function requestResolvedObjectFromContainer(
|
|
|
291
286
|
throw new Error(`Invalid URL ${container.resolvedUrl.url}`);
|
|
292
287
|
}
|
|
293
288
|
|
|
289
|
+
// eslint-disable-next-line import/no-deprecated
|
|
294
290
|
const entryPoint: FluidObject<IFluidRouter> | undefined = await container.getEntryPoint?.();
|
|
295
291
|
const router = entryPoint?.IFluidRouter ?? container.IFluidRouter;
|
|
296
292
|
|
|
@@ -304,7 +300,6 @@ export async function requestResolvedObjectFromContainer(
|
|
|
304
300
|
* Manages Fluid resource loading
|
|
305
301
|
*/
|
|
306
302
|
export class Loader implements IHostLoader {
|
|
307
|
-
private readonly containers = new Map<string, Promise<Container>>();
|
|
308
303
|
public readonly services: ILoaderServices;
|
|
309
304
|
private readonly mc: MonitoringContext;
|
|
310
305
|
|
|
@@ -354,6 +349,7 @@ export class Loader implements IHostLoader {
|
|
|
354
349
|
/**
|
|
355
350
|
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
|
|
356
351
|
*/
|
|
352
|
+
// eslint-disable-next-line import/no-deprecated
|
|
357
353
|
public get IFluidRouter(): IFluidRouter {
|
|
358
354
|
return this;
|
|
359
355
|
}
|
|
@@ -365,25 +361,13 @@ export class Loader implements IHostLoader {
|
|
|
365
361
|
clientDetailsOverride?: IClientDetails;
|
|
366
362
|
},
|
|
367
363
|
): Promise<IContainer> {
|
|
368
|
-
|
|
364
|
+
return Container.createDetached(
|
|
369
365
|
{
|
|
370
366
|
...createDetachedProps,
|
|
371
367
|
...this.services,
|
|
372
368
|
},
|
|
373
369
|
codeDetails,
|
|
374
370
|
);
|
|
375
|
-
|
|
376
|
-
if (this.cachingEnabled) {
|
|
377
|
-
container.once("attached", () => {
|
|
378
|
-
ensureResolvedUrlDefined(container.resolvedUrl);
|
|
379
|
-
const parsedUrl = parseUrl(container.resolvedUrl.url);
|
|
380
|
-
if (parsedUrl !== undefined) {
|
|
381
|
-
this.addToContainerCache(parsedUrl.id, Promise.resolve(container));
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
return container;
|
|
387
371
|
}
|
|
388
372
|
|
|
389
373
|
public async rehydrateDetachedContainerFromSnapshot(
|
|
@@ -430,37 +414,6 @@ export class Loader implements IHostLoader {
|
|
|
430
414
|
);
|
|
431
415
|
}
|
|
432
416
|
|
|
433
|
-
private getKeyForContainerCache(request: IRequest, parsedUrl: IParsedUrl): string {
|
|
434
|
-
const key =
|
|
435
|
-
request.headers?.[LoaderHeader.version] !== undefined
|
|
436
|
-
? `${parsedUrl.id}@${request.headers[LoaderHeader.version]}`
|
|
437
|
-
: parsedUrl.id;
|
|
438
|
-
return key;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
private addToContainerCache(key: string, containerP: Promise<Container>) {
|
|
442
|
-
this.containers.set(key, containerP);
|
|
443
|
-
containerP
|
|
444
|
-
.then((container) => {
|
|
445
|
-
// If the container is closed/disposed or becomes closed/disposed after we resolve it,
|
|
446
|
-
// remove it from the cache.
|
|
447
|
-
if (container.closed || container.disposed) {
|
|
448
|
-
this.containers.delete(key);
|
|
449
|
-
} else {
|
|
450
|
-
container.once("closed", () => {
|
|
451
|
-
this.containers.delete(key);
|
|
452
|
-
});
|
|
453
|
-
container.once("disposed", () => {
|
|
454
|
-
this.containers.delete(key);
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
})
|
|
458
|
-
.catch((error) => {
|
|
459
|
-
// If an error occured while resolving the container request, then remove it from the cache.
|
|
460
|
-
this.containers.delete(key);
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
|
|
464
417
|
private async resolveCore(
|
|
465
418
|
request: IRequest,
|
|
466
419
|
pendingLocalState?: IPendingContainerState,
|
|
@@ -489,11 +442,6 @@ export class Loader implements IHostLoader {
|
|
|
489
442
|
// If set in both query string and headers, use query string. Also write the value from the query string into the header either way.
|
|
490
443
|
request.headers[LoaderHeader.version] =
|
|
491
444
|
parsed.version ?? request.headers[LoaderHeader.version];
|
|
492
|
-
const cacheHeader = request.headers[LoaderHeader.cache];
|
|
493
|
-
const canCache =
|
|
494
|
-
// Take header value if present, else use ILoaderOptions.cache value
|
|
495
|
-
(cacheHeader !== undefined ? cacheHeader === true : this.cachingEnabled) &&
|
|
496
|
-
pendingLocalState === undefined;
|
|
497
445
|
const fromSequenceNumber = request.headers[LoaderHeader.sequenceNumber] as
|
|
498
446
|
| number
|
|
499
447
|
| undefined;
|
|
@@ -513,26 +461,10 @@ export class Loader implements IHostLoader {
|
|
|
513
461
|
throw new UsageError('opsBeforeReturn must be set to "sequenceNumber"');
|
|
514
462
|
}
|
|
515
463
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
if (maybeContainer !== undefined) {
|
|
521
|
-
container = maybeContainer;
|
|
522
|
-
} else {
|
|
523
|
-
const containerP = this.loadContainer(request, resolvedAsFluid);
|
|
524
|
-
this.addToContainerCache(key, containerP);
|
|
525
|
-
container = await containerP;
|
|
526
|
-
}
|
|
527
|
-
} else {
|
|
528
|
-
container = await this.loadContainer(request, resolvedAsFluid, pendingLocalState);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
return { container, parsed };
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
private get cachingEnabled() {
|
|
535
|
-
return this.services.options.cache === true;
|
|
464
|
+
return {
|
|
465
|
+
container: await this.loadContainer(request, resolvedAsFluid, pendingLocalState),
|
|
466
|
+
parsed,
|
|
467
|
+
};
|
|
536
468
|
}
|
|
537
469
|
|
|
538
470
|
private async loadContainer(
|
package/src/packageVersion.ts
CHANGED
package/src/protocol.ts
CHANGED
|
@@ -13,16 +13,12 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
IDocumentAttributes,
|
|
15
15
|
IProcessMessageResult,
|
|
16
|
-
ISequencedClient,
|
|
17
16
|
ISequencedDocumentMessage,
|
|
18
17
|
ISignalClient,
|
|
19
18
|
ISignalMessage,
|
|
20
19
|
MessageType,
|
|
21
20
|
} from "@fluidframework/protocol-definitions";
|
|
22
21
|
|
|
23
|
-
// "term" was an experimental feature that is being removed. The only safe value to use is 1.
|
|
24
|
-
export const OnlyValidTermValue = 1 as const;
|
|
25
|
-
|
|
26
22
|
// ADO: #1986: Start using enum from protocol-base.
|
|
27
23
|
export enum SignalType {
|
|
28
24
|
ClientJoin = "join", // same value as MessageType.ClientJoin,
|
|
@@ -75,11 +71,11 @@ export class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandl
|
|
|
75
71
|
message: ISequencedDocumentMessage,
|
|
76
72
|
local: boolean,
|
|
77
73
|
): IProcessMessageResult {
|
|
78
|
-
const client: ISequencedClient | undefined = this.quorum.getMember(message.clientId);
|
|
79
|
-
|
|
80
74
|
// Check and report if we're getting messages from a clientId that we previously
|
|
81
75
|
// flagged as shouldHaveLeft, or from a client that's not in the quorum but should be
|
|
82
76
|
if (message.clientId != null) {
|
|
77
|
+
const client = this.quorum.getMember(message.clientId);
|
|
78
|
+
|
|
83
79
|
if (client === undefined && message.type !== MessageType.ClientJoin) {
|
|
84
80
|
// pre-0.58 error message: messageClientIdMissingFromQuorum
|
|
85
81
|
throw new Error("Remote message's clientId is missing from the quorum");
|