@fluidframework/datastore 2.0.0-rc.4.0.6 → 2.0.0-rc.5.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 +8 -0
- package/api-extractor/api-extractor-lint-bundle.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
- package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-public.esm.json +5 -0
- package/api-extractor.json +1 -1
- package/api-report/{datastore.api.md → datastore.alpha.api.md} +18 -18
- package/api-report/datastore.beta.api.md +39 -0
- package/api-report/datastore.public.api.md +39 -0
- package/biome.jsonc +4 -0
- package/dist/channelContext.d.ts +4 -7
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js +2 -2
- package/dist/channelContext.js.map +1 -1
- package/dist/channelDeltaConnection.d.ts +3 -8
- package/dist/channelDeltaConnection.d.ts.map +1 -1
- package/dist/channelDeltaConnection.js +1 -4
- package/dist/channelDeltaConnection.js.map +1 -1
- package/dist/channelStorageService.d.ts +2 -3
- package/dist/channelStorageService.d.ts.map +1 -1
- package/dist/channelStorageService.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +18 -19
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +38 -56
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/fluidHandle.d.ts +2 -1
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/fluidHandle.js.map +1 -1
- package/dist/localChannelContext.d.ts +5 -8
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.js +4 -4
- package/dist/localChannelContext.js.map +1 -1
- package/dist/localChannelStorageService.d.ts +2 -2
- package/dist/localChannelStorageService.d.ts.map +1 -1
- package/dist/localChannelStorageService.js +5 -5
- package/dist/localChannelStorageService.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/remoteChannelContext.d.ts +4 -7
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +2 -2
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts +4 -7
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js +2 -2
- package/lib/channelContext.js.map +1 -1
- package/lib/channelDeltaConnection.d.ts +3 -8
- package/lib/channelDeltaConnection.d.ts.map +1 -1
- package/lib/channelDeltaConnection.js +1 -4
- package/lib/channelDeltaConnection.js.map +1 -1
- package/lib/channelStorageService.d.ts +2 -3
- package/lib/channelStorageService.d.ts.map +1 -1
- package/lib/channelStorageService.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +18 -19
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +35 -53
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/fluidHandle.d.ts +2 -1
- package/lib/fluidHandle.d.ts.map +1 -1
- package/lib/fluidHandle.js +1 -1
- package/lib/fluidHandle.js.map +1 -1
- package/lib/localChannelContext.d.ts +5 -8
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.js +5 -5
- package/lib/localChannelContext.js.map +1 -1
- package/lib/localChannelStorageService.d.ts +2 -2
- package/lib/localChannelStorageService.d.ts.map +1 -1
- package/lib/localChannelStorageService.js +1 -1
- package/lib/localChannelStorageService.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/remoteChannelContext.d.ts +4 -7
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +2 -2
- package/lib/remoteChannelContext.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +33 -33
- package/src/channelContext.ts +12 -10
- package/src/channelDeltaConnection.ts +10 -9
- package/src/channelStorageService.ts +5 -3
- package/src/dataStoreRuntime.ts +74 -121
- package/src/fluidHandle.ts +9 -3
- package/src/localChannelContext.ts +15 -10
- package/src/localChannelStorageService.ts +3 -6
- package/src/packageVersion.ts +1 -1
- package/src/remoteChannelContext.ts +11 -14
- package/tsconfig.json +2 -0
- package/tsdoc.json +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelDeltaConnection.js","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"channelDeltaConnection.js","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,MAAM,qBAAqB,GAAG,MAAM,EAAE,CAAC;AAKvC,SAAS,uBAAuB;IAC/B,MAAM,GAAG,GAAG,EAAE,CAAC;IACf,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,qBAAqB,EAAE;QACjD,KAAK,EAAE,qBAAqB;QAC5B,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,IAAI;KAChB,CAAC,CAAC;IACH,OAAO,GAA+B,CAAC;AACxC,CAAC;AAED,SAAS,mBAAmB,CAAC,EAAW;IACvC,OAAO,CACN,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACjB,qBAAqB,IAAI,EAAE;QAC3B,EAAE,CAAC,qBAAqB,CAAC,KAAK,qBAAqB,CACnD,CAAC;AACH,CAAC;AAED,SAAS,oCAAoC,CAC5C,OAAY,EACZ,eAAwB,EACxB,IAAgD;IAEhD,IAAI,mBAAmB,CAAC,eAAe,CAAC,EAAE,CAAC;QAC1C,eAAe,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,QA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*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDeltaConnection,\n\tIDeltaHandler,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport { DataProcessingError } from \"@fluidframework/telemetry-utils/internal\";\n\nconst stashedOpMetadataMark = Symbol();\n\ntype StashedOpMetadata = { contents: any; metadata: unknown }[] &\n\tRecord<typeof stashedOpMetadataMark, typeof stashedOpMetadataMark>;\n\nfunction createStashedOpMetadata(): StashedOpMetadata {\n\tconst arr = [];\n\tObject.defineProperty(arr, stashedOpMetadataMark, {\n\t\tvalue: stashedOpMetadataMark,\n\t\twritable: false,\n\t\tenumerable: true,\n\t});\n\treturn arr as any as StashedOpMetadata;\n}\n\nfunction isStashedOpMetadata(md: unknown): md is StashedOpMetadata {\n\treturn (\n\t\tArray.isArray(md) &&\n\t\tstashedOpMetadataMark in md &&\n\t\tmd[stashedOpMetadataMark] === stashedOpMetadataMark\n\t);\n}\n\nfunction processWithStashedOpMetadataHandling(\n\tcontent: any,\n\tlocalOpMetaData: unknown,\n\tfunc: (contents: any, metadata: unknown) => void,\n) {\n\tif (isStashedOpMetadata(localOpMetaData)) {\n\t\tlocalOpMetaData.forEach(({ contents, metadata }) => func(contents, metadata));\n\t} else {\n\t\tfunc(content, localOpMetaData);\n\t}\n}\n\nexport class ChannelDeltaConnection implements IDeltaConnection {\n\tprivate _handler: IDeltaHandler | undefined;\n\tprivate stashedOpMd: StashedOpMetadata | undefined;\n\n\tprivate get handler(): IDeltaHandler {\n\t\tassert(!!this._handler, 0x177 /* \"Missing delta handler\" */);\n\t\treturn this._handler;\n\t}\n\tpublic get connected(): boolean {\n\t\treturn this._connected;\n\t}\n\n\tconstructor(\n\t\tprivate _connected: boolean,\n\t\tprivate readonly submitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tpublic readonly dirty: () => void,\n\t\tprivate readonly isAttachedAndVisible: () => boolean,\n\t) {}\n\n\tpublic attach(handler: IDeltaHandler) {\n\t\tassert(this._handler === undefined, 0x178 /* \"Missing delta handler on attach\" */);\n\t\tthis._handler = handler;\n\t}\n\n\tpublic setConnectionState(connected: boolean) {\n\t\tthis._connected = connected;\n\t\tthis.handler.setConnectionState(connected);\n\t}\n\n\tpublic process(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\ttry {\n\t\t\t// catches as data processing error whether or not they come from async pending queues\n\t\t\tprocessWithStashedOpMetadataHandling(\n\t\t\t\tmessage.contents,\n\t\t\t\tlocalOpMetadata,\n\t\t\t\t(contents, metadata) =>\n\t\t\t\t\tthis.handler.process({ ...message, contents }, local, metadata),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\terror,\n\t\t\t\t\"channelDeltaConnectionFailedToProcessMessage\",\n\t\t\t\tmessage,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tprocessWithStashedOpMetadataHandling(\n\t\t\tcontent,\n\t\t\tlocalOpMetadata,\n\t\t\tthis.handler.reSubmit.bind(this.handler),\n\t\t);\n\t}\n\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tif (this.handler.rollback === undefined) {\n\t\t\tthrow new Error(\"Handler doesn't support rollback\");\n\t\t}\n\t\tprocessWithStashedOpMetadataHandling(\n\t\t\tcontent,\n\t\t\tlocalOpMetadata,\n\t\t\tthis.handler.rollback.bind(this.handler),\n\t\t);\n\t}\n\n\tpublic applyStashedOp(content: any): unknown {\n\t\ttry {\n\t\t\tthis.stashedOpMd = this.isAttachedAndVisible() ? createStashedOpMetadata() : undefined;\n\t\t\tthis.handler.applyStashedOp(content);\n\t\t\treturn this.stashedOpMd;\n\t\t} finally {\n\t\t\tthis.stashedOpMd = undefined;\n\t\t}\n\t}\n\n\tpublic submit(contents: any, metadata: unknown): void {\n\t\tif (this.stashedOpMd !== undefined) {\n\t\t\tthis.stashedOpMd.push({ contents, metadata });\n\t\t} else {\n\t\t\tthis.submitFn(contents, metadata);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IChannelStorageService } from "@fluidframework/datastore-definitions";
|
|
6
|
-
import { IDocumentStorageService } from "@fluidframework/driver-definitions/internal";
|
|
7
|
-
import { ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
5
|
+
import { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
6
|
+
import { IDocumentStorageService, ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
8
7
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
9
8
|
export declare class ChannelStorageService implements IChannelStorageService {
|
|
10
9
|
private readonly tree;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelStorageService.d.ts","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"channelStorageService.d.ts","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EACN,uBAAuB,EACvB,aAAa,EACb,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,qBAAa,qBAAsB,YAAW,sBAAsB;IAoBlE,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAtB7B,OAAO,CAAC,MAAM,CAAC,WAAW;IAgB1B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6B;gBAGzC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,EAClD,MAAM,EAAE,mBAAmB,EAC3B,UAAU,CAAC,0CAA8B;IAS9C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAehD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;YAepC,YAAY;CAG1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channelStorageService.js","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"channelStorageService.js","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAG7F,MAAM,OAAO,qBAAqB;IACzB,MAAM,CAAC,WAAW,CACzB,IAAY,EACZ,IAAmB,EACnB,OAAmC;QAEnC,8DAA8D;QAC9D,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC/B,qBAAqB,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QACjF,CAAC;QAED,8DAA8D;QAC9D,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC,GA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;QAC7B,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACrB,MAAM,SAAS,GAAG,mCAAmC,CAAC,IAAI,CAAC,CAAC;QAC5D,OAAO,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnD,oEAAoE;YACpE,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAG,CAAC;YAChC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACxC,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,IAAY;QACtC,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tIDocumentStorageService,\n\tISnapshotTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { getNormalizedObjectStoragePathParts } from \"@fluidframework/runtime-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nexport class ChannelStorageService implements IChannelStorageService {\n\tprivate static flattenTree(\n\t\tbase: string,\n\t\ttree: ISnapshotTree,\n\t\tresults: { [path: string]: string },\n\t) {\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const path in tree.trees) {\n\t\t\tChannelStorageService.flattenTree(`${base}${path}/`, tree.trees[path], results);\n\t\t}\n\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const blob in tree.blobs) {\n\t\t\tresults[`${base}${blob}`] = tree.blobs[blob];\n\t\t}\n\t}\n\n\tprivate readonly flattenedTree: { [path: string]: string };\n\n\tconstructor(\n\t\tprivate readonly tree: ISnapshotTree | undefined,\n\t\tprivate readonly storage: Pick<IDocumentStorageService, \"readBlob\">,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly extraBlobs?: Map<string, ArrayBufferLike>,\n\t) {\n\t\tthis.flattenedTree = {};\n\t\t// Create a map from paths to blobs\n\t\tif (tree !== undefined) {\n\t\t\tChannelStorageService.flattenTree(\"\", tree, this.flattenedTree);\n\t\t}\n\t}\n\n\tpublic async contains(path: string): Promise<boolean> {\n\t\treturn this.flattenedTree[path] !== undefined;\n\t}\n\n\tpublic async readBlob(path: string): Promise<ArrayBufferLike> {\n\t\tconst id = await this.getIdForPath(path);\n\t\tconst blob = this.extraBlobs !== undefined ? this.extraBlobs.get(id) : undefined;\n\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\t\tconst blobP = this.storage.readBlob(id);\n\t\tblobP.catch((error) =>\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"ChannelStorageBlobError\" }, error),\n\t\t);\n\n\t\treturn blobP;\n\t}\n\n\tpublic async list(path: string): Promise<string[]> {\n\t\tlet tree = this.tree;\n\t\tconst pathParts = getNormalizedObjectStoragePathParts(path);\n\t\twhile (tree !== undefined && pathParts.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst part = pathParts.shift()!;\n\t\t\ttree = tree.trees[part];\n\t\t}\n\t\tif (tree === undefined || pathParts.length !== 0) {\n\t\t\tthrow new Error(\"path does not exist\");\n\t\t}\n\n\t\treturn Object.keys(tree?.blobs ?? {});\n\t}\n\n\tprivate async getIdForPath(path: string): Promise<string> {\n\t\treturn this.flattenedTree[path];\n\t}\n}\n"]}
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
6
6
|
import { AttachState, IAudience } from "@fluidframework/container-definitions";
|
|
7
7
|
import { IDeltaManager } from "@fluidframework/container-definitions/internal";
|
|
8
|
-
import { FluidObject, IFluidHandle,
|
|
8
|
+
import { FluidObject, IFluidHandle, IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
9
|
+
import { IFluidHandleContext } from "@fluidframework/core-interfaces/internal";
|
|
9
10
|
import type { IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
|
|
10
|
-
import { IChannel, IChannelFactory, IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents, type IDeltaManagerErased } from "@fluidframework/datastore-definitions";
|
|
11
|
+
import { IChannel, IChannelFactory, IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents, type IDeltaManagerErased } from "@fluidframework/datastore-definitions/internal";
|
|
12
|
+
import { IClientDetails, IQuorumClients } from "@fluidframework/driver-definitions";
|
|
13
|
+
import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
11
14
|
import { IIdCompressor } from "@fluidframework/id-compressor";
|
|
12
|
-
import {
|
|
13
|
-
import { IGarbageCollectionData, IInboundSignalMessage, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions";
|
|
14
|
-
import { IFluidDataStoreChannel, IFluidDataStoreContext, VisibilityState } from "@fluidframework/runtime-definitions/internal";
|
|
15
|
+
import { ISummaryTreeWithStats, ITelemetryContext, IGarbageCollectionData, IFluidDataStoreChannel, IFluidDataStoreContext, VisibilityState, IInboundSignalMessage } from "@fluidframework/runtime-definitions/internal";
|
|
15
16
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
16
17
|
/**
|
|
17
18
|
* @alpha
|
|
@@ -151,6 +152,13 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
151
152
|
* @param builder - The builder that contains the GC nodes for this channel's children.
|
|
152
153
|
*/
|
|
153
154
|
private updateGCNodes;
|
|
155
|
+
/**
|
|
156
|
+
* Returns a summary at the current sequence number.
|
|
157
|
+
* @param fullTree - true to bypass optimizations and force a full summary tree
|
|
158
|
+
* @param trackState - This tells whether we should track state from this summary.
|
|
159
|
+
* @param telemetryContext - summary data passed through the layers for telemetry purposes
|
|
160
|
+
*/
|
|
161
|
+
summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
|
|
154
162
|
/**
|
|
155
163
|
* Generates data used for garbage collection. This includes a list of GC nodes that represent this channel
|
|
156
164
|
* including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the
|
|
@@ -173,25 +181,16 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
|
|
|
173
181
|
* @param usedRoutes - The routes that are used in all contexts in this channel.
|
|
174
182
|
*/
|
|
175
183
|
updateUsedRoutes(usedRoutes: string[]): void;
|
|
176
|
-
/**
|
|
177
|
-
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
178
|
-
* all references added in the system.
|
|
179
|
-
* @param srcHandle - The handle of the node that added the reference.
|
|
180
|
-
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
181
|
-
*/
|
|
182
|
-
private addedGCOutboundReference;
|
|
183
|
-
/**
|
|
184
|
-
* Returns a summary at the current sequence number.
|
|
185
|
-
* @param fullTree - true to bypass optimizations and force a full summary tree
|
|
186
|
-
* @param trackState - This tells whether we should track state from this summary.
|
|
187
|
-
* @param telemetryContext - summary data passed through the layers for telemetry purposes
|
|
188
|
-
*/
|
|
189
|
-
summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
|
|
190
184
|
getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
|
|
191
185
|
/**
|
|
192
186
|
* Get the GC Data for the initial state being attached so remote clients can learn of this DataStore's outbound routes
|
|
193
187
|
*/
|
|
194
188
|
getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData;
|
|
189
|
+
/**
|
|
190
|
+
* Helper method for preparing to summarize this channel.
|
|
191
|
+
* Runs the callback for each bound context to incorporate its data however the caller specifies
|
|
192
|
+
*/
|
|
193
|
+
private visitContextsDuringSummary;
|
|
195
194
|
/**
|
|
196
195
|
* Helper method for preparing to attach this dataStore.
|
|
197
196
|
* Runs the callback for each bound context to incorporate its data however the caller specifies
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EACN,WAAW,EACX,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EACN,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAOrF,OAAO,EACN,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,4BAA4B,EAC5B,KAAK,mBAAmB,EACxB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,cAAc,EACd,cAAc,EAId,MAAM,oCAA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B,KAAK,QAAQ,SAAS,CAAC,SACnF,4BAA4B,iCAUD,CAAC;AAEnC;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,YACtB,CACR,OAAO,EAAE,qBAAqB,KAC1B,QAAQ;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,SACvD,4BAA4B,iCAyCD,CAAC"}
|
package/lib/dataStoreRuntime.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
6
6
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
7
7
|
import { assert, Deferred, LazyPromise, unreachableCase, } from "@fluidframework/core-utils/internal";
|
|
8
|
+
import { SummaryType, } from "@fluidframework/driver-definitions";
|
|
8
9
|
import { buildSnapshotTree } from "@fluidframework/driver-utils/internal";
|
|
9
|
-
import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
10
10
|
import { CreateSummarizerNodeSource, VisibilityState, gcDataBlobKey, } from "@fluidframework/runtime-definitions/internal";
|
|
11
11
|
import { GCDataBuilder, RequestParser, SummaryTreeBuilder, addBlobToSummary, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, create404Response, createResponseError, encodeCompactIdToString, exceptionToResponse, generateHandleContextPath, processAttachMessageGCData, toFluidHandleInternal, unpackChildNodesUsedRoutes, toDeltaManagerErased, } from "@fluidframework/runtime-utils/internal";
|
|
12
12
|
import { DataProcessingError, LoggingError, UsageError, createChildMonitoringContext, generateStack, raiseConnectedEvent, tagCodeArtifacts, } from "@fluidframework/telemetry-utils/internal";
|
|
@@ -98,7 +98,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
98
98
|
this.pendingHandlesToMakeVisible = new Set();
|
|
99
99
|
assert(!dataStoreContext.id.includes("/"), 0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */);
|
|
100
100
|
this.mc = createChildMonitoringContext({
|
|
101
|
-
logger: dataStoreContext.
|
|
101
|
+
logger: dataStoreContext.baseLogger,
|
|
102
102
|
namespace: "FluidDataStoreRuntime",
|
|
103
103
|
properties: {
|
|
104
104
|
all: { dataStoreId: uuid(), dataStoreVersion: pkgVersion },
|
|
@@ -135,7 +135,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
138
|
-
channelContext = new RemoteChannelContext(this, dataStoreContext, dataStoreContext.storage, (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata), (address) => this.setChannelDirty(address),
|
|
138
|
+
channelContext = new RemoteChannelContext(this, dataStoreContext, dataStoreContext.storage, (content, localOpMetadata) => this.submitChannelOp(path, content, localOpMetadata), (address) => this.setChannelDirty(address), path, tree.trees[path], this.sharedObjectRegistry, undefined /* extraBlobs */, this.dataStoreContext.getCreateChildSummarizerNodeFn(path, {
|
|
139
139
|
type: CreateSummarizerNodeSource.FromSummary,
|
|
140
140
|
}));
|
|
141
141
|
}
|
|
@@ -295,11 +295,11 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
295
295
|
}
|
|
296
296
|
createChannelContext(channel) {
|
|
297
297
|
this.notBoundedChannelContextSet.add(channel.id);
|
|
298
|
-
const context = new LocalChannelContext(channel, this, this.dataStoreContext, this.dataStoreContext.storage, this.logger, (content, localOpMetadata) => this.submitChannelOp(channel.id, content, localOpMetadata), (address) => this.setChannelDirty(address)
|
|
298
|
+
const context = new LocalChannelContext(channel, this, this.dataStoreContext, this.dataStoreContext.storage, this.logger, (content, localOpMetadata) => this.submitChannelOp(channel.id, content, localOpMetadata), (address) => this.setChannelDirty(address));
|
|
299
299
|
this.contexts.set(channel.id, context);
|
|
300
300
|
}
|
|
301
301
|
createRehydratedLocalChannelContext(id, tree, flatBlobs) {
|
|
302
|
-
return new RehydratedLocalChannelContext(id, this.sharedObjectRegistry, this, this.dataStoreContext, this.dataStoreContext.storage, this.logger, (content, localOpMetadata) => this.submitChannelOp(id, content, localOpMetadata), (address) => this.setChannelDirty(address),
|
|
302
|
+
return new RehydratedLocalChannelContext(id, this.sharedObjectRegistry, this, this.dataStoreContext, this.dataStoreContext.storage, this.logger, (content, localOpMetadata) => this.submitChannelOp(id, content, localOpMetadata), (address) => this.setChannelDirty(address), tree, flatBlobs);
|
|
303
303
|
}
|
|
304
304
|
/**
|
|
305
305
|
* Binds a channel with the runtime. If the runtime is attached we will attach the channel right away.
|
|
@@ -383,7 +383,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
383
383
|
createRemoteChannelContext(attachMessage, summarizerNodeParams) {
|
|
384
384
|
const flatBlobs = new Map();
|
|
385
385
|
const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs);
|
|
386
|
-
return new RemoteChannelContext(this, this.dataStoreContext, this.dataStoreContext.storage, (content, localContentMetadata) => this.submitChannelOp(attachMessage.id, content, localContentMetadata), (address) => this.setChannelDirty(address),
|
|
386
|
+
return new RemoteChannelContext(this, this.dataStoreContext, this.dataStoreContext.storage, (content, localContentMetadata) => this.submitChannelOp(attachMessage.id, content, localContentMetadata), (address) => this.setChannelDirty(address), attachMessage.id, snapshotTree, this.sharedObjectRegistry, flatBlobs, this.dataStoreContext.getCreateChildSummarizerNodeFn(attachMessage.id, summarizerNodeParams), attachMessage.type);
|
|
387
387
|
}
|
|
388
388
|
process(message, local, localOpMetadata) {
|
|
389
389
|
this.verifyNotClosed();
|
|
@@ -397,7 +397,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
397
397
|
processAttachMessageGCData(attachMessage.snapshot, (nodeId, toPath) => {
|
|
398
398
|
// Note: nodeId will be "/" unless and until we support sub-DDS GC Nodes
|
|
399
399
|
const fromPath = `/${this.id}/${id}${nodeId === "/" ? "" : nodeId}`;
|
|
400
|
-
this.dataStoreContext.addedGCOutboundRoute
|
|
400
|
+
this.dataStoreContext.addedGCOutboundRoute(fromPath, toPath, message.timestamp);
|
|
401
401
|
});
|
|
402
402
|
// If a non-local operation then go and create the object
|
|
403
403
|
// Otherwise mark it as officially attached.
|
|
@@ -467,6 +467,20 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
467
467
|
// Get the outbound routes and add a GC node for this channel.
|
|
468
468
|
builder.addNode("/", this.getOutboundRoutes());
|
|
469
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* Returns a summary at the current sequence number.
|
|
472
|
+
* @param fullTree - true to bypass optimizations and force a full summary tree
|
|
473
|
+
* @param trackState - This tells whether we should track state from this summary.
|
|
474
|
+
* @param telemetryContext - summary data passed through the layers for telemetry purposes
|
|
475
|
+
*/
|
|
476
|
+
async summarize(fullTree = false, trackState = true, telemetryContext) {
|
|
477
|
+
const summaryBuilder = new SummaryTreeBuilder();
|
|
478
|
+
await this.visitContextsDuringSummary(async (contextId, context) => {
|
|
479
|
+
const contextSummary = await context.summarize(fullTree, trackState, telemetryContext);
|
|
480
|
+
summaryBuilder.addWithStats(contextId, contextSummary);
|
|
481
|
+
});
|
|
482
|
+
return summaryBuilder.getSummaryTree();
|
|
483
|
+
}
|
|
470
484
|
/**
|
|
471
485
|
* Generates data used for garbage collection. This includes a list of GC nodes that represent this channel
|
|
472
486
|
* including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the
|
|
@@ -484,19 +498,12 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
484
498
|
*/
|
|
485
499
|
async getGCData(fullGC = false) {
|
|
486
500
|
const builder = new GCDataBuilder();
|
|
487
|
-
|
|
488
|
-
await Promise.all(Array.from(this.contexts)
|
|
489
|
-
.filter(([contextId, _]) => {
|
|
490
|
-
// Get GC data only for attached contexts. Detached contexts are not connected in the GC reference
|
|
491
|
-
// graph so any references they might have won't be connected as well.
|
|
492
|
-
return this.isChannelAttached(contextId);
|
|
493
|
-
})
|
|
494
|
-
.map(async ([contextId, context]) => {
|
|
501
|
+
await this.visitContextsDuringSummary(async (contextId, context) => {
|
|
495
502
|
const contextGCData = await context.getGCData(fullGC);
|
|
496
503
|
// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.
|
|
497
504
|
// This also gradually builds the id of each node to be a path from the root.
|
|
498
505
|
builder.prefixAndAddNodes(contextId, contextGCData.gcNodes);
|
|
499
|
-
})
|
|
506
|
+
});
|
|
500
507
|
this.updateGCNodes(builder);
|
|
501
508
|
return builder.getGCData();
|
|
502
509
|
}
|
|
@@ -517,43 +524,6 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
517
524
|
context.updateUsedRoutes(usedContextRoutes.get(contextId) ?? []);
|
|
518
525
|
}
|
|
519
526
|
}
|
|
520
|
-
/**
|
|
521
|
-
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
522
|
-
* all references added in the system.
|
|
523
|
-
* @param srcHandle - The handle of the node that added the reference.
|
|
524
|
-
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
525
|
-
*/
|
|
526
|
-
addedGCOutboundReference(srcHandle, outboundHandle) {
|
|
527
|
-
// Note: This is deprecated on IFluidDataStoreContext, and in an n/n-1 scenario where the
|
|
528
|
-
// ContainerRuntime is newer, it will actually be a no-op since then the ContainerRuntime
|
|
529
|
-
// will be the one to call addedGCOutboundReference directly.
|
|
530
|
-
// But on the flip side, if the ContainerRuntime is older, then it's important we still call this.
|
|
531
|
-
this.dataStoreContext.addedGCOutboundReference?.(toFluidHandleInternal(srcHandle), toFluidHandleInternal(outboundHandle));
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
* Returns a summary at the current sequence number.
|
|
535
|
-
* @param fullTree - true to bypass optimizations and force a full summary tree
|
|
536
|
-
* @param trackState - This tells whether we should track state from this summary.
|
|
537
|
-
* @param telemetryContext - summary data passed through the layers for telemetry purposes
|
|
538
|
-
*/
|
|
539
|
-
async summarize(fullTree = false, trackState = true, telemetryContext) {
|
|
540
|
-
const summaryBuilder = new SummaryTreeBuilder();
|
|
541
|
-
// Iterate over each data store and ask it to summarize
|
|
542
|
-
await Promise.all(Array.from(this.contexts)
|
|
543
|
-
.filter(([contextId, _]) => {
|
|
544
|
-
const isAttached = this.isChannelAttached(contextId);
|
|
545
|
-
// We are not expecting local dds! Summary may not capture local state.
|
|
546
|
-
assert(isAttached, 0x17f /* "Not expecting detached channels during summarize" */);
|
|
547
|
-
// If the object is registered - and we have received the sequenced op creating the object
|
|
548
|
-
// (i.e. it has a base mapping) - then we go ahead and summarize
|
|
549
|
-
return isAttached;
|
|
550
|
-
})
|
|
551
|
-
.map(async ([contextId, context]) => {
|
|
552
|
-
const contextSummary = await context.summarize(fullTree, trackState, telemetryContext);
|
|
553
|
-
summaryBuilder.addWithStats(contextId, contextSummary);
|
|
554
|
-
}));
|
|
555
|
-
return summaryBuilder.getSummaryTree();
|
|
556
|
-
}
|
|
557
527
|
getAttachSummary(telemetryContext) {
|
|
558
528
|
const summaryBuilder = new SummaryTreeBuilder();
|
|
559
529
|
this.visitLocalBoundContextsDuringAttach((contextId, context) => {
|
|
@@ -589,6 +559,18 @@ export class FluidDataStoreRuntime extends TypedEventEmitter {
|
|
|
589
559
|
this.updateGCNodes(gcDataBuilder);
|
|
590
560
|
return gcDataBuilder.getGCData();
|
|
591
561
|
}
|
|
562
|
+
/**
|
|
563
|
+
* Helper method for preparing to summarize this channel.
|
|
564
|
+
* Runs the callback for each bound context to incorporate its data however the caller specifies
|
|
565
|
+
*/
|
|
566
|
+
async visitContextsDuringSummary(visitor) {
|
|
567
|
+
for (const [contextId, context] of this.contexts) {
|
|
568
|
+
const isAttached = this.isChannelAttached(contextId);
|
|
569
|
+
// We are not expecting local dds! Summary / GC data may not capture local state.
|
|
570
|
+
assert(isAttached, 0x17f /* "Not expecting detached channels during summarize" */);
|
|
571
|
+
await visitor(contextId, context);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
592
574
|
/**
|
|
593
575
|
* Helper method for preparing to attach this dataStore.
|
|
594
576
|
* Runs the callback for each bound context to incorporate its data however the caller specifies
|