@fluidframework/datastore 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419

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.
Files changed (145) hide show
  1. package/.eslintrc.js +5 -7
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +273 -0
  4. package/README.md +41 -0
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/datastore.api.md +168 -0
  8. package/dist/channelContext.cjs +86 -0
  9. package/dist/channelContext.cjs.map +1 -0
  10. package/dist/channelContext.d.ts +15 -9
  11. package/dist/channelContext.d.ts.map +1 -1
  12. package/dist/{channelDeltaConnection.js → channelDeltaConnection.cjs} +14 -15
  13. package/dist/channelDeltaConnection.cjs.map +1 -0
  14. package/dist/channelDeltaConnection.d.ts +4 -5
  15. package/dist/channelDeltaConnection.d.ts.map +1 -1
  16. package/dist/{channelStorageService.js → channelStorageService.cjs} +13 -16
  17. package/dist/channelStorageService.cjs.map +1 -0
  18. package/dist/channelStorageService.d.ts +2 -2
  19. package/dist/channelStorageService.d.ts.map +1 -1
  20. package/dist/{dataStoreRuntime.js → dataStoreRuntime.cjs} +302 -225
  21. package/dist/dataStoreRuntime.cjs.map +1 -0
  22. package/dist/dataStoreRuntime.d.ts +81 -37
  23. package/dist/dataStoreRuntime.d.ts.map +1 -1
  24. package/dist/datastore-alpha.d.ts +317 -0
  25. package/dist/datastore-beta.d.ts +47 -0
  26. package/dist/datastore-public.d.ts +47 -0
  27. package/dist/datastore-untrimmed.d.ts +324 -0
  28. package/dist/{fluidHandle.js → fluidHandle.cjs} +44 -16
  29. package/dist/fluidHandle.cjs.map +1 -0
  30. package/dist/fluidHandle.d.ts +33 -6
  31. package/dist/fluidHandle.d.ts.map +1 -1
  32. package/dist/index.cjs +15 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.ts +2 -2
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/localChannelContext.cjs +190 -0
  37. package/dist/localChannelContext.cjs.map +1 -0
  38. package/dist/localChannelContext.d.ts +12 -21
  39. package/dist/localChannelContext.d.ts.map +1 -1
  40. package/dist/{localChannelStorageService.js → localChannelStorageService.cjs} +3 -3
  41. package/dist/localChannelStorageService.cjs.map +1 -0
  42. package/dist/localChannelStorageService.d.ts.map +1 -1
  43. package/dist/remoteChannelContext.cjs +124 -0
  44. package/dist/remoteChannelContext.cjs.map +1 -0
  45. package/dist/remoteChannelContext.d.ts +5 -10
  46. package/dist/remoteChannelContext.d.ts.map +1 -1
  47. package/dist/tsdoc-metadata.json +11 -0
  48. package/lib/{channelContext.d.ts → channelContext.d.mts} +16 -10
  49. package/lib/channelContext.d.mts.map +1 -0
  50. package/lib/channelContext.mjs +78 -0
  51. package/lib/channelContext.mjs.map +1 -0
  52. package/lib/{channelDeltaConnection.d.ts → channelDeltaConnection.d.mts} +4 -5
  53. package/lib/channelDeltaConnection.d.mts.map +1 -0
  54. package/lib/{channelDeltaConnection.js → channelDeltaConnection.mjs} +11 -12
  55. package/lib/channelDeltaConnection.mjs.map +1 -0
  56. package/lib/{channelStorageService.d.ts → channelStorageService.d.mts} +2 -2
  57. package/lib/channelStorageService.d.mts.map +1 -0
  58. package/lib/{channelStorageService.js → channelStorageService.mjs} +13 -16
  59. package/lib/channelStorageService.mjs.map +1 -0
  60. package/lib/{dataStoreRuntime.d.ts → dataStoreRuntime.d.mts} +81 -37
  61. package/lib/dataStoreRuntime.d.mts.map +1 -0
  62. package/lib/{dataStoreRuntime.js → dataStoreRuntime.mjs} +286 -209
  63. package/lib/dataStoreRuntime.mjs.map +1 -0
  64. package/lib/datastore-alpha.d.mts +317 -0
  65. package/lib/datastore-beta.d.mts +47 -0
  66. package/lib/datastore-public.d.mts +47 -0
  67. package/lib/datastore-untrimmed.d.mts +324 -0
  68. package/lib/fluidHandle.d.mts +57 -0
  69. package/lib/fluidHandle.d.mts.map +1 -0
  70. package/lib/{fluidHandle.js → fluidHandle.mjs} +44 -16
  71. package/lib/fluidHandle.mjs.map +1 -0
  72. package/lib/index.d.mts +7 -0
  73. package/lib/index.d.mts.map +1 -0
  74. package/lib/index.mjs +7 -0
  75. package/lib/index.mjs.map +1 -0
  76. package/lib/{localChannelContext.d.ts → localChannelContext.d.mts} +13 -22
  77. package/lib/localChannelContext.d.mts.map +1 -0
  78. package/lib/{localChannelContext.js → localChannelContext.mjs} +73 -85
  79. package/lib/localChannelContext.mjs.map +1 -0
  80. package/lib/localChannelStorageService.d.mts.map +1 -0
  81. package/lib/{localChannelStorageService.js → localChannelStorageService.mjs} +2 -2
  82. package/lib/localChannelStorageService.mjs.map +1 -0
  83. package/lib/{remoteChannelContext.d.ts → remoteChannelContext.d.mts} +7 -12
  84. package/lib/remoteChannelContext.d.mts.map +1 -0
  85. package/lib/remoteChannelContext.mjs +120 -0
  86. package/lib/remoteChannelContext.mjs.map +1 -0
  87. package/package.json +107 -72
  88. package/{lib/index.js → prettier.config.cjs} +4 -3
  89. package/src/channelContext.ts +168 -71
  90. package/src/channelDeltaConnection.ts +52 -47
  91. package/src/channelStorageService.ts +59 -55
  92. package/src/dataStoreRuntime.ts +1158 -983
  93. package/src/fluidHandle.ts +92 -64
  94. package/src/index.ts +8 -2
  95. package/src/localChannelContext.ts +278 -272
  96. package/src/localChannelStorageService.ts +48 -46
  97. package/src/remoteChannelContext.ts +237 -300
  98. package/tsc-multi.test.json +4 -0
  99. package/tsconfig.json +11 -13
  100. package/dist/channelContext.js +0 -35
  101. package/dist/channelContext.js.map +0 -1
  102. package/dist/channelDeltaConnection.js.map +0 -1
  103. package/dist/channelStorageService.js.map +0 -1
  104. package/dist/dataStoreRuntime.js.map +0 -1
  105. package/dist/fluidHandle.js.map +0 -1
  106. package/dist/index.js +0 -19
  107. package/dist/index.js.map +0 -1
  108. package/dist/localChannelContext.js +0 -202
  109. package/dist/localChannelContext.js.map +0 -1
  110. package/dist/localChannelStorageService.js.map +0 -1
  111. package/dist/packageVersion.d.ts +0 -9
  112. package/dist/packageVersion.d.ts.map +0 -1
  113. package/dist/packageVersion.js +0 -12
  114. package/dist/packageVersion.js.map +0 -1
  115. package/dist/remoteChannelContext.js +0 -207
  116. package/dist/remoteChannelContext.js.map +0 -1
  117. package/lib/channelContext.d.ts.map +0 -1
  118. package/lib/channelContext.js +0 -29
  119. package/lib/channelContext.js.map +0 -1
  120. package/lib/channelDeltaConnection.d.ts.map +0 -1
  121. package/lib/channelDeltaConnection.js.map +0 -1
  122. package/lib/channelStorageService.d.ts.map +0 -1
  123. package/lib/channelStorageService.js.map +0 -1
  124. package/lib/dataStoreRuntime.d.ts.map +0 -1
  125. package/lib/dataStoreRuntime.js.map +0 -1
  126. package/lib/fluidHandle.d.ts +0 -30
  127. package/lib/fluidHandle.d.ts.map +0 -1
  128. package/lib/fluidHandle.js.map +0 -1
  129. package/lib/index.d.ts +0 -7
  130. package/lib/index.d.ts.map +0 -1
  131. package/lib/index.js.map +0 -1
  132. package/lib/localChannelContext.d.ts.map +0 -1
  133. package/lib/localChannelContext.js.map +0 -1
  134. package/lib/localChannelStorageService.d.ts.map +0 -1
  135. package/lib/localChannelStorageService.js.map +0 -1
  136. package/lib/packageVersion.d.ts +0 -9
  137. package/lib/packageVersion.d.ts.map +0 -1
  138. package/lib/packageVersion.js +0 -9
  139. package/lib/packageVersion.js.map +0 -1
  140. package/lib/remoteChannelContext.d.ts.map +0 -1
  141. package/lib/remoteChannelContext.js +0 -203
  142. package/lib/remoteChannelContext.js.map +0 -1
  143. package/src/packageVersion.ts +0 -9
  144. package/tsconfig.esnext.json +0 -7
  145. /package/lib/{localChannelStorageService.d.ts → localChannelStorageService.d.mts} +0 -0
@@ -2,14 +2,15 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryLogger } from "@fluidframework/common-definitions";
5
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
6
6
  import { IFluidHandle } from "@fluidframework/core-interfaces";
7
- import { IChannel } from "@fluidframework/datastore-definitions";
7
+ import { IChannel, IChannelAttributes, IChannelFactory, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
8
8
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
9
9
  import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
10
- import { IGarbageCollectionData, ISummarizeResult, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions";
11
- import { ChannelDeltaConnection } from "./channelDeltaConnection";
12
- import { ChannelStorageService } from "./channelStorageService";
10
+ import { IGarbageCollectionData, IExperimentalIncrementalSummaryContext, ISummarizeResult, ISummaryTreeWithStats, ITelemetryContext, IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
11
+ import { ChannelStorageService } from "./channelStorageService.mjs";
12
+ import { ChannelDeltaConnection } from "./channelDeltaConnection.mjs";
13
+ import { ISharedObjectRegistry } from "./dataStoreRuntime.mjs";
13
14
  export declare const attributesBlobKey = ".attributes";
14
15
  export interface IChannelContext {
15
16
  getChannel(): Promise<IChannel>;
@@ -30,14 +31,19 @@ export interface IChannelContext {
30
31
  * 1. To identify if this context is being referenced in the document or not.
31
32
  * 2. To identify if this context or any of its children's used routes changed since last summary.
32
33
  * 3. They are added to the summary generated by this context.
33
- * 4. To update the timestamp when this context is marked as unreferenced.
34
34
  */
35
- updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): void;
35
+ updateUsedRoutes(usedRoutes: string[]): void;
36
36
  }
37
- export declare function createServiceEndpoints(id: string, connected: boolean, submitFn: (content: any, localOpMetadata: unknown) => void, dirtyFn: () => void, addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void, storageService: IDocumentStorageService, logger: ITelemetryLogger, tree?: ISnapshotTree, extraBlobs?: Map<string, ArrayBufferLike>): {
37
+ export interface ChannelServiceEndpoints {
38
38
  deltaConnection: ChannelDeltaConnection;
39
39
  objectStorage: ChannelStorageService;
40
- };
40
+ }
41
+ export declare function createChannelServiceEndpoints(connected: boolean, submitFn: (content: any, localOpMetadata: unknown) => void, dirtyFn: () => void, addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void, storageService: IDocumentStorageService, logger: ITelemetryLoggerExt, tree?: ISnapshotTree, extraBlobs?: Map<string, ArrayBufferLike>): ChannelServiceEndpoints;
41
42
  export declare function summarizeChannel(channel: IChannel, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
42
- export declare function summarizeChannelAsync(channel: IChannel, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
43
+ export declare function summarizeChannelAsync(channel: IChannel, fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): Promise<ISummaryTreeWithStats>;
44
+ export declare function loadChannelFactoryAndAttributes(dataStoreContext: IFluidDataStoreContext, services: ChannelServiceEndpoints, channelId: string, registry: ISharedObjectRegistry, attachMessageType?: string): Promise<{
45
+ factory: IChannelFactory;
46
+ attributes: IChannelAttributes;
47
+ }>;
48
+ export declare function loadChannel(dataStoreRuntime: IFluidDataStoreRuntime, attributes: IChannelAttributes, factory: IChannelFactory, services: ChannelServiceEndpoints, logger: ITelemetryLoggerExt, channelId: string): Promise<IChannel>;
43
49
  //# sourceMappingURL=channelContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelContext.d.ts","sourceRoot":"","sources":["../src/channelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAEN,mBAAmB,EAEnB,MAAM,iCAAiC;OACjC,EAAE,YAAY,EAAE,MAAM,iCAAiC;OACvD,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,MAAM,uCAAuC;OACvC,EAAE,uBAAuB,EAAE,MAAM,oCAAoC;OACrE,EAAE,yBAAyB,EAAE,a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Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { DataCorruptionError, tagCodeArtifacts, } from "@fluidframework/telemetry-utils";
6
+ import { addBlobToSummary } from "@fluidframework/runtime-utils";
7
+ import { readAndParse } from "@fluidframework/driver-utils";
8
+ import { ChannelStorageService } from "./channelStorageService.mjs";
9
+ import { ChannelDeltaConnection } from "./channelDeltaConnection.mjs";
10
+ export const attributesBlobKey = ".attributes";
11
+ export function createChannelServiceEndpoints(connected, submitFn, dirtyFn, addedGCOutboundReferenceFn, storageService, logger, tree, extraBlobs) {
12
+ const deltaConnection = new ChannelDeltaConnection(connected, (message, localOpMetadata) => submitFn(message, localOpMetadata), dirtyFn, addedGCOutboundReferenceFn);
13
+ const objectStorage = new ChannelStorageService(tree, storageService, logger, extraBlobs);
14
+ return {
15
+ deltaConnection,
16
+ objectStorage,
17
+ };
18
+ }
19
+ export function summarizeChannel(channel, fullTree = false, trackState = false, telemetryContext) {
20
+ const summarizeResult = channel.getAttachSummary(fullTree, trackState, telemetryContext);
21
+ // Add the channel attributes to the returned result.
22
+ addBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));
23
+ return summarizeResult;
24
+ }
25
+ export async function summarizeChannelAsync(channel, fullTree = false, trackState = false, telemetryContext, incrementalSummaryContext) {
26
+ const summarizeResult = await channel.summarize(fullTree, trackState, telemetryContext, incrementalSummaryContext);
27
+ // Add the channel attributes to the returned result.
28
+ addBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));
29
+ return summarizeResult;
30
+ }
31
+ export async function loadChannelFactoryAndAttributes(dataStoreContext, services, channelId, registry, attachMessageType) {
32
+ let attributes;
33
+ if (await services.objectStorage.contains(attributesBlobKey)) {
34
+ attributes = await readAndParse(services.objectStorage, attributesBlobKey);
35
+ }
36
+ // This is a backward compatibility case where the attach message doesn't include attributes. They must
37
+ // include attach message type.
38
+ // Since old attach messages will not have attributes, we need to keep this as long as we support old attach
39
+ // messages.
40
+ const channelFactoryType = attributes ? attributes.type : attachMessageType;
41
+ if (channelFactoryType === undefined) {
42
+ throw new DataCorruptionError("channelTypeNotAvailable", tagCodeArtifacts({
43
+ channelId,
44
+ dataStoreId: dataStoreContext.id,
45
+ dataStorePackagePath: dataStoreContext.packagePath.join("/"),
46
+ channelFactoryType,
47
+ }));
48
+ }
49
+ const factory = registry.get(channelFactoryType);
50
+ if (factory === undefined) {
51
+ throw new DataCorruptionError("channelFactoryNotRegisteredForGivenType", tagCodeArtifacts({
52
+ channelId,
53
+ dataStoreId: dataStoreContext.id,
54
+ dataStorePackagePath: dataStoreContext.packagePath.join("/"),
55
+ channelFactoryType,
56
+ }));
57
+ }
58
+ // This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes
59
+ // from the factory.
60
+ attributes = attributes ?? factory.attributes;
61
+ return { factory, attributes };
62
+ }
63
+ export async function loadChannel(dataStoreRuntime, attributes, factory, services, logger, channelId) {
64
+ // Compare snapshot version to collaborative object version
65
+ if (attributes.snapshotFormatVersion !== undefined &&
66
+ attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion) {
67
+ logger.sendTelemetryEvent({
68
+ eventName: "ChannelAttributesVersionMismatch",
69
+ ...tagCodeArtifacts({
70
+ channelType: attributes.type,
71
+ channelSnapshotVersion: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,
72
+ channelCodeVersion: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,
73
+ }),
74
+ });
75
+ }
76
+ return factory.load(dataStoreRuntime, channelId, services, attributes);
77
+ }
78
+ //# sourceMappingURL=channelContext.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelContext.mjs","sourceRoot":"","sources":["../src/channelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,mBAAmB,EAEnB,gBAAgB,GAChB,MAAM,iCAAiC;OAkBjC,EAAE,gBAAgB,EAAE,MAAM,+BAA+B;OACzD,EAAE,YAAY,EAAE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AAC;IAC9C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAChC,gBAAwC,EACxC,UAA8B,EAC9B,OAAwB,EACxB,QAAiC,EACjC,MAA2B,EAC3B,SAAiB;IAEjB,2DAA2D;IAC3D,IACC,UAAU,CAAC,qBAAqB,KAAK,SAAS;QAC9C,UAAU,CAAC,qBAAqB,KAAK,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAC5E;QACD,MAAM,CAAC,kBAAkB,CAAC;YACzB,SAAS,EAAE,kCAAkC;YAC7C,GAAG,gBAAgB,CAAC;gBACnB,WAAW,EAAE,UAAU,CAAC,IAAI;gBAC5B,sBAAsB,EAAE,GAAG,UAAU,CAAC,qBAAqB,IAAI,UAAU,CAAC,cAAc,EAAE;gBAC1F,kBAAkB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,IAAI,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE;aACtG,CAAC;SACF,CAAC,CAAC;KACH;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDataCorruptionError,\n\tITelemetryLoggerExt,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIChannel,\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tIExperimentalIncrementalSummaryContext,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIFluidDataStoreContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { addBlobToSummary } from \"@fluidframework/runtime-utils\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { ChannelStorageService } from \"./channelStorageService\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport const attributesBlobKey = \".attributes\";\n\nexport interface IChannelContext {\n\tgetChannel(): Promise<IChannel>;\n\n\tsetConnectionState(connected: boolean, clientId?: string);\n\n\tprocessOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata?: unknown): void;\n\n\tsummarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult>;\n\n\treSubmit(content: any, localOpMetadata: unknown): void;\n\n\tapplyStashedOp(content: any): unknown;\n\n\trollback(message: any, localOpMetadata: unknown): void;\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 * including any of its children. Each node has a set of outbound routes to other GC nodes in the document.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tgetGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\n\t/**\n\t * After GC has run, called to notify this context of routes that are used in it. These are used for the following:\n\t * 1. To identify if this context is being referenced in the document or not.\n\t * 2. To identify if this context or any of its children's used routes changed since last summary.\n\t * 3. They are added to the summary generated by this context.\n\t */\n\tupdateUsedRoutes(usedRoutes: string[]): void;\n}\n\nexport interface ChannelServiceEndpoints {\n\tdeltaConnection: ChannelDeltaConnection;\n\tobjectStorage: ChannelStorageService;\n}\n\nexport function createChannelServiceEndpoints(\n\tconnected: boolean,\n\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\tdirtyFn: () => void,\n\taddedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n\tstorageService: IDocumentStorageService,\n\tlogger: ITelemetryLoggerExt,\n\ttree?: ISnapshotTree,\n\textraBlobs?: Map<string, ArrayBufferLike>,\n): ChannelServiceEndpoints {\n\tconst deltaConnection = new ChannelDeltaConnection(\n\t\tconnected,\n\t\t(message, localOpMetadata) => submitFn(message, localOpMetadata),\n\t\tdirtyFn,\n\t\taddedGCOutboundReferenceFn,\n\t);\n\tconst objectStorage = new ChannelStorageService(tree, storageService, logger, extraBlobs);\n\n\treturn {\n\t\tdeltaConnection,\n\t\tobjectStorage,\n\t};\n}\n\nexport function summarizeChannel(\n\tchannel: IChannel,\n\tfullTree: boolean = false,\n\ttrackState: boolean = false,\n\ttelemetryContext?: ITelemetryContext,\n): ISummaryTreeWithStats {\n\tconst summarizeResult = channel.getAttachSummary(fullTree, trackState, telemetryContext);\n\n\t// Add the channel attributes to the returned result.\n\taddBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));\n\treturn summarizeResult;\n}\n\nexport async function summarizeChannelAsync(\n\tchannel: IChannel,\n\tfullTree: boolean = false,\n\ttrackState: boolean = false,\n\ttelemetryContext?: ITelemetryContext,\n\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n): Promise<ISummaryTreeWithStats> {\n\tconst summarizeResult = await channel.summarize(\n\t\tfullTree,\n\t\ttrackState,\n\t\ttelemetryContext,\n\t\tincrementalSummaryContext,\n\t);\n\n\t// Add the channel attributes to the returned result.\n\taddBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));\n\treturn summarizeResult;\n}\n\nexport async function loadChannelFactoryAndAttributes(\n\tdataStoreContext: IFluidDataStoreContext,\n\tservices: ChannelServiceEndpoints,\n\tchannelId: string,\n\tregistry: ISharedObjectRegistry,\n\tattachMessageType?: string,\n): Promise<{ factory: IChannelFactory; attributes: IChannelAttributes }> {\n\tlet attributes: IChannelAttributes | undefined;\n\tif (await services.objectStorage.contains(attributesBlobKey)) {\n\t\tattributes = await readAndParse<IChannelAttributes | undefined>(\n\t\t\tservices.objectStorage,\n\t\t\tattributesBlobKey,\n\t\t);\n\t}\n\n\t// This is a backward compatibility case where the attach message doesn't include attributes. They must\n\t// include attach message type.\n\t// Since old attach messages will not have attributes, we need to keep this as long as we support old attach\n\t// messages.\n\tconst channelFactoryType = attributes ? attributes.type : attachMessageType;\n\tif (channelFactoryType === undefined) {\n\t\tthrow new DataCorruptionError(\n\t\t\t\"channelTypeNotAvailable\",\n\t\t\ttagCodeArtifacts({\n\t\t\t\tchannelId,\n\t\t\t\tdataStoreId: dataStoreContext.id,\n\t\t\t\tdataStorePackagePath: dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\tchannelFactoryType,\n\t\t\t}),\n\t\t);\n\t}\n\tconst factory = registry.get(channelFactoryType);\n\tif (factory === undefined) {\n\t\tthrow new DataCorruptionError(\n\t\t\t\"channelFactoryNotRegisteredForGivenType\",\n\t\t\ttagCodeArtifacts({\n\t\t\t\tchannelId,\n\t\t\t\tdataStoreId: dataStoreContext.id,\n\t\t\t\tdataStorePackagePath: dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\tchannelFactoryType,\n\t\t\t}),\n\t\t);\n\t}\n\t// This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes\n\t// from the factory.\n\tattributes = attributes ?? factory.attributes;\n\treturn { factory, attributes };\n}\n\nexport async function loadChannel(\n\tdataStoreRuntime: IFluidDataStoreRuntime,\n\tattributes: IChannelAttributes,\n\tfactory: IChannelFactory,\n\tservices: ChannelServiceEndpoints,\n\tlogger: ITelemetryLoggerExt,\n\tchannelId: string,\n): Promise<IChannel> {\n\t// Compare snapshot version to collaborative object version\n\tif (\n\t\tattributes.snapshotFormatVersion !== undefined &&\n\t\tattributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion\n\t) {\n\t\tlogger.sendTelemetryEvent({\n\t\t\teventName: \"ChannelAttributesVersionMismatch\",\n\t\t\t...tagCodeArtifacts({\n\t\t\t\tchannelType: attributes.type,\n\t\t\t\tchannelSnapshotVersion: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n\t\t\t\tchannelCodeVersion: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n\t\t\t}),\n\t\t});\n\t}\n\n\treturn factory.load(dataStoreRuntime, channelId, services, attributes);\n}\n"]}
@@ -2,24 +2,23 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
5
+ import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
6
6
  import { IDeltaConnection, IDeltaHandler } from "@fluidframework/datastore-definitions";
7
7
  import { IFluidHandle } from "@fluidframework/core-interfaces";
8
8
  export declare class ChannelDeltaConnection implements IDeltaConnection {
9
- objectId: string;
10
9
  private _connected;
11
- readonly submit: (message: IDocumentMessage, localOpMetadata: unknown) => void;
10
+ readonly submit: (content: any, localOpMetadata: unknown) => void;
12
11
  readonly dirty: () => void;
13
12
  readonly addedGCOutboundReference: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void;
14
13
  private _handler;
15
14
  private get handler();
16
15
  get connected(): boolean;
17
- constructor(objectId: string, _connected: boolean, submit: (message: IDocumentMessage, localOpMetadata: unknown) => void, dirty: () => void, addedGCOutboundReference: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void);
16
+ constructor(_connected: boolean, submit: (content: any, localOpMetadata: unknown) => void, dirty: () => void, addedGCOutboundReference: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void);
18
17
  attach(handler: IDeltaHandler): void;
19
18
  setConnectionState(connected: boolean): void;
20
19
  process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
21
20
  reSubmit(content: any, localOpMetadata: unknown): void;
22
21
  rollback(content: any, localOpMetadata: unknown): void;
23
- applyStashedOp(message: ISequencedDocumentMessage): unknown;
22
+ applyStashedOp(content: any): unknown;
24
23
  }
25
24
  //# sourceMappingURL=channelDeltaConnection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelDeltaConnection.d.ts","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,yBAAyB,EAAE,MAAM,sCAAsC;OACzE,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uCAAuC;OAEhF,EAAE,YAAY,EAAE,MAAM,iCAAiC;AAE9D,qBAAa,sBAAuB,YAAW,gBAAgB;IAY7D,OAAO,CAAC,UAAU;aACF,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI;aACxD,KAAK,EAAE,MAAM,IAAI;aACjB,wBAAwB,EAAE,CACzC,SAAS,EAAE,YAAY,EACvB,cAAc,EAAE,YAAY,KACxB,IAAI;IAjBV,OAAO,CAAC,QAAQ,CAA4B;IAE5C,OAAO,KAAK,OAAO,GAGlB;IACD,IAAW,SAAS,IAAI,OAAO,CAE9B;gBAGQ,UAAU,EAAE,OAAO,EACX,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,EACxD,KAAK,EAAE,MAAM,IAAI,EACjB,wBAAwB,EAAE,CACzC,SAAS,EAAE,YAAY,EACvB,cAAc,EAAE,YAAY,KACxB,IAAI;IAGH,MAAM,CAAC,OAAO,EAAE,aAAa;IAK7B,kBAAkB,CAAC,SAAS,EAAE,OAAO;IAKrC,OAAO,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;IAapF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAI/C,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAO/C,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;CAG5C"}
@@ -2,16 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/common-utils";
6
- import { DataProcessingError } from "@fluidframework/container-utils";
5
+ import { assert } from "@fluidframework/core-utils";
6
+ import { DataProcessingError } from "@fluidframework/telemetry-utils";
7
7
  export class ChannelDeltaConnection {
8
- constructor(objectId, _connected, submit, dirty, addedGCOutboundReference) {
9
- this.objectId = objectId;
10
- this._connected = _connected;
11
- this.submit = submit;
12
- this.dirty = dirty;
13
- this.addedGCOutboundReference = addedGCOutboundReference;
14
- }
15
8
  get handler() {
16
9
  assert(!!this._handler, 0x177 /* "Missing delta handler" */);
17
10
  return this._handler;
@@ -19,6 +12,12 @@ export class ChannelDeltaConnection {
19
12
  get connected() {
20
13
  return this._connected;
21
14
  }
15
+ constructor(_connected, submit, dirty, addedGCOutboundReference) {
16
+ this._connected = _connected;
17
+ this.submit = submit;
18
+ this.dirty = dirty;
19
+ this.addedGCOutboundReference = addedGCOutboundReference;
20
+ }
22
21
  attach(handler) {
23
22
  assert(this._handler === undefined, 0x178 /* "Missing delta handler on attach" */);
24
23
  this._handler = handler;
@@ -45,8 +44,8 @@ export class ChannelDeltaConnection {
45
44
  }
46
45
  this.handler.rollback(content, localOpMetadata);
47
46
  }
48
- applyStashedOp(message) {
49
- return this.handler.applyStashedOp(message);
47
+ applyStashedOp(content) {
48
+ return this.handler.applyStashedOp(content);
50
49
  }
51
50
  }
52
- //# sourceMappingURL=channelDeltaConnection.js.map
51
+ //# sourceMappingURL=channelDeltaConnection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelDeltaConnection.mjs","sourceRoot":"","sources":["../src/channelDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAG5C,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;AAGrE,MAAM,OAAO,sBAAsB;IAGlC,IAAY,OAAO;QAClB,MAAM,CAAC,CAAC,CAAC,IAAI,C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C,CAAC;SACpD;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACjD,CAAC;IAEM,cAAc,CAAC,OAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IDeltaConnection, IDeltaHandler } from \"@fluidframework/datastore-definitions\";\nimport { DataProcessingError } from \"@fluidframework/telemetry-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\nexport class ChannelDeltaConnection implements IDeltaConnection {\n\tprivate _handler: IDeltaHandler | 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\tpublic readonly submit: (content: any, localOpMetadata: unknown) => void,\n\t\tpublic readonly dirty: () => void,\n\t\tpublic readonly addedGCOutboundReference: (\n\t\t\tsrcHandle: IFluidHandle,\n\t\t\toutboundHandle: IFluidHandle,\n\t\t) => void,\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(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n\t\ttry {\n\t\t\t// catches as data processing error whether or not they come from async pending queues\n\t\t\tthis.handler.process(message, local, localOpMetadata);\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\tthis.handler.reSubmit(content, localOpMetadata);\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\tthis.handler.rollback(content, localOpMetadata);\n\t}\n\n\tpublic applyStashedOp(content: any): unknown {\n\t\treturn this.handler.applyStashedOp(content);\n\t}\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
6
6
  import { ISnapshotTree } from "@fluidframework/protocol-definitions";
7
7
  import { IChannelStorageService } from "@fluidframework/datastore-definitions";
8
- import { ITelemetryLogger } from "@fluidframework/common-definitions";
8
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
9
9
  export declare class ChannelStorageService implements IChannelStorageService {
10
10
  private readonly tree;
11
11
  private readonly storage;
@@ -13,7 +13,7 @@ export declare class ChannelStorageService implements IChannelStorageService {
13
13
  private readonly extraBlobs?;
14
14
  private static flattenTree;
15
15
  private readonly flattenedTree;
16
- constructor(tree: ISnapshotTree | undefined, storage: Pick<IDocumentStorageService, "readBlob">, logger: ITelemetryLogger, extraBlobs?: Map<string, ArrayBufferLike> | undefined);
16
+ constructor(tree: ISnapshotTree | undefined, storage: Pick<IDocumentStorageService, "readBlob">, logger: ITelemetryLoggerExt, extraBlobs?: Map<string, ArrayBufferLike> | undefined);
17
17
  contains(path: string): Promise<boolean>;
18
18
  readBlob(path: string): Promise<ArrayBufferLike>;
19
19
  list(path: string): Promise<string[]>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelStorageService.d.ts","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,uBAAuB,EAAE,MAAM,oCAAoC;OACrE,EAAE,aAAa,EAAE,MAAM,sCAAsC;OAC7D,EAAE,sBAAsB,EAAE,MAAM,uCAAuC;OAEvE,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;AAErE,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"}
@@ -4,6 +4,16 @@
4
4
  */
5
5
  import { getNormalizedObjectStoragePathParts } from "@fluidframework/runtime-utils";
6
6
  export class ChannelStorageService {
7
+ static flattenTree(base, tree, results) {
8
+ // eslint-disable-next-line guard-for-in, no-restricted-syntax
9
+ for (const path in tree.trees) {
10
+ ChannelStorageService.flattenTree(`${base}${path}/`, tree.trees[path], results);
11
+ }
12
+ // eslint-disable-next-line guard-for-in, no-restricted-syntax
13
+ for (const blob in tree.blobs) {
14
+ results[`${base}${blob}`] = tree.blobs[blob];
15
+ }
16
+ }
7
17
  constructor(tree, storage, logger, extraBlobs) {
8
18
  this.tree = tree;
9
19
  this.storage = storage;
@@ -15,24 +25,12 @@ export class ChannelStorageService {
15
25
  ChannelStorageService.flattenTree("", tree, this.flattenedTree);
16
26
  }
17
27
  }
18
- static flattenTree(base, tree, results) {
19
- // eslint-disable-next-line guard-for-in, no-restricted-syntax
20
- for (const path in tree.trees) {
21
- ChannelStorageService.flattenTree(`${base}${path}/`, tree.trees[path], results);
22
- }
23
- // eslint-disable-next-line guard-for-in, no-restricted-syntax
24
- for (const blob in tree.blobs) {
25
- results[`${base}${blob}`] = tree.blobs[blob];
26
- }
27
- }
28
28
  async contains(path) {
29
29
  return this.flattenedTree[path] !== undefined;
30
30
  }
31
31
  async readBlob(path) {
32
32
  const id = await this.getIdForPath(path);
33
- const blob = this.extraBlobs !== undefined
34
- ? this.extraBlobs.get(id)
35
- : undefined;
33
+ const blob = this.extraBlobs !== undefined ? this.extraBlobs.get(id) : undefined;
36
34
  if (blob !== undefined) {
37
35
  return blob;
38
36
  }
@@ -41,7 +39,6 @@ export class ChannelStorageService {
41
39
  return blobP;
42
40
  }
43
41
  async list(path) {
44
- var _a;
45
42
  let tree = this.tree;
46
43
  const pathParts = getNormalizedObjectStoragePathParts(path);
47
44
  while (tree !== undefined && pathParts.length > 0) {
@@ -52,10 +49,10 @@ export class ChannelStorageService {
52
49
  if (tree === undefined || pathParts.length !== 0) {
53
50
  throw new Error("path does not exist");
54
51
  }
55
- return Object.keys((_a = tree === null || tree === void 0 ? void 0 : tree.blobs) !== null && _a !== void 0 ? _a : {});
52
+ return Object.keys(tree?.blobs ?? {});
56
53
  }
57
54
  async getIdForPath(path) {
58
55
  return this.flattenedTree[path];
59
56
  }
60
57
  }
61
- //# sourceMappingURL=channelStorageService.js.map
58
+ //# sourceMappingURL=channelStorageService.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelStorageService.mjs","sourceRoot":"","sources":["../src/channelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAKI,EAAE,mCAAmC,EAAE,MAAM,+BAA+B;AAGnF,MAAM,OAAO,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QAEjF,IAAI,IAAI,KAAK,SAAS,EAAE;YACvB,OAAO,IAAI,CAAC;SACZ;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACxC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CACrB,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,yBAAyB,EAAE,EAAE,KAAK,CAAC,CAC3E,CAAC;QAEF,OAAO,KAAK,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAY;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;YAClD,oEAAoE;YACpE,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAG,CAAC;YAChC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACxB;QACD,IAAI,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YACjD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SACvC;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 { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { IChannelStorageService } from \"@fluidframework/datastore-definitions\";\nimport { getNormalizedObjectStoragePathParts } from \"@fluidframework/runtime-utils\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\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"]}
@@ -2,34 +2,37 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryLogger } from "@fluidframework/common-definitions";
6
- import { IFluidHandle, IFluidHandleContext, IRequest, IResponse } from "@fluidframework/core-interfaces";
5
+ import { TypedEventEmitter } from "@fluid-internal/client-utils";
6
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
7
+ import { FluidObject, IFluidHandle, IFluidHandleContext, IRequest, IResponse } from "@fluidframework/core-interfaces";
7
8
  import { IAudience, IDeltaManager, AttachState, ILoaderOptions } from "@fluidframework/container-definitions";
8
- import { TypedEventEmitter } from "@fluidframework/common-utils";
9
9
  import { IClientDetails, IDocumentMessage, ISequencedDocumentMessage, IQuorumClients } from "@fluidframework/protocol-definitions";
10
- import { IFluidDataStoreContext, IFluidDataStoreChannel, IGarbageCollectionData, IInboundSignalMessage, ISummaryTreeWithStats, VisibilityState, ITelemetryContext } from "@fluidframework/runtime-definitions";
10
+ import { IFluidDataStoreContext, IFluidDataStoreChannel, IGarbageCollectionData, IInboundSignalMessage, ISummaryTreeWithStats, VisibilityState, ITelemetryContext, IIdCompressor } from "@fluidframework/runtime-definitions";
11
11
  import { IChannel, IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents, IChannelFactory } from "@fluidframework/datastore-definitions";
12
+ /**
13
+ * @alpha
14
+ */
12
15
  export declare enum DataStoreMessageType {
13
16
  Attach = "attach",
14
17
  ChannelOp = "op"
15
18
  }
19
+ /**
20
+ * @alpha
21
+ */
16
22
  export interface ISharedObjectRegistry {
17
23
  get(name: string): IChannelFactory | undefined;
18
24
  }
19
25
  /**
20
26
  * Base data store class
27
+ * @alpha
21
28
  */
22
29
  export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataStoreRuntimeEvents> implements IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
23
30
  private readonly dataStoreContext;
24
31
  private readonly sharedObjectRegistry;
25
32
  /**
26
- * Loads the data store runtime
27
- * @param context - The data store context
28
- * @param sharedObjectRegistry - The registry of shared objects used by this data store
29
- * @param existing - If loading from an existing file.
33
+ * {@inheritDoc @fluidframework/datastore-definitions#IFluidDataStoreRuntime.entryPoint}
30
34
  */
31
- static load(context: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean): FluidDataStoreRuntime;
32
- get IFluidRouter(): this;
35
+ readonly entryPoint: IFluidHandle<FluidObject>;
33
36
  get connected(): boolean;
34
37
  get clientId(): string | undefined;
35
38
  get clientDetails(): IClientDetails;
@@ -37,6 +40,7 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
37
40
  get attachState(): AttachState;
38
41
  get absolutePath(): string;
39
42
  get routeContext(): IFluidHandleContext;
43
+ get idCompressor(): IIdCompressor | undefined;
40
44
  get IFluidHandleContext(): this;
41
45
  get rootRoutingContext(): this;
42
46
  get channelsRoutingContext(): this;
@@ -44,9 +48,7 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
44
48
  private _disposed;
45
49
  get disposed(): boolean;
46
50
  private readonly contexts;
47
- private readonly contextsDeferred;
48
51
  private readonly pendingAttach;
49
- private bindState;
50
52
  private readonly deferredAttached;
51
53
  private readonly localChannelContextQueue;
52
54
  private readonly notBoundedChannelContextSet;
@@ -58,14 +60,49 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
58
60
  readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
59
61
  private readonly quorum;
60
62
  private readonly audience;
61
- readonly logger: ITelemetryLogger;
62
- private readonly channelsBaseGCDetails;
63
- constructor(dataStoreContext: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean);
63
+ private readonly mc;
64
+ get logger(): ITelemetryLoggerExt;
65
+ /**
66
+ * If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.
67
+ * So, adding a count of how many telemetry events are logged per data store context. This can be
68
+ * controlled via feature flags.
69
+ */
70
+ private localChangesTelemetryCount;
71
+ /**
72
+ * Invokes the given callback and expects that no ops are submitted
73
+ * until execution finishes. If an op is submitted, an error will be raised.
74
+ *
75
+ * Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
76
+ *
77
+ * @param callback - the callback to be invoked
78
+ */
79
+ ensureNoDataModelChanges<T>(callback: () => T): T;
80
+ /**
81
+ * Create an instance of a DataStore runtime.
82
+ *
83
+ * @param dataStoreContext - Context object for the runtime.
84
+ * @param sharedObjectRegistry - The registry of shared objects that this data store will be able to instantiate.
85
+ * @param existing - Pass 'true' if loading this datastore from an existing file; pass 'false' otherwise.
86
+ * @param provideEntryPoint - Function to initialize the entryPoint object for the data store runtime. The
87
+ * handle to this data store runtime will point to the object returned by this function. If this function is not
88
+ * provided, the handle will be left undefined. This is here so we can start making handles a first-class citizen
89
+ * and the primary way of interacting with some Fluid objects, and should be used if possible.
90
+ */
91
+ constructor(dataStoreContext: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean, provideEntryPoint: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>);
64
92
  dispose(): void;
65
93
  resolveHandle(request: IRequest): Promise<IResponse>;
66
94
  request(request: IRequest): Promise<IResponse>;
67
95
  getChannel(id: string): Promise<IChannel>;
96
+ /**
97
+ * Api which allows caller to create the channel first and then add it to the runtime.
98
+ * The channel type should be present in the registry, otherwise the runtime would reject
99
+ * the channel. Also the runtime used to create the channel object should be same to which
100
+ * it is added.
101
+ * @param channel - channel which needs to be added to the runtime.
102
+ */
103
+ addChannel(channel: IChannel): void;
68
104
  createChannel(id: string | undefined, type: string): IChannel;
105
+ private createChannelContext;
69
106
  /**
70
107
  * Binds a channel with the runtime. If the runtime is attached we will attach the channel right away.
71
108
  * If the runtime is not attached we will defer the attach until the runtime attaches.
@@ -74,29 +111,26 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
74
111
  bindChannel(channel: IChannel): void;
75
112
  /**
76
113
  * This function is called when a data store becomes root. It does the following:
114
+ *
77
115
  * 1. Marks the data store locally visible in the container.
116
+ *
78
117
  * 2. Attaches the graph of all the handles bound to it.
118
+ *
79
119
  * 3. Calls into the data store context to mark it visible in the container too. If the container is globally
80
- * visible, it will mark us globally visible. Otherwise, it will mark us globally visible when it becomes
81
- * globally visible.
120
+ * visible, it will mark us globally visible. Otherwise, it will mark us globally visible when it becomes
121
+ * globally visible.
82
122
  */
83
123
  makeVisibleAndAttachGraph(): void;
84
124
  /**
85
125
  * This function is called when a handle to this data store is added to a visible DDS.
86
126
  */
87
127
  attachGraph(): void;
88
- /**
89
- * Binds this runtime to the container
90
- * This includes the following:
91
- * 1. Sending an Attach op that includes all existing state
92
- * 2. Attaching the graph if the data store becomes attached.
93
- */
94
- bindToContext(): void;
95
128
  bind(handle: IFluidHandle): void;
96
129
  setConnectionState(connected: boolean, clientId?: string): void;
97
130
  getQuorum(): IQuorumClients;
98
131
  getAudience(): IAudience;
99
- uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
132
+ uploadBlob(blob: ArrayBufferLike, signal?: AbortSignal): Promise<IFluidHandle<ArrayBufferLike>>;
133
+ private createRemoteChannelContext;
100
134
  process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
101
135
  processSignal(message: IInboundSignalMessage, local: boolean): void;
102
136
  private isChannelAttached;
@@ -117,11 +151,15 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
117
151
  * Generates data used for garbage collection. This includes a list of GC nodes that represent this channel
118
152
  * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the
119
153
  * document. It does the following:
154
+ *
120
155
  * 1. Calls into each child context to get its GC data.
156
+ *
121
157
  * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be
122
- * identified as belonging to the child.
158
+ * identified as belonging to the child.
159
+ *
123
160
  * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent
124
- * the GC data of this channel.
161
+ * the GC data of this channel.
162
+ *
125
163
  * @param fullGC - true to bypass optimizations and force full generation of GC data.
126
164
  */
127
165
  getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
@@ -129,10 +167,8 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
129
167
  * After GC has run, called to notify this channel of routes that are used in it. It calls the child contexts to
130
168
  * update their used routes.
131
169
  * @param usedRoutes - The routes that are used in all contexts in this channel.
132
- * @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced
133
- * as part of this GC run, this should be used to update the time when it happens.
134
170
  */
135
- updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): void;
171
+ updateUsedRoutes(usedRoutes: string[]): void;
136
172
  /**
137
173
  * Called when a new outbound reference is added to another node. This is used by garbage collection to identify
138
174
  * all references added in the system.
@@ -140,12 +176,6 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
140
176
  * @param outboundHandle - The handle of the outbound node that is referenced.
141
177
  */
142
178
  private addedGCOutboundReference;
143
- /**
144
- * Returns the base GC details for the channel with the given id. This is used to initialize its GC state.
145
- * @param channelId - The id of the channel context that is asked for the initial GC details.
146
- * @returns the requested channel's base GC details.
147
- */
148
- private getChannelBaseGCDetails;
149
179
  /**
150
180
  * Returns a summary at the current sequence number.
151
181
  * @param fullTree - true to bypass optimizations and force a full summary tree
@@ -155,7 +185,13 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
155
185
  summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
156
186
  getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
157
187
  submitMessage(type: DataStoreMessageType, content: any, localOpMetadata: unknown): void;
158
- submitSignal(type: string, content: any): void;
188
+ /**
189
+ * Submits the signal to be sent to other clients.
190
+ * @param type - Type of the signal.
191
+ * @param content - Content of the signal.
192
+ * @param targetClientId - When specified, the signal is only sent to the provided client id.
193
+ */
194
+ submitSignal(type: string, content: any, targetClientId?: string): void;
159
195
  /**
160
196
  * Will return when the data store is attached.
161
197
  */
@@ -185,12 +221,19 @@ export declare class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataS
185
221
  private processChannelOp;
186
222
  private attachListener;
187
223
  private verifyNotClosed;
224
+ /**
225
+ * Summarizer client should not have local changes. These changes can become part of the summary and can break
226
+ * eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas
227
+ * other clients that are up-to-date till seq# 100 may not have them yet.
228
+ */
229
+ private identifyLocalChangeInSummarizer;
188
230
  }
189
231
  /**
190
232
  * Mixin class that adds request handler to FluidDataStoreRuntime
191
233
  * Request handler is only called when data store can't resolve request, i.e. for custom requests.
192
234
  * @param Base - base class, inherits from FluidDataStoreRuntime
193
235
  * @param requestHandler - request handler to mix in
236
+ * @internal
194
237
  */
195
238
  export declare const mixinRequestHandler: (requestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>, Base?: typeof FluidDataStoreRuntime) => typeof FluidDataStoreRuntime;
196
239
  /**
@@ -198,6 +241,7 @@ export declare const mixinRequestHandler: (requestHandler: (request: IRequest, r
198
241
  * @param handler - handler that returns info about blob to be added to summary.
199
242
  * Or undefined not to add anything to summary.
200
243
  * @param Base - base class, inherits from FluidDataStoreRuntime
244
+ * @alpha
201
245
  */
202
246
  export declare const mixinSummaryHandler: (handler: (runtime: FluidDataStoreRuntime) => Promise<{
203
247
  path: string[];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OACzD,EAEN,mBAAmB,EAQnB,MAAM,iCAAiC;OACjC,EACN,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,MAAM,iCAAiC;OAEjC,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACd,MAAM,uCAAuC;OAEvC,EACN,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EAIzB,cAAc,EACd,MAAM,sCAAsC;OACtC,EAKN,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,MAAM,qCAAqC;OAarC,EACN,QAAQ,EACR,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,MAAM,uCAAuC;AAW9C;;GAEG;AACH,oBAAY,oBAAoB;IAE/B,MAAM,WAAW;IACjB,SAAS,OAAO;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAGrC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;CAC/C;AAED;;;GAGG;AACH,qBAAa,qBACZ,SAAQ,iBAAiB,CAAC,4BAA4B,CACtD,YAAW,sBAAsB,EAAE,sBAAsB,EAAE,mBAAmB;IAkH7E,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IAjHtC;;OAEG;IACH,SAAgB,UAAU,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAEtD,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,IAAW,QAAQ,IAAI,MAAM,GAAG,SAAS,CAExC;IAED,IAAW,aAAa,IAAI,cA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