@fluidframework/container-runtime 2.70.0-361788 → 2.71.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.cjs +5 -1
- package/CHANGELOG.md +14 -0
- package/container-runtime.test-files.tar +0 -0
- package/dist/channelCollection.d.ts +66 -17
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +118 -84
- package/dist/channelCollection.js.map +1 -1
- package/dist/containerRuntime.d.ts +19 -11
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +146 -52
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.d.ts +3 -1
- package/dist/dataStore.d.ts.map +1 -1
- package/dist/dataStore.js +8 -9
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +6 -5
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +7 -4
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/messageTypes.d.ts +17 -4
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/runtimeLayerCompatState.d.ts +2 -2
- package/dist/runtimeLayerCompatState.d.ts.map +1 -1
- package/dist/runtimeLayerCompatState.js.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summary/summarizerNode/summarizerNode.js +3 -1
- package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/channelCollection.d.ts +66 -17
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +115 -82
- package/lib/channelCollection.js.map +1 -1
- package/lib/containerRuntime.d.ts +19 -11
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +148 -53
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.d.ts +3 -1
- package/lib/dataStore.d.ts.map +1 -1
- package/lib/dataStore.js +3 -4
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +6 -5
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +8 -5
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/messageTypes.d.ts +17 -4
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/runtimeLayerCompatState.d.ts +2 -2
- package/lib/runtimeLayerCompatState.d.ts.map +1 -1
- package/lib/runtimeLayerCompatState.js.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summary/summarizerNode/summarizerNode.js +3 -1
- package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
- package/package.json +22 -30
- package/src/channelCollection.ts +255 -109
- package/src/containerRuntime.ts +262 -92
- package/src/dataStore.ts +12 -10
- package/src/dataStoreContext.ts +45 -39
- package/src/index.ts +8 -3
- package/src/messageTypes.ts +17 -2
- package/src/packageVersion.ts +1 -1
- package/src/runtimeLayerCompatState.ts +1 -1
- package/src/summary/summarizerNode/summarizerNode.ts +1 -0
package/.eslintrc.cjs
CHANGED
|
@@ -8,7 +8,11 @@ module.exports = {
|
|
|
8
8
|
parserOptions: {
|
|
9
9
|
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
10
10
|
},
|
|
11
|
-
rules: {
|
|
11
|
+
rules: {
|
|
12
|
+
// FIXME: temporarily disabled because of crashes in typescript-eslint on destructuring in promise chains.
|
|
13
|
+
// See: channelCollection.ts:1070
|
|
14
|
+
"@typescript-eslint/unbound-method": "off",
|
|
15
|
+
},
|
|
12
16
|
overrides: [
|
|
13
17
|
{
|
|
14
18
|
// Rules only for test files
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @fluidframework/container-runtime
|
|
2
2
|
|
|
3
|
+
## 2.71.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.70.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- Removed deprecated export of MinimumVersionForCollab from @fluidframework/container-runtime ([#25309](https://github.com/microsoft/FluidFramework/pull/25309)) [776cb1ce31](https://github.com/microsoft/FluidFramework/commit/776cb1ce31176e1eb07ba2723c2d51e6f4cc379f)
|
|
12
|
+
|
|
13
|
+
Removed the deprecated re-export of MinimumVersionForCollab from @fluidframework/container-runtime.
|
|
14
|
+
This type should now be imported from @fluidframework/runtime-definitions.
|
|
15
|
+
See the [Fluid Framework 2.52.0 release notes](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.52.0) for details.
|
|
16
|
+
|
|
3
17
|
## 2.63.0
|
|
4
18
|
|
|
5
19
|
Dependency updates only.
|
|
Binary file
|
|
@@ -4,20 +4,31 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
6
6
|
import type { FluidObject, IDisposable, IRequest, IResponse, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
|
-
import type { IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
|
|
7
|
+
import type { IFluidHandleInternal, ISignalEnvelope } from "@fluidframework/core-interfaces/internal";
|
|
8
8
|
import type { ISnapshot, ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
9
|
-
import
|
|
9
|
+
import type { AliasResult, ContainerExtensionProvider, FluidDataStoreMessage, IEnvelope, IFluidDataStoreChannel, IFluidDataStoreContext, IFluidDataStoreContextDetached, IFluidDataStoreFactory, IFluidDataStoreRegistry, IFluidParentContext, IGarbageCollectionData, IInboundSignalMessage, IRuntimeMessageCollection, ISummaryTreeWithStats, ITelemetryContext, MinimumVersionForCollab, NamedFluidDataStoreRegistryEntries } from "@fluidframework/runtime-definitions/internal";
|
|
10
10
|
import { type MonitoringContext } from "@fluidframework/telemetry-utils/internal";
|
|
11
11
|
import { type RuntimeHeaderData } from "./containerRuntime.js";
|
|
12
|
-
import { type
|
|
12
|
+
import { type IFluidDataStoreContextPrivate, type ILocalDetachedFluidDataStoreContextProps, LocalFluidDataStoreContext } from "./dataStoreContext.js";
|
|
13
13
|
import { DataStoreContexts } from "./dataStoreContexts.js";
|
|
14
14
|
import { GCNodeType, type IGCNodeUpdatedProps } from "./gc/index.js";
|
|
15
|
+
import type { ContainerRuntimeAliasMessage, ContainerRuntimeDataStoreOpMessage, OutboundContainerRuntimeAttachMessage } from "./messageTypes.js";
|
|
15
16
|
import { type IContainerRuntimeMetadata } from "./summary/index.js";
|
|
16
17
|
/**
|
|
17
18
|
* True if a tombstoned object should be returned without erroring
|
|
18
19
|
* @legacy @beta
|
|
19
20
|
*/
|
|
20
21
|
export declare const AllowTombstoneRequestHeaderKey = "allowTombstone";
|
|
22
|
+
/**
|
|
23
|
+
* Envelope for signals not intended for the container.
|
|
24
|
+
*
|
|
25
|
+
* @privateRemarks
|
|
26
|
+
* `clientBroadcastSignalSequenceNumber` might be added to the envelope by the container runtime.
|
|
27
|
+
* But it should not be provided to start with.
|
|
28
|
+
*
|
|
29
|
+
* Equivalent to `Required<Omit<ISignalEnvelope, "clientBroadcastSignalSequenceNumber">>`.
|
|
30
|
+
*/
|
|
31
|
+
export type AddressedUnsequencedSignalEnvelope = IEnvelope<ISignalEnvelope["contents"]>;
|
|
21
32
|
/**
|
|
22
33
|
* This version of the interface is private to this the package. It should never be exported under any tag.
|
|
23
34
|
* It is used to manage interactions within the container-runtime package. If something is needed
|
|
@@ -26,17 +37,44 @@ export declare const AllowTombstoneRequestHeaderKey = "allowTombstone";
|
|
|
26
37
|
* being staged on IFluidParentContext can be added here as well, likely with optionality removed,
|
|
27
38
|
* to ease interactions within this package.
|
|
28
39
|
*/
|
|
29
|
-
export interface IFluidParentContextPrivate extends
|
|
40
|
+
export interface IFluidParentContextPrivate extends IFluidParentContext, ContainerExtensionProvider {
|
|
30
41
|
readonly isReadOnly: () => boolean;
|
|
42
|
+
readonly minVersionForCollab: MinimumVersionForCollab;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Kin of {@link @fluidframework/runtime-definitions#IFluidParentContext} with alternate
|
|
46
|
+
* `submitMessage` and `submitSignal` methods that are typed specifically for the
|
|
47
|
+
* root context (aka {@link ContainerRuntime} provided context).
|
|
48
|
+
*
|
|
49
|
+
* @privateRemarks
|
|
50
|
+
* These replacements might be able to get cleaned up if the future suggestions
|
|
51
|
+
* found in {@link @fluidframework/runtime-definitions#FluidDataStoreMessage}
|
|
52
|
+
* `@privateRemarks` section are implemented.
|
|
53
|
+
*/
|
|
54
|
+
export interface IFluidRootParentContextPrivate extends Omit<IFluidParentContextPrivate, "submitMessage" | "submitSignal"> {
|
|
31
55
|
/**
|
|
32
|
-
*
|
|
56
|
+
* Submits the message to be sent to other clients.
|
|
57
|
+
* @param containerRuntimeMessage - The message.
|
|
58
|
+
* @param localOpMetadata - The local metadata associated with the message.
|
|
59
|
+
* This is kept locally and not sent to the server. This will be sent back
|
|
60
|
+
* when this message is received back from the server. This is also sent if
|
|
61
|
+
* we are asked to resubmit the message.
|
|
33
62
|
*/
|
|
34
|
-
readonly
|
|
63
|
+
readonly submitMessage: (containerRuntimeMessage: ContainerRuntimeDataStoreOpMessage | OutboundContainerRuntimeAttachMessage | ContainerRuntimeAliasMessage, localOpMetadata: unknown) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Submits the signal to be sent to other clients.
|
|
66
|
+
* @param envelope - {@link IEnvelope} containing the signal address and contents.
|
|
67
|
+
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
68
|
+
*/
|
|
69
|
+
readonly submitSignal: (envelope: AddressedUnsequencedSignalEnvelope, targetClientId?: string) => void;
|
|
35
70
|
}
|
|
71
|
+
type SubmitKeys = "submitMessage" | "submitSignal";
|
|
36
72
|
/**
|
|
37
|
-
* Creates a shallow wrapper of {@link
|
|
73
|
+
* Creates a shallow wrapper of {@link IFluidParentContextPrivate} or
|
|
74
|
+
* {@link IFluidRootParentContextPrivate} with `submitMessage` and `submitSignal`
|
|
75
|
+
* methods replaced with the provided overrides.
|
|
38
76
|
*/
|
|
39
|
-
export declare function
|
|
77
|
+
export declare function formParentContext<T extends IFluidParentContextPrivate | IFluidRootParentContextPrivate>(context: Omit<IFluidParentContextPrivate & IFluidRootParentContextPrivate, SubmitKeys>, overrides: Pick<T, SubmitKeys>): Omit<IFluidParentContextPrivate & IFluidRootParentContextPrivate, SubmitKeys> & Pick<T, SubmitKeys>;
|
|
40
78
|
/**
|
|
41
79
|
* Returns the type of the given local data store from its package path.
|
|
42
80
|
*/
|
|
@@ -46,9 +84,9 @@ export declare function getLocalDataStoreType(localDataStore: LocalFluidDataStor
|
|
|
46
84
|
* but eventually could be hosted on any channel once we formalize the channel api boundary.
|
|
47
85
|
* @internal
|
|
48
86
|
*/
|
|
49
|
-
export declare class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
|
|
87
|
+
export declare class ChannelCollection implements Omit<IFluidDataStoreChannel, "entryPoint" | "reSubmit" | "rollback">, IDisposable {
|
|
50
88
|
protected readonly baseSnapshot: ISnapshotTree | ISnapshot | undefined;
|
|
51
|
-
readonly parentContext:
|
|
89
|
+
readonly parentContext: IFluidRootParentContextPrivate;
|
|
52
90
|
private readonly gcNodeUpdated;
|
|
53
91
|
private readonly isDataStoreDeleted;
|
|
54
92
|
private readonly aliasMap;
|
|
@@ -56,7 +94,6 @@ export declare class ChannelCollection implements IFluidDataStoreChannel, IDispo
|
|
|
56
94
|
readonly attachOpFiredForDataStore: Set<string>;
|
|
57
95
|
protected readonly mc: MonitoringContext;
|
|
58
96
|
private readonly disposeOnce;
|
|
59
|
-
readonly entryPoint: IFluidHandleInternal<FluidObject>;
|
|
60
97
|
readonly containerLoadStats: {
|
|
61
98
|
readonly containerLoadDataStoreCount: number;
|
|
62
99
|
readonly referencedDataStoreCount: number;
|
|
@@ -64,7 +101,7 @@ export declare class ChannelCollection implements IFluidDataStoreChannel, IDispo
|
|
|
64
101
|
private readonly pendingAliasMap;
|
|
65
102
|
protected readonly contexts: DataStoreContexts;
|
|
66
103
|
private readonly aliasedDataStores;
|
|
67
|
-
constructor(baseSnapshot: ISnapshotTree | ISnapshot | undefined, parentContext:
|
|
104
|
+
constructor(baseSnapshot: ISnapshotTree | ISnapshot | undefined, parentContext: IFluidRootParentContextPrivate, baseLogger: ITelemetryBaseLogger, gcNodeUpdated: (props: IGCNodeUpdatedProps) => void, isDataStoreDeleted: (nodePath: string) => boolean, aliasMap: Map<string, string>);
|
|
68
105
|
get aliases(): ReadonlyMap<string, string>;
|
|
69
106
|
get pendingAliases(): Map<string, Promise<AliasResult>>;
|
|
70
107
|
waitIfPendingAlias(maybeAlias: string): Promise<AliasResult>;
|
|
@@ -112,13 +149,13 @@ export declare class ChannelCollection implements IFluidDataStoreChannel, IDispo
|
|
|
112
149
|
*/
|
|
113
150
|
protected createDataStoreId(): string;
|
|
114
151
|
createDetachedDataStore(pkg: readonly string[], loadingGroupId?: string): IFluidDataStoreContextDetached;
|
|
115
|
-
createDataStoreContext(pkg: readonly string[], loadingGroupId?: string):
|
|
152
|
+
createDataStoreContext(pkg: readonly string[], loadingGroupId?: string): IFluidDataStoreContextPrivate;
|
|
116
153
|
protected createContext<T extends LocalFluidDataStoreContext>(id: string, pkg: readonly string[], contextCtor: new (props: ILocalDetachedFluidDataStoreContextProps) => T, loadingGroupId?: string): T;
|
|
117
154
|
get disposed(): boolean;
|
|
118
155
|
dispose(): void;
|
|
119
|
-
|
|
120
|
-
protected
|
|
121
|
-
|
|
156
|
+
readonly reSubmitContainerMessage: (message: ContainerRuntimeDataStoreOpMessage | OutboundContainerRuntimeAttachMessage | ContainerRuntimeAliasMessage, localOpMetadata: unknown, squash: boolean | undefined) => void;
|
|
157
|
+
protected readonly resubmitDataStoreOp: (envelope: IEnvelope<FluidDataStoreMessage>, localOpMetadata: unknown, squash: boolean | undefined) => void;
|
|
158
|
+
readonly rollbackDataStoreOp: (envelope: IEnvelope<FluidDataStoreMessage>, localOpMetadata: unknown) => void;
|
|
122
159
|
applyStashedOp(content: unknown): Promise<unknown>;
|
|
123
160
|
protected applyStashedChannelChannelOp(envelope: IEnvelope): Promise<unknown>;
|
|
124
161
|
private applyStashedAttachOp;
|
|
@@ -137,7 +174,7 @@ export declare class ChannelCollection implements IFluidDataStoreChannel, IDispo
|
|
|
137
174
|
/**
|
|
138
175
|
* Returns the data store requested with the given id if available. Otherwise, returns undefined.
|
|
139
176
|
*/
|
|
140
|
-
getDataStoreIfAvailable(id: string, requestHeaderData: RuntimeHeaderData): Promise<
|
|
177
|
+
getDataStoreIfAvailable(id: string, requestHeaderData: RuntimeHeaderData): Promise<IFluidDataStoreContextPrivate | undefined>;
|
|
141
178
|
/**
|
|
142
179
|
* Checks if the data store has been deleted by GC. If so, log an error.
|
|
143
180
|
* @param id - The data store's id.
|
|
@@ -243,6 +280,17 @@ export declare function getSummaryForDatastores(snapshot: ISnapshotTree | undefi
|
|
|
243
280
|
*/
|
|
244
281
|
export declare function detectOutboundReferences(address: string, contents: unknown, addedOutboundReference: (fromNodePath: string, toNodePath: string) => void): void;
|
|
245
282
|
/**
|
|
283
|
+
* @privateRemarks This class is only used for experimentation/testing.
|
|
284
|
+
*/
|
|
285
|
+
export declare class ComposableChannelCollection extends ChannelCollection implements IFluidDataStoreChannel {
|
|
286
|
+
readonly entryPoint: IFluidHandleInternal<FluidObject>;
|
|
287
|
+
constructor(baseSnapshot: ISnapshotTree | ISnapshot | undefined, parentContext: IFluidParentContextPrivate, baseLogger: ITelemetryBaseLogger, gcNodeUpdated: (props: IGCNodeUpdatedProps) => void, isDataStoreDeleted: (nodePath: string) => boolean, aliasMap: Map<string, string>, provideEntryPoint: (runtime: ComposableChannelCollection) => Promise<FluidObject>);
|
|
288
|
+
reSubmit(type: string, content: unknown, localOpMetadata: unknown, squash?: boolean): void;
|
|
289
|
+
rollback(type: string, content: unknown, localOpMetadata: unknown): void;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* @privateRemarks This factory is only used for experimentation/testing.
|
|
293
|
+
*
|
|
246
294
|
* @internal
|
|
247
295
|
*/
|
|
248
296
|
export declare class ChannelCollectionFactory implements IFluidDataStoreFactory {
|
|
@@ -253,4 +301,5 @@ export declare class ChannelCollectionFactory implements IFluidDataStoreFactory
|
|
|
253
301
|
get IFluidDataStoreFactory(): ChannelCollectionFactory;
|
|
254
302
|
instantiateDataStore(context: IFluidDataStoreContext, _existing: boolean): Promise<IFluidDataStoreChannel>;
|
|
255
303
|
}
|
|
304
|
+
export {};
|
|
256
305
|
//# sourceMappingURL=channelCollection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelCollection.d.ts","sourceRoot":"","sources":["../src/channelCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,KAAK,EACX,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"channelCollection.d.ts","sourceRoot":"","sources":["../src/channelCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,KAAK,EACX,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACX,oB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,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,OAAO,CAAC,WAAW,CAAC;IAiD3E,QAAQ,CACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,OAAO,EACxB,MAAM,CAAC,EAAE,OAAO,GACd,IAAI;IAcA,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;CAI/E;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IAQrE,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAPnC,SAAgB,IAAI,8BAA8B;IAE3C,uBAAuB,EAAE,uBAAuB,CAAC;gBAGvD,eAAe,EAAE,kCAAkC,EAElC,iBAAiB,EAAE,CACnC,OAAO,EAAE,sBAAsB,KAC3B,OAAO,CAAC,WAAW,CAAC;IAK1B,IAAW,sBAAsB,IAAI,wBAAwB,CAE5D;IAEY,oBAAoB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,SAAS,EAAE,OAAO,GAChB,OAAO,CAAC,sBAAsB,CAAC;CA6BlC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ChannelCollectionFactory = exports.detectOutboundReferences = exports.getSummaryForDatastores = exports.ChannelCollection = exports.getLocalDataStoreType = exports.
|
|
7
|
+
exports.ChannelCollectionFactory = exports.ComposableChannelCollection = exports.detectOutboundReferences = exports.getSummaryForDatastores = exports.ChannelCollection = exports.getLocalDataStoreType = exports.formParentContext = exports.AllowTombstoneRequestHeaderKey = void 0;
|
|
8
8
|
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
9
9
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
10
10
|
const internal_2 = require("@fluidframework/datastore/internal");
|
|
@@ -28,9 +28,11 @@ const index_js_2 = require("./summary/index.js");
|
|
|
28
28
|
*/
|
|
29
29
|
exports.AllowTombstoneRequestHeaderKey = "allowTombstone"; // Belongs in the enum above, but avoiding the breaking change
|
|
30
30
|
/**
|
|
31
|
-
* Creates a shallow wrapper of {@link
|
|
31
|
+
* Creates a shallow wrapper of {@link IFluidParentContextPrivate} or
|
|
32
|
+
* {@link IFluidRootParentContextPrivate} with `submitMessage` and `submitSignal`
|
|
33
|
+
* methods replaced with the provided overrides.
|
|
32
34
|
*/
|
|
33
|
-
function
|
|
35
|
+
function formParentContext(context, overrides) {
|
|
34
36
|
return {
|
|
35
37
|
get IFluidDataStoreRegistry() {
|
|
36
38
|
return context.IFluidDataStoreRegistry;
|
|
@@ -70,12 +72,8 @@ function wrapContext(context) {
|
|
|
70
72
|
getAudience: (...args) => {
|
|
71
73
|
return context.getAudience(...args);
|
|
72
74
|
},
|
|
73
|
-
submitMessage: (
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
submitSignal: (...args) => {
|
|
77
|
-
return context.submitSignal(...args);
|
|
78
|
-
},
|
|
75
|
+
submitMessage: overrides.submitMessage.bind(overrides),
|
|
76
|
+
submitSignal: overrides.submitSignal,
|
|
79
77
|
makeLocallyVisible: (...args) => {
|
|
80
78
|
return context.makeLocallyVisible(...args);
|
|
81
79
|
},
|
|
@@ -95,37 +93,35 @@ function wrapContext(context) {
|
|
|
95
93
|
return context.setChannelDirty(address);
|
|
96
94
|
},
|
|
97
95
|
minVersionForCollab: context.minVersionForCollab,
|
|
96
|
+
getExtension: context.getExtension.bind(context),
|
|
98
97
|
};
|
|
99
98
|
}
|
|
100
|
-
exports.
|
|
99
|
+
exports.formParentContext = formParentContext;
|
|
101
100
|
/**
|
|
102
|
-
* Creates a wrapper of a {@link
|
|
101
|
+
* Creates a wrapper of a {@link IFluidRootParentContextPrivate} to be provided to the inner datastore channels.
|
|
103
102
|
* The wrapper will have the submit methods overwritten with the appropriate id as the destination address.
|
|
104
103
|
*
|
|
105
104
|
* @param id - the id of the channel
|
|
106
|
-
* @param parentContext - the {@link
|
|
105
|
+
* @param parentContext - the {@link IFluidRootParentContextPrivate} to wrap
|
|
107
106
|
* @returns A wrapped {@link IFluidParentContext}
|
|
108
107
|
*/
|
|
109
108
|
function wrapContextForInnerChannel(id, parentContext) {
|
|
110
|
-
const context =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
127
|
-
parentContext.submitSignal(type, envelope, targetClientId);
|
|
128
|
-
};
|
|
109
|
+
const context = formParentContext(parentContext, {
|
|
110
|
+
submitMessage: (type, content, localOpMetadata) => {
|
|
111
|
+
const fluidDataStoreContent = {
|
|
112
|
+
content,
|
|
113
|
+
type,
|
|
114
|
+
};
|
|
115
|
+
const envelope = {
|
|
116
|
+
address: id,
|
|
117
|
+
contents: fluidDataStoreContent,
|
|
118
|
+
};
|
|
119
|
+
parentContext.submitMessage({ type: messageTypes_js_1.ContainerMessageType.FluidDataStoreOp, contents: envelope }, localOpMetadata);
|
|
120
|
+
},
|
|
121
|
+
submitSignal: (type, content, targetClientId) => {
|
|
122
|
+
parentContext.submitSignal({ address: id, contents: { type, content } }, targetClientId);
|
|
123
|
+
},
|
|
124
|
+
});
|
|
129
125
|
return context;
|
|
130
126
|
}
|
|
131
127
|
/**
|
|
@@ -141,7 +137,7 @@ exports.getLocalDataStoreType = getLocalDataStoreType;
|
|
|
141
137
|
* @internal
|
|
142
138
|
*/
|
|
143
139
|
class ChannelCollection {
|
|
144
|
-
constructor(baseSnapshot, parentContext, baseLogger, gcNodeUpdated, isDataStoreDeleted, aliasMap
|
|
140
|
+
constructor(baseSnapshot, parentContext, baseLogger, gcNodeUpdated, isDataStoreDeleted, aliasMap) {
|
|
145
141
|
this.baseSnapshot = baseSnapshot;
|
|
146
142
|
this.parentContext = parentContext;
|
|
147
143
|
this.gcNodeUpdated = gcNodeUpdated;
|
|
@@ -158,9 +154,49 @@ class ChannelCollection {
|
|
|
158
154
|
* For sampling. Only log once per container
|
|
159
155
|
*/
|
|
160
156
|
this.shouldSendAttachLog = true;
|
|
157
|
+
this.reSubmitContainerMessage = (message, localOpMetadata, squash) => {
|
|
158
|
+
switch (message.type) {
|
|
159
|
+
case messageTypes_js_1.ContainerMessageType.Attach:
|
|
160
|
+
case messageTypes_js_1.ContainerMessageType.Alias: {
|
|
161
|
+
this.parentContext.submitMessage(message, localOpMetadata);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
case messageTypes_js_1.ContainerMessageType.FluidDataStoreOp: {
|
|
165
|
+
return this.resubmitDataStoreOp(message.contents, localOpMetadata, squash);
|
|
166
|
+
}
|
|
167
|
+
default: {
|
|
168
|
+
(0, internal_1.assert)(false, 0x907 /* unknown op type */);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
this.resubmitDataStoreOp = (envelope, localOpMetadata, squash) => {
|
|
173
|
+
const context = this.contexts.get(envelope.address);
|
|
174
|
+
// If the data store has been deleted, log an error and throw an error. If there are local changes for a
|
|
175
|
+
// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
|
|
176
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "resubmitDataStoreOp")) {
|
|
177
|
+
throw new internal_6.DataCorruptionError("Context is deleted!", {
|
|
178
|
+
callSite: "resubmitDataStoreOp",
|
|
179
|
+
...(0, internal_6.tagCodeArtifacts)({ id: envelope.address }),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
(0, internal_1.assert)(!!context, 0x160 /* "There should be a store context for the op" */);
|
|
183
|
+
context.reSubmit(envelope.contents, localOpMetadata, squash);
|
|
184
|
+
};
|
|
185
|
+
this.rollbackDataStoreOp = (envelope, localOpMetadata) => {
|
|
186
|
+
const context = this.contexts.get(envelope.address);
|
|
187
|
+
// If the data store has been deleted, log an error and throw an error. If there are local changes for a
|
|
188
|
+
// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
|
|
189
|
+
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "rollbackDataStoreOp")) {
|
|
190
|
+
throw new internal_6.DataCorruptionError("Context is deleted!", {
|
|
191
|
+
callSite: "rollbackDataStoreOp",
|
|
192
|
+
...(0, internal_6.tagCodeArtifacts)({ id: envelope.address }),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
(0, internal_1.assert)(!!context, 0x2e8 /* "There should be a store context for the op" */);
|
|
196
|
+
context.rollback(envelope.contents, localOpMetadata);
|
|
197
|
+
};
|
|
161
198
|
this.mc = (0, internal_6.createChildMonitoringContext)({ logger: baseLogger });
|
|
162
199
|
this.contexts = new dataStoreContexts_js_1.DataStoreContexts(baseLogger);
|
|
163
|
-
this.entryPoint = new internal_2.FluidObjectHandle(new internal_1.LazyPromise(async () => provideEntryPoint(this)), "", this.parentContext.IFluidHandleContext);
|
|
164
200
|
this.aliasedDataStores = new Set(aliasMap.values());
|
|
165
201
|
// Extract stores stored inside the snapshot
|
|
166
202
|
const fluidDataStores = new Map();
|
|
@@ -403,7 +439,7 @@ class ChannelCollection {
|
|
|
403
439
|
submitAttachChannelOp(localContext) {
|
|
404
440
|
const message = this.generateAttachMessage(localContext);
|
|
405
441
|
this.pendingAttach.set(localContext.id, message);
|
|
406
|
-
this.parentContext.submitMessage(messageTypes_js_1.ContainerMessageType.Attach, message, undefined);
|
|
442
|
+
this.parentContext.submitMessage({ type: messageTypes_js_1.ContainerMessageType.Attach, contents: message }, undefined);
|
|
407
443
|
this.attachOpFiredForDataStore.add(localContext.id);
|
|
408
444
|
}
|
|
409
445
|
/**
|
|
@@ -477,52 +513,6 @@ class ChannelCollection {
|
|
|
477
513
|
dispose() {
|
|
478
514
|
return this.disposeOnce.value;
|
|
479
515
|
}
|
|
480
|
-
reSubmit(type, content, localOpMetadata, squash) {
|
|
481
|
-
switch (type) {
|
|
482
|
-
case messageTypes_js_1.ContainerMessageType.Attach:
|
|
483
|
-
case messageTypes_js_1.ContainerMessageType.Alias: {
|
|
484
|
-
this.parentContext.submitMessage(type, content, localOpMetadata);
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
case messageTypes_js_1.ContainerMessageType.FluidDataStoreOp: {
|
|
488
|
-
return this.reSubmitChannelOp(type, content, localOpMetadata, squash);
|
|
489
|
-
}
|
|
490
|
-
default: {
|
|
491
|
-
(0, internal_1.assert)(false, 0x907 /* unknown op type */);
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
reSubmitChannelOp(type, content, localOpMetadata, squash) {
|
|
496
|
-
const envelope = content;
|
|
497
|
-
const context = this.contexts.get(envelope.address);
|
|
498
|
-
// If the data store has been deleted, log an error and throw an error. If there are local changes for a
|
|
499
|
-
// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
|
|
500
|
-
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "resubmitDataStoreOp")) {
|
|
501
|
-
throw new internal_6.DataCorruptionError("Context is deleted!", {
|
|
502
|
-
callSite: "resubmitDataStoreOp",
|
|
503
|
-
...(0, internal_6.tagCodeArtifacts)({ id: envelope.address }),
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
(0, internal_1.assert)(!!context, 0x160 /* "There should be a store context for the op" */);
|
|
507
|
-
const innerContents = envelope.contents;
|
|
508
|
-
context.reSubmit(innerContents.type, innerContents.content, localOpMetadata, squash);
|
|
509
|
-
}
|
|
510
|
-
rollback(type, content, localOpMetadata) {
|
|
511
|
-
(0, internal_1.assert)(type === messageTypes_js_1.ContainerMessageType.FluidDataStoreOp, 0x8e8 /* type */);
|
|
512
|
-
const envelope = content;
|
|
513
|
-
const context = this.contexts.get(envelope.address);
|
|
514
|
-
// If the data store has been deleted, log an error and throw an error. If there are local changes for a
|
|
515
|
-
// deleted data store, it can otherwise lead to inconsistent state when compared to other clients.
|
|
516
|
-
if (this.checkAndLogIfDeleted(envelope.address, context, "Changed", "rollbackDataStoreOp")) {
|
|
517
|
-
throw new internal_6.DataCorruptionError("Context is deleted!", {
|
|
518
|
-
callSite: "rollbackDataStoreOp",
|
|
519
|
-
...(0, internal_6.tagCodeArtifacts)({ id: envelope.address }),
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
(0, internal_1.assert)(!!context, 0x2e8 /* "There should be a store context for the op" */);
|
|
523
|
-
const innerContents = envelope.contents;
|
|
524
|
-
context.rollback(innerContents.type, innerContents.content, localOpMetadata);
|
|
525
|
-
}
|
|
526
516
|
async applyStashedOp(content) {
|
|
527
517
|
const opContents = content;
|
|
528
518
|
switch (opContents.type) {
|
|
@@ -1237,7 +1227,51 @@ function detectOutboundReferences(address, contents, addedOutboundReference) {
|
|
|
1237
1227
|
}
|
|
1238
1228
|
}
|
|
1239
1229
|
exports.detectOutboundReferences = detectOutboundReferences;
|
|
1230
|
+
// #region Experimentation
|
|
1231
|
+
// The code below here is for experimentation (and one test) only.
|
|
1240
1232
|
/**
|
|
1233
|
+
* @privateRemarks This class is only used for experimentation/testing.
|
|
1234
|
+
*/
|
|
1235
|
+
class ComposableChannelCollection extends ChannelCollection {
|
|
1236
|
+
constructor(baseSnapshot, parentContext, baseLogger, gcNodeUpdated, isDataStoreDeleted, aliasMap, provideEntryPoint) {
|
|
1237
|
+
super(baseSnapshot,
|
|
1238
|
+
/* [root] parentContext */
|
|
1239
|
+
formParentContext(parentContext, {
|
|
1240
|
+
submitMessage: (containerRuntimeMessage, localOpMetadata) => {
|
|
1241
|
+
// Note that here our message format is reconfigured.
|
|
1242
|
+
// While `ContainerRuntime*Message`s use `contents`
|
|
1243
|
+
// as `FluidDataStoreMessage`s, the content is
|
|
1244
|
+
// stored in `content`.
|
|
1245
|
+
parentContext.submitMessage(containerRuntimeMessage.type, containerRuntimeMessage.contents, localOpMetadata);
|
|
1246
|
+
},
|
|
1247
|
+
submitSignal: (envelope, targetClientId) => {
|
|
1248
|
+
parentContext.submitSignal(envelope.contents.type, {
|
|
1249
|
+
address: envelope.address,
|
|
1250
|
+
contents: envelope.contents.content,
|
|
1251
|
+
}, targetClientId);
|
|
1252
|
+
},
|
|
1253
|
+
}), baseLogger, gcNodeUpdated, isDataStoreDeleted, aliasMap);
|
|
1254
|
+
this.entryPoint = new internal_2.FluidObjectHandle(new internal_1.LazyPromise(async () => provideEntryPoint(this)), "", this.parentContext.IFluidHandleContext);
|
|
1255
|
+
}
|
|
1256
|
+
reSubmit(type, content, localOpMetadata, squash) {
|
|
1257
|
+
// If the cast is incorrect and type is not one of the three supported,
|
|
1258
|
+
// reSubmitContainerMessage will assert.
|
|
1259
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Need to force conversion
|
|
1260
|
+
const message = {
|
|
1261
|
+
type,
|
|
1262
|
+
contents: content,
|
|
1263
|
+
};
|
|
1264
|
+
this.reSubmitContainerMessage(message, localOpMetadata, squash);
|
|
1265
|
+
}
|
|
1266
|
+
rollback(type, content, localOpMetadata) {
|
|
1267
|
+
(0, internal_1.assert)(type === messageTypes_js_1.ContainerMessageType.FluidDataStoreOp, 0x8e8 /* type */);
|
|
1268
|
+
this.rollbackDataStoreOp(content, localOpMetadata);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
exports.ComposableChannelCollection = ComposableChannelCollection;
|
|
1272
|
+
/**
|
|
1273
|
+
* @privateRemarks This factory is only used for experimentation/testing.
|
|
1274
|
+
*
|
|
1241
1275
|
* @internal
|
|
1242
1276
|
*/
|
|
1243
1277
|
class ChannelCollectionFactory {
|
|
@@ -1262,10 +1296,10 @@ class ChannelCollectionFactory {
|
|
|
1262
1296
|
// this factory and the container runtime are
|
|
1263
1297
|
// from the same package.
|
|
1264
1298
|
(0, internal_1.assert)(context instanceof dataStoreContext_js_1.FluidDataStoreContext, 0xb8f /* we don't support the layer boundary here today */);
|
|
1265
|
-
const runtime = new
|
|
1266
|
-
|
|
1267
|
-
(
|
|
1268
|
-
new Map(), // aliasMap
|
|
1299
|
+
const runtime = new ComposableChannelCollection(context.baseSnapshot,
|
|
1300
|
+
/* parentContext */ context, context.baseLogger,
|
|
1301
|
+
/* gcNodeUpdated */ () => { },
|
|
1302
|
+
/* isDataStoreDeleted */ (_nodePath) => false, new Map(), // aliasMap
|
|
1269
1303
|
this.provideEntryPoint);
|
|
1270
1304
|
return runtime;
|
|
1271
1305
|
}
|