@fluidframework/container-runtime 2.0.0-dev.1.4.6.106135 → 2.0.0-dev.2.3.0.115467

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 (239) hide show
  1. package/.eslintrc.js +1 -1
  2. package/dist/blobManager.d.ts +20 -5
  3. package/dist/blobManager.d.ts.map +1 -1
  4. package/dist/blobManager.js +57 -15
  5. package/dist/blobManager.js.map +1 -1
  6. package/dist/containerRuntime.d.ts +88 -51
  7. package/dist/containerRuntime.d.ts.map +1 -1
  8. package/dist/containerRuntime.js +205 -300
  9. package/dist/containerRuntime.js.map +1 -1
  10. package/dist/dataStore.d.ts.map +1 -1
  11. package/dist/dataStore.js +6 -0
  12. package/dist/dataStore.js.map +1 -1
  13. package/dist/dataStoreContext.d.ts +14 -21
  14. package/dist/dataStoreContext.d.ts.map +1 -1
  15. package/dist/dataStoreContext.js +71 -57
  16. package/dist/dataStoreContext.js.map +1 -1
  17. package/dist/dataStoreContexts.js +1 -1
  18. package/dist/dataStoreContexts.js.map +1 -1
  19. package/dist/dataStores.d.ts +11 -10
  20. package/dist/dataStores.d.ts.map +1 -1
  21. package/dist/dataStores.js +51 -20
  22. package/dist/dataStores.js.map +1 -1
  23. package/dist/garbageCollection.d.ts +40 -32
  24. package/dist/garbageCollection.d.ts.map +1 -1
  25. package/dist/garbageCollection.js +227 -161
  26. package/dist/garbageCollection.js.map +1 -1
  27. package/dist/garbageCollectionConstants.d.ts +19 -0
  28. package/dist/garbageCollectionConstants.d.ts.map +1 -0
  29. package/dist/garbageCollectionConstants.js +34 -0
  30. package/dist/garbageCollectionConstants.js.map +1 -0
  31. package/dist/gcSweepReadyUsageDetection.d.ts.map +1 -1
  32. package/dist/gcSweepReadyUsageDetection.js +5 -14
  33. package/dist/gcSweepReadyUsageDetection.js.map +1 -1
  34. package/dist/index.d.ts +6 -6
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +8 -9
  37. package/dist/index.js.map +1 -1
  38. package/dist/opLifecycle/batchManager.d.ts +30 -0
  39. package/dist/opLifecycle/batchManager.d.ts.map +1 -0
  40. package/dist/{batchManager.js → opLifecycle/batchManager.js} +25 -15
  41. package/dist/opLifecycle/batchManager.js.map +1 -0
  42. package/dist/opLifecycle/definitions.d.ts +40 -0
  43. package/dist/opLifecycle/definitions.d.ts.map +1 -0
  44. package/dist/opLifecycle/definitions.js +7 -0
  45. package/dist/opLifecycle/definitions.js.map +1 -0
  46. package/dist/opLifecycle/index.d.ts +12 -0
  47. package/dist/opLifecycle/index.d.ts.map +1 -0
  48. package/dist/opLifecycle/index.js +21 -0
  49. package/dist/opLifecycle/index.js.map +1 -0
  50. package/dist/opLifecycle/opCompressor.d.ts +18 -0
  51. package/dist/opLifecycle/opCompressor.d.ts.map +1 -0
  52. package/dist/opLifecycle/opCompressor.js +53 -0
  53. package/dist/opLifecycle/opCompressor.js.map +1 -0
  54. package/dist/opLifecycle/opDecompressor.d.ts +20 -0
  55. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -0
  56. package/dist/opLifecycle/opDecompressor.js +72 -0
  57. package/dist/opLifecycle/opDecompressor.js.map +1 -0
  58. package/dist/opLifecycle/opSplitter.d.ts +17 -0
  59. package/dist/opLifecycle/opSplitter.d.ts.map +1 -0
  60. package/dist/opLifecycle/opSplitter.js +61 -0
  61. package/dist/opLifecycle/opSplitter.js.map +1 -0
  62. package/dist/opLifecycle/outbox.d.ts +47 -0
  63. package/dist/opLifecycle/outbox.d.ts.map +1 -0
  64. package/dist/opLifecycle/outbox.js +153 -0
  65. package/dist/opLifecycle/outbox.js.map +1 -0
  66. package/dist/opLifecycle/remoteMessageProcessor.d.ts +26 -0
  67. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
  68. package/dist/opLifecycle/remoteMessageProcessor.js +81 -0
  69. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -0
  70. package/dist/packageVersion.d.ts +1 -1
  71. package/dist/packageVersion.js +1 -1
  72. package/dist/packageVersion.js.map +1 -1
  73. package/dist/pendingStateManager.d.ts +6 -26
  74. package/dist/pendingStateManager.d.ts.map +1 -1
  75. package/dist/pendingStateManager.js +42 -62
  76. package/dist/pendingStateManager.js.map +1 -1
  77. package/dist/runningSummarizer.d.ts +3 -2
  78. package/dist/runningSummarizer.d.ts.map +1 -1
  79. package/dist/runningSummarizer.js +10 -3
  80. package/dist/runningSummarizer.js.map +1 -1
  81. package/dist/scheduleManager.js.map +1 -1
  82. package/dist/summarizer.js +7 -2
  83. package/dist/summarizer.js.map +1 -1
  84. package/dist/summarizerClientElection.js +1 -1
  85. package/dist/summarizerClientElection.js.map +1 -1
  86. package/dist/summarizerHeuristics.d.ts.map +1 -1
  87. package/dist/summarizerHeuristics.js +0 -3
  88. package/dist/summarizerHeuristics.js.map +1 -1
  89. package/dist/summarizerTypes.d.ts +19 -2
  90. package/dist/summarizerTypes.d.ts.map +1 -1
  91. package/dist/summarizerTypes.js.map +1 -1
  92. package/dist/summaryFormat.d.ts +4 -2
  93. package/dist/summaryFormat.d.ts.map +1 -1
  94. package/dist/summaryFormat.js +2 -2
  95. package/dist/summaryFormat.js.map +1 -1
  96. package/dist/summaryGenerator.d.ts.map +1 -1
  97. package/dist/summaryGenerator.js +3 -2
  98. package/dist/summaryGenerator.js.map +1 -1
  99. package/dist/summaryManager.d.ts.map +1 -1
  100. package/dist/summaryManager.js +10 -6
  101. package/dist/summaryManager.js.map +1 -1
  102. package/garbageCollection.md +27 -22
  103. package/lib/blobManager.d.ts +20 -5
  104. package/lib/blobManager.d.ts.map +1 -1
  105. package/lib/blobManager.js +59 -17
  106. package/lib/blobManager.js.map +1 -1
  107. package/lib/containerRuntime.d.ts +88 -51
  108. package/lib/containerRuntime.d.ts.map +1 -1
  109. package/lib/containerRuntime.js +203 -297
  110. package/lib/containerRuntime.js.map +1 -1
  111. package/lib/dataStore.d.ts.map +1 -1
  112. package/lib/dataStore.js +6 -0
  113. package/lib/dataStore.js.map +1 -1
  114. package/lib/dataStoreContext.d.ts +14 -21
  115. package/lib/dataStoreContext.d.ts.map +1 -1
  116. package/lib/dataStoreContext.js +75 -61
  117. package/lib/dataStoreContext.js.map +1 -1
  118. package/lib/dataStoreContexts.js +1 -1
  119. package/lib/dataStoreContexts.js.map +1 -1
  120. package/lib/dataStores.d.ts +11 -10
  121. package/lib/dataStores.d.ts.map +1 -1
  122. package/lib/dataStores.js +53 -22
  123. package/lib/dataStores.js.map +1 -1
  124. package/lib/garbageCollection.d.ts +40 -32
  125. package/lib/garbageCollection.d.ts.map +1 -1
  126. package/lib/garbageCollection.js +220 -154
  127. package/lib/garbageCollection.js.map +1 -1
  128. package/lib/garbageCollectionConstants.d.ts +19 -0
  129. package/lib/garbageCollectionConstants.d.ts.map +1 -0
  130. package/lib/garbageCollectionConstants.js +31 -0
  131. package/lib/garbageCollectionConstants.js.map +1 -0
  132. package/lib/gcSweepReadyUsageDetection.d.ts.map +1 -1
  133. package/lib/gcSweepReadyUsageDetection.js +4 -13
  134. package/lib/gcSweepReadyUsageDetection.js.map +1 -1
  135. package/lib/index.d.ts +6 -6
  136. package/lib/index.d.ts.map +1 -1
  137. package/lib/index.js +3 -4
  138. package/lib/index.js.map +1 -1
  139. package/lib/opLifecycle/batchManager.d.ts +30 -0
  140. package/lib/opLifecycle/batchManager.d.ts.map +1 -0
  141. package/lib/{batchManager.js → opLifecycle/batchManager.js} +25 -15
  142. package/lib/opLifecycle/batchManager.js.map +1 -0
  143. package/lib/opLifecycle/definitions.d.ts +40 -0
  144. package/lib/opLifecycle/definitions.d.ts.map +1 -0
  145. package/lib/opLifecycle/definitions.js +6 -0
  146. package/lib/opLifecycle/definitions.js.map +1 -0
  147. package/lib/opLifecycle/index.d.ts +12 -0
  148. package/lib/opLifecycle/index.d.ts.map +1 -0
  149. package/lib/opLifecycle/index.js +11 -0
  150. package/lib/opLifecycle/index.js.map +1 -0
  151. package/lib/opLifecycle/opCompressor.d.ts +18 -0
  152. package/lib/opLifecycle/opCompressor.d.ts.map +1 -0
  153. package/lib/opLifecycle/opCompressor.js +49 -0
  154. package/lib/opLifecycle/opCompressor.js.map +1 -0
  155. package/lib/opLifecycle/opDecompressor.d.ts +20 -0
  156. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -0
  157. package/lib/opLifecycle/opDecompressor.js +68 -0
  158. package/lib/opLifecycle/opDecompressor.js.map +1 -0
  159. package/lib/opLifecycle/opSplitter.d.ts +17 -0
  160. package/lib/opLifecycle/opSplitter.d.ts.map +1 -0
  161. package/lib/opLifecycle/opSplitter.js +57 -0
  162. package/lib/opLifecycle/opSplitter.js.map +1 -0
  163. package/lib/opLifecycle/outbox.d.ts +47 -0
  164. package/lib/opLifecycle/outbox.d.ts.map +1 -0
  165. package/lib/opLifecycle/outbox.js +149 -0
  166. package/lib/opLifecycle/outbox.js.map +1 -0
  167. package/lib/opLifecycle/remoteMessageProcessor.d.ts +26 -0
  168. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -0
  169. package/lib/opLifecycle/remoteMessageProcessor.js +76 -0
  170. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -0
  171. package/lib/packageVersion.d.ts +1 -1
  172. package/lib/packageVersion.js +1 -1
  173. package/lib/packageVersion.js.map +1 -1
  174. package/lib/pendingStateManager.d.ts +6 -26
  175. package/lib/pendingStateManager.d.ts.map +1 -1
  176. package/lib/pendingStateManager.js +42 -62
  177. package/lib/pendingStateManager.js.map +1 -1
  178. package/lib/runningSummarizer.d.ts +3 -2
  179. package/lib/runningSummarizer.d.ts.map +1 -1
  180. package/lib/runningSummarizer.js +10 -3
  181. package/lib/runningSummarizer.js.map +1 -1
  182. package/lib/scheduleManager.js.map +1 -1
  183. package/lib/summarizer.js +7 -2
  184. package/lib/summarizer.js.map +1 -1
  185. package/lib/summarizerClientElection.js +1 -1
  186. package/lib/summarizerClientElection.js.map +1 -1
  187. package/lib/summarizerHeuristics.d.ts.map +1 -1
  188. package/lib/summarizerHeuristics.js +0 -3
  189. package/lib/summarizerHeuristics.js.map +1 -1
  190. package/lib/summarizerTypes.d.ts +19 -2
  191. package/lib/summarizerTypes.d.ts.map +1 -1
  192. package/lib/summarizerTypes.js.map +1 -1
  193. package/lib/summaryFormat.d.ts +4 -2
  194. package/lib/summaryFormat.d.ts.map +1 -1
  195. package/lib/summaryFormat.js +1 -1
  196. package/lib/summaryFormat.js.map +1 -1
  197. package/lib/summaryGenerator.d.ts.map +1 -1
  198. package/lib/summaryGenerator.js +3 -2
  199. package/lib/summaryGenerator.js.map +1 -1
  200. package/lib/summaryManager.d.ts.map +1 -1
  201. package/lib/summaryManager.js +10 -6
  202. package/lib/summaryManager.js.map +1 -1
  203. package/package.json +32 -71
  204. package/prettier.config.cjs +8 -0
  205. package/src/blobManager.ts +74 -19
  206. package/src/containerRuntime.ts +286 -369
  207. package/src/dataStore.ts +13 -1
  208. package/src/dataStoreContext.ts +100 -76
  209. package/src/dataStoreContexts.ts +1 -1
  210. package/src/dataStores.ts +61 -22
  211. package/src/garbageCollection.ts +282 -163
  212. package/src/garbageCollectionConstants.ts +35 -0
  213. package/src/gcSweepReadyUsageDetection.ts +3 -11
  214. package/src/index.ts +9 -8
  215. package/src/{batchManager.ts → opLifecycle/batchManager.ts} +42 -28
  216. package/src/opLifecycle/definitions.ts +44 -0
  217. package/src/opLifecycle/index.ts +17 -0
  218. package/src/opLifecycle/opCompressor.ts +64 -0
  219. package/src/opLifecycle/opDecompressor.ts +84 -0
  220. package/src/opLifecycle/opSplitter.ts +78 -0
  221. package/src/opLifecycle/outbox.ts +204 -0
  222. package/src/opLifecycle/remoteMessageProcessor.ts +90 -0
  223. package/src/packageVersion.ts +1 -1
  224. package/src/pendingStateManager.ts +57 -96
  225. package/src/runningSummarizer.ts +11 -3
  226. package/src/scheduleManager.ts +1 -0
  227. package/src/summarizer.ts +6 -6
  228. package/src/summarizerClientElection.ts +1 -1
  229. package/src/summarizerHeuristics.ts +0 -3
  230. package/src/summarizerTypes.ts +20 -7
  231. package/src/summaryFormat.ts +5 -3
  232. package/src/summaryGenerator.ts +3 -2
  233. package/src/summaryManager.ts +18 -7
  234. package/dist/batchManager.d.ts +0 -37
  235. package/dist/batchManager.d.ts.map +0 -1
  236. package/dist/batchManager.js.map +0 -1
  237. package/lib/batchManager.d.ts +0 -37
  238. package/lib/batchManager.d.ts.map +0 -1
  239. package/lib/batchManager.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAKtE,OAAO,EAAe,UAAU,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAEtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC,uCAAuC;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,+BACJ,GAAG,yDAIlC,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BACJ,sBAAsB,cACjC,MAAM,WACT,gBAAgB,cACb,UAAU,UACd,gBAAgB,KACzB,UAA2F,CAAC"}
1
+ {"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAUtE,OAAO,EAAe,UAAU,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAEtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC,uCAAuC;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,+BACJ,GAAG,yDAIlC,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BACJ,sBAAsB,cACjC,MAAM,WACT,gBAAgB,cACb,UAAU,UACd,gBAAgB,KACzB,UAA2F,CAAC"}
package/dist/dataStore.js CHANGED
@@ -116,6 +116,12 @@ class DataStore {
116
116
  async request(request) {
117
117
  return this.fluidDataStoreChannel.request(request);
118
118
  }
119
+ /**
120
+ * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}
121
+ */
122
+ get entryPoint() {
123
+ return this.fluidDataStoreChannel.entryPoint;
124
+ }
119
125
  get IFluidRouter() { return this.fluidDataStoreChannel; }
120
126
  async ackBasedPromise(executor) {
121
127
  let rejectBecauseDispose;
@@ -1 +1 @@
1
- {"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAuE;AACvE,iFAAoE;AACpE,qEAA6D;AAG7D,qEAAmE;AAenE;;;;;GAKG;AACI,MAAM,uBAAuB,GAAG,CACnC,0BAA+B,EACqB,EAAE;IACtD,OAAO,OAAO,CAAA,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,CAAE,UAAU,CAAA,KAAK,QAAQ;WAC1D,OAAO,CAAA,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,CAAE,KAAK,CAAA,KAAK,QAAQ,CAAC;AACjE,CAAC,CAAC;AALW,QAAA,uBAAuB,2BAKlC;AAEK,MAAM,kBAAkB,GAAG,CAC9B,qBAA6C,EAC7C,UAAkB,EAClB,OAAyB,EACzB,UAAsB,EACtB,MAAwB,EACd,EAAE,CAAC,IAAI,SAAS,CAAC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K,CAAC,oEAAoE,CAAC,CAAC,CAAC;YAElG,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACvB,oBAAoB,EAAE,CAAC;gBACvB,OAAO;aACV;YAED,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","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, unreachableCase } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { AliasResult, IDataStore, IFluidDataStoreChannel } from \"@fluidframework/runtime-definitions\";\nimport { TelemetryDataTag } from \"@fluidframework/telemetry-utils\";\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport { DataStores } from \"./dataStores\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n /** The internal id of the datastore */\n readonly internalId: string;\n /** The alias name to be assigned to the datastore */\n readonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements {@link IDataStoreAliasMessage}\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise\n */\nexport const isDataStoreAliasMessage = (\n maybeDataStoreAliasMessage: any,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n return typeof maybeDataStoreAliasMessage?.internalId === \"string\"\n && typeof maybeDataStoreAliasMessage?.alias === \"string\";\n};\n\nexport const channelToDataStore = (\n fluidDataStoreChannel: IFluidDataStoreChannel,\n internalId: string,\n runtime: ContainerRuntime,\n datastores: DataStores,\n logger: ITelemetryLogger,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);\n\nenum AliasState {\n Aliased = \"Aliased\",\n Aliasing = \"Aliasing\",\n None = \"None\",\n}\n\nclass DataStore implements IDataStore {\n private aliasState: AliasState = AliasState.None;\n private alias: string | undefined;\n private readonly pendingAliases: Map<string, Promise<AliasResult>>;\n private aliasResult: Promise<AliasResult> | undefined;\n\n async trySetAlias(alias: string): Promise<AliasResult> {\n if (alias.includes(\"/\")) {\n throw new UsageError(`The alias cannot contain slashes: '${alias}'`);\n }\n\n switch (this.aliasState) {\n // If we're already aliasing, check if it's for the same value and return\n // the stored promise, otherwise return 'AlreadyAliased'\n case AliasState.Aliasing:\n assert(this.aliasResult !== undefined,\n 0x316 /* There should be a cached promise of in-progress aliasing */);\n await this.aliasResult;\n return this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\n // If this datastore is already aliased, return true only if this\n // is a repeated call for the same alias\n case AliasState.Aliased:\n return this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\n case AliasState.None: {\n const existingAlias = this.pendingAliases.get(alias);\n if (existingAlias !== undefined) {\n // There is already another datastore which will be aliased\n // to the same name\n return \"Conflict\";\n }\n\n // There is no current or past alias operation for this datastore,\n // or for this alias, so it is safe to continue execution\n break;\n }\n\n default: unreachableCase(this.aliasState);\n }\n\n this.aliasState = AliasState.Aliasing;\n this.aliasResult = this.trySetAliasInternal(alias);\n this.pendingAliases.set(alias, this.aliasResult);\n return this.aliasResult;\n }\n\n async trySetAliasInternal(alias: string): Promise<AliasResult> {\n const message: IDataStoreAliasMessage = {\n internalId: this.internalId,\n alias,\n };\n\n this.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n if (this.runtime.attachState === AttachState.Detached) {\n const localResult = this.datastores.processAliasMessageCore(message);\n // Explicitly lock-out future attempts of aliasing,\n // regardless of result\n this.aliasState = AliasState.Aliased;\n return localResult ? \"Success\" : \"Conflict\";\n }\n\n const aliased = await this\n .ackBasedPromise<boolean>((resolve) => {\n this.runtime.submitDataStoreAliasOp(message, resolve);\n })\n .catch((error) => {\n this.logger.sendErrorEvent({\n eventName: \"AliasingException\",\n alias: {\n value: alias,\n tag: TelemetryDataTag.UserData,\n },\n internalId: {\n value: this.internalId,\n tag: TelemetryDataTag.CodeArtifact,\n },\n }, error);\n\n return false;\n }).finally(() => {\n this.pendingAliases.delete(alias);\n });\n\n if (!aliased) {\n this.aliasState = AliasState.None;\n this.aliasResult = undefined;\n return \"Conflict\";\n }\n\n this.alias = alias;\n this.aliasState = AliasState.Aliased;\n return \"Success\";\n }\n\n async request(request: IRequest): Promise<IResponse> {\n return this.fluidDataStoreChannel.request(request);\n }\n\n constructor(\n private readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n private readonly internalId: string,\n private readonly runtime: ContainerRuntime,\n private readonly datastores: DataStores,\n private readonly logger: ITelemetryLogger,\n ) {\n this.pendingAliases = datastores.pendingAliases;\n }\n\n public get IFluidRouter() { return this.fluidDataStoreChannel; }\n\n private async ackBasedPromise<T>(\n executor: (resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void) => void,\n ): Promise<T> {\n let rejectBecauseDispose: () => void;\n return new Promise<T>((resolve, reject) => {\n rejectBecauseDispose =\n () => reject(new Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"));\n\n if (this.runtime.disposed) {\n rejectBecauseDispose();\n return;\n }\n\n this.runtime.on(\"dispose\", rejectBecauseDispose);\n executor(resolve, reject);\n }).finally(() => {\n this.runtime.off(\"dispose\", rejectBecauseDispose);\n });\n }\n}\n"]}
1
+ {"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAuE;AACvE,iFAAoE;AAC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nB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC;QACrC,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAiB;QAC3B,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC;IACjD,CAAC;IAYD,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAExD,KAAK,CAAC,eAAe,CACzB,QAC2C;QAE3C,IAAI,oBAAgC,CAAC;QACrC,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,oBAAoB;gBAChB,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC,CAAC;YAElG,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACvB,oBAAoB,EAAE,CAAC;gBACvB,OAAO;aACV;YAED,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","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, unreachableCase } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport {\n FluidObject,\n IFluidHandle,\n IRequest,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { AliasResult, IDataStore, IFluidDataStoreChannel } from \"@fluidframework/runtime-definitions\";\nimport { TelemetryDataTag } from \"@fluidframework/telemetry-utils\";\nimport { ContainerRuntime } from \"./containerRuntime\";\nimport { DataStores } from \"./dataStores\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n */\nexport interface IDataStoreAliasMessage {\n /** The internal id of the datastore */\n readonly internalId: string;\n /** The alias name to be assigned to the datastore */\n readonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements {@link IDataStoreAliasMessage}\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise\n */\nexport const isDataStoreAliasMessage = (\n maybeDataStoreAliasMessage: any,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n return typeof maybeDataStoreAliasMessage?.internalId === \"string\"\n && typeof maybeDataStoreAliasMessage?.alias === \"string\";\n};\n\nexport const channelToDataStore = (\n fluidDataStoreChannel: IFluidDataStoreChannel,\n internalId: string,\n runtime: ContainerRuntime,\n datastores: DataStores,\n logger: ITelemetryLogger,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, runtime, datastores, logger);\n\nenum AliasState {\n Aliased = \"Aliased\",\n Aliasing = \"Aliasing\",\n None = \"None\",\n}\n\nclass DataStore implements IDataStore {\n private aliasState: AliasState = AliasState.None;\n private alias: string | undefined;\n private readonly pendingAliases: Map<string, Promise<AliasResult>>;\n private aliasResult: Promise<AliasResult> | undefined;\n\n async trySetAlias(alias: string): Promise<AliasResult> {\n if (alias.includes(\"/\")) {\n throw new UsageError(`The alias cannot contain slashes: '${alias}'`);\n }\n\n switch (this.aliasState) {\n // If we're already aliasing, check if it's for the same value and return\n // the stored promise, otherwise return 'AlreadyAliased'\n case AliasState.Aliasing:\n assert(this.aliasResult !== undefined,\n 0x316 /* There should be a cached promise of in-progress aliasing */);\n await this.aliasResult;\n return this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\n // If this datastore is already aliased, return true only if this\n // is a repeated call for the same alias\n case AliasState.Aliased:\n return this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\n case AliasState.None: {\n const existingAlias = this.pendingAliases.get(alias);\n if (existingAlias !== undefined) {\n // There is already another datastore which will be aliased\n // to the same name\n return \"Conflict\";\n }\n\n // There is no current or past alias operation for this datastore,\n // or for this alias, so it is safe to continue execution\n break;\n }\n\n default: unreachableCase(this.aliasState);\n }\n\n this.aliasState = AliasState.Aliasing;\n this.aliasResult = this.trySetAliasInternal(alias);\n this.pendingAliases.set(alias, this.aliasResult);\n return this.aliasResult;\n }\n\n async trySetAliasInternal(alias: string): Promise<AliasResult> {\n const message: IDataStoreAliasMessage = {\n internalId: this.internalId,\n alias,\n };\n\n this.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n if (this.runtime.attachState === AttachState.Detached) {\n const localResult = this.datastores.processAliasMessageCore(message);\n // Explicitly lock-out future attempts of aliasing,\n // regardless of result\n this.aliasState = AliasState.Aliased;\n return localResult ? \"Success\" : \"Conflict\";\n }\n\n const aliased = await this\n .ackBasedPromise<boolean>((resolve) => {\n this.runtime.submitDataStoreAliasOp(message, resolve);\n })\n .catch((error) => {\n this.logger.sendErrorEvent({\n eventName: \"AliasingException\",\n alias: {\n value: alias,\n tag: TelemetryDataTag.UserData,\n },\n internalId: {\n value: this.internalId,\n tag: TelemetryDataTag.CodeArtifact,\n },\n }, error);\n\n return false;\n }).finally(() => {\n this.pendingAliases.delete(alias);\n });\n\n if (!aliased) {\n this.aliasState = AliasState.None;\n this.aliasResult = undefined;\n return \"Conflict\";\n }\n\n this.alias = alias;\n this.aliasState = AliasState.Aliased;\n return \"Success\";\n }\n\n async request(request: IRequest): Promise<IResponse> {\n return this.fluidDataStoreChannel.request(request);\n }\n\n /**\n * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n */\n get entryPoint(): IFluidHandle<FluidObject> | undefined {\n return this.fluidDataStoreChannel.entryPoint;\n }\n\n constructor(\n private readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n private readonly internalId: string,\n private readonly runtime: ContainerRuntime,\n private readonly datastores: DataStores,\n private readonly logger: ITelemetryLogger,\n ) {\n this.pendingAliases = datastores.pendingAliases;\n }\n\n public get IFluidRouter() { return this.fluidDataStoreChannel; }\n\n private async ackBasedPromise<T>(\n executor: (resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: any) => void) => void,\n ): Promise<T> {\n let rejectBecauseDispose: () => void;\n return new Promise<T>((resolve, reject) => {\n rejectBecauseDispose =\n () => reject(new Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"));\n\n if (this.runtime.disposed) {\n rejectBecauseDispose();\n return;\n }\n\n this.runtime.on(\"dispose\", rejectBecauseDispose);\n executor(resolve, reject);\n }).finally(() => {\n this.runtime.off(\"dispose\", rejectBecauseDispose);\n });\n }\n}\n"]}
@@ -9,7 +9,7 @@ import { Deferred, TypedEventEmitter } from "@fluidframework/common-utils";
9
9
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
10
10
  import { IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, ISnapshotTree, ITreeEntry } from "@fluidframework/protocol-definitions";
11
11
  import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
12
- import { BindState, CreateChildSummarizerNodeFn, CreateChildSummarizerNodeParam, IAttachMessage, IFluidDataStoreChannel, IFluidDataStoreContext, IFluidDataStoreContextDetached, IFluidDataStoreContextEvents, IFluidDataStoreRegistry, IGarbageCollectionData, IGarbageCollectionDetailsBase, IGarbageCollectionSummaryDetails, IInboundSignalMessage, IProvideFluidDataStoreFactory, ISummarizeResult, ISummarizerNodeWithGC, SummarizeInternalFn, ITelemetryContext } from "@fluidframework/runtime-definitions";
12
+ import { BindState, CreateChildSummarizerNodeFn, CreateChildSummarizerNodeParam, IAttachMessage, IFluidDataStoreChannel, IFluidDataStoreContext, IFluidDataStoreContextDetached, IFluidDataStoreContextEvents, IFluidDataStoreRegistry, IGarbageCollectionData, IGarbageCollectionDetailsBase, IInboundSignalMessage, IProvideFluidDataStoreFactory, ISummarizeResult, ISummarizerNodeWithGC, SummarizeInternalFn, ITelemetryContext } from "@fluidframework/runtime-definitions";
13
13
  import { ContainerRuntime } from "./containerRuntime";
14
14
  export declare function createAttributesBlob(pkg: readonly string[], isRootDataStore: boolean): ITreeEntry;
15
15
  interface ISnapshotDetails {
@@ -24,7 +24,6 @@ export interface IFluidDataStoreContextProps {
24
24
  readonly storage: IDocumentStorageService;
25
25
  readonly scope: FluidObject;
26
26
  readonly createSummarizerNodeFn: CreateChildSummarizerNodeFn;
27
- readonly writeGCDataAtRoot: boolean;
28
27
  readonly pkg?: Readonly<string[]>;
29
28
  }
30
29
  /** Properties necessary for creating a local FluidDataStoreContext */
@@ -40,7 +39,7 @@ export interface ILocalFluidDataStoreContextProps extends IFluidDataStoreContext
40
39
  }
41
40
  /** Properties necessary for creating a remote FluidDataStoreContext */
42
41
  export interface IRemoteFluidDataStoreContextProps extends IFluidDataStoreContextProps {
43
- readonly snapshotTree: ISnapshotTree | string | undefined;
42
+ readonly snapshotTree: ISnapshotTree | undefined;
44
43
  readonly getBaseGCDetails: () => Promise<IGarbageCollectionDetailsBase | undefined>;
45
44
  }
46
45
  /**
@@ -64,6 +63,14 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
64
63
  get baseSnapshot(): ISnapshotTree | undefined;
65
64
  private _disposed;
66
65
  get disposed(): boolean;
66
+ /**
67
+ * Tombstone is a temporary feature that prevents a data store from sending / receiving ops, signals and from
68
+ * loading.
69
+ */
70
+ private _tombstoned;
71
+ get tombstoned(): boolean;
72
+ /** If true, throw an error when a tombstone data store is used. */
73
+ private readonly throwOnTombstoneUsage;
67
74
  get attachState(): AttachState;
68
75
  get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined;
69
76
  /**
@@ -93,19 +100,19 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
93
100
  protected _attachState: AttachState;
94
101
  private _isInMemoryRoot;
95
102
  protected readonly summarizerNode: ISummarizerNodeWithGC;
96
- private readonly subLogger;
103
+ private readonly mc;
97
104
  private readonly thresholdOpsCounter;
98
105
  private static readonly pendingOpsCountThreshold;
99
- private lastUsedState;
106
+ private lastUsedRoutes;
100
107
  readonly id: string;
101
108
  private readonly _containerRuntime;
102
109
  readonly storage: IDocumentStorageService;
103
110
  readonly scope: FluidObject;
104
- private readonly writeGCDataAtRoot;
105
111
  protected pkg?: readonly string[];
106
112
  constructor(props: IFluidDataStoreContextProps, existing: boolean, bindState: BindState, // Used to assert for state tracking purposes
107
113
  isLocalDataStore: boolean, makeLocallyVisibleFn: () => void);
108
114
  dispose(): void;
115
+ setTombstone(tombstone: boolean): void;
109
116
  private rejectDeferredRealize;
110
117
  realize(): Promise<IFluidDataStoreChannel>;
111
118
  protected factoryFromPackagePath(packages?: readonly string[]): Promise<{
@@ -162,10 +169,8 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
162
169
  * 5. To update the timestamp when this data store or any children are marked as unreferenced.
163
170
  *
164
171
  * @param usedRoutes - The routes that are used in this data store.
165
- * @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced
166
- * as part of this GC run, this should be used to update the time when it happens.
167
172
  */
168
- updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): void;
173
+ updateUsedRoutes(usedRoutes: string[]): void;
169
174
  /**
170
175
  * Called when a new outbound reference is added to another node. This is used by garbage collection to identify
171
176
  * all references added in the system.
@@ -211,10 +216,6 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
211
216
  * It will be removed, as the source of truth for this flag will be the aliasing blob.
212
217
  */
213
218
  setInMemoryRoot(): void;
214
- /**
215
- * @deprecated Renamed to `{@link FluidDataStoreContext.getBaseGCDetails}()`.
216
- */
217
- abstract getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails>;
218
219
  abstract getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
219
220
  reSubmit(contents: any, localOpMetadata: unknown): void;
220
221
  rollback(contents: any, localOpMetadata: unknown): void;
@@ -229,10 +230,6 @@ export declare class RemoteFluidDataStoreContext extends FluidDataStoreContext {
229
230
  constructor(props: IRemoteFluidDataStoreContextProps);
230
231
  private readonly initialSnapshotDetailsP;
231
232
  getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
232
- /**
233
- * @deprecated Renamed to {@link RemoteFluidDataStoreContext.getBaseGCDetails}.
234
- */
235
- getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails>;
236
233
  getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
237
234
  generateAttachMessage(): IAttachMessage;
238
235
  }
@@ -249,10 +246,6 @@ export declare class LocalFluidDataStoreContextBase extends FluidDataStoreContex
249
246
  private attachListeners;
250
247
  generateAttachMessage(): IAttachMessage;
251
248
  getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
252
- /**
253
- * @deprecated Renamed to {@link LocalFluidDataStoreContextBase.getBaseGCDetails}.
254
- */
255
- getInitialGCSummaryDetails(): Promise<IGarbageCollectionSummaryDetails>;
256
249
  getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
257
250
  }
258
251
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreContext.d.ts","sourceRoot":"","sources":["../src/dataStoreContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EACH,WAAW,EACX,QAAQ,EACR,SAAS,EACT,YAAY,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,SAAS,EACT,aAAa,EACb,WAAW,EACX,cAAc,EACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEH,QAAQ,EAER,iBAAiB,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,E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CAAC,QAAQ,CAAC,iBAAiB,CAA4B;IAC9D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAyC;gBAE5D,KAAK,EAAE,iCAAiC;IAqBpD,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CA0CrC;IAEU,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAItD,gBAAgB,IAAI,OAAO,CAAC,6BAA6B,CAAC;IAIhE,qBAAqB,IAAI,cAAc;CAGjD;AAED;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,qBAAqB;IACrE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD;;OAEG;IACH,SAAgB,WAAW,CAAC,EAAE,GAAG,CAAC;gBAEtB,KAAK,EAAE,gCAAgC;IAiBnD,OAAO,CAAC,eAAe;IAWhB,qBAAqB,IAAI,cAAc;IA4BjC,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAiCtD,gBAAgB,IAAI,OAAO,CAAC,6BAA6B,CAAC;CAI1E;AAED;;;;;GAKG;AACH,qBAAa,0BAA2B,SAAQ,8BAA8B;gBAC9D,KAAK,EAAE,gCAAgC;CAGtD;AAED;;;;;GAKG;AACH,qBAAa,kCACT,SAAQ,8BACR,YAAW,8BAA8B;gBAC7B,KAAK,EAAE,gCAAgC;IAKtC,aAAa,CACtB,QAAQ,EAAE,6BAA6B,EACvC,gBAAgB,EAAE,sBAAsB;IA+B/B,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAMtE"}
@@ -14,6 +14,8 @@ const runtime_utils_1 = require("@fluidframework/runtime-utils");
14
14
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
15
15
  const container_utils_1 = require("@fluidframework/container-utils");
16
16
  const summaryFormat_1 = require("./summaryFormat");
17
+ const garbageCollectionConstants_1 = require("./garbageCollectionConstants");
18
+ const summarizerClientElection_1 = require("./summarizerClientElection");
17
19
  function createAttributes(pkg, isRootDataStore) {
18
20
  const stringifiedPkg = JSON.stringify(pkg);
19
21
  return {
@@ -39,6 +41,11 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
39
41
  this.isLocalDataStore = isLocalDataStore;
40
42
  this.makeLocallyVisibleFn = makeLocallyVisibleFn;
41
43
  this._disposed = false;
44
+ /**
45
+ * Tombstone is a temporary feature that prevents a data store from sending / receiving ops, signals and from
46
+ * loading.
47
+ */
48
+ this._tombstoned = false;
42
49
  this.detachedRuntimeCreation = false;
43
50
  this.loaded = false;
44
51
  this.pending = [];
@@ -47,7 +54,6 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
47
54
  this.id = props.id;
48
55
  this.storage = props.storage;
49
56
  this.scope = props.scope;
50
- this.writeGCDataAtRoot = props.writeGCDataAtRoot;
51
57
  this.pkg = props.pkg;
52
58
  // URIs use slashes as delimiters. Handles use URIs.
53
59
  // Thus having slashes in types almost guarantees trouble down the road!
@@ -63,8 +69,12 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
63
69
  };
64
70
  const thisSummarizeInternal = async (fullTree, trackState, telemetryContext) => this.summarizeInternal(fullTree, trackState, telemetryContext);
65
71
  this.summarizerNode = props.createSummarizerNodeFn(thisSummarizeInternal, async (fullGC) => this.getGCDataInternal(fullGC), async () => this.getBaseGCDetails());
66
- this.subLogger = telemetry_utils_1.ChildLogger.create(this.logger, "FluidDataStoreContext");
67
- this.thresholdOpsCounter = new telemetry_utils_1.ThresholdCounter(FluidDataStoreContext.pendingOpsCountThreshold, this.subLogger);
72
+ this.mc = (0, telemetry_utils_1.loggerToMonitoringContext)(telemetry_utils_1.ChildLogger.create(this.logger, "FluidDataStoreContext"));
73
+ this.thresholdOpsCounter = new telemetry_utils_1.ThresholdCounter(FluidDataStoreContext.pendingOpsCountThreshold, this.mc.logger);
74
+ // Tombstone should only throw when the feature flag is enabled and the client isn't a summarizer
75
+ this.throwOnTombstoneUsage =
76
+ this.mc.config.getBoolean(garbageCollectionConstants_1.throwOnTombstoneUsageKey) === true &&
77
+ this.clientDetails.type !== summarizerClientElection_1.summarizerClientType;
68
78
  }
69
79
  get packagePath() {
70
80
  (0, common_utils_1.assert)(this.pkg !== undefined, 0x139 /* "Undefined package path" */);
@@ -101,6 +111,7 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
101
111
  return this._baseSnapshot;
102
112
  }
103
113
  get disposed() { return this._disposed; }
114
+ get tombstoned() { return this._tombstoned; }
104
115
  get attachState() {
105
116
  return this._attachState;
106
117
  }
@@ -139,6 +150,12 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
139
150
  }).catch((error) => { });
140
151
  }
141
152
  }
153
+ setTombstone(tombstone) {
154
+ if (this.tombstoned === tombstone) {
155
+ return;
156
+ }
157
+ this._tombstoned = tombstone;
158
+ }
142
159
  rejectDeferredRealize(reason, packageName) {
143
160
  throw new telemetry_utils_1.LoggingError(reason, { packageName: { value: packageName, tag: telemetry_utils_1.TelemetryDataTag.CodeArtifact } });
144
161
  }
@@ -207,7 +224,8 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
207
224
  * its new client ID when we are connecting or connected.
208
225
  */
209
226
  setConnectionState(connected, clientId) {
210
- this.verifyNotClosed();
227
+ // ConnectionState should not fail in tombstone mode as this is internally run
228
+ this.verifyNotClosed("setConnectionState", false /* checkTombstone */);
211
229
  // Connection events are ignored if the store is not yet loaded
212
230
  if (!this.loaded) {
213
231
  return;
@@ -218,7 +236,7 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
218
236
  }
219
237
  process(messageArg, local, localOpMetadata) {
220
238
  var _a;
221
- this.verifyNotClosed();
239
+ this.verifyNotClosed("process", true, (0, container_utils_1.extractSafePropertiesFromMessage)(messageArg));
222
240
  const innerContents = messageArg.contents;
223
241
  const message = Object.assign(Object.assign({}, messageArg), { type: innerContents.type, contents: innerContents.content });
224
242
  this.summarizerNode.recordChange(message);
@@ -234,7 +252,7 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
234
252
  }
235
253
  processSignal(message, local) {
236
254
  var _a;
237
- this.verifyNotClosed();
255
+ this.verifyNotClosed("processSignal");
238
256
  // Signals are ignored if the store is not yet loaded
239
257
  if (!this.loaded) {
240
258
  return;
@@ -268,10 +286,6 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
268
286
  const isRoot = await this.isRoot();
269
287
  const attributes = createAttributes(pkg, isRoot);
270
288
  (0, runtime_utils_1.addBlobToSummary)(summarizeResult, summaryFormat_1.dataStoreAttributesBlobName, JSON.stringify(attributes));
271
- // Add GC data to the summary if it's not written at the root.
272
- if (!this.writeGCDataAtRoot) {
273
- (0, runtime_utils_1.addBlobToSummary)(summarizeResult, runtime_definitions_1.gcBlobKey, JSON.stringify(this.summarizerNode.getGCSummaryDetails()));
274
- }
275
289
  // If we are not referenced, mark the summary tree as unreferenced. Also, update unreferenced blob
276
290
  // size in the summary stats with the blobs size of this data store.
277
291
  if (!this.summarizerNode.isReferenced()) {
@@ -316,20 +330,16 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
316
330
  * 5. To update the timestamp when this data store or any children are marked as unreferenced.
317
331
  *
318
332
  * @param usedRoutes - The routes that are used in this data store.
319
- * @param gcTimestamp - The time when GC was run that generated these used routes. If any node becomes unreferenced
320
- * as part of this GC run, this should be used to update the time when it happens.
321
333
  */
322
- updateUsedRoutes(usedRoutes, gcTimestamp) {
334
+ updateUsedRoutes(usedRoutes) {
323
335
  // Update the used routes in this data store's summarizer node.
324
- this.summarizerNode.updateUsedRoutes(usedRoutes, gcTimestamp);
336
+ this.summarizerNode.updateUsedRoutes(usedRoutes);
325
337
  /**
326
- * If the data store has not been realized yet, we need this used state to update the used state of the channel
327
- * when it realizes. It's safe to keep only the last used state because if something changes because of this GC
328
- * run, the data store will be immediately realized as part of the summary that follows GC. For example, if a
329
- * child's reference state changes, the gcTimestamp has to be used to update its unreferencedTimestamp. Since
330
- * it will result in a change in this data store's used routes, it will be realized to regenerate its summary.
338
+ * Store the used routes to update the channel if the data store is not loaded yet. If the used routes changed
339
+ * since the previous run, the data store will be loaded during summarize since the used state changed. So, it's
340
+ * safe to only store the last used routes.
331
341
  */
332
- this.lastUsedState = { usedRoutes, gcTimestamp };
342
+ this.lastUsedRoutes = usedRoutes;
333
343
  // If we are loaded, call the channel so it can update the used routes of the child contexts.
334
344
  // If we are not loaded, we will update this when we are realized.
335
345
  if (this.loaded) {
@@ -354,13 +364,13 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
354
364
  updateChannelUsedRoutes() {
355
365
  (0, common_utils_1.assert)(this.loaded, 0x144 /* "Channel should be loaded when updating used routes" */);
356
366
  (0, common_utils_1.assert)(this.channel !== undefined, 0x145 /* "Channel should be present when data store is loaded" */);
357
- // If there is no lastUsedState, GC has not run up until this point.
358
- if (this.lastUsedState === undefined) {
367
+ // If there is no lastUsedRoutes, GC has not run up until this point.
368
+ if (this.lastUsedRoutes === undefined) {
359
369
  return;
360
370
  }
361
371
  // Remove the route to this data store, if it exists.
362
- const usedChannelRoutes = this.lastUsedState.usedRoutes.filter((id) => { return id !== "/" && id !== ""; });
363
- this.channel.updateUsedRoutes(usedChannelRoutes, this.lastUsedState.gcTimestamp);
372
+ const usedChannelRoutes = this.lastUsedRoutes.filter((id) => { return id !== "/" && id !== ""; });
373
+ this.channel.updateUsedRoutes(usedChannelRoutes);
364
374
  }
365
375
  /**
366
376
  * @deprecated 0.18.Should call request on the runtime directly
@@ -370,7 +380,7 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
370
380
  return runtime.request(request);
371
381
  }
372
382
  submitMessage(type, content, localOpMetadata) {
373
- this.verifyNotClosed();
383
+ this.verifyNotClosed("submitMessage");
374
384
  (0, common_utils_1.assert)(!!this.channel, 0x146 /* "Channel must exist when submitting message" */);
375
385
  const fluidDataStoreContent = {
376
386
  content,
@@ -388,7 +398,7 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
388
398
  *
389
399
  */
390
400
  setChannelDirty(address) {
391
- this.verifyNotClosed();
401
+ this.verifyNotClosed("setChannelDirty");
392
402
  // Get the latest sequence number.
393
403
  const latestSequenceNumber = this.deltaManager.lastSequenceNumber;
394
404
  this.summarizerNode.invalidate(latestSequenceNumber);
@@ -398,7 +408,7 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
398
408
  }
399
409
  }
400
410
  submitSignal(type, content) {
401
- this.verifyNotClosed();
411
+ this.verifyNotClosed("submitSignal");
402
412
  (0, common_utils_1.assert)(!!this.channel, 0x147 /* "Channel must exist on submitting signal" */);
403
413
  return this._containerRuntime.submitDataStoreSignal(this.id, type, content);
404
414
  }
@@ -489,9 +499,25 @@ class FluidDataStoreContext extends common_utils_1.TypedEventEmitter {
489
499
  const innerContents = contents;
490
500
  return this.channel.applyStashedOp(innerContents.content);
491
501
  }
492
- verifyNotClosed() {
502
+ verifyNotClosed(callSite, checkTombstone = true, safeTelemetryProps = {}) {
493
503
  if (this._disposed) {
494
- throw new Error("Context is closed");
504
+ throw new Error(`Context is closed! Call site [${callSite}]`);
505
+ }
506
+ if (checkTombstone && this.tombstoned) {
507
+ const messageString = `Context is tombstoned! Call site [${callSite}]`;
508
+ const error = new container_utils_1.DataCorruptionError(messageString, Object.assign({ errorMessage: messageString }, safeTelemetryProps));
509
+ // Always log an error when tombstoned data store is used. However, throw an error only if
510
+ // throwOnTombstoneUsage is set.
511
+ this.mc.logger.sendErrorEvent({
512
+ eventName: "GC_Tombstone_DataStore_Changed",
513
+ callSite,
514
+ pkg: (0, runtime_utils_1.packagePathToTelemetryProperty)(this.pkg),
515
+ }, error);
516
+ // Always log an error when tombstoned data store is used. However, throw an error only if
517
+ // throwOnTombstoneUsage is set and the client is not a summarizer.
518
+ if (this.throwOnTombstoneUsage) {
519
+ throw error;
520
+ }
495
521
  }
496
522
  }
497
523
  getCreateChildSummarizerNodeFn(id, createParam) {
@@ -511,23 +537,12 @@ class RemoteFluidDataStoreContext extends FluidDataStoreContext {
511
537
  throw new Error("Already attached");
512
538
  });
513
539
  this.initialSnapshotDetailsP = new common_utils_1.LazyPromise(async () => {
514
- var _a, _b;
515
- let tree;
540
+ var _a;
541
+ let tree = this.initSnapshotValue;
516
542
  let isRootDataStore = true;
517
- if (typeof this.initSnapshotValue === "string") {
518
- const commit = (await this.storage.getVersions(this.initSnapshotValue, 1))[0];
519
- tree = (_a = await this.storage.getSnapshotTree(commit)) !== null && _a !== void 0 ? _a : undefined;
520
- }
521
- else {
522
- tree = this.initSnapshotValue;
523
- }
524
- const localReadAndParse = async (id) => (0, driver_utils_1.readAndParse)(this.storage, id);
525
- if (tree) {
526
- tree = await this.summarizerNode.loadBaseSummary(tree, localReadAndParse);
527
- }
528
543
  if (!!tree && tree.blobs[summaryFormat_1.dataStoreAttributesBlobName] !== undefined) {
529
544
  // Need to get through snapshot and use that to populate extraBlobs
530
- const attributes = await localReadAndParse(tree.blobs[summaryFormat_1.dataStoreAttributesBlobName]);
545
+ const attributes = await (0, driver_utils_1.readAndParse)(this.storage, tree.blobs[summaryFormat_1.dataStoreAttributesBlobName]);
531
546
  let pkgFromSnapshot;
532
547
  // Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.
533
548
  // For snapshotFormatVersion = "0.1" (1) or above, pkg is jsonified, otherwise it is just a string.
@@ -546,7 +561,7 @@ class RemoteFluidDataStoreContext extends FluidDataStoreContext {
546
561
  * data stores in older documents are not garbage collected incorrectly. This may lead to additional
547
562
  * roots in the document but they won't break.
548
563
  */
549
- isRootDataStore = (_b = attributes.isRootDataStore) !== null && _b !== void 0 ? _b : true;
564
+ isRootDataStore = (_a = attributes.isRootDataStore) !== null && _a !== void 0 ? _a : true;
550
565
  if ((0, summaryFormat_1.hasIsolatedChannels)(attributes)) {
551
566
  tree = tree.trees[runtime_definitions_1.channelsTreeName];
552
567
  (0, common_utils_1.assert)(tree !== undefined, 0x1fe /* "isolated channels subtree should exist in remote datastore snapshot" */);
@@ -564,16 +579,13 @@ class RemoteFluidDataStoreContext extends FluidDataStoreContext {
564
579
  var _a;
565
580
  return (_a = (await props.getBaseGCDetails())) !== null && _a !== void 0 ? _a : {};
566
581
  });
582
+ if (props.snapshotTree !== undefined) {
583
+ this.summarizerNode.updateBaseSummaryState(props.snapshotTree);
584
+ }
567
585
  }
568
586
  async getInitialSnapshotDetails() {
569
587
  return this.initialSnapshotDetailsP;
570
588
  }
571
- /**
572
- * @deprecated Renamed to {@link RemoteFluidDataStoreContext.getBaseGCDetails}.
573
- */
574
- async getInitialGCSummaryDetails() {
575
- return this.getBaseGCDetails();
576
- }
577
589
  async getBaseGCDetails() {
578
590
  return this.baseGCDetailsP;
579
591
  }
@@ -654,13 +666,6 @@ class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
654
666
  snapshot,
655
667
  };
656
668
  }
657
- /**
658
- * @deprecated Renamed to {@link LocalFluidDataStoreContextBase.getBaseGCDetails}.
659
- */
660
- async getInitialGCSummaryDetails() {
661
- // Local data store does not have initial summary.
662
- return {};
663
- }
664
669
  async getBaseGCDetails() {
665
670
  // Local data store does not have initial summary.
666
671
  return {};
@@ -691,6 +696,7 @@ class LocalDetachedFluidDataStoreContext extends LocalFluidDataStoreContextBase
691
696
  this.detachedRuntimeCreation = true;
692
697
  }
693
698
  async attachRuntime(registry, dataStoreChannel) {
699
+ var _a;
694
700
  (0, common_utils_1.assert)(this.detachedRuntimeCreation, 0x154 /* "runtime creation is already attached" */);
695
701
  this.detachedRuntimeCreation = false;
696
702
  (0, common_utils_1.assert)(this.channelDeferred === undefined, 0x155 /* "channel deferral is already set" */);
@@ -701,6 +707,14 @@ class LocalDetachedFluidDataStoreContext extends LocalFluidDataStoreContextBase
701
707
  (0, common_utils_1.assert)(this.registry === undefined, 0x157 /* "datastore registry already attached" */);
702
708
  this.registry = entry.registry;
703
709
  super.bindRuntime(dataStoreChannel);
710
+ // Load the handle to the data store's entryPoint to make sure that for a detached data store, the entryPoint
711
+ // initialization function is called before the data store gets attached and potentially connected to the
712
+ // delta stream, so it gets a chance to do things while the data store is still "purely local".
713
+ // This preserves the behavior from before we introduced entryPoints, where the instantiateDataStore method
714
+ // of data store factories tends to construct the data object (at least kick off an async method that returns
715
+ // it); that code moved to the entryPoint initialization function, so we want to ensure it still executes
716
+ // before the data store is attached.
717
+ await ((_a = dataStoreChannel.entryPoint) === null || _a === void 0 ? void 0 : _a.get());
704
718
  if (await this.isRoot()) {
705
719
  dataStoreChannel.makeVisibleAndAttachGraph();
706
720
  }