@fluidframework/datastore 2.0.0-internal.4.2.1 → 2.0.0-internal.4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/channelContext.d.ts +12 -5
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js +74 -5
- package/dist/channelContext.js.map +1 -1
- package/dist/channelDeltaConnection.d.ts +4 -5
- package/dist/channelDeltaConnection.d.ts.map +1 -1
- package/dist/channelDeltaConnection.js +3 -4
- package/dist/channelDeltaConnection.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +1 -2
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/localChannelContext.d.ts +7 -16
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.js +52 -65
- package/dist/localChannelContext.js.map +1 -1
- package/dist/remoteChannelContext.d.ts +3 -8
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +22 -89
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts +12 -5
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js +70 -3
- package/lib/channelContext.js.map +1 -1
- package/lib/channelDeltaConnection.d.ts +4 -5
- package/lib/channelDeltaConnection.d.ts.map +1 -1
- package/lib/channelDeltaConnection.js +3 -4
- package/lib/channelDeltaConnection.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +1 -2
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/localChannelContext.d.ts +7 -16
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.js +54 -67
- package/lib/localChannelContext.js.map +1 -1
- package/lib/remoteChannelContext.d.ts +3 -8
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +25 -92
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +16 -17
- package/src/channelContext.ts +105 -6
- package/src/channelDeltaConnection.ts +4 -5
- package/src/dataStoreRuntime.ts +4 -8
- package/src/localChannelContext.ts +105 -140
- package/src/remoteChannelContext.ts +58 -125
- package/dist/packageVersion.d.ts +0 -9
- package/dist/packageVersion.d.ts.map +0 -1
- package/dist/packageVersion.js +0 -12
- package/dist/packageVersion.js.map +0 -1
- package/lib/packageVersion.d.ts +0 -9
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js +0 -9
- package/lib/packageVersion.js.map +0 -1
- package/src/packageVersion.ts +0 -9
|
@@ -4,16 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
|
-
import { assert } from "@fluidframework/common-utils";
|
|
8
|
-
import { DataCorruptionError } from "@fluidframework/container-utils";
|
|
7
|
+
import { LazyPromise, assert } from "@fluidframework/common-utils";
|
|
9
8
|
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
10
|
-
import {
|
|
11
|
-
IChannel,
|
|
12
|
-
IChannelAttributes,
|
|
13
|
-
IFluidDataStoreRuntime,
|
|
14
|
-
} from "@fluidframework/datastore-definitions";
|
|
9
|
+
import { IChannel, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
15
10
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
16
|
-
import { readAndParse } from "@fluidframework/driver-utils";
|
|
17
11
|
import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
18
12
|
import {
|
|
19
13
|
CreateChildSummarizerNodeFn,
|
|
@@ -25,52 +19,48 @@ import {
|
|
|
25
19
|
ISummarizerNodeWithGC,
|
|
26
20
|
ITelemetryContext,
|
|
27
21
|
} from "@fluidframework/runtime-definitions";
|
|
28
|
-
import { ChildLogger,
|
|
22
|
+
import { ChildLogger, ThresholdCounter } from "@fluidframework/telemetry-utils";
|
|
29
23
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
ChannelServiceEndpoints,
|
|
25
|
+
createChannelServiceEndpoints,
|
|
32
26
|
IChannelContext,
|
|
27
|
+
loadChannel,
|
|
28
|
+
loadChannelFactoryAndAttributes,
|
|
33
29
|
summarizeChannelAsync,
|
|
34
30
|
} from "./channelContext";
|
|
35
|
-
import { ChannelDeltaConnection } from "./channelDeltaConnection";
|
|
36
|
-
import { ChannelStorageService } from "./channelStorageService";
|
|
37
31
|
import { ISharedObjectRegistry } from "./dataStoreRuntime";
|
|
38
32
|
|
|
39
33
|
export class RemoteChannelContext implements IChannelContext {
|
|
40
34
|
private isLoaded = false;
|
|
41
35
|
private pending: ISequencedDocumentMessage[] | undefined = [];
|
|
42
|
-
private channelP: Promise<IChannel
|
|
36
|
+
private readonly channelP: Promise<IChannel>;
|
|
43
37
|
private channel: IChannel | undefined;
|
|
44
|
-
private readonly services:
|
|
45
|
-
readonly deltaConnection: ChannelDeltaConnection;
|
|
46
|
-
readonly objectStorage: ChannelStorageService;
|
|
47
|
-
};
|
|
38
|
+
private readonly services: ChannelServiceEndpoints;
|
|
48
39
|
private readonly summarizerNode: ISummarizerNodeWithGC;
|
|
49
40
|
private readonly subLogger: ITelemetryLogger;
|
|
50
41
|
private readonly thresholdOpsCounter: ThresholdCounter;
|
|
51
42
|
private static readonly pendingOpsCountThreshold = 1000;
|
|
52
43
|
|
|
53
44
|
constructor(
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
runtime: IFluidDataStoreRuntime,
|
|
46
|
+
dataStoreContext: IFluidDataStoreContext,
|
|
56
47
|
storageService: IDocumentStorageService,
|
|
57
48
|
submitFn: (content: any, localOpMetadata: unknown) => void,
|
|
58
49
|
dirtyFn: (address: string) => void,
|
|
59
50
|
addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,
|
|
60
51
|
private readonly id: string,
|
|
61
52
|
baseSnapshot: ISnapshotTree,
|
|
62
|
-
|
|
53
|
+
registry: ISharedObjectRegistry,
|
|
63
54
|
extraBlobs: Map<string, ArrayBufferLike> | undefined,
|
|
64
55
|
createSummarizerNode: CreateChildSummarizerNodeFn,
|
|
65
|
-
|
|
56
|
+
attachMessageType?: string,
|
|
66
57
|
) {
|
|
67
58
|
assert(!this.id.includes("/"), 0x310 /* Channel context ID cannot contain slashes */);
|
|
68
59
|
|
|
69
|
-
this.subLogger = ChildLogger.create(
|
|
60
|
+
this.subLogger = ChildLogger.create(runtime.logger, "RemoteChannelContext");
|
|
70
61
|
|
|
71
|
-
this.services =
|
|
72
|
-
|
|
73
|
-
this.dataStoreContext.connected,
|
|
62
|
+
this.services = createChannelServiceEndpoints(
|
|
63
|
+
dataStoreContext.connected,
|
|
74
64
|
submitFn,
|
|
75
65
|
() => dirtyFn(this.id),
|
|
76
66
|
addedGCOutboundReferenceFn,
|
|
@@ -80,6 +70,46 @@ export class RemoteChannelContext implements IChannelContext {
|
|
|
80
70
|
extraBlobs,
|
|
81
71
|
);
|
|
82
72
|
|
|
73
|
+
this.channelP = new LazyPromise<IChannel>(async () => {
|
|
74
|
+
const { attributes, factory } = await loadChannelFactoryAndAttributes(
|
|
75
|
+
dataStoreContext,
|
|
76
|
+
this.services,
|
|
77
|
+
this.id,
|
|
78
|
+
registry,
|
|
79
|
+
attachMessageType,
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const channel = await loadChannel(
|
|
83
|
+
runtime,
|
|
84
|
+
attributes,
|
|
85
|
+
factory,
|
|
86
|
+
this.services,
|
|
87
|
+
this.subLogger,
|
|
88
|
+
this.id,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
// Send all pending messages to the channel
|
|
92
|
+
assert(this.pending !== undefined, 0x23f /* "pending undefined" */);
|
|
93
|
+
for (const message of this.pending) {
|
|
94
|
+
this.services.deltaConnection.process(
|
|
95
|
+
message,
|
|
96
|
+
false,
|
|
97
|
+
undefined /* localOpMetadata */,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
this.thresholdOpsCounter.send("ProcessPendingOps", this.pending.length);
|
|
101
|
+
|
|
102
|
+
// Commit changes.
|
|
103
|
+
this.channel = channel;
|
|
104
|
+
this.pending = undefined;
|
|
105
|
+
this.isLoaded = true;
|
|
106
|
+
|
|
107
|
+
// Because have some await between we created the service and here, the connection state might have changed
|
|
108
|
+
// and we don't propagate the connection state when we are not loaded. So we have to set it again here.
|
|
109
|
+
this.services.deltaConnection.setConnectionState(dataStoreContext.connected);
|
|
110
|
+
return this.channel;
|
|
111
|
+
});
|
|
112
|
+
|
|
83
113
|
const thisSummarizeInternal = async (
|
|
84
114
|
fullTree: boolean,
|
|
85
115
|
trackState: boolean,
|
|
@@ -106,10 +136,6 @@ export class RemoteChannelContext implements IChannelContext {
|
|
|
106
136
|
|
|
107
137
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
108
138
|
public getChannel(): Promise<IChannel> {
|
|
109
|
-
if (this.channelP === undefined) {
|
|
110
|
-
this.channelP = this.loadChannel();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
139
|
return this.channelP;
|
|
114
140
|
}
|
|
115
141
|
|
|
@@ -122,9 +148,9 @@ export class RemoteChannelContext implements IChannelContext {
|
|
|
122
148
|
this.services.deltaConnection.setConnectionState(connected);
|
|
123
149
|
}
|
|
124
150
|
|
|
125
|
-
public applyStashedOp(
|
|
151
|
+
public applyStashedOp(content: any): unknown {
|
|
126
152
|
assert(this.isLoaded, 0x194 /* "Remote channel must be loaded when rebasing op" */);
|
|
127
|
-
return this.services.deltaConnection.applyStashedOp(
|
|
153
|
+
return this.services.deltaConnection.applyStashedOp(content);
|
|
128
154
|
}
|
|
129
155
|
|
|
130
156
|
public processOp(
|
|
@@ -187,99 +213,6 @@ export class RemoteChannelContext implements IChannelContext {
|
|
|
187
213
|
return { ...summarizeResult, id: this.id };
|
|
188
214
|
}
|
|
189
215
|
|
|
190
|
-
private async loadChannel(): Promise<IChannel> {
|
|
191
|
-
assert(
|
|
192
|
-
!this.isLoaded,
|
|
193
|
-
0x197 /* "Remote channel must not already be loaded when loading" */,
|
|
194
|
-
);
|
|
195
|
-
|
|
196
|
-
let attributes: IChannelAttributes | undefined;
|
|
197
|
-
if (await this.services.objectStorage.contains(attributesBlobKey)) {
|
|
198
|
-
attributes = await readAndParse<IChannelAttributes | undefined>(
|
|
199
|
-
this.services.objectStorage,
|
|
200
|
-
attributesBlobKey,
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// This is a backward compatibility case where the attach message doesn't include attributes. They must
|
|
205
|
-
// include attach message type.
|
|
206
|
-
// Since old attach messages will not have attributes, we need to keep this as long as we support old attach
|
|
207
|
-
// messages.
|
|
208
|
-
const channelFactoryType = attributes ? attributes.type : this.attachMessageType;
|
|
209
|
-
if (channelFactoryType === undefined) {
|
|
210
|
-
throw new DataCorruptionError("channelTypeNotAvailable", {
|
|
211
|
-
channelId: {
|
|
212
|
-
value: this.id,
|
|
213
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
214
|
-
},
|
|
215
|
-
dataStoreId: {
|
|
216
|
-
value: this.dataStoreContext.id,
|
|
217
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
218
|
-
},
|
|
219
|
-
dataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
|
|
220
|
-
channelFactoryType: this.attachMessageType,
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
const factory = this.registry.get(channelFactoryType);
|
|
224
|
-
if (factory === undefined) {
|
|
225
|
-
// TODO: dataStoreId may require a different tag from PackageData #7488
|
|
226
|
-
throw new DataCorruptionError("channelFactoryNotRegisteredForGivenType", {
|
|
227
|
-
channelId: {
|
|
228
|
-
value: this.id,
|
|
229
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
230
|
-
},
|
|
231
|
-
dataStoreId: {
|
|
232
|
-
value: this.dataStoreContext.id,
|
|
233
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
234
|
-
},
|
|
235
|
-
dataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
|
|
236
|
-
channelFactoryType,
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes
|
|
241
|
-
// from the factory.
|
|
242
|
-
attributes = attributes ?? factory.attributes;
|
|
243
|
-
|
|
244
|
-
// Compare snapshot version to collaborative object version
|
|
245
|
-
if (
|
|
246
|
-
attributes.snapshotFormatVersion !== undefined &&
|
|
247
|
-
attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion
|
|
248
|
-
) {
|
|
249
|
-
this.subLogger.sendTelemetryEvent({
|
|
250
|
-
eventName: "ChannelAttributesVersionMismatch",
|
|
251
|
-
channelType: { value: attributes.type, tag: TelemetryDataTag.CodeArtifact },
|
|
252
|
-
channelSnapshotVersion: {
|
|
253
|
-
value: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,
|
|
254
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
255
|
-
},
|
|
256
|
-
channelCodeVersion: {
|
|
257
|
-
value: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,
|
|
258
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
259
|
-
},
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
const channel = await factory.load(this.runtime, this.id, this.services, attributes);
|
|
264
|
-
|
|
265
|
-
// Send all pending messages to the channel
|
|
266
|
-
assert(this.pending !== undefined, 0x23f /* "pending undefined" */);
|
|
267
|
-
for (const message of this.pending) {
|
|
268
|
-
this.services.deltaConnection.process(message, false, undefined /* localOpMetadata */);
|
|
269
|
-
}
|
|
270
|
-
this.thresholdOpsCounter.send("ProcessPendingOps", this.pending.length);
|
|
271
|
-
|
|
272
|
-
// Commit changes.
|
|
273
|
-
this.channel = channel;
|
|
274
|
-
this.pending = undefined;
|
|
275
|
-
this.isLoaded = true;
|
|
276
|
-
|
|
277
|
-
// Because have some await between we created the service and here, the connection state might have changed
|
|
278
|
-
// and we don't propagate the connection state when we are not loaded. So we have to set it again here.
|
|
279
|
-
this.services.deltaConnection.setConnectionState(this.dataStoreContext.connected);
|
|
280
|
-
return this.channel;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
216
|
/**
|
|
284
217
|
* Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.
|
|
285
218
|
* Each node has a set of outbound routes to other GC nodes in the document.
|
package/dist/packageVersion.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
-
*/
|
|
7
|
-
export declare const pkgName = "@fluidframework/datastore";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.4.2.1";
|
|
9
|
-
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,8BAA8B,CAAC;AACnD,eAAO,MAAM,UAAU,yBAAyB,CAAC"}
|
package/dist/packageVersion.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*
|
|
6
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
|
-
exports.pkgName = "@fluidframework/datastore";
|
|
11
|
-
exports.pkgVersion = "2.0.0-internal.4.2.1";
|
|
12
|
-
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,2BAA2B,CAAC;AACtC,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/datastore\";\nexport const pkgVersion = \"2.0.0-internal.4.2.1\";\n"]}
|
package/lib/packageVersion.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
-
*/
|
|
7
|
-
export declare const pkgName = "@fluidframework/datastore";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.4.2.1";
|
|
9
|
-
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,8BAA8B,CAAC;AACnD,eAAO,MAAM,UAAU,yBAAyB,CAAC"}
|
package/lib/packageVersion.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
-
*/
|
|
7
|
-
export const pkgName = "@fluidframework/datastore";
|
|
8
|
-
export const pkgVersion = "2.0.0-internal.4.2.1";
|
|
9
|
-
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,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/datastore\";\nexport const pkgVersion = \"2.0.0-internal.4.2.1\";\n"]}
|
package/src/packageVersion.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const pkgName = "@fluidframework/datastore";
|
|
9
|
-
export const pkgVersion = "2.0.0-internal.4.2.1";
|