@fluidframework/datastore 2.0.0-internal.5.3.2 → 2.0.0-internal.6.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 +50 -0
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js +15 -32
- package/dist/channelContext.js.map +1 -1
- package/dist/channelStorageService.js +1 -2
- package/dist/channelStorageService.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +7 -2
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +36 -58
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +5 -2
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js +16 -33
- package/lib/channelContext.js.map +1 -1
- package/lib/channelStorageService.js +1 -2
- package/lib/channelStorageService.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +7 -2
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +38 -60
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +6 -3
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +22 -18
- package/src/channelContext.ts +24 -35
- package/src/dataStoreRuntime.ts +32 -57
- package/src/remoteChannelContext.ts +5 -2
package/src/dataStoreRuntime.ts
CHANGED
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
ITelemetryLoggerExt,
|
|
8
|
-
ChildLogger,
|
|
9
8
|
generateStack,
|
|
10
9
|
LoggingError,
|
|
11
|
-
loggerToMonitoringContext,
|
|
12
10
|
MonitoringContext,
|
|
13
11
|
raiseConnectedEvent,
|
|
14
|
-
|
|
12
|
+
createChildMonitoringContext,
|
|
13
|
+
tagCodeArtifacts,
|
|
15
14
|
} from "@fluidframework/telemetry-utils";
|
|
16
15
|
import {
|
|
17
16
|
FluidObject,
|
|
@@ -63,7 +62,6 @@ import {
|
|
|
63
62
|
exceptionToResponse,
|
|
64
63
|
GCDataBuilder,
|
|
65
64
|
requestFluidObject,
|
|
66
|
-
packagePathToTelemetryProperty,
|
|
67
65
|
unpackChildNodesUsedRoutes,
|
|
68
66
|
} from "@fluidframework/runtime-utils";
|
|
69
67
|
import {
|
|
@@ -127,6 +125,9 @@ export class FluidDataStoreRuntime
|
|
|
127
125
|
*/
|
|
128
126
|
public readonly entryPoint?: IFluidHandle<FluidObject>;
|
|
129
127
|
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
130
|
+
*/
|
|
130
131
|
public get IFluidRouter() {
|
|
131
132
|
return this;
|
|
132
133
|
}
|
|
@@ -183,7 +184,6 @@ export class FluidDataStoreRuntime
|
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
private readonly contexts = new Map<string, IChannelContext>();
|
|
186
|
-
private readonly contextsDeferred = new Map<string, Deferred<IChannelContext>>();
|
|
187
187
|
private readonly pendingAttach = new Map<string, IAttachMessage>();
|
|
188
188
|
|
|
189
189
|
private readonly deferredAttached = new Deferred<void>();
|
|
@@ -251,11 +251,13 @@ export class FluidDataStoreRuntime
|
|
|
251
251
|
0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */,
|
|
252
252
|
);
|
|
253
253
|
|
|
254
|
-
this.mc =
|
|
255
|
-
|
|
254
|
+
this.mc = createChildMonitoringContext({
|
|
255
|
+
logger: dataStoreContext.logger,
|
|
256
|
+
namespace: "FluidDataStoreRuntime",
|
|
257
|
+
properties: {
|
|
256
258
|
all: { dataStoreId: uuid() },
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
+
},
|
|
260
|
+
});
|
|
259
261
|
|
|
260
262
|
this.id = dataStoreContext.id;
|
|
261
263
|
this.options = dataStoreContext.options;
|
|
@@ -320,11 +322,8 @@ export class FluidDataStoreRuntime
|
|
|
320
322
|
}),
|
|
321
323
|
);
|
|
322
324
|
}
|
|
323
|
-
const deferred = new Deferred<IChannelContext>();
|
|
324
|
-
deferred.resolve(channelContext);
|
|
325
325
|
|
|
326
326
|
this.contexts.set(path, channelContext);
|
|
327
|
-
this.contextsDeferred.set(path, deferred);
|
|
328
327
|
});
|
|
329
328
|
}
|
|
330
329
|
|
|
@@ -383,6 +382,9 @@ export class FluidDataStoreRuntime
|
|
|
383
382
|
return this.request(request);
|
|
384
383
|
}
|
|
385
384
|
|
|
385
|
+
/**
|
|
386
|
+
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
387
|
+
*/
|
|
386
388
|
public async request(request: IRequest): Promise<IResponse> {
|
|
387
389
|
try {
|
|
388
390
|
const parser = RequestParser.create(request);
|
|
@@ -393,11 +395,10 @@ export class FluidDataStoreRuntime
|
|
|
393
395
|
}
|
|
394
396
|
|
|
395
397
|
// Check for a data type reference first
|
|
396
|
-
|
|
398
|
+
const context = this.contexts.get(id);
|
|
399
|
+
if (context !== undefined && parser.isLeaf(1)) {
|
|
397
400
|
try {
|
|
398
|
-
|
|
399
|
-
const value = await this.contextsDeferred.get(id)!.promise;
|
|
400
|
-
const channel = await value.getChannel();
|
|
401
|
+
const channel = await context.getChannel();
|
|
401
402
|
|
|
402
403
|
return { mimeType: "fluid/object", status: 200, value: channel };
|
|
403
404
|
} catch (error) {
|
|
@@ -420,18 +421,12 @@ export class FluidDataStoreRuntime
|
|
|
420
421
|
public async getChannel(id: string): Promise<IChannel> {
|
|
421
422
|
this.verifyNotClosed();
|
|
422
423
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
if (!this.contextsDeferred.has(id)) {
|
|
427
|
-
this.contextsDeferred.set(id, new Deferred<IChannelContext>());
|
|
424
|
+
const context = this.contexts.get(id);
|
|
425
|
+
if (context === undefined) {
|
|
426
|
+
throw new LoggingError("Channel does not exist");
|
|
428
427
|
}
|
|
429
428
|
|
|
430
|
-
|
|
431
|
-
const context = await this.contextsDeferred.get(id)!.promise;
|
|
432
|
-
const channel = await context.getChannel();
|
|
433
|
-
|
|
434
|
-
return channel;
|
|
429
|
+
return context.getChannel();
|
|
435
430
|
}
|
|
436
431
|
|
|
437
432
|
public createChannel(id: string = uuid(), type: string): IChannel {
|
|
@@ -458,15 +453,6 @@ export class FluidDataStoreRuntime
|
|
|
458
453
|
);
|
|
459
454
|
this.contexts.set(id, context);
|
|
460
455
|
|
|
461
|
-
if (this.contextsDeferred.has(id)) {
|
|
462
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
463
|
-
this.contextsDeferred.get(id)!.resolve(context);
|
|
464
|
-
} else {
|
|
465
|
-
const deferred = new Deferred<IChannelContext>();
|
|
466
|
-
deferred.resolve(context);
|
|
467
|
-
this.contextsDeferred.set(id, deferred);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
456
|
// Channels (DDS) should not be created in summarizer client.
|
|
471
457
|
this.identifyLocalChangeInSummarizer("DDSCreatedInSummarizer", id, type);
|
|
472
458
|
|
|
@@ -578,10 +564,13 @@ export class FluidDataStoreRuntime
|
|
|
578
564
|
return this.audience;
|
|
579
565
|
}
|
|
580
566
|
|
|
581
|
-
public async uploadBlob(
|
|
567
|
+
public async uploadBlob(
|
|
568
|
+
blob: ArrayBufferLike,
|
|
569
|
+
signal?: AbortSignal,
|
|
570
|
+
): Promise<IFluidHandle<ArrayBufferLike>> {
|
|
582
571
|
this.verifyNotClosed();
|
|
583
572
|
|
|
584
|
-
return this.dataStoreContext.uploadBlob(blob);
|
|
573
|
+
return this.dataStoreContext.uploadBlob(blob, signal);
|
|
585
574
|
}
|
|
586
575
|
|
|
587
576
|
public process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {
|
|
@@ -633,14 +622,6 @@ export class FluidDataStoreRuntime
|
|
|
633
622
|
);
|
|
634
623
|
|
|
635
624
|
this.contexts.set(id, remoteChannelContext);
|
|
636
|
-
if (this.contextsDeferred.has(id)) {
|
|
637
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
638
|
-
this.contextsDeferred.get(id)!.resolve(remoteChannelContext);
|
|
639
|
-
} else {
|
|
640
|
-
const deferred = new Deferred<IChannelContext>();
|
|
641
|
-
deferred.resolve(remoteChannelContext);
|
|
642
|
-
this.contextsDeferred.set(id, deferred);
|
|
643
|
-
}
|
|
644
625
|
}
|
|
645
626
|
break;
|
|
646
627
|
}
|
|
@@ -1098,18 +1079,12 @@ export class FluidDataStoreRuntime
|
|
|
1098
1079
|
// in the summarizer and the data will help us plan this.
|
|
1099
1080
|
this.mc.logger.sendTelemetryEvent({
|
|
1100
1081
|
eventName,
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
value: this.id,
|
|
1108
|
-
tag: TelemetryDataTag.CodeArtifact,
|
|
1109
|
-
},
|
|
1110
|
-
fluidDataStorePackagePath: packagePathToTelemetryProperty(
|
|
1111
|
-
this.dataStoreContext.packagePath,
|
|
1112
|
-
),
|
|
1082
|
+
...tagCodeArtifacts({
|
|
1083
|
+
channelType,
|
|
1084
|
+
channelId,
|
|
1085
|
+
fluidDataStoreId: this.id,
|
|
1086
|
+
fluidDataStorePackagePath: this.dataStoreContext.packagePath.join("/"),
|
|
1087
|
+
}),
|
|
1113
1088
|
stack: generateStack(),
|
|
1114
1089
|
});
|
|
1115
1090
|
this.localChangesTelemetryCount--;
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
ITelemetryContext,
|
|
21
21
|
} from "@fluidframework/runtime-definitions";
|
|
22
22
|
import {
|
|
23
|
-
|
|
23
|
+
createChildLogger,
|
|
24
24
|
ITelemetryLoggerExt,
|
|
25
25
|
ThresholdCounter,
|
|
26
26
|
} from "@fluidframework/telemetry-utils";
|
|
@@ -61,7 +61,10 @@ export class RemoteChannelContext implements IChannelContext {
|
|
|
61
61
|
) {
|
|
62
62
|
assert(!this.id.includes("/"), 0x310 /* Channel context ID cannot contain slashes */);
|
|
63
63
|
|
|
64
|
-
this.subLogger =
|
|
64
|
+
this.subLogger = createChildLogger({
|
|
65
|
+
logger: runtime.logger,
|
|
66
|
+
namespace: "RemoteChannelContext",
|
|
67
|
+
});
|
|
65
68
|
|
|
66
69
|
this.services = createChannelServiceEndpoints(
|
|
67
70
|
dataStoreContext.connected,
|