@fluidframework/datastore 2.0.0-internal.3.1.0 → 2.0.0-internal.3.2.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.
@@ -6,7 +6,7 @@ import { IFluidHandle } from "@fluidframework/core-interfaces";
6
6
  import { IChannel, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
7
7
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
8
8
  import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
9
- import { CreateChildSummarizerNodeFn, IFluidDataStoreContext, IGarbageCollectionData, IGarbageCollectionDetailsBase, ISummarizeResult, ITelemetryContext } from "@fluidframework/runtime-definitions";
9
+ import { CreateChildSummarizerNodeFn, IFluidDataStoreContext, IGarbageCollectionData, ISummarizeResult, ITelemetryContext } from "@fluidframework/runtime-definitions";
10
10
  import { IChannelContext } from "./channelContext";
11
11
  import { ISharedObjectRegistry } from "./dataStoreRuntime";
12
12
  export declare class RemoteChannelContext implements IChannelContext {
@@ -24,7 +24,7 @@ export declare class RemoteChannelContext implements IChannelContext {
24
24
  private readonly subLogger;
25
25
  private readonly thresholdOpsCounter;
26
26
  private static readonly pendingOpsCountThreshold;
27
- constructor(runtime: IFluidDataStoreRuntime, dataStoreContext: IFluidDataStoreContext, storageService: IDocumentStorageService, submitFn: (content: any, localOpMetadata: unknown) => void, dirtyFn: (address: string) => void, addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void, id: string, baseSnapshot: ISnapshotTree, registry: ISharedObjectRegistry, extraBlobs: Map<string, ArrayBufferLike> | undefined, createSummarizerNode: CreateChildSummarizerNodeFn, getBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase>, attachMessageType?: string | undefined);
27
+ constructor(runtime: IFluidDataStoreRuntime, dataStoreContext: IFluidDataStoreContext, storageService: IDocumentStorageService, submitFn: (content: any, localOpMetadata: unknown) => void, dirtyFn: (address: string) => void, addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void, id: string, baseSnapshot: ISnapshotTree, registry: ISharedObjectRegistry, extraBlobs: Map<string, ArrayBufferLike> | undefined, createSummarizerNode: CreateChildSummarizerNodeFn, attachMessageType?: string | undefined);
28
28
  getChannel(): Promise<IChannel>;
29
29
  setConnectionState(connected: boolean, clientId?: string): void;
30
30
  applyStashedOp(message: ISequencedDocumentMessage): unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"remoteChannelContext.d.ts","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACN,QAAQ,EAER,sBAAsB,EAEtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EACN,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAE7B,gBAAgB,EAEhB,iBAAiB,EACjB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAGN,eAAe,EAEf,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,qBAAa,oBAAqB,YAAW,eAAe;IAe1D,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAKjC,OAAO,CAAC,QAAQ,CAAC,EAAE;IAEnB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAIzB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IA1BpC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,OAAO,CAAuB;IAC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GAClC,OAAO,CAAC,gBAAgB,CAAC;YAId,iBAAiB;YAejB,WAAW;IA8GzB;;;;;;OAMG;IACU,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIhF;;;;OAIG;YACW,iBAAiB;IAKxB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE;CAS5C"}
@@ -11,7 +11,7 @@ const driver_utils_1 = require("@fluidframework/driver-utils");
11
11
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
12
12
  const channelContext_1 = require("./channelContext");
13
13
  class RemoteChannelContext {
14
- constructor(runtime, dataStoreContext, storageService, submitFn, dirtyFn, addedGCOutboundReferenceFn, id, baseSnapshot, registry, extraBlobs, createSummarizerNode, getBaseGCDetails, attachMessageType) {
14
+ constructor(runtime, dataStoreContext, storageService, submitFn, dirtyFn, addedGCOutboundReferenceFn, id, baseSnapshot, registry, extraBlobs, createSummarizerNode, attachMessageType) {
15
15
  this.runtime = runtime;
16
16
  this.dataStoreContext = dataStoreContext;
17
17
  this.id = id;
@@ -23,7 +23,7 @@ class RemoteChannelContext {
23
23
  this.subLogger = telemetry_utils_1.ChildLogger.create(this.runtime.logger, "RemoteChannelContext");
24
24
  this.services = (0, channelContext_1.createServiceEndpoints)(this.id, this.dataStoreContext.connected, submitFn, () => dirtyFn(this.id), addedGCOutboundReferenceFn, storageService, this.subLogger, baseSnapshot, extraBlobs);
25
25
  const thisSummarizeInternal = async (fullTree, trackState, telemetryContext) => this.summarizeInternal(fullTree, trackState, telemetryContext);
26
- this.summarizerNode = createSummarizerNode(thisSummarizeInternal, async (fullGC) => this.getGCDataInternal(fullGC), async () => getBaseGCDetails());
26
+ this.summarizerNode = createSummarizerNode(thisSummarizeInternal, async (fullGC) => this.getGCDataInternal(fullGC));
27
27
  this.thresholdOpsCounter = new telemetry_utils_1.ThresholdCounter(RemoteChannelContext.pendingOpsCountThreshold, this.subLogger);
28
28
  }
29
29
  // eslint-disable-next-line @typescript-eslint/promise-function-async
@@ -1 +1 @@
1
- {"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAsD;AACtD,qEAAsE;AAStE,+DAA4D;AAY5D,qEAAkG;AAClG,qDAK0B;AAK1B,MAAa,oBAAoB;IAchC,YACkB,OAA+B,EAC/B,gBAAwC,EACzD,cAAuC,EACvC,QAA0D,EAC1D,OAAkC,EAClC,0BAA2F,EAC1E,EAAU,EAC3B,YAA2B,EACV,QAA+B,EAChD,UAAoD,EACpD,oBAAiD,EACjD,gBAA8D,EAC7C,iBAA0B;QAZ1B,YAAO,GAAP,OAAO,CAAwB;QAC/B,qBAAgB,GAAhB,gBAAgB,CAAwB;QAKxC,OAAE,GAAF,EAAE,CAAQ;QAEV,aAAQ,GAAR,QAAQ,CAAuB;QAI/B,sBAAiB,GAAjB,iBAAiB,CAAS;QA1BpC,aAAQ,GAAG,KAAK,CAAC;QACjB,YAAO,GAA4C,EAAE,CAAC;QA2B7D,IAAA,qBAAM,EAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAEtF,IAAI,CAAC,SAAS,GAAG,6BAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;QAEjF,IAAI,CAAC,QAAQ,GAAG,IAAA,uCAAsB,EACrC,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAC/B,QAAQ,EACR,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EACtB,0BAA0B,EAC1B,cAAc,EACd,IAAI,CAAC,SAAS,EACd,YAAY,EACZ,UAAU,CACV,CAAC;QAEF,MAAM,qBAAqB,GAAG,KAAK,EAClC,QAAiB,EACjB,UAAmB,EACnB,gBAAoC,EACnC,EAAE,CA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,CAAC,SAAkB,KAAK;QAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,iBAAiB,CAAC,SAAkB,KAAK;QACtD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAEM,gBAAgB,CAAC,UAAoB;QAC3C;;;;;WAKG;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;;AA3RF,oDA4RC;AAhRwB,6CAAwB,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { DataCorruptionError } from \"@fluidframework/container-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIChannel,\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ChildLogger, TelemetryDataTag, ThresholdCounter } from \"@fluidframework/telemetry-utils\";\nimport {\n\tattributesBlobKey,\n\tcreateServiceEndpoints,\n\tIChannelContext,\n\tsummarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ChannelStorageService } from \"./channelStorageService\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\tprivate pending: ISequencedDocumentMessage[] | undefined = [];\n\tprivate channelP: Promise<IChannel> | undefined;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: {\n\t\treadonly deltaConnection: ChannelDeltaConnection;\n\t\treadonly objectStorage: ChannelStorageService;\n\t};\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLogger;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly dataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\taddedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n\t\tprivate readonly id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tprivate readonly registry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tgetBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase>,\n\t\tprivate readonly attachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = ChildLogger.create(this.runtime.logger, \"RemoteChannelContext\");\n\n\t\tthis.services = createServiceEndpoints(\n\t\t\tthis.id,\n\t\t\tthis.dataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\taddedGCOutboundReferenceFn,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tconst thisSummarizeInternal = async (\n\t\t\tfullTree: boolean,\n\t\t\ttrackState: boolean,\n\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t) => this.summarizeInternal(fullTree, trackState, telemetryContext);\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tthisSummarizeInternal,\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t\tasync () => getBaseGCDetails(),\n\t\t);\n\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tRemoteChannelContext.pendingOpsCountThreshold,\n\t\t\tthis.subLogger,\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic getChannel(): Promise<IChannel> {\n\t\tif (this.channelP === undefined) {\n\t\t\tthis.channelP = this.loadChannel();\n\t\t}\n\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// Connection events are ignored if the data store is not yet loaded\n\t\tif (!this.isLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.services.deltaConnection.setConnectionState(connected);\n\t}\n\n\tpublic applyStashedOp(message: ISequencedDocumentMessage): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(message);\n\t}\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.summarizerNode.invalidate(message.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.process(message, local, localOpMetadata);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(this.pending !== undefined, 0x23e /* \"pending is undefined\" */);\n\t\t\tthis.pending.push(message);\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata);\n\t}\n\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n\t\tthis.services.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst channel = await this.getChannel();\n\t\tconst summarizeResult = await summarizeChannelAsync(\n\t\t\tchannel,\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn { ...summarizeResult, id: this.id };\n\t}\n\n\tprivate async loadChannel(): Promise<IChannel> {\n\t\tassert(\n\t\t\t!this.isLoaded,\n\t\t\t0x197 /* \"Remote channel must not already be loaded when loading\" */,\n\t\t);\n\n\t\tlet attributes: IChannelAttributes | undefined;\n\t\tif (await this.services.objectStorage.contains(attributesBlobKey)) {\n\t\t\tattributes = await readAndParse<IChannelAttributes | undefined>(\n\t\t\t\tthis.services.objectStorage,\n\t\t\t\tattributesBlobKey,\n\t\t\t);\n\t\t}\n\n\t\tlet factory: IChannelFactory | undefined;\n\t\t// this is a backward compatibility case where\n\t\t// the attach message doesn't include\n\t\t// the attributes. Since old attach messages\n\t\t// will not have attributes we need to keep\n\t\t// this as long as we support old attach messages\n\t\tif (attributes === undefined) {\n\t\t\tif (this.attachMessageType === undefined) {\n\t\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\t\tthrow new DataCorruptionError(\"channelTypeNotAvailable\", {\n\t\t\t\t\tchannelId: {\n\t\t\t\t\t\tvalue: this.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStoreId: {\n\t\t\t\t\t\tvalue: this.dataStoreContext.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\t});\n\t\t\t}\n\t\t\tfactory = this.registry.get(this.attachMessageType);\n\t\t\tif (factory === undefined) {\n\t\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\t\tthrow new DataCorruptionError(\"channelFactoryNotRegisteredForAttachMessageType\", {\n\t\t\t\t\tchannelId: {\n\t\t\t\t\t\tvalue: this.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStoreId: {\n\t\t\t\t\t\tvalue: this.dataStoreContext.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\t\tchannelFactoryType: this.attachMessageType,\n\t\t\t\t});\n\t\t\t}\n\t\t\tattributes = factory.attributes;\n\t\t} else {\n\t\t\tfactory = this.registry.get(attributes.type);\n\t\t\tif (factory === undefined) {\n\t\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\t\tthrow new DataCorruptionError(\"channelFactoryNotRegisteredForGivenType\", {\n\t\t\t\t\tchannelId: {\n\t\t\t\t\t\tvalue: this.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStoreId: {\n\t\t\t\t\t\tvalue: this.dataStoreContext.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\t\tchannelFactoryType: attributes.type,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Compare snapshot version to collaborative object version\n\t\tif (\n\t\t\tattributes.snapshotFormatVersion !== undefined &&\n\t\t\tattributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion\n\t\t) {\n\t\t\tthis.subLogger.sendTelemetryEvent({\n\t\t\t\teventName: \"ChannelAttributesVersionMismatch\",\n\t\t\t\tchannelType: { value: attributes.type, tag: TelemetryDataTag.CodeArtifact },\n\t\t\t\tchannelSnapshotVersion: {\n\t\t\t\t\tvalue: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t},\n\t\t\t\tchannelCodeVersion: {\n\t\t\t\t\tvalue: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\tconst channel = await factory.load(this.runtime, this.id, this.services, attributes);\n\n\t\t// Send all pending messages to the channel\n\t\tassert(this.pending !== undefined, 0x23f /* \"pending undefined\" */);\n\t\tfor (const message of this.pending) {\n\t\t\tthis.services.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n\t\t}\n\t\tthis.thresholdOpsCounter.send(\"ProcessPendingOps\", this.pending.length);\n\n\t\t// Commit changes.\n\t\tthis.channel = channel;\n\t\tthis.pending = undefined;\n\t\tthis.isLoaded = true;\n\n\t\t// Because have some await between we created the service and here, the connection state might have changed\n\t\t// and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n\t\tthis.services.deltaConnection.setConnectionState(this.dataStoreContext.connected);\n\t\treturn this.channel;\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document.\n\t * If there is no new data in this context since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n\t * loads the context and calls into the channel to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n\t\t * used routes to contain a route to this channel context.\n\t\t * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n\t\t * https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\t}\n}\n"]}
1
+ {"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAsD;AACtD,qEAAsE;AAStE,+DAA4D;AAW5D,qEAAkG;AAClG,qDAK0B;AAK1B,MAAa,oBAAoB;IAchC,YACkB,OAA+B,EAC/B,gBAAwC,EACzD,cAAuC,EACvC,QAA0D,EAC1D,OAAkC,EAClC,0BAA2F,EAC1E,EAAU,EAC3B,YAA2B,EACV,QAA+B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AC5C,CAAC;;AAzRF,oDA0RC;AA9QwB,6CAAwB,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { DataCorruptionError } from \"@fluidframework/container-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIChannel,\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ChildLogger, TelemetryDataTag, ThresholdCounter } from \"@fluidframework/telemetry-utils\";\nimport {\n\tattributesBlobKey,\n\tcreateServiceEndpoints,\n\tIChannelContext,\n\tsummarizeChannelAsync,\n} from \"./channelContext\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ChannelStorageService } from \"./channelStorageService\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\tprivate pending: ISequencedDocumentMessage[] | undefined = [];\n\tprivate channelP: Promise<IChannel> | undefined;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: {\n\t\treadonly deltaConnection: ChannelDeltaConnection;\n\t\treadonly objectStorage: ChannelStorageService;\n\t};\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLogger;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly dataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\taddedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n\t\tprivate readonly id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tprivate readonly registry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tprivate readonly attachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = ChildLogger.create(this.runtime.logger, \"RemoteChannelContext\");\n\n\t\tthis.services = createServiceEndpoints(\n\t\t\tthis.id,\n\t\t\tthis.dataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\taddedGCOutboundReferenceFn,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tconst thisSummarizeInternal = async (\n\t\t\tfullTree: boolean,\n\t\t\ttrackState: boolean,\n\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t) => this.summarizeInternal(fullTree, trackState, telemetryContext);\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tthisSummarizeInternal,\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tRemoteChannelContext.pendingOpsCountThreshold,\n\t\t\tthis.subLogger,\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic getChannel(): Promise<IChannel> {\n\t\tif (this.channelP === undefined) {\n\t\t\tthis.channelP = this.loadChannel();\n\t\t}\n\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// Connection events are ignored if the data store is not yet loaded\n\t\tif (!this.isLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.services.deltaConnection.setConnectionState(connected);\n\t}\n\n\tpublic applyStashedOp(message: ISequencedDocumentMessage): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(message);\n\t}\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.summarizerNode.invalidate(message.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.process(message, local, localOpMetadata);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(this.pending !== undefined, 0x23e /* \"pending is undefined\" */);\n\t\t\tthis.pending.push(message);\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\"StorePendingOps\", this.pending.length);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata);\n\t}\n\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n\t\tthis.services.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst channel = await this.getChannel();\n\t\tconst summarizeResult = await summarizeChannelAsync(\n\t\t\tchannel,\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn { ...summarizeResult, id: this.id };\n\t}\n\n\tprivate async loadChannel(): Promise<IChannel> {\n\t\tassert(\n\t\t\t!this.isLoaded,\n\t\t\t0x197 /* \"Remote channel must not already be loaded when loading\" */,\n\t\t);\n\n\t\tlet attributes: IChannelAttributes | undefined;\n\t\tif (await this.services.objectStorage.contains(attributesBlobKey)) {\n\t\t\tattributes = await readAndParse<IChannelAttributes | undefined>(\n\t\t\t\tthis.services.objectStorage,\n\t\t\t\tattributesBlobKey,\n\t\t\t);\n\t\t}\n\n\t\tlet factory: IChannelFactory | undefined;\n\t\t// this is a backward compatibility case where\n\t\t// the attach message doesn't include\n\t\t// the attributes. Since old attach messages\n\t\t// will not have attributes we need to keep\n\t\t// this as long as we support old attach messages\n\t\tif (attributes === undefined) {\n\t\t\tif (this.attachMessageType === undefined) {\n\t\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\t\tthrow new DataCorruptionError(\"channelTypeNotAvailable\", {\n\t\t\t\t\tchannelId: {\n\t\t\t\t\t\tvalue: this.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStoreId: {\n\t\t\t\t\t\tvalue: this.dataStoreContext.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\t});\n\t\t\t}\n\t\t\tfactory = this.registry.get(this.attachMessageType);\n\t\t\tif (factory === undefined) {\n\t\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\t\tthrow new DataCorruptionError(\"channelFactoryNotRegisteredForAttachMessageType\", {\n\t\t\t\t\tchannelId: {\n\t\t\t\t\t\tvalue: this.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStoreId: {\n\t\t\t\t\t\tvalue: this.dataStoreContext.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\t\tchannelFactoryType: this.attachMessageType,\n\t\t\t\t});\n\t\t\t}\n\t\t\tattributes = factory.attributes;\n\t\t} else {\n\t\t\tfactory = this.registry.get(attributes.type);\n\t\t\tif (factory === undefined) {\n\t\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\t\tthrow new DataCorruptionError(\"channelFactoryNotRegisteredForGivenType\", {\n\t\t\t\t\tchannelId: {\n\t\t\t\t\t\tvalue: this.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStoreId: {\n\t\t\t\t\t\tvalue: this.dataStoreContext.id,\n\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t},\n\t\t\t\t\tdataStorePackagePath: this.dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\t\tchannelFactoryType: attributes.type,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Compare snapshot version to collaborative object version\n\t\tif (\n\t\t\tattributes.snapshotFormatVersion !== undefined &&\n\t\t\tattributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion\n\t\t) {\n\t\t\tthis.subLogger.sendTelemetryEvent({\n\t\t\t\teventName: \"ChannelAttributesVersionMismatch\",\n\t\t\t\tchannelType: { value: attributes.type, tag: TelemetryDataTag.CodeArtifact },\n\t\t\t\tchannelSnapshotVersion: {\n\t\t\t\t\tvalue: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t},\n\t\t\t\tchannelCodeVersion: {\n\t\t\t\t\tvalue: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\tconst channel = await factory.load(this.runtime, this.id, this.services, attributes);\n\n\t\t// Send all pending messages to the channel\n\t\tassert(this.pending !== undefined, 0x23f /* \"pending undefined\" */);\n\t\tfor (const message of this.pending) {\n\t\t\tthis.services.deltaConnection.process(message, false, undefined /* localOpMetadata */);\n\t\t}\n\t\tthis.thresholdOpsCounter.send(\"ProcessPendingOps\", this.pending.length);\n\n\t\t// Commit changes.\n\t\tthis.channel = channel;\n\t\tthis.pending = undefined;\n\t\tthis.isLoaded = true;\n\n\t\t// Because have some await between we created the service and here, the connection state might have changed\n\t\t// and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n\t\tthis.services.deltaConnection.setConnectionState(this.dataStoreContext.connected);\n\t\treturn this.channel;\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document.\n\t * If there is no new data in this context since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n\t * loads the context and calls into the channel to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n\t\t * used routes to contain a route to this channel context.\n\t\t * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n\t\t * https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\t}\n}\n"]}
@@ -52,7 +52,6 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
52
52
  private readonly contexts;
53
53
  private readonly contextsDeferred;
54
54
  private readonly pendingAttach;
55
- private bindState;
56
55
  private readonly deferredAttached;
57
56
  private readonly localChannelContextQueue;
58
57
  private readonly notBoundedChannelContextSet;
@@ -64,8 +63,14 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
64
63
  readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
65
64
  private readonly quorum;
66
65
  private readonly audience;
67
- readonly logger: ITelemetryLogger;
68
- private readonly channelsBaseGCDetails;
66
+ private readonly mc;
67
+ get logger(): ITelemetryLogger;
68
+ /**
69
+ * If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.
70
+ * So, adding a count of how many telemetry events are logged per data store context. This can be
71
+ * controlled via feature flags.
72
+ */
73
+ private localChangesTelemetryCount;
69
74
  /**
70
75
  * Invokes the given callback and expects that no ops are submitted
71
76
  * until execution finishes. If an op is submitted, an error will be raised.
@@ -172,12 +177,6 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
172
177
  * @param outboundHandle - The handle of the outbound node that is referenced.
173
178
  */
174
179
  private addedGCOutboundReference;
175
- /**
176
- * Returns the base GC details for the channel with the given id. This is used to initialize its GC state.
177
- * @param channelId - The id of the channel context that is asked for the initial GC details.
178
- * @returns the requested channel's base GC details.
179
- */
180
- private getChannelBaseGCDetails;
181
180
  /**
182
181
  * Returns a summary at the current sequence number.
183
182
  * @param fullTree - true to bypass optimizations and force a full summary tree
@@ -217,6 +216,12 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
217
216
  private processChannelOp;
218
217
  private attachListener;
219
218
  private verifyNotClosed;
219
+ /**
220
+ * Summarizer client should not have local changes. These changes can become part of the summary and can break
221
+ * eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas
222
+ * other clients that are up-to-date till seq# 100 may not have them yet.
223
+ */
224
+ private identifyLocalChangeInSummarizer;
220
225
  }
221
226
  /**
222
227
  * Mixin class that adds request handler to FluidDataStoreRuntime
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACN,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAIN,iBAAiB,EAEjB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EAIzB,cAAc,EACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAKN,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EAEtB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,MAAM,qCAAqC,CAAC;AAY7C,OAAO,EACN,QAAQ,EACR,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,MAAM,uCAAuC,CAAC;AAiB/C,oB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,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAIhF,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAK9C;;OAEG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C;;OAEG;IACH,OAAO,CAAC,aAAa;IAmCrB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,MAAM;IASd;;;;;;OAMG;IACI,QAAQ,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAwBlF;;;;OAIG;IACI,QAAQ,CAAC,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAoBtE,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ3D,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,cAAc;IA0CtB,OAAO,CAAC,eAAe;IAMvB;;;;OAIG;IACH,OAAO,CAAC,+BAA+B;CA8BvC;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,6BACL,QAAQ,WAAW,qBAAqB,KAAK,QAAQ,SAAS,CAAC,SACnF,4BAA4B,iCAUD,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,sBAErB,qBAAqB,KAC1B,QAAQ;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,SACvD,4BAA4B,iCAkCD,CAAC"}
@@ -5,12 +5,12 @@
5
5
  import { AttachState, } from "@fluidframework/container-definitions";
6
6
  import { DataProcessingError, UsageError } from "@fluidframework/container-utils";
7
7
  import { assert, Deferred, LazyPromise, TypedEventEmitter, unreachableCase, } from "@fluidframework/common-utils";
8
- import { ChildLogger, LoggingError, raiseConnectedEvent } from "@fluidframework/telemetry-utils";
8
+ import { ChildLogger, generateStack, LoggingError, loggerToMonitoringContext, raiseConnectedEvent, TelemetryDataTag, } from "@fluidframework/telemetry-utils";
9
9
  import { buildSnapshotTree } from "@fluidframework/driver-utils";
10
10
  import { SummaryType, } from "@fluidframework/protocol-definitions";
11
- import { BindState, CreateSummarizerNodeSource, VisibilityState, } from "@fluidframework/runtime-definitions";
12
- import { convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, generateHandleContextPath, RequestParser, SummaryTreeBuilder, create404Response, createResponseError, exceptionToResponse, requestFluidObject, } from "@fluidframework/runtime-utils";
13
- import { GCDataBuilder, removeRouteFromAllNodes, unpackChildNodesGCDetails, unpackChildNodesUsedRoutes, } from "@fluidframework/garbage-collector";
11
+ import { CreateSummarizerNodeSource, VisibilityState, } from "@fluidframework/runtime-definitions";
12
+ import { convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, generateHandleContextPath, RequestParser, SummaryTreeBuilder, create404Response, createResponseError, exceptionToResponse, requestFluidObject, packagePathToTelemetryProperty, } from "@fluidframework/runtime-utils";
13
+ import { GCDataBuilder, unpackChildNodesUsedRoutes } from "@fluidframework/garbage-collector";
14
14
  import { v4 as uuid } from "uuid";
15
15
  import { summarizeChannel } from "./channelContext";
16
16
  import { LocalChannelContext, LocalChannelContextBase, RehydratedLocalChannelContext, } from "./localChannelContext";
@@ -38,6 +38,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
38
38
  * and the primary way of interacting with some Fluid objects, and should be used if possible.
39
39
  */
40
40
  constructor(dataStoreContext, sharedObjectRegistry, existing, initializeEntryPoint) {
41
+ var _a;
41
42
  super();
42
43
  this.dataStoreContext = dataStoreContext;
43
44
  this.sharedObjectRegistry = sharedObjectRegistry;
@@ -52,19 +53,15 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
52
53
  // store becomes visible.
53
54
  this.pendingHandlesToMakeVisible = new Set();
54
55
  assert(!dataStoreContext.id.includes("/"), 0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */);
55
- this.logger = ChildLogger.create(dataStoreContext.logger, "FluidDataStoreRuntime", {
56
+ this.mc = loggerToMonitoringContext(ChildLogger.create(dataStoreContext.logger, "FluidDataStoreRuntime", {
56
57
  all: { dataStoreId: uuid() },
57
- });
58
+ }));
58
59
  this.id = dataStoreContext.id;
59
60
  this.options = dataStoreContext.options;
60
61
  this.deltaManager = dataStoreContext.deltaManager;
61
62
  this.quorum = dataStoreContext.getQuorum();
62
63
  this.audience = dataStoreContext.getAudience();
63
64
  const tree = dataStoreContext.baseSnapshot;
64
- this.channelsBaseGCDetails = new LazyPromise(async () => {
65
- const baseGCDetails = await this.dataStoreContext.getBaseGCDetails();
66
- return unpackChildNodesGCDetails(baseGCDetails);
67
- });
68
65
  // Must always receive the data store type inside of the attributes
69
66
  if ((tree === null || tree === void 0 ? void 0 : tree.trees) !== undefined) {
70
67
  Object.keys(tree.trees).forEach((path) => {
@@ -92,7 +89,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
92
89
  else {
93
90
  channelContext = new RemoteChannelContext(this, dataStoreContext, dataStoreContext.storage, (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata), (address) => this.setChannelDirty(address), (srcHandle, outboundHandle) => this.addedGCOutboundReference(srcHandle, outboundHandle), path, tree.trees[path], this.sharedObjectRegistry, undefined /* extraBlobs */, this.dataStoreContext.getCreateChildSummarizerNodeFn(path, {
94
91
  type: CreateSummarizerNodeSource.FromSummary,
95
- }), async () => this.getChannelBaseGCDetails(path));
92
+ }));
96
93
  }
97
94
  const deferred = new Deferred();
98
95
  deferred.resolve(channelContext);
@@ -105,8 +102,6 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
105
102
  this.entryPoint = new FluidObjectHandle(promise, "", this.objectsRoutingContext);
106
103
  }
107
104
  this.attachListener();
108
- // If exists on storage or loaded from a snapshot, it should already be bound.
109
- this.bindState = existing ? BindState.Bound : BindState.NotBound;
110
105
  this._attachState = dataStoreContext.attachState;
111
106
  /**
112
107
  * If existing flag is false, this is a new data store and is not visible. The existing flag can be true in two
@@ -131,6 +126,9 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
131
126
  if (existing) {
132
127
  this.deferredAttached.resolve();
133
128
  }
129
+ // By default, a data store can log maximum 10 local changes telemetry in summarizer.
130
+ this.localChangesTelemetryCount =
131
+ (_a = this.mc.config.getNumber("Fluid.Telemetry.LocalChangesTelemetryCount")) !== null && _a !== void 0 ? _a : 10;
134
132
  }
135
133
  /**
136
134
  * @deprecated - Instantiate the class using its constructor instead.
@@ -182,6 +180,9 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
182
180
  get disposed() {
183
181
  return this._disposed;
184
182
  }
183
+ get logger() {
184
+ return this.mc.logger;
185
+ }
185
186
  /**
186
187
  * Invokes the given callback and expects that no ops are submitted
187
188
  * until execution finishes. If an op is submitted, an error will be raised.
@@ -223,7 +224,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
223
224
  return { mimeType: "fluid/object", status: 200, value: channel };
224
225
  }
225
226
  catch (error) {
226
- this.logger.sendErrorEvent({ eventName: "GetChannelFailedInRequest" }, error);
227
+ this.mc.logger.sendErrorEvent({ eventName: "GetChannelFailedInRequest" }, error);
227
228
  return createResponseError(500, `Failed to get Channel: ${error}`, request);
228
229
  }
229
230
  }
@@ -265,6 +266,8 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
265
266
  deferred.resolve(context);
266
267
  this.contextsDeferred.set(id, deferred);
267
268
  }
269
+ // Channels (DDS) should not be created in summarizer client.
270
+ this.identifyLocalChangeInSummarizer("DDSCreatedInSummarizer", id, type);
268
271
  assert(!!context.channel, 0x17a /* "Channel should be loaded when created!!" */);
269
272
  return context.channel;
270
273
  }
@@ -314,7 +317,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
314
317
  handle.attachGraph();
315
318
  });
316
319
  this.pendingHandlesToMakeVisible.clear();
317
- this.bindToContext();
320
+ this.dataStoreContext.makeLocallyVisible();
318
321
  }
319
322
  /**
320
323
  * This function is called when a handle to this data store is added to a visible DDS.
@@ -330,12 +333,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
330
333
  * 2. Attaching the graph if the data store becomes attached.
331
334
  */
332
335
  bindToContext() {
333
- if (this.bindState !== BindState.NotBound) {
334
- return;
335
- }
336
- this.bindState = BindState.Binding;
337
- this.dataStoreContext.bindToContext();
338
- this.bindState = BindState.Bound;
336
+ this.makeVisibleAndAttachGraph();
339
337
  }
340
338
  bind(handle) {
341
339
  // If visible, attach the incoming handle's graph. Else, this will be done when we become visible.
@@ -377,16 +375,14 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
377
375
  this.pendingAttach.delete(id);
378
376
  }
379
377
  else {
380
- assert(!this.contexts.has(id), 0x17d /* `Unexpected attach channel OP,
381
- is in pendingAttach set: ${this.pendingAttach.has(id)},
382
- is local channel contexts: ${this.contexts.get(id) instanceof LocalChannelContextBase}` */);
378
+ assert(!this.contexts.has(id), 0x17d /* "Unexpected attach channel OP" */);
383
379
  const flatBlobs = new Map();
384
380
  const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs);
385
381
  const remoteChannelContext = new RemoteChannelContext(this, this.dataStoreContext, this.dataStoreContext.storage, (content, localContentMetadata) => this.submitChannelOp(id, content, localContentMetadata), (address) => this.setChannelDirty(address), (srcHandle, outboundHandle) => this.addedGCOutboundReference(srcHandle, outboundHandle), id, snapshotTree, this.sharedObjectRegistry, flatBlobs, this.dataStoreContext.getCreateChildSummarizerNodeFn(id, {
386
382
  type: CreateSummarizerNodeSource.FromAttach,
387
383
  sequenceNumber: message.sequenceNumber,
388
384
  snapshot: attachMessage.snapshot,
389
- }), async () => this.getChannelBaseGCDetails(id), attachMessage.type);
385
+ }), attachMessage.type);
390
386
  this.contexts.set(id, remoteChannelContext);
391
387
  if (this.contextsDeferred.has(id)) {
392
388
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -512,30 +508,6 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
512
508
  var _a, _b;
513
509
  (_b = (_a = this.dataStoreContext).addedGCOutboundReference) === null || _b === void 0 ? void 0 : _b.call(_a, srcHandle, outboundHandle);
514
510
  }
515
- /**
516
- * Returns the base GC details for the channel with the given id. This is used to initialize its GC state.
517
- * @param channelId - The id of the channel context that is asked for the initial GC details.
518
- * @returns the requested channel's base GC details.
519
- */
520
- async getChannelBaseGCDetails(channelId) {
521
- var _a;
522
- let channelBaseGCDetails = (await this.channelsBaseGCDetails).get(channelId);
523
- if (channelBaseGCDetails === undefined) {
524
- channelBaseGCDetails = {};
525
- }
526
- else if (((_a = channelBaseGCDetails.gcData) === null || _a === void 0 ? void 0 : _a.gcNodes) !== undefined) {
527
- // Note: if the child channel has an explicit handle route to its parent, it will be removed here and
528
- // expected to be added back by the parent when getGCData is called.
529
- removeRouteFromAllNodes(channelBaseGCDetails.gcData.gcNodes, this.absolutePath);
530
- }
531
- // Currently, channel context's are always considered used. So, it there are no used routes for it, we still
532
- // need to mark it as used. Add self-route (empty string) to the channel context's used routes.
533
- if (channelBaseGCDetails.usedRoutes === undefined ||
534
- channelBaseGCDetails.usedRoutes.length === 0) {
535
- channelBaseGCDetails.usedRoutes = [""];
536
- }
537
- return channelBaseGCDetails;
538
- }
539
511
  /**
540
512
  * Returns a summary at the current sequence number.
541
513
  * @param fullTree - true to bypass optimizations and force a full summary tree
@@ -751,6 +723,34 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
751
723
  throw new LoggingError("Runtime is closed");
752
724
  }
753
725
  }
726
+ /**
727
+ * Summarizer client should not have local changes. These changes can become part of the summary and can break
728
+ * eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas
729
+ * other clients that are up-to-date till seq# 100 may not have them yet.
730
+ */
731
+ identifyLocalChangeInSummarizer(eventName, channelId, channelType) {
732
+ if (this.clientDetails.type !== "summarizer" || this.localChangesTelemetryCount <= 0) {
733
+ return;
734
+ }
735
+ // Log a telemetry if there are local changes in the summarizer. This will give us data on how often
736
+ // this is happening and which data stores do this. The eventual goal is to disallow local changes
737
+ // in the summarizer and the data will help us plan this.
738
+ this.mc.logger.sendTelemetryEvent({
739
+ eventName,
740
+ channelType,
741
+ channelId: {
742
+ value: channelId,
743
+ tag: TelemetryDataTag.CodeArtifact,
744
+ },
745
+ fluidDataStoreId: {
746
+ value: this.id,
747
+ tag: TelemetryDataTag.CodeArtifact,
748
+ },
749
+ fluidDataStorePackagePath: packagePathToTelemetryProperty(this.dataStoreContext.packagePath),
750
+ stack: generateStack(),
751
+ });
752
+ this.localChangesTelemetryCount--;
753
+ }
754
754
  }
755
755
  /**
756
756
  * Mixin class that adds request handler to FluidDataStoreRuntime