@fluidframework/container-runtime 2.0.0-internal.6.3.3 → 2.0.0-internal.6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/blobManager.d.ts +3 -2
  3. package/dist/blobManager.d.ts.map +1 -1
  4. package/dist/blobManager.js +29 -25
  5. package/dist/blobManager.js.map +1 -1
  6. package/dist/containerRuntime.d.ts +14 -69
  7. package/dist/containerRuntime.d.ts.map +1 -1
  8. package/dist/containerRuntime.js +155 -184
  9. package/dist/containerRuntime.js.map +1 -1
  10. package/dist/dataStoreContext.d.ts.map +1 -1
  11. package/dist/dataStoreContext.js +3 -1
  12. package/dist/dataStoreContext.js.map +1 -1
  13. package/dist/dataStores.d.ts +1 -1
  14. package/dist/dataStores.js +3 -3
  15. package/dist/dataStores.js.map +1 -1
  16. package/dist/gc/garbageCollection.d.ts +6 -3
  17. package/dist/gc/garbageCollection.d.ts.map +1 -1
  18. package/dist/gc/garbageCollection.js +6 -3
  19. package/dist/gc/garbageCollection.js.map +1 -1
  20. package/dist/gc/gcDefinitions.d.ts +13 -2
  21. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  22. package/dist/gc/gcDefinitions.js +14 -15
  23. package/dist/gc/gcDefinitions.js.map +1 -1
  24. package/dist/gc/gcHelpers.d.ts +0 -9
  25. package/dist/gc/gcHelpers.d.ts.map +1 -1
  26. package/dist/gc/gcHelpers.js +1 -13
  27. package/dist/gc/gcHelpers.js.map +1 -1
  28. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  29. package/dist/gc/gcTelemetry.js +1 -4
  30. package/dist/gc/gcTelemetry.js.map +1 -1
  31. package/dist/gc/index.d.ts +2 -2
  32. package/dist/gc/index.d.ts.map +1 -1
  33. package/dist/gc/index.js +3 -4
  34. package/dist/gc/index.js.map +1 -1
  35. package/dist/index.d.ts +2 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +3 -2
  38. package/dist/index.js.map +1 -1
  39. package/dist/messageTypes.d.ts +134 -0
  40. package/dist/messageTypes.d.ts.map +1 -0
  41. package/dist/messageTypes.js +29 -0
  42. package/dist/messageTypes.js.map +1 -0
  43. package/dist/opLifecycle/definitions.d.ts +2 -1
  44. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  45. package/dist/opLifecycle/definitions.js.map +1 -1
  46. package/dist/opLifecycle/opDecompressor.d.ts.map +1 -1
  47. package/dist/opLifecycle/opDecompressor.js +0 -4
  48. package/dist/opLifecycle/opDecompressor.js.map +1 -1
  49. package/dist/opLifecycle/opGroupingManager.d.ts.map +1 -1
  50. package/dist/opLifecycle/opGroupingManager.js +4 -2
  51. package/dist/opLifecycle/opGroupingManager.js.map +1 -1
  52. package/dist/opLifecycle/opSplitter.js +3 -3
  53. package/dist/opLifecycle/opSplitter.js.map +1 -1
  54. package/dist/opLifecycle/remoteMessageProcessor.d.ts +17 -3
  55. package/dist/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  56. package/dist/opLifecycle/remoteMessageProcessor.js +38 -25
  57. package/dist/opLifecycle/remoteMessageProcessor.js.map +1 -1
  58. package/dist/packageVersion.d.ts +1 -1
  59. package/dist/packageVersion.js +1 -1
  60. package/dist/packageVersion.js.map +1 -1
  61. package/dist/pendingStateManager.d.ts +2 -2
  62. package/dist/pendingStateManager.d.ts.map +1 -1
  63. package/dist/pendingStateManager.js +13 -6
  64. package/dist/pendingStateManager.js.map +1 -1
  65. package/dist/summary/runningSummarizer.d.ts +1 -1
  66. package/dist/summary/runningSummarizer.d.ts.map +1 -1
  67. package/dist/summary/runningSummarizer.js +4 -2
  68. package/dist/summary/runningSummarizer.js.map +1 -1
  69. package/dist/summary/summarizer.d.ts +2 -2
  70. package/dist/summary/summarizer.js +2 -2
  71. package/dist/summary/summarizer.js.map +1 -1
  72. package/dist/summary/summarizerNode/summarizerNode.d.ts +1 -1
  73. package/dist/summary/summarizerNode/summarizerNode.js +1 -1
  74. package/dist/summary/summarizerNode/summarizerNode.js.map +1 -1
  75. package/dist/summary/summarizerTypes.d.ts +2 -1
  76. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  77. package/dist/summary/summarizerTypes.js.map +1 -1
  78. package/dist/summary/summaryFormat.d.ts +3 -0
  79. package/dist/summary/summaryFormat.d.ts.map +1 -1
  80. package/dist/summary/summaryFormat.js +3 -0
  81. package/dist/summary/summaryFormat.js.map +1 -1
  82. package/lib/blobManager.d.ts +3 -2
  83. package/lib/blobManager.d.ts.map +1 -1
  84. package/lib/blobManager.js +30 -26
  85. package/lib/blobManager.js.map +1 -1
  86. package/lib/containerRuntime.d.ts +14 -69
  87. package/lib/containerRuntime.d.ts.map +1 -1
  88. package/lib/containerRuntime.js +121 -150
  89. package/lib/containerRuntime.js.map +1 -1
  90. package/lib/dataStoreContext.d.ts.map +1 -1
  91. package/lib/dataStoreContext.js +3 -1
  92. package/lib/dataStoreContext.js.map +1 -1
  93. package/lib/dataStores.d.ts +1 -1
  94. package/lib/dataStores.js +4 -4
  95. package/lib/dataStores.js.map +1 -1
  96. package/lib/gc/garbageCollection.d.ts +6 -3
  97. package/lib/gc/garbageCollection.d.ts.map +1 -1
  98. package/lib/gc/garbageCollection.js +6 -3
  99. package/lib/gc/garbageCollection.js.map +1 -1
  100. package/lib/gc/gcDefinitions.d.ts +13 -2
  101. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  102. package/lib/gc/gcDefinitions.js +13 -14
  103. package/lib/gc/gcDefinitions.js.map +1 -1
  104. package/lib/gc/gcHelpers.d.ts +0 -9
  105. package/lib/gc/gcHelpers.d.ts.map +1 -1
  106. package/lib/gc/gcHelpers.js +0 -11
  107. package/lib/gc/gcHelpers.js.map +1 -1
  108. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  109. package/lib/gc/gcTelemetry.js +1 -4
  110. package/lib/gc/gcTelemetry.js.map +1 -1
  111. package/lib/gc/index.d.ts +2 -2
  112. package/lib/gc/index.d.ts.map +1 -1
  113. package/lib/gc/index.js +2 -2
  114. package/lib/gc/index.js.map +1 -1
  115. package/lib/index.d.ts +2 -1
  116. package/lib/index.d.ts.map +1 -1
  117. package/lib/index.js +2 -1
  118. package/lib/index.js.map +1 -1
  119. package/lib/messageTypes.d.ts +134 -0
  120. package/lib/messageTypes.d.ts.map +1 -0
  121. package/lib/messageTypes.js +26 -0
  122. package/lib/messageTypes.js.map +1 -0
  123. package/lib/opLifecycle/definitions.d.ts +2 -1
  124. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  125. package/lib/opLifecycle/definitions.js.map +1 -1
  126. package/lib/opLifecycle/opDecompressor.d.ts.map +1 -1
  127. package/lib/opLifecycle/opDecompressor.js +0 -4
  128. package/lib/opLifecycle/opDecompressor.js.map +1 -1
  129. package/lib/opLifecycle/opGroupingManager.d.ts.map +1 -1
  130. package/lib/opLifecycle/opGroupingManager.js +4 -2
  131. package/lib/opLifecycle/opGroupingManager.js.map +1 -1
  132. package/lib/opLifecycle/opSplitter.js +1 -1
  133. package/lib/opLifecycle/opSplitter.js.map +1 -1
  134. package/lib/opLifecycle/remoteMessageProcessor.d.ts +17 -3
  135. package/lib/opLifecycle/remoteMessageProcessor.d.ts.map +1 -1
  136. package/lib/opLifecycle/remoteMessageProcessor.js +37 -24
  137. package/lib/opLifecycle/remoteMessageProcessor.js.map +1 -1
  138. package/lib/packageVersion.d.ts +1 -1
  139. package/lib/packageVersion.js +1 -1
  140. package/lib/packageVersion.js.map +1 -1
  141. package/lib/pendingStateManager.d.ts +2 -2
  142. package/lib/pendingStateManager.d.ts.map +1 -1
  143. package/lib/pendingStateManager.js +12 -5
  144. package/lib/pendingStateManager.js.map +1 -1
  145. package/lib/summary/runningSummarizer.d.ts +1 -1
  146. package/lib/summary/runningSummarizer.d.ts.map +1 -1
  147. package/lib/summary/runningSummarizer.js +4 -2
  148. package/lib/summary/runningSummarizer.js.map +1 -1
  149. package/lib/summary/summarizer.d.ts +2 -2
  150. package/lib/summary/summarizer.js +2 -2
  151. package/lib/summary/summarizer.js.map +1 -1
  152. package/lib/summary/summarizerNode/summarizerNode.d.ts +1 -1
  153. package/lib/summary/summarizerNode/summarizerNode.js +1 -1
  154. package/lib/summary/summarizerNode/summarizerNode.js.map +1 -1
  155. package/lib/summary/summarizerTypes.d.ts +2 -1
  156. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  157. package/lib/summary/summarizerTypes.js.map +1 -1
  158. package/lib/summary/summaryFormat.d.ts +3 -0
  159. package/lib/summary/summaryFormat.d.ts.map +1 -1
  160. package/lib/summary/summaryFormat.js +3 -0
  161. package/lib/summary/summaryFormat.js.map +1 -1
  162. package/package.json +16 -16
  163. package/src/blobManager.ts +38 -28
  164. package/src/containerRuntime.ts +181 -245
  165. package/src/dataStoreContext.ts +3 -1
  166. package/src/dataStores.ts +4 -4
  167. package/src/gc/garbageCollection.md +53 -5
  168. package/src/gc/garbageCollection.ts +6 -3
  169. package/src/gc/gcDefinitions.ts +13 -14
  170. package/src/gc/gcEarlyAdoption.md +145 -0
  171. package/src/gc/gcHelpers.ts +0 -12
  172. package/src/gc/gcTelemetry.ts +1 -4
  173. package/src/gc/index.ts +2 -3
  174. package/src/index.ts +7 -4
  175. package/src/messageTypes.ts +225 -0
  176. package/src/opLifecycle/README.md +40 -40
  177. package/src/opLifecycle/definitions.ts +2 -1
  178. package/src/opLifecycle/opDecompressor.ts +0 -8
  179. package/src/opLifecycle/opGroupingManager.ts +7 -6
  180. package/src/opLifecycle/opSplitter.ts +2 -2
  181. package/src/opLifecycle/remoteMessageProcessor.ts +54 -33
  182. package/src/packageVersion.ts +1 -1
  183. package/src/pendingStateManager.ts +23 -6
  184. package/src/summary/runningSummarizer.ts +4 -2
  185. package/src/summary/summarizer.ts +2 -2
  186. package/src/summary/summarizerNode/summarizerNode.ts +1 -1
  187. package/src/summary/summarizerTypes.ts +2 -1
  188. package/src/summary/summaryFormat.ts +3 -0
@@ -1 +1 @@
1
- {"version":3,"file":"summa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,CAAC;IACF,qFAAqF;IACrF,mGAAmG;IACnG,uFAAuF;IACvF,0FAA0F;IAC1F,MAAM,aAAa,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAC7D,MAAM,CAAC,aAAa,GAAG,CAAC,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvE,OAAO,UAAU,CAAC;AACnB,CAAC","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 { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n\treadAndParse,\n\tblobHeadersBlobName as blobNameForBlobHeaders,\n} from \"@fluidframework/driver-utils\";\nimport {\n\tISequencedDocumentMessage,\n\tISnapshotTree,\n\tSummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tchannelsTreeName,\n\tgcTreeKey,\n\tISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport { IGCMetadata } from \"../gc\";\n\ntype OmitAttributesVersions<T> = Omit<T, \"snapshotFormatVersion\" | \"summaryFormatVersion\">;\ninterface IFluidDataStoreAttributes0 {\n\treadonly snapshotFormatVersion?: undefined;\n\treadonly summaryFormatVersion?: undefined;\n\tpkg: string;\n\t/**\n\t * This tells whether a data store is root. Root data stores are never collected.\n\t * Non-root data stores may be collected if they are not used. If this is not present, default it to\n\t * true. This will ensure that older data stores are incorrectly collected.\n\t */\n\treadonly isRootDataStore?: boolean;\n}\ninterface IFluidDataStoreAttributes1 extends OmitAttributesVersions<IFluidDataStoreAttributes0> {\n\treadonly snapshotFormatVersion: \"0.1\";\n\treadonly summaryFormatVersion?: undefined;\n}\ninterface IFluidDataStoreAttributes2 extends OmitAttributesVersions<IFluidDataStoreAttributes1> {\n\t/** Switch from snapshotFormatVersion to summaryFormatVersion */\n\treadonly snapshotFormatVersion?: undefined;\n\treadonly summaryFormatVersion: 2;\n\t/**\n\t * True if channels are not isolated in .channels subtrees, otherwise isolated.\n\t * This is required in both datastore attributes as well as the root container,\n\t * because reused summary handles may cause different format versions in each\n\t * datastore subtree within the summary.\n\t */\n\treadonly disableIsolatedChannels?: true;\n}\n/**\n * Added IFluidDataStoreAttributes similar to IChannelAttributes which will tell the attributes of a\n * store like the package, snapshotFormatVersion to take different decisions based on a particular\n * snapshotFormatVersion.\n */\nexport type ReadFluidDataStoreAttributes =\n\t| IFluidDataStoreAttributes0\n\t| IFluidDataStoreAttributes1\n\t| IFluidDataStoreAttributes2;\nexport type WriteFluidDataStoreAttributes = IFluidDataStoreAttributes1 | IFluidDataStoreAttributes2;\n\nexport function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttributes): number {\n\tif (attributes.summaryFormatVersion) {\n\t\t/**\n\t\t * Version 2+: Introduces .channels trees for isolation of\n\t\t * channel trees from data store objects.\n\t\t */\n\t\treturn attributes.summaryFormatVersion;\n\t} else if (attributes.snapshotFormatVersion === \"0.1\") {\n\t\t/**\n\t\t * Version 1: from this version the pkg within the data store\n\t\t * attributes blob is a JSON array rather than a string.\n\t\t */\n\t\treturn 1;\n\t}\n\t/**\n\t * Version 0: format version is missing from summary.\n\t * This indicates it is an older version.\n\t */\n\treturn 0;\n}\n\nexport function hasIsolatedChannels(attributes: ReadFluidDataStoreAttributes): boolean {\n\treturn !!attributes.summaryFormatVersion && !attributes.disableIsolatedChannels;\n}\nexport interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {\n\treadonly summaryFormatVersion: 1;\n\t/** The last message processed at the time of summary. Only primitive property types are added to the summary. */\n\treadonly message: ISummaryMetadataMessage | undefined;\n\t/** True if channels are not isolated in .channels subtrees, otherwise isolated. */\n\treadonly disableIsolatedChannels?: true;\n\t/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */\n\treadonly summaryNumber?: number;\n\t/** GUID to identify a document in telemetry */\n\treadonly telemetryDocumentId?: string;\n\t/** True if the runtime IdCompressor is enabled */\n\treadonly idCompressorEnabled?: boolean;\n}\n\nexport interface ICreateContainerMetadata {\n\t/** Runtime version of the container when it was first created */\n\tcreateContainerRuntimeVersion?: string;\n\t/** Timestamp of the container when it was first created */\n\tcreateContainerTimestamp?: number;\n}\n\n/** The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary. */\nexport type ISummaryMetadataMessage = Pick<\n\tISequencedDocumentMessage,\n\t| \"clientId\"\n\t| \"clientSequenceNumber\"\n\t| \"minimumSequenceNumber\"\n\t| \"referenceSequenceNumber\"\n\t| \"sequenceNumber\"\n\t| \"timestamp\"\n\t| \"type\"\n>;\n\n/**\n * Extracts the properties from an ISequencedDocumentMessage as defined by ISummaryMetadataMessage. This message is\n * added to the metadata blob in summary.\n */\nexport const extractSummaryMetadataMessage = (\n\tmessage?: ISequencedDocumentMessage,\n): ISummaryMetadataMessage | undefined =>\n\tmessage === undefined\n\t\t? undefined\n\t\t: {\n\t\t\t\tclientId: message.clientId,\n\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t\tminimumSequenceNumber: message.minimumSequenceNumber,\n\t\t\t\treferenceSequenceNumber: message.referenceSequenceNumber,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\ttimestamp: message.timestamp,\n\t\t\t\ttype: message.type,\n\t\t };\n\nexport function getMetadataFormatVersion(metadata?: IContainerRuntimeMetadata): number {\n\t/**\n\t * Version 2+: Introduces runtime sequence number for data verification.\n\t *\n\t * Version 1+: Introduces .metadata blob and .channels trees for isolation of\n\t * data store trees from container-level objects.\n\t * Also introduces enableGC option stored in the summary.\n\t *\n\t * Version 0: metadata blob missing; format version is missing from summary.\n\t * This indicates it is an older version.\n\t */\n\treturn metadata?.summaryFormatVersion ?? 0;\n}\n\nexport const aliasBlobName = \".aliases\";\nexport const metadataBlobName = \".metadata\";\nexport const chunksBlobName = \".chunks\";\nexport const electedSummarizerBlobName = \".electedSummarizer\";\nexport const blobsTreeName = \".blobs\";\nexport const idCompressorBlobName = \".idCompressor\";\nexport const blobHeadersBlobName = blobNameForBlobHeaders;\n\nexport function rootHasIsolatedChannels(metadata?: IContainerRuntimeMetadata): boolean {\n\treturn !!metadata && !metadata.disableIsolatedChannels;\n}\n\nexport const protocolTreeName = \".protocol\";\n\n/**\n * List of tree IDs at the container level which are reserved.\n * This is for older versions of summaries that do not yet have an\n * isolated data stores namespace. Without the namespace, this must\n * be used to prevent name collisions with data store IDs.\n */\nexport const nonDataStorePaths = [\n\tprotocolTreeName,\n\t\".logTail\",\n\t\".serviceProtocol\",\n\tblobsTreeName,\n\tgcTreeKey,\n\tidCompressorBlobName,\n];\n\nexport const dataStoreAttributesBlobName = \".component\";\n\n/**\n * Modifies summary tree and stats to put tree under .channels tree.\n *\n * @param summarizeResult - Summary tree and stats to modify\n *\n * @example\n * Converts from:\n * ```typescript\n * {\n * type: SummaryType.Tree,\n * tree: { a: {...}, b: {...}, c: {...} },\n * }\n * ```\n *\n * to:\n *\n * ```typescript\n * {\n * type: SummaryType.Tree,\n * tree: {\n * \".channels\": {\n * type: SummaryType.Tree,\n * tree: { a: {...}, b: {...}, c: {...} }\n * },\n * },\n * }\n * ```\n * And adds +1 to treeNodeCount in stats.\n */\nexport function wrapSummaryInChannelsTree(summarizeResult: ISummaryTreeWithStats): void {\n\tsummarizeResult.summary = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: { [channelsTreeName]: summarizeResult.summary },\n\t};\n\tsummarizeResult.stats.treeNodeCount++;\n}\n\nexport async function getFluidDataStoreAttributes(\n\tstorage: IDocumentStorageService,\n\tsnapshot: ISnapshotTree,\n): Promise<ReadFluidDataStoreAttributes> {\n\tconst attributes = await readAndParse<ReadFluidDataStoreAttributes>(\n\t\tstorage,\n\t\tsnapshot.blobs[dataStoreAttributesBlobName],\n\t);\n\t// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.\n\t// For snapshotFormatVersion = \"0.1\" (1) or above, pkg is jsonified, otherwise it is just a string.\n\t// However the feature of loading a detached container from snapshot, is added when the\n\t// snapshotFormatVersion is at least \"0.1\" (1), so we don't expect it to be anything else.\n\tconst formatVersion = getAttributesFormatVersion(attributes);\n\tassert(formatVersion > 0, 0x1d5 /* Invalid snapshot format version */);\n\treturn attributes;\n}\n"]}
1
+ {"version":3,"file":"summaryFormat.js","sourceRoot":"","sources":["../../src/summary/summaryFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EACN,YAAY,EACZ,mBAAmB,IAAI,sBAAsB,GAC7C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGN,WAAW,GACX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,gBAAgB,EAChB,SAAS,GAET,MAAM,qCAAqC,CAAC;AA0C7C,MAAM,UAAU,0BAA0B,CAAC,UAAwC;IAClF,IAAI,UAAU,CAAC,oBAAoB,EAAE;QACpC;;;WAGG;QACH,OAAO,UAAU,CAAC,oBAAoB,CAAC;KACvC;SAAM,IAAI,UAAU,CAAC,qBAAqB,KAAK,KAAK,EAAE;QACtD;;;WAGG;QACH,OAAO,CAAC,CAAC;KACT;IACD;;;OAGG;IACH,OAAO,CAAC,CAAC;AACV,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,UAAwC;IAC3E,OAAO,CAAC,CAAC,UAAU,CAAC,oBAAoB,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC;AACjF,CAAC;AAkCD;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC5C,OAAmC,EACG,EAAE,CACxC,OAAO,KAAK,SAAS;IACpB,CAAC,CAAC,SAAS;IACX,CAAC,CAAC;QACA,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;QACpD,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;QACxD,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,SA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AM,CAAC,KAAK,UAAU,2BAA2B,CAChD,OAAgC,EAChC,QAAuB;IAEvB,MAAM,UAAU,GAAG,MAAM,YAAY,CACpC,OAAO,EACP,QAAQ,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAC3C,CAAC;IACF,qFAAqF;IACrF,mGAAmG;IACnG,uFAAuF;IACvF,0FAA0F;IAC1F,MAAM,aAAa,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAC7D,MAAM,CAAC,aAAa,GAAG,CAAC,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvE,OAAO,UAAU,CAAC;AACnB,CAAC","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 { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n\treadAndParse,\n\tblobHeadersBlobName as blobNameForBlobHeaders,\n} from \"@fluidframework/driver-utils\";\nimport {\n\tISequencedDocumentMessage,\n\tISnapshotTree,\n\tSummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tchannelsTreeName,\n\tgcTreeKey,\n\tISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport { IGCMetadata } from \"../gc\";\n\ntype OmitAttributesVersions<T> = Omit<T, \"snapshotFormatVersion\" | \"summaryFormatVersion\">;\ninterface IFluidDataStoreAttributes0 {\n\treadonly snapshotFormatVersion?: undefined;\n\treadonly summaryFormatVersion?: undefined;\n\tpkg: string;\n\t/**\n\t * This tells whether a data store is root. Root data stores are never collected.\n\t * Non-root data stores may be collected if they are not used. If this is not present, default it to\n\t * true. This will ensure that older data stores are incorrectly collected.\n\t */\n\treadonly isRootDataStore?: boolean;\n}\ninterface IFluidDataStoreAttributes1 extends OmitAttributesVersions<IFluidDataStoreAttributes0> {\n\treadonly snapshotFormatVersion: \"0.1\";\n\treadonly summaryFormatVersion?: undefined;\n}\ninterface IFluidDataStoreAttributes2 extends OmitAttributesVersions<IFluidDataStoreAttributes1> {\n\t/** Switch from snapshotFormatVersion to summaryFormatVersion */\n\treadonly snapshotFormatVersion?: undefined;\n\treadonly summaryFormatVersion: 2;\n\t/**\n\t * True if channels are not isolated in .channels subtrees, otherwise isolated.\n\t * This is required in both datastore attributes as well as the root container,\n\t * because reused summary handles may cause different format versions in each\n\t * datastore subtree within the summary.\n\t */\n\treadonly disableIsolatedChannels?: true;\n}\n/**\n * Added IFluidDataStoreAttributes similar to IChannelAttributes which will tell the attributes of a\n * store like the package, snapshotFormatVersion to take different decisions based on a particular\n * snapshotFormatVersion.\n */\nexport type ReadFluidDataStoreAttributes =\n\t| IFluidDataStoreAttributes0\n\t| IFluidDataStoreAttributes1\n\t| IFluidDataStoreAttributes2;\nexport type WriteFluidDataStoreAttributes = IFluidDataStoreAttributes1 | IFluidDataStoreAttributes2;\n\nexport function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttributes): number {\n\tif (attributes.summaryFormatVersion) {\n\t\t/**\n\t\t * Version 2+: Introduces .channels trees for isolation of\n\t\t * channel trees from data store objects.\n\t\t */\n\t\treturn attributes.summaryFormatVersion;\n\t} else if (attributes.snapshotFormatVersion === \"0.1\") {\n\t\t/**\n\t\t * Version 1: from this version the pkg within the data store\n\t\t * attributes blob is a JSON array rather than a string.\n\t\t */\n\t\treturn 1;\n\t}\n\t/**\n\t * Version 0: format version is missing from summary.\n\t * This indicates it is an older version.\n\t */\n\treturn 0;\n}\n\nexport function hasIsolatedChannels(attributes: ReadFluidDataStoreAttributes): boolean {\n\treturn !!attributes.summaryFormatVersion && !attributes.disableIsolatedChannels;\n}\nexport interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {\n\treadonly summaryFormatVersion: 1;\n\t/** The last message processed at the time of summary. Only primitive property types are added to the summary. */\n\treadonly message: ISummaryMetadataMessage | undefined;\n\t/** True if channels are not isolated in .channels subtrees, otherwise isolated. */\n\treadonly disableIsolatedChannels?: true;\n\t/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */\n\treadonly summaryNumber?: number;\n\t/** GUID to identify a document in telemetry */\n\treadonly telemetryDocumentId?: string;\n\t/** True if the runtime IdCompressor is enabled */\n\treadonly idCompressorEnabled?: boolean;\n}\n\nexport interface ICreateContainerMetadata {\n\t/** Runtime version of the container when it was first created */\n\tcreateContainerRuntimeVersion?: string;\n\t/** Timestamp of the container when it was first created */\n\tcreateContainerTimestamp?: number;\n}\n\n/** The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary. */\nexport type ISummaryMetadataMessage = Pick<\n\tISequencedDocumentMessage,\n\t| \"clientId\"\n\t| \"clientSequenceNumber\"\n\t| \"minimumSequenceNumber\"\n\t| \"referenceSequenceNumber\"\n\t| \"sequenceNumber\"\n\t| \"timestamp\"\n\t| \"type\"\n>;\n\n/**\n * Extracts the properties from an ISequencedDocumentMessage as defined by ISummaryMetadataMessage. This message is\n * added to the metadata blob in summary.\n */\nexport const extractSummaryMetadataMessage = (\n\tmessage?: ISequencedDocumentMessage,\n): ISummaryMetadataMessage | undefined =>\n\tmessage === undefined\n\t\t? undefined\n\t\t: {\n\t\t\t\tclientId: message.clientId,\n\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t\tminimumSequenceNumber: message.minimumSequenceNumber,\n\t\t\t\treferenceSequenceNumber: message.referenceSequenceNumber,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\ttimestamp: message.timestamp,\n\t\t\t\ttype: message.type,\n\t\t };\n\nexport function getMetadataFormatVersion(metadata?: IContainerRuntimeMetadata): number {\n\t/**\n\t * Version 2+: Introduces runtime sequence number for data verification.\n\t *\n\t * Version 1+: Introduces .metadata blob and .channels trees for isolation of\n\t * data store trees from container-level objects.\n\t * Also introduces enableGC option stored in the summary.\n\t *\n\t * Version 0: metadata blob missing; format version is missing from summary.\n\t * This indicates it is an older version.\n\t */\n\treturn metadata?.summaryFormatVersion ?? 0;\n}\n\nexport const aliasBlobName = \".aliases\";\nexport const metadataBlobName = \".metadata\";\nexport const chunksBlobName = \".chunks\";\nexport const electedSummarizerBlobName = \".electedSummarizer\";\nexport const blobsTreeName = \".blobs\";\nexport const idCompressorBlobName = \".idCompressor\";\nexport const blobHeadersBlobName = blobNameForBlobHeaders;\n\nexport function rootHasIsolatedChannels(metadata?: IContainerRuntimeMetadata): boolean {\n\treturn !!metadata && !metadata.disableIsolatedChannels;\n}\n\nexport const protocolTreeName = \".protocol\";\n\n/**\n * List of tree IDs at the container level which are reserved.\n * This is for older versions of summaries that do not yet have an\n * isolated data stores namespace. Without the namespace, this must\n * be used to prevent name collisions with data store IDs.\n */\nexport const nonDataStorePaths = [\n\tprotocolTreeName,\n\t\".logTail\",\n\t\".serviceProtocol\",\n\tblobsTreeName,\n\tgcTreeKey,\n\tidCompressorBlobName,\n];\n\nexport const dataStoreAttributesBlobName = \".component\";\n\n/**\n * Modifies summary tree and stats to put tree under .channels tree.\n *\n * @param summarizeResult - Summary tree and stats to modify\n *\n * @example\n *\n * Converts from:\n *\n * ```typescript\n * {\n * type: SummaryType.Tree,\n * tree: { a: {...}, b: {...}, c: {...} },\n * }\n * ```\n *\n * to:\n *\n * ```typescript\n * {\n * type: SummaryType.Tree,\n * tree: {\n * \".channels\": {\n * type: SummaryType.Tree,\n * tree: { a: {...}, b: {...}, c: {...} }\n * },\n * },\n * }\n * ```\n *\n * And adds +1 to treeNodeCount in stats.\n */\nexport function wrapSummaryInChannelsTree(summarizeResult: ISummaryTreeWithStats): void {\n\tsummarizeResult.summary = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: { [channelsTreeName]: summarizeResult.summary },\n\t};\n\tsummarizeResult.stats.treeNodeCount++;\n}\n\nexport async function getFluidDataStoreAttributes(\n\tstorage: IDocumentStorageService,\n\tsnapshot: ISnapshotTree,\n): Promise<ReadFluidDataStoreAttributes> {\n\tconst attributes = await readAndParse<ReadFluidDataStoreAttributes>(\n\t\tstorage,\n\t\tsnapshot.blobs[dataStoreAttributesBlobName],\n\t);\n\t// Use the snapshotFormatVersion to determine how the pkg is encoded in the snapshot.\n\t// For snapshotFormatVersion = \"0.1\" (1) or above, pkg is jsonified, otherwise it is just a string.\n\t// However the feature of loading a detached container from snapshot, is added when the\n\t// snapshotFormatVersion is at least \"0.1\" (1), so we don't expect it to be anything else.\n\tconst formatVersion = getAttributesFormatVersion(attributes);\n\tassert(formatVersion > 0, 0x1d5 /* Invalid snapshot format version */);\n\treturn attributes;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-runtime",
3
- "version": "2.0.0-internal.6.3.3",
3
+ "version": "2.0.0-internal.6.4.0",
4
4
  "description": "Fluid container runtime",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -35,18 +35,18 @@
35
35
  "temp-directory": "nyc/.nyc_output"
36
36
  },
37
37
  "dependencies": {
38
- "@fluid-internal/client-utils": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
39
- "@fluidframework/container-definitions": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
40
- "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
41
- "@fluidframework/core-interfaces": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
42
- "@fluidframework/core-utils": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
43
- "@fluidframework/datastore": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
44
- "@fluidframework/driver-definitions": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
45
- "@fluidframework/driver-utils": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
38
+ "@fluid-internal/client-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
39
+ "@fluidframework/container-definitions": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
40
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
41
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
42
+ "@fluidframework/core-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
43
+ "@fluidframework/datastore": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
44
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
45
+ "@fluidframework/driver-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
46
46
  "@fluidframework/protocol-definitions": "^1.1.0",
47
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
48
- "@fluidframework/runtime-utils": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
49
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
47
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
48
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
49
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
50
50
  "double-ended-queue": "^2.1.0-0",
51
51
  "events": "^3.1.0",
52
52
  "lz4js": "^0.2.0",
@@ -54,15 +54,15 @@
54
54
  "uuid": "^9.0.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@fluid-internal/stochastic-test-utils": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
57
+ "@fluid-internal/stochastic-test-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
58
58
  "@fluid-tools/benchmark": "^0.48.0",
59
59
  "@fluid-tools/build-cli": "^0.22.0",
60
60
  "@fluidframework/build-common": "^2.0.0",
61
61
  "@fluidframework/build-tools": "^0.22.0",
62
- "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.6.3.1",
62
+ "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.6.3.0",
63
63
  "@fluidframework/eslint-config-fluid": "^2.1.0",
64
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
65
- "@fluidframework/test-runtime-utils": ">=2.0.0-internal.6.3.3 <2.0.0-internal.6.4.0",
64
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
65
+ "@fluidframework/test-runtime-utils": ">=2.0.0-internal.6.4.0 <2.0.0-internal.6.5.0",
66
66
  "@microsoft/api-extractor": "^7.34.4",
67
67
  "@types/double-ended-queue": "^2.1.0",
68
68
  "@types/events": "^3.0.0",
@@ -38,7 +38,11 @@ import {
38
38
  } from "@fluidframework/runtime-definitions";
39
39
 
40
40
  import { ContainerRuntime, TombstoneResponseHeaderKey } from "./containerRuntime";
41
- import { sendGCUnexpectedUsageEvent, sweepAttachmentBlobsKey, throwOnTombstoneLoadKey } from "./gc";
41
+ import {
42
+ sendGCUnexpectedUsageEvent,
43
+ disableAttachmentBlobSweepKey,
44
+ throwOnTombstoneLoadKey,
45
+ } from "./gc";
42
46
  import { Throttler, formExponentialFn, IThrottler } from "./throttler";
43
47
  import { summarizerClientType } from "./summary";
44
48
  import { IBlobMetadata } from "./metadata";
@@ -132,6 +136,7 @@ interface PendingBlob {
132
136
  attached?: boolean;
133
137
  acked?: boolean;
134
138
  abortSignal?: AbortSignal;
139
+ pendingStashed?: boolean;
135
140
  }
136
141
 
137
142
  export interface IPendingBlobs {
@@ -265,6 +270,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
265
270
  attached,
266
271
  acked,
267
272
  opsent: true,
273
+ pendingStashed: true,
268
274
  });
269
275
  });
270
276
 
@@ -325,13 +331,17 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
325
331
  uploadTime: pending?.uploadTime,
326
332
  });
327
333
  }
334
+
335
+ public hasPendingStashedBlobs(): boolean {
336
+ return Array.from(this.pendingBlobs.values()).some((e) => e.pendingStashed === true);
337
+ }
328
338
  /**
329
339
  * Upload blobs added while offline. This must be completed before connecting and resubmitting ops.
330
340
  */
331
341
  public async processStashedChanges() {
332
342
  this.retryThrottler.cancel();
333
343
  const pendingUploads = Array.from(this.pendingBlobs.values())
334
- .filter((e) => e.uploading === true)
344
+ .filter((e) => e.pendingStashed === true)
335
345
  .map(async (e) => e.uploadP);
336
346
  await PerformanceEvent.timedExecAsync(
337
347
  this.mc.logger,
@@ -555,7 +565,6 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
555
565
  (this.opsInFlight.get(response.id) ?? []).concat(localId),
556
566
  );
557
567
  }
558
-
559
568
  return response;
560
569
  }
561
570
 
@@ -610,6 +619,9 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
610
619
  this.deletePendingBlob(localId);
611
620
  return;
612
621
  }
622
+ if (pendingEntry?.pendingStashed) {
623
+ pendingEntry.pendingStashed = false;
624
+ }
613
625
  }
614
626
  assert(blobId !== undefined, 0x12a /* "Missing blob id on metadata" */);
615
627
 
@@ -755,11 +767,11 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
755
767
  * Delete attachment blobs that are sweep ready.
756
768
  * @param sweepReadyBlobRoutes - The routes of blobs that are sweep ready and should be deleted. These routes will
757
769
  * be based off of local ids.
758
- * @returns - The routes of blobs that were deleted.
770
+ * @returns The routes of blobs that were deleted.
759
771
  */
760
772
  public deleteSweepReadyNodes(sweepReadyBlobRoutes: string[]): string[] {
761
773
  // If sweep for attachment blobs is not enabled, return empty list indicating nothing is deleted.
762
- if (this.mc.config.getBoolean(sweepAttachmentBlobsKey) !== true) {
774
+ if (this.mc.config.getBoolean(disableAttachmentBlobSweepKey) === true) {
763
775
  return [];
764
776
  }
765
777
 
@@ -918,7 +930,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
918
930
  }
919
931
  }
920
932
 
921
- public async getPendingBlobs(waitBlobsToAttach?: boolean): Promise<IPendingBlobs | undefined> {
933
+ public async attachAndGetPendingBlobs(): Promise<IPendingBlobs | undefined> {
922
934
  return PerformanceEvent.timedExecAsync(
923
935
  this.mc.logger,
924
936
  { eventName: "GetPendingBlobs" },
@@ -933,34 +945,32 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
933
945
  for (const [id, entry] of this.pendingBlobs) {
934
946
  if (!localBlobs.has(entry)) {
935
947
  localBlobs.add(entry);
936
- if (waitBlobsToAttach) {
937
- if (!entry.opsent) {
938
- this.sendBlobAttachOp(id, entry.storageId);
939
- }
940
- entry.handleP.resolve(this.getBlobHandle(id));
941
- attachBlobsP.push(
942
- new Promise<void>((resolve) => {
943
- const onBlobAttached = (attachedEntry) => {
944
- if (attachedEntry === entry) {
945
- this.off("blobAttached", onBlobAttached);
946
- resolve();
947
- }
948
- };
949
- if (!entry.attached) {
950
- this.on("blobAttached", onBlobAttached);
951
- } else {
948
+ if (!entry.opsent) {
949
+ this.sendBlobAttachOp(id, entry.storageId);
950
+ }
951
+ entry.handleP.resolve(this.getBlobHandle(id));
952
+ attachBlobsP.push(
953
+ new Promise<void>((resolve) => {
954
+ const onBlobAttached = (attachedEntry) => {
955
+ if (attachedEntry === entry) {
956
+ this.off("blobAttached", onBlobAttached);
952
957
  resolve();
953
958
  }
954
- }),
955
- );
956
- }
959
+ };
960
+ if (!entry.attached) {
961
+ this.on("blobAttached", onBlobAttached);
962
+ } else {
963
+ resolve();
964
+ }
965
+ }),
966
+ );
957
967
  }
958
968
  }
959
969
  await Promise.all(attachBlobsP);
960
970
  }
961
- // another for is needed to correctly mark attach state
962
- // future optimization won't add unattached blobs to the list
971
+
963
972
  for (const [id, entry] of this.pendingBlobs) {
973
+ assert(entry.attached === true, 0x790 /* stashed blob should be attached */);
964
974
  blobs[id] = {
965
975
  blob: bufferToString(entry.blob, "base64"),
966
976
  storageId: entry.storageId,
@@ -970,7 +980,7 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
970
980
  uploadTime: entry.uploadTime,
971
981
  };
972
982
  }
973
- return blobs;
983
+ return Object.keys(blobs).length > 0 ? blobs : undefined;
974
984
  },
975
985
  );
976
986
  }