@fluid-experimental/tree 0.59.2002 → 0.59.2004
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SharedTree.d.ts.map +1 -1
- package/dist/SharedTree.js +6 -3
- package/dist/SharedTree.js.map +1 -1
- package/lib/SharedTree.d.ts.map +1 -1
- package/lib/SharedTree.js +6 -3
- package/lib/SharedTree.js.map +1 -1
- package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeTests.js +26 -0
- package/lib/test/utilities/SharedTreeTests.js.map +1 -1
- package/package.json +14 -14
- package/src/SharedTree.ts +6 -3
package/dist/SharedTree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedTree.d.ts","sourceRoot":"","sources":["../src/SharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEN,gBAAgB,EAChB,mBAAmB,EAEnB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,EAA6D,cAAc,EAAE,MAAM,WAAW,CAAC;AACtG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAA2D,MAAM,eAAe,CAAC;AAEtH,OAAO,EAIN,SAAS,EAGT,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAEN,cAAc,EAKd,IAAI,EAGJ,UAAU,EAWV,qBAAqB,EAIrB,WAAW,EAEX,kBAAkB,EAClB,MAAM,mBAAmB,CAAC;AA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
|
|
|
621
621
|
const typedMessage = message;
|
|
622
622
|
this.cachingLogViewer.setMinimumSequenceNumber(typedMessage.minimumSequenceNumber);
|
|
623
623
|
const op = typedMessage.contents;
|
|
624
|
+
if (op.version === undefined) {
|
|
625
|
+
// Back-compat: some legacy documents may contain trailing ops with an unstamped version; normalize them.
|
|
626
|
+
op.version = persisted_types_1.WriteFormat.v0_0_2;
|
|
627
|
+
}
|
|
624
628
|
const { type, version } = op;
|
|
625
|
-
const
|
|
626
|
-
const sameVersion = resolvedVersion === this.writeFormat;
|
|
629
|
+
const sameVersion = version === this.writeFormat;
|
|
627
630
|
// Edit and handle ops should only be processed if they're the same version as the tree write version.
|
|
628
631
|
// Update ops should only be processed if they're not the same version.
|
|
629
632
|
if (sameVersion) {
|
|
@@ -656,7 +659,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
|
|
|
656
659
|
else if (type === persisted_types_1.SharedTreeOpType.Update) {
|
|
657
660
|
this.processVersionUpdate(op.version);
|
|
658
661
|
}
|
|
659
|
-
else if (compareSummaryFormatVersions(
|
|
662
|
+
else if (compareSummaryFormatVersions(version, this.writeFormat) === 1) {
|
|
660
663
|
// An op version newer than our current version should not be received. If this happens, either an
|
|
661
664
|
// incorrect op version has been written or an update op was skipped.
|
|
662
665
|
const error = 'Newer op version received by a client that has yet to be updated.';
|
package/dist/SharedTree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedTree.js","sourceRoot":"","sources":["../src/SharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyE;AAWzE,iFAAoE;AACpE,2EAM4C;AAE5C,qEAA8G;AAE9G,qCAAmF;AACnF,uCAAsG;AACtG,+CAAsH;AACtH,+CAA4C;AAC5C,2CAOqB;AACrB,yEAA+E;AAE/E,uDA4B2B;AAC3B,uCAAuD;AACvD,mDAQyB;AACzB,uDAA6G;AAC7G,6CAA0E;AAC1E,iDAA8C;AAC9C,2DAAuF;AACvF,6DA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CAAC,CAAC,CAAC;KACV;SAAM,IAAI,aAAa,GAAG,aAAa,EAAE;QACzC,OAAO,CAAC,CAAC;KACT;IAED,OAAO,CAAC,CAAC;AACV,CAAC;AAED;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,UAAkB,EAAE,UAAkB;IAC/D,MAAM,eAAe,GAAG,mBAAmB,CAAC,OAAO,CAAC,UAAyB,CAAC,CAAC;IAC/E,IAAI,eAAe,KAAK,CAAC,CAAC,EAAE;QAC3B,aAAI,CAAC,+BAA+B,CAAC,CAAC;KACtC;IAED,OAAO,4BAA4B,CAAC,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACnF,CAAC;AAED,SAAS,kBAAkB,CAAC,MAA+C;IAC1E,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, IsoBuffer } from '@fluidframework/common-utils';\nimport { IFluidHandle } from '@fluidframework/core-interfaces';\nimport { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';\nimport {\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelFactory,\n\tIChannelAttributes,\n\tIChannelServices,\n\tIChannel,\n} from '@fluidframework/datastore-definitions';\nimport { AttachState } from '@fluidframework/container-definitions';\nimport {\n\tcreateSingleBlobSummary,\n\tIFluidSerializer,\n\tISharedObjectEvents,\n\tserializeHandles,\n\tSharedObject,\n} from '@fluidframework/shared-object-base';\nimport { ITelemetryLogger, ITelemetryProperties } from '@fluidframework/common-definitions';\nimport { ChildLogger, ITelemetryLoggerPropertyBags, PerformanceEvent } from '@fluidframework/telemetry-utils';\nimport { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';\nimport { assert, assertNotUndefined, fail, copyPropertyIfDefined } from './Common';\nimport { EditHandle, EditLog, getNumberOfHandlesFromEditLogSummary, OrderedEditSet } from './EditLog';\nimport { EditId, NodeId, StableNodeId, DetachedSequenceId, OpSpaceNodeId, isDetachedSequenceId } from './Identifiers';\nimport { initialTree } from './InitialTree';\nimport {\n\tCachingLogViewer,\n\tEditCacheEntry,\n\tEditStatusCallback,\n\tLogViewer,\n\tSequencedEditResult,\n\tSequencedEditResultCallback,\n} from './LogViewer';\nimport { deserialize, getSummaryStatistics } from './SummaryBackCompatibility';\nimport { ReconciliationPath } from './ReconciliationPath';\nimport {\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeNode,\n\tChangeTypeInternal,\n\tConstraintInternal,\n\tDetachInternal,\n\tEdit,\n\tEditLogSummary,\n\tEditChunkContents,\n\tEditStatus,\n\tEditWithoutId,\n\treservedIdCount,\n\tSharedTreeEditOp,\n\tSharedTreeEditOp_0_0_2,\n\tSharedTreeHandleOp,\n\tSharedTreeNoOp,\n\tSharedTreeOp,\n\tSharedTreeOpType,\n\tSharedTreeOp_0_0_2,\n\tSharedTreeSummary,\n\tSharedTreeSummaryBase,\n\tSharedTreeSummary_0_0_2,\n\tTreeNode,\n\tghostSessionId,\n\tWriteFormat,\n\tTreeNodeSequence,\n\tInternalizedChange,\n} from './persisted-types';\nimport { serialize, SummaryContents } from './Summary';\nimport {\n\tareRevisionViewsSemanticallyEqual,\n\tconvertTreeNodes,\n\tdeepCloneStablePlace,\n\tdeepCloneStableRange,\n\tinternalizeBuildNode,\n\tnewEditId,\n\twalkTree,\n} from './EditUtilities';\nimport { getNodeIdContext, NodeIdContext, NodeIdNormalizer, sequencedIdNormalizer } from './NodeIdUtilities';\nimport { SharedTreeDiagnosticEvent, SharedTreeEvent } from './EventTypes';\nimport { RevisionView } from './RevisionView';\nimport { SharedTreeEncoder_0_0_2, SharedTreeEncoder_0_1_1 } from './SharedTreeEncoder';\nimport { revert } from './HistoryEditFactory';\nimport { BuildNode, BuildTreeNode, Change, ChangeType } from './ChangeTypes';\nimport { TransactionInternal } from './TransactionInternal';\nimport { IdCompressor, createSessionId } from './id-compressor';\nimport { convertEditIds } from './IdConversion';\nimport { MutableStringInterner } from './StringInterner';\n\n/**\n * Factory for SharedTree.\n * Includes history in the summary.\n * @public\n */\nexport class SharedTreeFactory implements IChannelFactory {\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.\"type\"}\n\t */\n\tpublic static Type = 'SharedTree';\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}\n\t */\n\tpublic static Attributes: IChannelAttributes = {\n\t\ttype: SharedTreeFactory.Type,\n\t\tsnapshotFormatVersion: '0.1',\n\t\tpackageVersion: '0.1',\n\t};\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store.\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format\n\t * documentation](../docs/Write-Format.md) for more information.\n\t * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.\n\t * See the [breaking change migration documentation](docs/Breaking-Change-Migration) for more details on this scheme.\n\t * @param expensiveValidation - Enables expensive asserts on SharedTree.\n\t * @returns A factory that creates `SharedTree`s and loads them from storage.\n\t */\n\tconstructor(\n\t\tprivate readonly writeFormat: WriteFormat,\n\t\tprivate readonly summarizeHistory: false | { uploadEditChunks: boolean } = false,\n\t\tprivate expensiveValidation = false\n\t) {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn SharedTreeFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn SharedTreeFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\t_channelAttributes: Readonly<IChannelAttributes>\n\t): Promise<IChannel> {\n\t\tconst sharedTree = this.createSharedTree(runtime, id);\n\t\tawait sharedTree.load(services);\n\t\treturn sharedTree;\n\t}\n\n\t/**\n\t * Create a new SharedTree.\n\t * @param runtime - data store runtime that owns the new SharedTree\n\t * @param id - optional name for the SharedTree\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string, expensiveValidation: boolean = false): SharedTree {\n\t\tthis.expensiveValidation = expensiveValidation;\n\t\tconst sharedTree = this.createSharedTree(runtime, id);\n\t\tsharedTree.initializeLocal();\n\t\treturn sharedTree;\n\t}\n\n\tprivate createSharedTree(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst sharedTree = new SharedTree(\n\t\t\truntime,\n\t\t\tid,\n\t\t\tthis.writeFormat,\n\t\t\tthis.summarizeHistory,\n\t\t\tthis.expensiveValidation\n\t\t);\n\t\treturn sharedTree;\n\t}\n}\n\n/**\n * Filename where the snapshot is stored.\n */\nconst snapshotFileName = 'header';\n\n/**\n * Used for version comparison.\n */\nconst sortedWriteVersions = [WriteFormat.v0_0_2, WriteFormat.v0_1_1];\n\n/**\n * The arguments included when the EditCommitted SharedTreeEvent is emitted.\n * @public\n */\nexport interface EditCommittedEventArguments {\n\t/** The ID of the edit committed. */\n\treadonly editId: EditId;\n\t/** Whether or not this is a local edit. */\n\treadonly local: boolean;\n\t/** The tree the edit was committed on. Required for local edit events handled by SharedTreeUndoRedoHandler. */\n\treadonly tree: SharedTree;\n}\n\n/**\n * The arguments included when the {@link SharedTreeEvent.SequencedEditApplied} SharedTreeEvent is emitted.\n * @public\n */\nexport interface SequencedEditAppliedEventArguments {\n\t/** The ID of the edit committed. */\n\treadonly edit: Edit<ChangeInternal>;\n\t/** Whether or not this was a local edit. */\n\treadonly wasLocal: boolean;\n\t/** The tree the edit was applied to. */\n\treadonly tree: SharedTree;\n\t/** The telemetry logger associated with sequenced edit application. */\n\treadonly logger: ITelemetryLogger;\n\t/** The reconciliation path for the edit. See {@link ReconciliationPath} for details. */\n\treadonly reconciliationPath: ReconciliationPath;\n\t/** The outcome of the sequenced edit being applied. */\n\treadonly outcome: EditApplicationOutcome;\n}\n\n/**\n * The outcome of an edit.\n * @public\n */\nexport type EditApplicationOutcome =\n\t| {\n\t\t\t/**\n\t\t\t * The revision view resulting from the edit.\n\t\t\t */\n\t\t\treadonly view: RevisionView;\n\t\t\t/**\n\t\t\t * The status code for the edit that produced the revision.\n\t\t\t */\n\t\t\treadonly status: EditStatus.Applied;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The revision view resulting from the edit.\n\t\t\t */\n\t\t\treadonly failure: TransactionInternal.Failure;\n\t\t\t/**\n\t\t\t * The status code for the edit that produced the revision.\n\t\t\t */\n\t\t\treadonly status: EditStatus.Invalid | EditStatus.Malformed;\n\t };\n\n/**\n * Events which may be emitted by `SharedTree`. See {@link SharedTreeEvent} for documentation of event semantics.\n * @public\n */\nexport interface ISharedTreeEvents extends ISharedObjectEvents {\n\t(event: 'committedEdit', listener: EditCommittedHandler);\n\t(event: 'appliedSequencedEdit', listener: SequencedEditAppliedHandler);\n}\n\n/**\n * Expected type for a handler of the `EditCommitted` event.\n * @public\n */\nexport type EditCommittedHandler = (args: EditCommittedEventArguments) => void;\n\n/**\n * Expected type for a handler of the {@link SharedTreeEvent.SequencedEditApplied} event.\n * @public\n */\nexport type SequencedEditAppliedHandler = (args: SequencedEditAppliedEventArguments) => void;\n\nconst sharedTreeTelemetryProperties: ITelemetryLoggerPropertyBags = { all: { isSharedTreeEvent: true } };\n\n/**\n * A [distributed tree](../Readme.md).\n * @public\n */\nexport class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeIdContext {\n\t/**\n\t * Create a new SharedTree. It will contain the default value (see initialTree).\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedTree {\n\t\treturn runtime.createChannel(id, SharedTreeFactory.Type) as SharedTree;\n\t}\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store.\n\t * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.\n\t *\n\t * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.\n\t * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.\n\t *\n\t * The technical limitations here relate to clients with mixed versions collaborating.\n\t * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.\n\t * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.\n\t * See docs/Breaking-Change-Migration for more details on the consensus scheme.\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.\n\t * This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree\n\t * that was initialized with a newer write version connects to the session. Care must be taken when changing this value,\n\t * as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version\n\t * written.\n\t * See [the write format documentation](../docs/Write-Format.md) for more information.\n\t * @returns A factory that creates `SharedTree`s and loads them from storage.\n\t */\n\tpublic static getFactory(\n\t\twriteFormat: WriteFormat,\n\t\tsummarizeHistory: false | { uploadEditChunks: boolean } = false\n\t): SharedTreeFactory {\n\t\t// \tOn 0.1.1 documents, due to current code limitations, all clients MUST agree on the value of `summarizeHistory`.\n\t\t// Note that this means staged rollout changing this value should not be attempted.\n\t\t// It is possible to update shared-tree to correctly handle such a staged rollout, but that hasn't been implemented.\n\t\t// See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.\n\t\treturn new SharedTreeFactory(writeFormat, summarizeHistory);\n\t}\n\n\tprivate idCompressor: IdCompressor = new IdCompressor(createSessionId(), reservedIdCount);\n\tprivate readonly idNormalizer: NodeIdNormalizer<OpSpaceNodeId> & { tree: SharedTree } = {\n\t\ttree: this,\n\t\tget localSessionId() {\n\t\t\treturn this.tree.idCompressor.localSessionId;\n\t\t},\n\t\tnormalizeToOpSpace: (id) => this.idCompressor.normalizeToOpSpace(id) as OpSpaceNodeId,\n\t\tnormalizeToSessionSpace: (id, sessionId) => this.idCompressor.normalizeToSessionSpace(id, sessionId) as NodeId,\n\t};\n\n\t// The initial tree's definition isn't included in any op by default but it should still be interned. Including it here ensures that.\n\tprivate interner: MutableStringInterner = new MutableStringInterner([initialTree.definition]);\n\n\t/**\n\t * The log of completed edits for this SharedTree.\n\t */\n\tprivate editLog: EditLog<ChangeInternal>;\n\n\t/**\n\t * As an implementation detail, SharedTree uses a log viewer that caches views of different revisions.\n\t * It is not exposed to avoid accidental correctness issues, but `logViewer` is exposed in order to give clients a way\n\t * to access the revision history.\n\t */\n\tprivate cachingLogViewer: CachingLogViewer;\n\n\t/**\n\t * Viewer for trees defined by editLog. This allows access to views of the tree at different revisions (various points in time).\n\t */\n\tpublic get logViewer(): LogViewer {\n\t\treturn this.cachingLogViewer;\n\t}\n\n\tprotected readonly logger: ITelemetryLogger;\n\tprivate readonly sequencedEditAppliedLogger: ITelemetryLogger;\n\n\tprivate readonly encoder_0_0_2: SharedTreeEncoder_0_0_2;\n\tprivate encoder_0_1_1: SharedTreeEncoder_0_1_1;\n\n\t/** Indicates if the client is the oldest member of the quorum. */\n\tprivate currentIsOldest: boolean;\n\n\tprivate readonly processEditResult = (editResult: EditStatus, editId: EditId): void => {\n\t\t// TODO:#44859: Invalid results should be handled by the app\n\t\tthis.emit(SharedTree.eventFromEditResult(editResult), editId);\n\t};\n\n\tprivate readonly processSequencedEditResult = ({\n\t\tedit,\n\t\twasLocal,\n\t\tresult,\n\t\treconciliationPath,\n\t}: SequencedEditResult): void => {\n\t\tconst eventArguments: SequencedEditAppliedEventArguments = {\n\t\t\tedit,\n\t\t\twasLocal,\n\t\t\ttree: this,\n\t\t\tlogger: this.sequencedEditAppliedLogger,\n\t\t\treconciliationPath,\n\t\t\toutcome: result,\n\t\t};\n\t\tthis.emit(SharedTreeEvent.SequencedEditApplied, eventArguments);\n\t};\n\n\tprivate summarizeHistory: boolean;\n\tprivate uploadEditChunks: boolean;\n\n\t/**\n\t * Create a new SharedTreeFactory.\n\t * @param runtime - The runtime the SharedTree will be associated with\n\t * @param id - Unique ID for the SharedTree\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format\n\t * documentation](../docs/Write-Format.md) for more information.\n\t * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.\n\t * @param expensiveValidation - Enable expensive asserts.\n\t */\n\tpublic constructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tprivate writeFormat: WriteFormat,\n\t\tsummarizeHistory: false | { uploadEditChunks: boolean } = false,\n\t\tprivate readonly expensiveValidation = false\n\t) {\n\t\tsuper(id, runtime, SharedTreeFactory.Attributes);\n\t\tthis.summarizeHistory = summarizeHistory === false ? false : true;\n\t\tthis.uploadEditChunks = summarizeHistory === false ? false : summarizeHistory.uploadEditChunks;\n\n\t\t// This code is somewhat duplicated from OldestClientObserver because it currently depends on the container runtime\n\t\t// which SharedTree does not have access to.\n\t\t// TODO:#55900: Get rid of copy-pasted OldestClientObserver code\n\t\tconst quorum = this.runtime.getQuorum();\n\t\tthis.currentIsOldest = this.computeIsOldest();\n\t\tquorum.on('addMember', this.updateOldest);\n\t\tquorum.on('removeMember', this.updateOldest);\n\t\truntime.on('connected', this.updateOldest);\n\t\truntime.on('disconnected', this.updateOldest);\n\n\t\tthis.logger = ChildLogger.create(runtime.logger, 'SharedTree', sharedTreeTelemetryProperties);\n\t\tthis.sequencedEditAppliedLogger = ChildLogger.create(\n\t\t\tthis.logger,\n\t\t\t'SequencedEditApplied',\n\t\t\tsharedTreeTelemetryProperties\n\t\t);\n\n\t\tconst { editLog, cachingLogViewer } = this.initializeNewEditLogFromSummary(\n\t\t\t{\n\t\t\t\teditChunks: [],\n\t\t\t\teditIds: [],\n\t\t\t},\n\t\t\tundefined,\n\t\t\tthis.idCompressor, // TODO: Attribution info\n\t\t\tthis.processEditResult,\n\t\t\tthis.processSequencedEditResult,\n\t\t\tWriteFormat.v0_1_1\n\t\t);\n\t\tthis.editLog = editLog;\n\t\tthis.cachingLogViewer = cachingLogViewer;\n\t\tthis.encoder_0_0_2 = new SharedTreeEncoder_0_0_2(this.summarizeHistory);\n\t\tthis.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);\n\t}\n\n\tpublic getWriteFormat(): WriteFormat {\n\t\treturn this.writeFormat;\n\t}\n\n\t/**\n\t * Re-computes currentIsOldest and emits an event if it has changed.\n\t * TODO:#55900: Get rid of copy-pasted OldestClientObserver code\n\t */\n\tprivate readonly updateOldest = () => {\n\t\tconst oldest = this.computeIsOldest();\n\t\tif (this.currentIsOldest !== oldest) {\n\t\t\tthis.currentIsOldest = oldest;\n\t\t\tif (oldest) {\n\t\t\t\tthis.emit('becameOldest');\n\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: 'BecameOldestClient' });\n\t\t\t} else {\n\t\t\t\tthis.emit('lostOldest');\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * Computes the oldest client in the quorum, true by default if the container is detached and false by default if the client isn't connected.\n\t * TODO:#55900: Get rid of copy-pasted OldestClientObserver code\n\t */\n\tprivate computeIsOldest(): boolean {\n\t\t// If the container is detached, we are the only ones that know about it and are the oldest by default.\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// If we're not connected we can't be the oldest connected client.\n\t\tif (!this.runtime.connected) {\n\t\t\treturn false;\n\t\t}\n\n\t\tassert(this.runtime.clientId !== undefined, 'Client id should be set if connected.');\n\n\t\tconst quorum = this.runtime.getQuorum();\n\t\tconst selfSequencedClient = quorum.getMember(this.runtime.clientId);\n\t\t// When in readonly mode our clientId will not be present in the quorum.\n\t\tif (selfSequencedClient === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst members = quorum.getMembers();\n\t\tfor (const sequencedClient of members.values()) {\n\t\t\tif (sequencedClient.sequenceNumber < selfSequencedClient.sequenceNumber) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// No member of the quorum was older\n\t\treturn true;\n\t}\n\n\t/**\n\t * @returns the current view of the tree.\n\t */\n\tpublic get currentView(): RevisionView {\n\t\treturn this.logViewer.getRevisionViewInSession(Number.POSITIVE_INFINITY);\n\t}\n\n\t/**\n\t * Generates a node identifier.\n\t * The returned IDs may be used as the identifier of a node in the SharedTree.\n\t * `NodeId`s are *always* unique and stable within the scope of the tree and session that generated them. They are *not* unique within\n\t * a Fluid container, and *cannot* be compared across instances of a SharedTree. They are *not* stable across sessions/lifetimes of a\n\t * SharedTree, and *cannot* be persisted (e.g. stored in payloads, uploaded in blobs, etc.). If stable persistence is needed,\n\t * NodeIdConverter.convertToStableNodeId may be used to return a corresponding UUID that is globally unique and stable.\n\t * @param override - if supplied, calls to `convertToStableNodeId` using the returned node ID will return the override instead of\n\t * the UUID. Calls to `generateNodeId` with the same override always return the same ID. Performance note: passing an override string\n\t * incurs a storage cost that is significantly higher that a node ID without one, and should be avoided if possible.\n\t * @public\n\t */\n\tpublic generateNodeId(override?: string): NodeId {\n\t\treturn this.idCompressor.generateCompressedId(override) as NodeId;\n\t}\n\n\t/**\n\t * Given a NodeId, returns the corresponding stable ID or throws if the supplied node ID was not generated with this tree (`NodeId`s\n\t * may not be used across SharedTree instances, see `generateNodeId` for more).\n\t * The returned value will be a UUID, unless the creation of `id` used an override string (see `generateNodeId` for more).\n\t * The result is safe to persist and re-use across `SharedTree` instances, unlike `NodeId`.\n\t * @public\n\t */\n\tpublic convertToStableNodeId(id: NodeId): StableNodeId {\n\t\treturn (this.idCompressor.tryDecompress(id) as StableNodeId) ?? fail('Node id is not known to this SharedTree');\n\t}\n\n\t/**\n\t * Given a NodeId, attempt to return the corresponding stable ID.\n\t * The returned value will be a UUID, unless the creation of `id` used an override string (see `generateNodeId` for more).\n\t * The returned stable ID is undefined if `id` was never created with this SharedTree. If a stable ID is returned, this does not imply\n\t * that there is a node with `id` in the current revision of the tree, only that `id` was at some point generated by some instance of\n\t * this tree.\n\t * @public\n\t */\n\tpublic tryConvertToStableNodeId(id: NodeId): StableNodeId | undefined {\n\t\treturn this.idCompressor.tryDecompress(id) as StableNodeId | undefined;\n\t}\n\n\t/**\n\t * Given a stable ID, return the corresponding NodeId or throws if the supplied stable ID was never generated with this tree, either\n\t * as a UUID corresponding to a `NodeId` or as an override passed to `generateNodeId`.\n\t * If a stable ID is returned, this does not imply that there is a node with `id` in the current revision of the tree, only that\n\t * `id` was at some point generated by an instance of this SharedTree.\n\t * @public\n\t */\n\tpublic convertToNodeId(id: StableNodeId): NodeId {\n\t\treturn (\n\t\t\t(this.idCompressor.tryRecompress(id) as NodeId) ?? fail('Stable node id is not known to this SharedTree')\n\t\t);\n\t}\n\n\t/**\n\t * Given a stable ID, return the corresponding NodeId or return undefined if the supplied stable ID was never generated with this tree,\n\t * either as a UUID corresponding to a `NodeId` or as an override passed to `generateNodeId`.\n\t * If a stable ID is returned, this does not imply that there is a node with `id` in the current revision of the tree, only that\n\t * `id` was at some point generated by an instance of this SharedTree.\n\t * @public\n\t */\n\tpublic tryConvertToNodeId(id: StableNodeId): NodeId | undefined {\n\t\treturn this.idCompressor.tryRecompress(id) as NodeId | undefined;\n\t}\n\n\t/**\n\t * @returns the edit history of the tree.\n\t * @public\n\t */\n\tpublic get edits(): OrderedEditSet<InternalizedChange> {\n\t\treturn this.editLog as unknown as OrderedEditSet<InternalizedChange>;\n\t}\n\n\tprivate deserializeHandle(serializedHandle: string): IFluidHandle<ArrayBufferLike> {\n\t\tconst deserializeHandle = this.serializer.parse(serializedHandle);\n\t\tassert(typeof deserializeHandle === 'object');\n\t\treturn deserializeHandle as IFluidHandle<ArrayBufferLike>;\n\t}\n\n\t/**\n\t * Uploads the edit chunk and sends the chunk starting revision along with the resulting handle as an op.\n\t */\n\tprivate async uploadEditChunk(\n\t\tedits: readonly EditWithoutId<ChangeInternal>[],\n\t\tstartRevision: number\n\t): Promise<void> {\n\t\tassert(this.writeFormat !== WriteFormat.v0_0_2, 'Edit chunking is not supported in v0_0_2');\n\t\t// SPO attachment blob upload limit is set here:\n\t\t// https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=%2Fsts%2Fstsom%2FPrague%2FSPPragueProtocolConfig.cs&version=GBmaster&line=82&lineEnd=82&lineStartColumn=29&lineEndColumn=116&lineStyle=plain&_a=contents\n\t\t// TODO:#59754: Create chunks based on data buffer size instead of number of edits\n\t\tconst blobUploadSizeLimit = 4194304;\n\n\t\ttry {\n\t\t\tconst chunkContents = this.encoder_0_1_1.encodeEditChunk(\n\t\t\t\tedits,\n\t\t\t\tsequencedIdNormalizer(this.idNormalizer),\n\t\t\t\tthis.interner\n\t\t\t);\n\t\t\tconst serializedContents = serializeHandles(chunkContents, this.serializer, this.handle);\n\t\t\tconst buffer = IsoBuffer.from(serializedContents);\n\t\t\tconst bufferSize = buffer.byteLength;\n\t\t\tassert(\n\t\t\t\tbufferSize <= blobUploadSizeLimit,\n\t\t\t\t`Edit chunk size ${bufferSize} is larger than blob upload size limit of ${blobUploadSizeLimit} bytes.`\n\t\t\t);\n\t\t\tconst editHandle = await this.runtime.uploadBlob(buffer);\n\t\t\tconst handleOp: SharedTreeHandleOp = {\n\t\t\t\teditHandle:\n\t\t\t\t\tserializeHandles(editHandle, this.serializer, this.handle) ??\n\t\t\t\t\tfail('Edit chunk handle could not be serialized.'),\n\t\t\t\tstartRevision,\n\t\t\t\ttype: SharedTreeOpType.Handle,\n\t\t\t\tversion: this.writeFormat,\n\t\t\t};\n\t\t\tthis.submitOp(handleOp);\n\t\t\tthis.emit(SharedTreeDiagnosticEvent.EditChunkUploaded);\n\t\t} catch (error) {\n\t\t\t// If chunk load fails, we will try again later in loadCore on the oldest client so we log the error instead of throwing.\n\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: 'EditChunkUploadFailure',\n\t\t\t\t},\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tpublic summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\treturn createSingleBlobSummary(snapshotFileName, this.saveSerializedSummary({ serializer }));\n\t}\n\n\t/**\n\t * Saves this SharedTree into a serialized summary. This is used for testing.\n\t *\n\t * @param summarizer - Optional summarizer to use. If not passed in, SharedTree's summarizer is used.\n\t * @internal\n\t */\n\tpublic saveSerializedSummary(options?: { serializer?: IFluidSerializer }): string {\n\t\tconst { serializer } = options || {};\n\t\treturn serialize(this.saveSummary(), serializer ?? this.serializer, this.handle);\n\t}\n\n\t/**\n\t * Initialize shared tree with a serialized summary. This is used for testing.\n\t * @returns - statistics about the loaded summary.\n\t * @internal\n\t */\n\tpublic loadSerializedSummary(blobData: string): ITelemetryProperties {\n\t\tconst summary = deserialize(blobData, this.serializer);\n\t\tthis.loadSummary(summary);\n\t\treturn getSummaryStatistics(summary);\n\t}\n\n\t/**\n\t * Saves this SharedTree into a deserialized summary.\n\t * @internal\n\t */\n\tpublic saveSummary(): SharedTreeSummaryBase {\n\t\t// If local changes exist, emulate the sequencing of those changes.\n\t\t// Doing so is necessary so edits created during DataObject.initializingFirstTime are included.\n\t\t// Doing so is safe because it is guaranteed that the DDS has not yet been attached. This is because summary creation is only\n\t\t// ever invoked on a DataObject containing local changes when it is attached for the first time. In post-attach flows, an extra\n\t\t// instance of the DataObject is created for generating summaries and will never have local edits.\n\t\tif (this.editLog.numberOfLocalEdits > 0) {\n\t\t\tassert(\n\t\t\t\tthis.runtime.attachState !== AttachState.Attached,\n\t\t\t\t'Summarizing should not occur with local edits except on first attach.'\n\t\t\t);\n\t\t\tif (this.writeFormat === WriteFormat.v0_1_1) {\n\t\t\t\t// Since we're the first client to attach, we can safely finalize ourselves since we're the only ones who have made IDs.\n\t\t\t\tthis.idCompressor.finalizeCreationRange(this.idCompressor.takeNextCreationRange());\n\t\t\t\tfor (const edit of this.editLog.getLocalEdits()) {\n\t\t\t\t\tthis.internStringsFromEdit(edit);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.editLog.sequenceLocalEdits();\n\t\t}\n\n\t\tassert(this.editLog.numberOfLocalEdits === 0, 'generateSummary must not be called with local edits');\n\t\treturn this.generateSummary();\n\t}\n\n\t/**\n\t * Generates a SharedTree summary for the current state of the tree.\n\t * Will never be called when local edits are present.\n\t */\n\tprivate generateSummary(): SharedTreeSummaryBase {\n\t\ttry {\n\t\t\tswitch (this.writeFormat) {\n\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\treturn this.encoder_0_0_2.encodeSummary(this.editLog, this.currentView, this);\n\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\treturn this.encoder_0_1_1.encodeSummary(\n\t\t\t\t\t\tthis.editLog,\n\t\t\t\t\t\tthis.currentView,\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tthis.idNormalizer,\n\t\t\t\t\t\tthis.interner,\n\t\t\t\t\t\tthis.idCompressor.serialize(false)\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\tfail('Unknown version');\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logger?.sendErrorEvent({\n\t\t\t\teventName: 'UnsupportedSummaryWriteFormat',\n\t\t\t\tformatVersion: this.writeFormat,\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Initialize shared tree with a deserialized summary.\n\t * @internal\n\t */\n\tpublic loadSummary(summary: SharedTreeSummaryBase): void {\n\t\tconst { version: loadedSummaryVersion } = summary;\n\n\t\tif (isUpdateRequired(loadedSummaryVersion, this.writeFormat)) {\n\t\t\tthis.submitOp({ type: SharedTreeOpType.Update, version: this.writeFormat });\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: 'RequestVersionUpdate',\n\t\t\t\tversionFrom: loadedSummaryVersion,\n\t\t\t\tversionTo: this.writeFormat,\n\t\t\t});\n\t\t}\n\n\t\tif (compareSummaryFormatVersions(loadedSummaryVersion, this.writeFormat) !== 0) {\n\t\t\t// Write whatever format the loaded summary uses (this is the current agreed-upon format: it may be updated by an update op)\n\t\t\tthis.changeWriteFormat(loadedSummaryVersion);\n\t\t}\n\n\t\tassert(\n\t\t\tthis.idCompressor.getAllIdsFromLocalSession().next().done === true,\n\t\t\t'Summary load should not be executed after local state is created.'\n\t\t);\n\n\t\tlet convertedSummary: SummaryContents;\n\t\tswitch (loadedSummaryVersion) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\tconvertedSummary = this.encoder_0_0_2.decodeSummary(summary as SharedTreeSummary_0_0_2);\n\t\t\t\tbreak;\n\t\t\tcase WriteFormat.v0_1_1: {\n\t\t\t\tconst typedSummary = summary as SharedTreeSummary;\n\t\t\t\t// See comment in factory constructor--ensure we write a consistent type of summary as how the document began.\n\t\t\t\tconst loadedSummaryIncludesHistory = typedSummary.currentTree !== undefined;\n\t\t\t\tif (loadedSummaryIncludesHistory !== this.summarizeHistory) {\n\t\t\t\t\tthis.summarizeHistory = loadedSummaryIncludesHistory;\n\t\t\t\t\tthis.uploadEditChunks = loadedSummaryIncludesHistory;\n\t\t\t\t\tthis.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);\n\t\t\t\t}\n\n\t\t\t\tconvertedSummary = this.encoder_0_1_1.decodeSummary(summary as SharedTreeSummary);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('Unknown version');\n\t\t}\n\n\t\tconst { editHistory, currentTree, idCompressor, interner } = convertedSummary;\n\t\tthis.interner = interner;\n\t\tthis.interner.getOrCreateInternedId(initialTree.definition);\n\t\tif (compareSummaryFormatVersions(loadedSummaryVersion, WriteFormat.v0_1_1) < 0) {\n\t\t\tconst { editIds, editChunks } = editHistory;\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: 'SummaryConversion',\n\t\t\t\tformatVersion: WriteFormat.v0_1_1,\n\t\t\t\thistorySize: editIds.length,\n\t\t\t\ttotalNumberOfChunks: editChunks.length,\n\t\t\t\tuploadedChunks: getNumberOfHandlesFromEditLogSummary(editHistory),\n\t\t\t});\n\t\t}\n\n\t\tthis.initializeNewEditLogFromSummary(\n\t\t\teditHistory,\n\t\t\tcurrentTree,\n\t\t\tidCompressor,\n\t\t\tthis.processEditResult,\n\t\t\tthis.processSequencedEditResult,\n\t\t\tsummary.version\n\t\t);\n\n\t\tif (this.runtime.connected) {\n\t\t\tconst noChunksReadyForUpload = this.editLog.getEditChunksReadyForUpload()[Symbol.iterator]().next().done;\n\t\t\tif (noChunksReadyForUpload === undefined || !noChunksReadyForUpload) {\n\t\t\t\t// A client does not become a member of the quorum until it is within the collaboration window.\n\t\t\t\t//\n\t\t\t\t// The collaboration window is the range from the minimum sequence number enforced by the server and head.\n\t\t\t\t// When a client sends an op, they include the last sequence number the client has processed. We call this the reference\n\t\t\t\t// sequence number.\n\t\t\t\t//\n\t\t\t\t// If there are no members in the quorum, we send a no op op in order to have this client added as a member to the quorum.\n\t\t\t\t// This is required so we can ensure only the oldest client will upload blobs during summary load.\n\t\t\t\tif (this.runtime.getQuorum().getMembers().size === 0) {\n\t\t\t\t\tconst noop: SharedTreeNoOp = {\n\t\t\t\t\t\ttype: SharedTreeOpType.NoOp,\n\t\t\t\t\t\tversion: this.writeFormat,\n\t\t\t\t\t};\n\n\t\t\t\t\tthis.submitOp(noop);\n\t\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: 'NoOpSent' });\n\t\t\t\t} else if (this.currentIsOldest) {\n\t\t\t\t\tthis.uploadCatchUpBlobs();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If this client becomes the oldest, it should take care of uploading catch up blobs.\n\t\t\tthis.on('becameOldest', () => this.uploadCatchUpBlobs());\n\t\t}\n\t}\n\n\tprivate static eventFromEditResult(editStatus: EditStatus): SharedTreeDiagnosticEvent {\n\t\tswitch (editStatus) {\n\t\t\tcase EditStatus.Applied:\n\t\t\t\treturn SharedTreeDiagnosticEvent.AppliedEdit;\n\t\t\tcase EditStatus.Invalid:\n\t\t\t\treturn SharedTreeDiagnosticEvent.DroppedInvalidEdit;\n\t\t\tdefault:\n\t\t\t\treturn SharedTreeDiagnosticEvent.DroppedMalformedEdit;\n\t\t}\n\t}\n\n\t/**\n\t * Initializes a new `EditLog` and `CachingLogViewer` on this `SharedTree`, replacing and disposing of any previously existing ones.\n\t * @returns the initialized values (this is mostly to keep the constructor happy)\n\t */\n\tprivate initializeNewEditLogFromSummary(\n\t\teditHistory: EditLogSummary<ChangeInternal, EditHandle<ChangeInternal>>,\n\t\tcurrentTree: ChangeNode | undefined,\n\t\tidCompressor: IdCompressor,\n\t\teditStatusCallback: EditStatusCallback,\n\t\tsequencedEditResultCallback: SequencedEditResultCallback,\n\t\tversion: WriteFormat\n\t): { editLog: EditLog<ChangeInternal>; cachingLogViewer: CachingLogViewer } {\n\t\tthis.idCompressor = idCompressor;\n\t\t// Dispose the current log viewer if it exists. This ensures that re-used EditAddedHandlers below don't retain references to old\n\t\t// log viewers.\n\t\tthis.cachingLogViewer?.detachFromEditLog();\n\t\tconst indexOfFirstEditInSession =\n\t\t\tversion === WriteFormat.v0_0_2 || (editHistory?.editIds.length === 1 && version === WriteFormat.v0_1_1)\n\t\t\t\t? 0\n\t\t\t\t: editHistory?.editIds.length;\n\n\t\t// Use previously registered EditAddedHandlers if there is an existing EditLog.\n\t\tconst editLog = new EditLog(\n\t\t\teditHistory,\n\t\t\tthis.logger,\n\t\t\tthis.editLog?.editAddedHandlers,\n\t\t\tindexOfFirstEditInSession\n\t\t);\n\n\t\teditLog.on(SharedTreeDiagnosticEvent.UnexpectedHistoryChunk, () => {\n\t\t\tthis.emit(SharedTreeDiagnosticEvent.UnexpectedHistoryChunk);\n\t\t});\n\n\t\tlet knownRevisions: [number, EditCacheEntry][] | undefined;\n\t\tif (currentTree !== undefined) {\n\t\t\tconst currentView = RevisionView.fromTree(currentTree);\n\t\t\t// TODO:#47830: Store multiple checkpoints in summary.\n\t\t\tknownRevisions = [[editLog.length, { view: currentView }]];\n\t\t}\n\n\t\tconst logViewer = new CachingLogViewer(\n\t\t\teditLog,\n\t\t\tRevisionView.fromTree(initialTree, this),\n\t\t\tknownRevisions,\n\t\t\tthis.expensiveValidation,\n\t\t\teditStatusCallback,\n\t\t\tsequencedEditResultCallback,\n\t\t\t0\n\t\t);\n\n\t\tthis.editLog = editLog;\n\t\tthis.cachingLogViewer = logViewer;\n\t\treturn { editLog, cachingLogViewer: logViewer };\n\t}\n\n\t/**\n\t * Upload any full chunks that have yet to be uploaded.\n\t */\n\tprivate uploadCatchUpBlobs(): void {\n\t\tif (this.writeFormat !== WriteFormat.v0_0_2 && this.uploadEditChunks) {\n\t\t\tfor (const [startRevision, chunk] of this.editLog.getEditChunksReadyForUpload()) {\n\t\t\t\tthis.uploadEditChunk(chunk, startRevision)\n\t\t\t\t\t.then(() => {\n\t\t\t\t\t\tthis.emit(SharedTreeDiagnosticEvent.CatchUpBlobUploaded);\n\t\t\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: 'CatchUpBlobUpload', chunkSize: chunk.length });\n\t\t\t\t\t})\n\t\t\t\t\t// It is safe to swallow errors from edit chunk upload because the next summary load will\n\t\t\t\t\t// do another attempt to upload the edit chunks that couldn't previously be uploaded\n\t\t\t\t\t.catch((error) => {});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Compares this shared tree to another for equality. Should only be used for internal correctness testing.\n\t *\n\t * Equality means that the histories as captured by the EditLogs are equivalent.\n\t *\n\t * Equality does not include:\n\t * - if an edit is open\n\t * - the shared tree's id\n\t * - local vs sequenced status of edits\n\t * - registered event listeners\n\t * - state of caches\n\t *\n\t * @internal\n\t * */\n\tpublic equals(sharedTree: SharedTree): boolean {\n\t\tif (!areRevisionViewsSemanticallyEqual(this.currentView, this, sharedTree.currentView, sharedTree)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.editLog.equals(sharedTree.editLog);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst summaryLoadPerformanceEvent = PerformanceEvent.start(this.logger, { eventName: 'SummaryLoad' });\n\n\t\ttry {\n\t\t\tconst newBlob = await storage.readBlob(snapshotFileName);\n\t\t\tconst blobData = bufferToString(newBlob, 'utf8');\n\n\t\t\tconst stats = this.loadSerializedSummary(blobData);\n\n\t\t\tsummaryLoadPerformanceEvent.end(stats);\n\t\t} catch (error) {\n\t\t\tsummaryLoadPerformanceEvent.cancel({ eventName: 'SummaryLoadFailure' }, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t */\n\tprotected processCore(message: unknown, local: boolean): void {\n\t\tconst typedMessage = message as Omit<ISequencedDocumentMessage, 'contents'> & {\n\t\t\tcontents: SharedTreeOp_0_0_2 | SharedTreeOp;\n\t\t};\n\t\tthis.cachingLogViewer.setMinimumSequenceNumber(typedMessage.minimumSequenceNumber);\n\t\tconst op = typedMessage.contents;\n\t\tconst { type, version } = op;\n\t\tconst resolvedVersion = version ?? WriteFormat.v0_0_2;\n\t\tconst sameVersion = resolvedVersion === this.writeFormat;\n\n\t\t// Edit and handle ops should only be processed if they're the same version as the tree write version.\n\t\t// Update ops should only be processed if they're not the same version.\n\t\tif (sameVersion) {\n\t\t\tif (type === SharedTreeOpType.Handle) {\n\t\t\t\tconst { editHandle, startRevision } = op as SharedTreeHandleOp;\n\t\t\t\tconst baseHandle = this.deserializeHandle(editHandle);\n\t\t\t\tconst decodedHandle: EditHandle<ChangeInternal> = {\n\t\t\t\t\tget: async () => {\n\t\t\t\t\t\tconst contents = await baseHandle.get();\n\t\t\t\t\t\tconst parsedContents: EditChunkContents = JSON.parse(IsoBuffer.from(contents).toString());\n\t\t\t\t\t\treturn this.encoder_0_1_1.decodeEditChunk(\n\t\t\t\t\t\t\tparsedContents,\n\t\t\t\t\t\t\tsequencedIdNormalizer(this.idNormalizer),\n\t\t\t\t\t\t\tthis.interner\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\tbaseHandle,\n\t\t\t\t};\n\t\t\t\tthis.editLog.processEditChunkHandle(decodedHandle, startRevision);\n\t\t\t} else if (type === SharedTreeOpType.Edit) {\n\t\t\t\tif (op.version === WriteFormat.v0_1_1) {\n\t\t\t\t\t// TODO: This cast can be removed on typescript 4.6\n\t\t\t\t\tthis.idCompressor.finalizeCreationRange((op as SharedTreeEditOp).idRange);\n\t\t\t\t}\n\t\t\t\t// TODO: This cast can be removed on typescript 4.6\n\t\t\t\tconst edit = this.parseSequencedEdit(op as SharedTreeEditOp | SharedTreeEditOp_0_0_2);\n\t\t\t\tif (op.version === WriteFormat.v0_1_1) {\n\t\t\t\t\tthis.internStringsFromEdit(edit);\n\t\t\t\t}\n\t\t\t\tthis.processSequencedEdit(edit, typedMessage);\n\t\t\t}\n\t\t} else if (type === SharedTreeOpType.Update) {\n\t\t\tthis.processVersionUpdate(op.version);\n\t\t} else if (compareSummaryFormatVersions(resolvedVersion, this.writeFormat) === 1) {\n\t\t\t// An op version newer than our current version should not be received. If this happens, either an\n\t\t\t// incorrect op version has been written or an update op was skipped.\n\t\t\tconst error = 'Newer op version received by a client that has yet to be updated.';\n\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: 'UnexpectedNewerOpVersion',\n\t\t\t\t},\n\t\t\t\terror\n\t\t\t);\n\t\t\tfail(error);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.registerCore}\n\t */\n\tprotected registerCore(): void {\n\t\t// Do nothing\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect(): void {\n\t\t// Do nothing\n\t}\n\n\t/**\n\t * Parses a sequenced edit. This is only invoked for ops with version matching the current `writeFormat`.\n\t */\n\tprivate parseSequencedEdit(op: SharedTreeEditOp | SharedTreeEditOp_0_0_2): Edit<ChangeInternal> {\n\t\t// TODO:Type Safety: Improve type safety around op sending/parsing (e.g. discriminated union over version field somehow)\n\t\tswitch (op.version) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\treturn this.encoder_0_0_2.decodeEditOp(op, this.encodeSemiSerializedEdit.bind(this), this);\n\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\treturn this.encoder_0_1_1.decodeEditOp(\n\t\t\t\t\top,\n\t\t\t\t\tthis.encodeSemiSerializedEdit.bind(this),\n\t\t\t\t\tthis.idNormalizer,\n\t\t\t\t\tthis.interner\n\t\t\t\t);\n\t\t\tdefault:\n\t\t\t\tfail('Unknown op version');\n\t\t}\n\t}\n\n\tprivate encodeSemiSerializedEdit<T>(semiSerializedEdit: Edit<T>): Edit<T> {\n\t\t// semiSerializedEdit may have handles which have been replaced by `serializer.encode`.\n\t\t// Since there is no API to un-replace them except via parse, re-stringify the edit, then parse it.\n\t\t// Stringify using JSON, not IFluidSerializer since OPs use JSON directly.\n\t\t// TODO:Performance:#48025: Avoid this serialization round trip.\n\t\tconst encodedEdit: Edit<T> = this.serializer.parse(JSON.stringify(semiSerializedEdit));\n\t\treturn encodedEdit;\n\t}\n\n\tprivate processSequencedEdit(edit: Edit<ChangeInternal>, message: ISequencedDocumentMessage): void {\n\t\tconst { id: editId } = edit;\n\t\tconst wasLocalEdit = this.editLog.isLocalEdit(editId);\n\n\t\t// If the id of the supplied edit matches a non-local edit already present in the log, this would normally be indicative of an error.\n\t\t// However, the @fluidframework packages prior to 0.37.x have a bug which can cause data corruption by sequencing duplicate edits--\n\t\t// see discussion on the following github issue: https://github.com/microsoft/FluidFramework/issues/4399\n\t\t// To work around this issue, we currently tolerate duplicate ops in loaded documents.\n\t\t// This could be strengthened in the future to only apply to documents which may have been impacted.\n\t\tconst shouldIgnoreEdit = this.editLog.tryGetIndexOfId(editId) !== undefined && !wasLocalEdit;\n\t\tif (shouldIgnoreEdit) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (wasLocalEdit) {\n\t\t\tthis.editLog.addSequencedEdit(edit, message);\n\t\t\t// If this client created the edit that filled up a chunk, it is responsible for uploading that chunk.\n\t\t\tif (compareSummaryFormatVersions(this.writeFormat, WriteFormat.v0_0_2) > 0 && this.uploadEditChunks) {\n\t\t\t\tconst lastPair = this.editLog.getLastEditChunk();\n\t\t\t\tif (lastPair !== undefined) {\n\t\t\t\t\tconst [startRevision, chunk] = lastPair;\n\t\t\t\t\tconst edits = assertNotUndefined(chunk.edits);\n\t\t\t\t\tif (edits.length === this.editLog.editsPerChunk) {\n\t\t\t\t\t\tthis.uploadEditChunk(edits, startRevision)\n\t\t\t\t\t\t\t.then(() => {\n\t\t\t\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\t\t\teventName: 'EditChunkUpload',\n\t\t\t\t\t\t\t\t\tchunkSize: edits.length,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t// It is safe to swallow errors from edit chunk upload because the next summary load will\n\t\t\t\t\t\t\t// do another attempt to upload the edit chunks that couldn't previously be uploaded\n\t\t\t\t\t\t\t.catch((error) => {});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.applyEditLocally(edit, message);\n\t\t}\n\t}\n\n\t/**\n\t * Updates SharedTree to the provided version if the version is a valid write version newer than the current version.\n\t * @param version - The version to update to.\n\t */\n\tprivate processVersionUpdate(version: WriteFormat) {\n\t\tif (isUpdateRequired(this.writeFormat, version)) {\n\t\t\tPerformanceEvent.timedExec(\n\t\t\t\tthis.logger,\n\t\t\t\t{ eventName: 'VersionUpdate', version },\n\t\t\t\t() => {\n\t\t\t\t\tif (compareSummaryFormatVersions(version, WriteFormat.v0_1_1) >= 0) {\n\t\t\t\t\t\tthis.upgradeFrom_0_0_2_to_0_1_1();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(`Updating to version ${version} is not supported.`);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.changeWriteFormat(version);\n\n\t\t\t\t\t// The edit log may contain some local edits submitted after the version update op was submitted but\n\t\t\t\t\t// before we receive the message it has been sequenced. Since these edits must be sequenced after the version\n\t\t\t\t\t// update op, they will be discarded. These edits are then re-submitted using the new format.\n\t\t\t\t\tfor (const edit of this.editLog.getLocalEdits()) {\n\t\t\t\t\t\tthis.submitEditOp(edit);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.currentIsOldest) {\n\t\t\t\t\t\tthis.uploadCatchUpBlobs();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tend: true,\n\t\t\t\t\tcancel: 'error',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate upgradeFrom_0_0_2_to_0_1_1(): void {\n\t\t// Reset the string interner, re-populate only with information that there is consensus on\n\t\tthis.interner = new MutableStringInterner([initialTree.definition]);\n\t\tconst oldIdCompressor = this.idCompressor;\n\t\t// Create the IdCompressor that will be used after the upgrade\n\t\tconst newIdCompressor = new IdCompressor(createSessionId(), reservedIdCount); // TODO: attribution info\n\t\tconst newContext = getNodeIdContext(newIdCompressor);\n\t\t// Generate all local IDs in the new compressor that were in the old compressor and preserve their UUIDs.\n\t\t// This will allow the client to continue to use local IDs that were allocated pre-upgrade\n\t\tfor (const localId of oldIdCompressor.getAllIdsFromLocalSession()) {\n\t\t\tnewIdCompressor.generateCompressedId(oldIdCompressor.decompress(localId));\n\t\t}\n\n\t\tconst unifyHistoricalIds = (context: NodeIdContext): void => {\n\t\t\tfor (let i = 0; i < this.editLog.numberOfSequencedEdits; i++) {\n\t\t\t\tconst edit = this.editLog.getEditInSessionAtIndex(i);\n\t\t\t\tconvertEditIds(edit, (id) => context.generateNodeId(this.convertToStableNodeId(id)));\n\t\t\t}\n\t\t};\n\t\t// Construct a temporary \"ghost\" compressor which is used to generate final IDs that will be consistent across all upgrading clients\n\t\tconst ghostIdCompressor = new IdCompressor(ghostSessionId, reservedIdCount); // TODO: attribution info\n\t\tconst ghostContext = getNodeIdContext(ghostIdCompressor);\n\t\tif (this.summarizeHistory) {\n\t\t\t// All clients have the full history, and can therefore all \"generate\" the same final IDs for every ID in the history\n\t\t\t// via the ghost compressor.\n\t\t\tunifyHistoricalIds(ghostContext);\n\t\t\t// The same logic applies to string interning, so intern all the strings in the history (superset of those in the current view)\n\t\t\tfor (let i = 0; i < this.editLog.numberOfSequencedEdits; i++) {\n\t\t\t\tthis.internStringsFromEdit(this.editLog.getEditInSessionAtIndex(i));\n\t\t\t}\n\t\t} else {\n\t\t\t// Clients do not have the full history, but all share the same current view (sequenced). They can all finalize the same final\n\t\t\t// IDs for every ID in the view via the ghost compressor.\n\t\t\t// The same logic applies for the string interner.\n\t\t\tfor (const node of this.logViewer.getRevisionViewInSession(this.editLog.numberOfSequencedEdits)) {\n\t\t\t\tghostContext.generateNodeId(this.convertToStableNodeId(node.identifier));\n\t\t\t\tthis.interner.getOrCreateInternedId(node.definition);\n\t\t\t\tfor (const label of [...node.traits.keys()].sort()) {\n\t\t\t\t\tthis.interner.getOrCreateInternedId(label);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Every node in this client's history can simply be generated in the new compressor as well, preserving the UUID\n\t\t\tunifyHistoricalIds(newContext);\n\t\t}\n\t\t// Finalize any IDs in the ghost compressor into the actual compressor. This simulates all clients reaching a consensus on those IDs\n\t\tnewIdCompressor.finalizeCreationRange(ghostIdCompressor.takeNextCreationRange());\n\t\tthis.idCompressor = newIdCompressor;\n\t}\n\n\t/**\n\t * Applies a set of changes to this tree. The result will be reflected in `SharedTree.currentView`.\n\t * This method does not allow for snapshot isolation, as the changes are always applied to the most recent revision.\n\t * If it is desireable to read from and apply changes to a fixed view that does not change when remote changes arrive, `Checkout`\n\t * should be used instead.\n\t * @public\n\t */\n\tpublic applyEdit(...changes: Change[]): Edit<InternalizedChange>;\n\tpublic applyEdit(changes: Change[]): Edit<InternalizedChange>;\n\tpublic applyEdit(headOrChanges: Change | Change[], ...tail: Change[]): Edit<InternalizedChange> {\n\t\tconst changes = Array.isArray(headOrChanges) ? headOrChanges : [headOrChanges, ...tail];\n\t\tconst id = newEditId();\n\t\tconst internalEdit: Edit<ChangeInternal> = {\n\t\t\tid,\n\t\t\tchanges: changes.map((c) => this.internalizeChange(c)),\n\t\t};\n\t\tthis.submitEditOp(internalEdit);\n\t\tthis.applyEditLocally(internalEdit, undefined);\n\t\treturn internalEdit as unknown as Edit<InternalizedChange>;\n\t}\n\n\t/**\n\t * Merges `edits` from `other` into this SharedTree.\n\t * @param other - Tree containing the edits that should be applied to this one.\n\t * @param edits - Iterable of edits from `other` to apply.\n\t * @param stableIdRemapper - Optional remapper to translate stable identities from `other` into stable identities on this tree.\n\t * Any references that `other` contains to a stable id `foo` will be replaced with references to the id `stableIdRemapper(foo)`.\n\t *\n\t * Payloads on the edits are left intact.\n\t * @returns a list containing `EditId`s for all applied edits.\n\t */\n\tpublic mergeEditsFrom(\n\t\tother: SharedTree,\n\t\tedits: Iterable<Edit<InternalizedChange>>,\n\t\tstableIdRemapper?: (id: StableNodeId) => StableNodeId\n\t): EditId[] {\n\t\tconst idConverter = (id: NodeId) => {\n\t\t\tconst stableId = other.convertToStableNodeId(id);\n\t\t\tconst convertedStableId = stableIdRemapper?.(stableId) ?? stableId;\n\t\t\treturn this.generateNodeId(convertedStableId);\n\t\t};\n\n\t\treturn Array.from(\n\t\t\tedits as unknown as Iterable<Edit<ChangeInternal>>,\n\t\t\t(edit) => this.applyEditInternal(convertEditIds(edit, (id) => idConverter(id))).id\n\t\t);\n\t}\n\n\t/**\n\t * Applies a set of internal changes to this tree. The result will be reflected in `SharedTree.currentView`.\n\t * External users should use one of the more specialized functions, like `applyEdit` which handles constructing the actual `Edit`\n\t * and uses public Change types.\n\t * This is exposed for internal use only.\n\t * @internal\n\t */\n\tpublic applyEditInternal(editOrChanges: Edit<ChangeInternal> | readonly ChangeInternal[]): Edit<ChangeInternal> {\n\t\tlet edit: Edit<ChangeInternal>;\n\t\tif (Array.isArray(editOrChanges)) {\n\t\t\tconst id = newEditId();\n\t\t\tedit = { id, changes: editOrChanges };\n\t\t} else {\n\t\t\tedit = editOrChanges as Edit<ChangeInternal>;\n\t\t}\n\t\tthis.submitEditOp(edit);\n\t\tthis.applyEditLocally(edit, undefined);\n\t\treturn edit;\n\t}\n\n\t/**\n\t * Converts a public Change type to an internal representation.\n\t * This is exposed for internal use only.\n\t * @internal\n\t */\n\tpublic internalizeChange(change: Change): ChangeInternal {\n\t\tswitch (change.type) {\n\t\t\tcase ChangeType.Insert:\n\t\t\t\treturn {\n\t\t\t\t\tsource: change.source as DetachedSequenceId,\n\t\t\t\t\tdestination: deepCloneStablePlace(change.destination),\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t};\n\t\t\tcase ChangeType.Detach: {\n\t\t\t\tconst detach: DetachInternal = {\n\t\t\t\t\tsource: deepCloneStableRange(change.source),\n\t\t\t\t\ttype: ChangeTypeInternal.Detach,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, detach, 'destination');\n\t\t\t\treturn detach;\n\t\t\t}\n\t\t\tcase ChangeType.Build: {\n\t\t\t\tif (isTreeNodeSequence(change.source)) {\n\t\t\t\t\tconst source = change.source.map((buildNode) =>\n\t\t\t\t\t\tconvertTreeNodes<BuildTreeNode, TreeNode<BuildNodeInternal, NodeId>, number>(\n\t\t\t\t\t\t\tbuildNode,\n\t\t\t\t\t\t\t(nodeData) => internalizeBuildNode(nodeData, this),\n\t\t\t\t\t\t\t(x): x is number => typeof x === 'number'\n\t\t\t\t\t\t)\n\t\t\t\t\t) as TreeNodeSequence<TreeNode<BuildNodeInternal, NodeId> | DetachedSequenceId>;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\tdestination: change.destination as DetachedSequenceId,\n\t\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst source = convertTreeNodes<BuildTreeNode, TreeNode<BuildNodeInternal, NodeId>, number>(\n\t\t\t\t\t\tchange.source,\n\t\t\t\t\t\t(nodeData) => internalizeBuildNode(nodeData, this),\n\t\t\t\t\t\t(x): x is number => typeof x === 'number'\n\t\t\t\t\t) as TreeNode<BuildNodeInternal, NodeId> | DetachedSequenceId;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsource: [source],\n\t\t\t\t\t\tdestination: change.destination as DetachedSequenceId,\n\t\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase ChangeType.SetValue:\n\t\t\t\treturn {\n\t\t\t\t\tnodeToModify: change.nodeToModify,\n\t\t\t\t\tpayload: change.payload,\n\t\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\t};\n\t\t\tcase ChangeType.Constraint: {\n\t\t\t\tconst constraint: ConstraintInternal = {\n\t\t\t\t\teffect: change.effect,\n\t\t\t\t\ttoConstrain: change.toConstrain,\n\t\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'contentHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'identityHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'label');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'length');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'parentNode');\n\t\t\t\treturn constraint;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('unexpected change type');\n\t\t}\n\t}\n\n\tprivate applyEditLocally(edit: Edit<ChangeInternal>, message: ISequencedDocumentMessage | undefined): void {\n\t\tconst isSequenced = message !== undefined;\n\t\tif (isSequenced) {\n\t\t\t// TODO: This cast can be removed on typescript 4.6\n\t\t\tthis.editLog.addSequencedEdit(edit, message as ISequencedDocumentMessage);\n\t\t} else {\n\t\t\tthis.editLog.addLocalEdit(edit);\n\t\t}\n\n\t\tconst eventArguments: EditCommittedEventArguments = {\n\t\t\teditId: edit.id,\n\t\t\tlocal: !isSequenced,\n\t\t\ttree: this,\n\t\t};\n\t\tthis.emit(SharedTreeEvent.EditCommitted, eventArguments);\n\t}\n\n\t/**\n\t * Reverts a previous edit by applying a new edit containing the inverse of the original edit's changes.\n\t * @param editId - the edit to revert\n\t * @returns the id of the new edit, or undefined if the original edit could not be inverted given the current tree state.\n\t * @public\n\t */\n\tpublic revert(editId: EditId): EditId | undefined {\n\t\tconst index = this.edits.getIndexOfId(editId);\n\t\tconst edit = this.edits.getEditInSessionAtIndex(index);\n\t\tconst before = this.logViewer.getRevisionViewInSession(index);\n\t\tconst changes = this.revertChanges(edit.changes, before);\n\t\tif (changes === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.applyEditInternal(changes).id;\n\t}\n\n\t/**\n\t * Revert the given changes\n\t * @param changes - the changes to revert\n\t * @param before - the revision view before the changes were originally applied\n\t * @returns the inverse of `changes` or undefined if the changes could not be inverted for the given tree state.\n\t * @internal\n\t */\n\tpublic revertChanges(changes: readonly InternalizedChange[], before: RevisionView): ChangeInternal[] | undefined {\n\t\treturn revert(changes as unknown as readonly ChangeInternal[], before);\n\t}\n\n\t/**\n\t * Submits an edit by the local client to the runtime.\n\t */\n\tprivate submitEditOp(edit: Edit<ChangeInternal>): void {\n\t\t// Only submit ops if attached, since op submission can have stateful side effects (e.g. changing the IdCompressor)\n\t\t// Ops will be submitted again when attached (see loadSummary())\n\t\tif (this.isAttached()) {\n\t\t\tswitch (this.writeFormat) {\n\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\tthis.submitOp(this.encoder_0_0_2.encodeEditOp(edit, this.serializeEdit.bind(this), this));\n\t\t\t\t\tbreak;\n\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\tthis.submitOp(\n\t\t\t\t\t\tthis.encoder_0_1_1.encodeEditOp(\n\t\t\t\t\t\t\tedit,\n\t\t\t\t\t\t\tthis.serializeEdit.bind(this),\n\t\t\t\t\t\t\tthis.idCompressor.takeNextCreationRange(),\n\t\t\t\t\t\t\tthis.idNormalizer,\n\t\t\t\t\t\t\tthis.interner\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tfail('Unknown version');\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate serializeEdit<TChange>(preparedEdit: Edit<TChange>): Edit<TChange> {\n\t\treturn this.serializer.encode(preparedEdit, this.handle) as Edit<TChange>;\n\t}\n\n\t/** A type-safe `submitLocalMessage` wrapper to enforce op format */\n\tprivate submitOp(content: SharedTreeOp | SharedTreeOp_0_0_2, localOpMetadata: unknown = undefined): void {\n\t\tassert(\n\t\t\tcompareSummaryFormatVersions(content.version, this.writeFormat) === 0,\n\t\t\t'Attempted to submit op of wrong version'\n\t\t);\n\t\tthis.submitLocalMessage(content, localOpMetadata);\n\t}\n\n\tpublic getRuntime(): IFluidDataStoreRuntime {\n\t\treturn this.runtime;\n\t}\n\n\t/**\n\t * \"Pending local state\" refers to ops submitted to the runtime that have not yet been acked.\n\t * When closing a container, hosts have the option to stash this pending local state somewhere to be reapplied\n\t * later (to avoid data loss).\n\t * If a host then loads a container using that stashed state, this function is called for each stashed op, and is expected to:\n\t * 1. Update this DDS to reflect that state locally.\n\t * 2. Return any `localOpMetadata` that would have been associated with this op.\n\t *\n\t * @param content - op to apply locally.\n\t */\n\tprotected applyStashedOp(op: unknown): void {\n\t\tconst sharedTreeOp = op as SharedTreeOp | SharedTreeOp_0_0_2;\n\t\tswitch (sharedTreeOp.type) {\n\t\t\tcase SharedTreeOpType.Edit: {\n\t\t\t\tswitch (this.writeFormat) {\n\t\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\t\tswitch (sharedTreeOp.version) {\n\t\t\t\t\t\t\tcase WriteFormat.v0_0_2: {\n\t\t\t\t\t\t\t\tconst edit = this.parseSequencedEdit(sharedTreeOp);\n\t\t\t\t\t\t\t\tthis.applyEditLocally(edit, undefined);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\t\t\t\t// TODO:#74390: Implement\n\t\t\t\t\t\t\t\tfail('Received stashed op 0.1.1 before upgrade');\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\t\tswitch (sharedTreeOp.version) {\n\t\t\t\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\t\t\t\t// TODO:#74390: Implement\n\t\t\t\t\t\t\t\tfail('v0.1.1 does not support stashed ops.');\n\t\t\t\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\t\t\t\t// TODO:#74390: Implement\n\t\t\t\t\t\t\t\tfail('v0.1.1 does not support stashed ops.');\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Handle and update ops are only acknowledged by the client that generated them upon sequencing--no local changes necessary.\n\t\t\tcase SharedTreeOpType.Handle:\n\t\t\tcase SharedTreeOpType.Update:\n\t\t\tcase SharedTreeOpType.NoOp:\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tfail('Unrecognized op');\n\t\t}\n\t}\n\n\tprivate changeWriteFormat(newFormat: WriteFormat): void {\n\t\tthis.writeFormat = newFormat;\n\t\tthis.emit(SharedTreeDiagnosticEvent.WriteVersionChanged, newFormat);\n\t}\n\n\t/**\n\t * Interns all Definitions and TraitLabel_s referenced by the provided edit.\n\t *\n\t * Clients must have consensus on the interned values to guarantee the interned ID is valid.\n\t */\n\tprivate internStringsFromEdit(edit: Edit<ChangeInternal>): void {\n\t\tfor (const change of edit.changes) {\n\t\t\tif (change.type === ChangeTypeInternal.Build) {\n\t\t\t\tfor (const root of change.source) {\n\t\t\t\t\twalkTree<TreeNode<BuildNodeInternal, NodeId>, DetachedSequenceId>(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\t(node) => {\n\t\t\t\t\t\t\tthis.interner.getOrCreateInternedId(node.definition);\n\t\t\t\t\t\t\tfor (const trait of Object.keys(node.traits)) {\n\t\t\t\t\t\t\t\tthis.interner.getOrCreateInternedId(trait);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisDetachedSequenceId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (change.type === ChangeTypeInternal.Insert) {\n\t\t\t\tconst { referenceTrait } = change.destination;\n\t\t\t\tif (referenceTrait !== undefined) {\n\t\t\t\t\tthis.interner.getOrCreateInternedId(referenceTrait.label);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @returns 1 if versionA is newer, -1 if versionB is newer, and 0 if the versions are the same.\n * @throws if either version isn't a valid WriteFormat version.\n */\nfunction compareSummaryFormatVersions(versionA: string, versionB: string): number {\n\tconst versionAIndex = sortedWriteVersions.indexOf(versionA as WriteFormat);\n\tconst versionBIndex = sortedWriteVersions.indexOf(versionB as WriteFormat);\n\n\tif (versionAIndex === -1 || versionBIndex === -1) {\n\t\tfail('Summary version being compared cannot be read.');\n\t}\n\n\tif (versionAIndex < versionBIndex) {\n\t\treturn -1;\n\t} else if (versionAIndex > versionBIndex) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\n/**\n * Checks if the summary version needs to be updated.\n * @returns true if the old version is older than the new version.\n * @throws if the new version isn't a supported WriteFormat version.\n */\nfunction isUpdateRequired(oldVersion: string, newVersion: string): boolean {\n\tconst newVersionIndex = sortedWriteVersions.indexOf(newVersion as WriteFormat);\n\tif (newVersionIndex === -1) {\n\t\tfail('New write version is invalid.');\n\t}\n\n\treturn compareSummaryFormatVersions(oldVersion, newVersion) === -1 ? true : false;\n}\n\nfunction isTreeNodeSequence(source: TreeNodeSequence<BuildNode> | BuildNode): source is TreeNodeSequence<BuildNode> {\n\treturn Array.isArray(source);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SharedTree.js","sourceRoot":"","sources":["../src/SharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyE;AAWzE,iFAAoE;AACpE,2EAM4C;AAE5C,qEAA8G;AAE9G,qCAAmF;AACnF,uCAAsG;AACtG,+CAAsH;AACtH,+CAA4C;AAC5C,2CAOqB;AACrB,yEAA+E;AAE/E,uDA4B2B;AAC3B,uCAAuD;AACvD,mDAQyB;AACzB,uDAA6G;AAC7G,6CAA0E;AAC1E,iDAA8C;AAC9C,2DAAuF;AACvF,6DAA8C;AAC9C,+CAA6E;AAE7E,mDAAgE;AAChE,iDAAgD;AAChD,qDAAyD;AAEzD;;;;GAIG;AACH,MAAa,iBAAiB;IAe7B;;;;;;;;OAQG;IACH,YACkB,WAAwB,EACxB,mBAA0D,KAAK,EACxE,sBAAsB,KAAK;QAFlB,gBAAW,GAAX,WAAW,CAAa;QACxB,qBAAgB,GAAhB,gBAAgB,CAA+C;QACxE,wBAAmB,GAAnB,mBAAmB,CAAQ;IACjC,CAAC;IAEJ;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,iBAAiB,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,iBAAiB,CAAC,UAAU,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,kBAAgD;QAEhD,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACtD,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACnB,CAAC;IAED;;;;OAIG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AC;gBAC9C,IAAI,cAAc,KAAK,SAAS,EAAE;oBACjC,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;iBAC1D;aACD;SACD;IACF,CAAC;CACD;AA3rCD,gCA2rCC;AAED;;;GAGG;AACH,SAAS,4BAA4B,CAAC,QAAgB,EAAE,QAAgB;IACvE,MAAM,aAAa,GAAG,mBAAmB,CAAC,OAAO,CAAC,QAAuB,CAAC,CAAC;IAC3E,MAAM,aAAa,GAAG,mBAAmB,CAAC,OAAO,CAAC,QAAuB,CAAC,CAAC;IAE3E,IAAI,aAAa,KAAK,CAAC,CAAC,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE;QACjD,aAAI,CAAC,gDAAgD,CAAC,CAAC;KACvD;IAED,IAAI,aAAa,GAAG,aAAa,EAAE;QAClC,OAAO,CAAC,CAAC,CAAC;KACV;SAAM,IAAI,aAAa,GAAG,aAAa,EAAE;QACzC,OAAO,CAAC,CAAC;KACT;IAED,OAAO,CAAC,CAAC;AACV,CAAC;AAED;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,UAAkB,EAAE,UAAkB;IAC/D,MAAM,eAAe,GAAG,mBAAmB,CAAC,OAAO,CAAC,UAAyB,CAAC,CAAC;IAC/E,IAAI,eAAe,KAAK,CAAC,CAAC,EAAE;QAC3B,aAAI,CAAC,+BAA+B,CAAC,CAAC;KACtC;IAED,OAAO,4BAA4B,CAAC,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACnF,CAAC;AAED,SAAS,kBAAkB,CAAC,MAA+C;IAC1E,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, IsoBuffer } from '@fluidframework/common-utils';\nimport { IFluidHandle } from '@fluidframework/core-interfaces';\nimport { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';\nimport {\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelFactory,\n\tIChannelAttributes,\n\tIChannelServices,\n\tIChannel,\n} from '@fluidframework/datastore-definitions';\nimport { AttachState } from '@fluidframework/container-definitions';\nimport {\n\tcreateSingleBlobSummary,\n\tIFluidSerializer,\n\tISharedObjectEvents,\n\tserializeHandles,\n\tSharedObject,\n} from '@fluidframework/shared-object-base';\nimport { ITelemetryLogger, ITelemetryProperties } from '@fluidframework/common-definitions';\nimport { ChildLogger, ITelemetryLoggerPropertyBags, PerformanceEvent } from '@fluidframework/telemetry-utils';\nimport { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';\nimport { assert, assertNotUndefined, fail, copyPropertyIfDefined } from './Common';\nimport { EditHandle, EditLog, getNumberOfHandlesFromEditLogSummary, OrderedEditSet } from './EditLog';\nimport { EditId, NodeId, StableNodeId, DetachedSequenceId, OpSpaceNodeId, isDetachedSequenceId } from './Identifiers';\nimport { initialTree } from './InitialTree';\nimport {\n\tCachingLogViewer,\n\tEditCacheEntry,\n\tEditStatusCallback,\n\tLogViewer,\n\tSequencedEditResult,\n\tSequencedEditResultCallback,\n} from './LogViewer';\nimport { deserialize, getSummaryStatistics } from './SummaryBackCompatibility';\nimport { ReconciliationPath } from './ReconciliationPath';\nimport {\n\tBuildNodeInternal,\n\tChangeInternal,\n\tChangeNode,\n\tChangeTypeInternal,\n\tConstraintInternal,\n\tDetachInternal,\n\tEdit,\n\tEditLogSummary,\n\tEditChunkContents,\n\tEditStatus,\n\tEditWithoutId,\n\treservedIdCount,\n\tSharedTreeEditOp,\n\tSharedTreeEditOp_0_0_2,\n\tSharedTreeHandleOp,\n\tSharedTreeNoOp,\n\tSharedTreeOp,\n\tSharedTreeOpType,\n\tSharedTreeOp_0_0_2,\n\tSharedTreeSummary,\n\tSharedTreeSummaryBase,\n\tSharedTreeSummary_0_0_2,\n\tTreeNode,\n\tghostSessionId,\n\tWriteFormat,\n\tTreeNodeSequence,\n\tInternalizedChange,\n} from './persisted-types';\nimport { serialize, SummaryContents } from './Summary';\nimport {\n\tareRevisionViewsSemanticallyEqual,\n\tconvertTreeNodes,\n\tdeepCloneStablePlace,\n\tdeepCloneStableRange,\n\tinternalizeBuildNode,\n\tnewEditId,\n\twalkTree,\n} from './EditUtilities';\nimport { getNodeIdContext, NodeIdContext, NodeIdNormalizer, sequencedIdNormalizer } from './NodeIdUtilities';\nimport { SharedTreeDiagnosticEvent, SharedTreeEvent } from './EventTypes';\nimport { RevisionView } from './RevisionView';\nimport { SharedTreeEncoder_0_0_2, SharedTreeEncoder_0_1_1 } from './SharedTreeEncoder';\nimport { revert } from './HistoryEditFactory';\nimport { BuildNode, BuildTreeNode, Change, ChangeType } from './ChangeTypes';\nimport { TransactionInternal } from './TransactionInternal';\nimport { IdCompressor, createSessionId } from './id-compressor';\nimport { convertEditIds } from './IdConversion';\nimport { MutableStringInterner } from './StringInterner';\n\n/**\n * Factory for SharedTree.\n * Includes history in the summary.\n * @public\n */\nexport class SharedTreeFactory implements IChannelFactory {\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.\"type\"}\n\t */\n\tpublic static Type = 'SharedTree';\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}\n\t */\n\tpublic static Attributes: IChannelAttributes = {\n\t\ttype: SharedTreeFactory.Type,\n\t\tsnapshotFormatVersion: '0.1',\n\t\tpackageVersion: '0.1',\n\t};\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store.\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format\n\t * documentation](../docs/Write-Format.md) for more information.\n\t * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.\n\t * See the [breaking change migration documentation](docs/Breaking-Change-Migration) for more details on this scheme.\n\t * @param expensiveValidation - Enables expensive asserts on SharedTree.\n\t * @returns A factory that creates `SharedTree`s and loads them from storage.\n\t */\n\tconstructor(\n\t\tprivate readonly writeFormat: WriteFormat,\n\t\tprivate readonly summarizeHistory: false | { uploadEditChunks: boolean } = false,\n\t\tprivate expensiveValidation = false\n\t) {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn SharedTreeFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn SharedTreeFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\t_channelAttributes: Readonly<IChannelAttributes>\n\t): Promise<IChannel> {\n\t\tconst sharedTree = this.createSharedTree(runtime, id);\n\t\tawait sharedTree.load(services);\n\t\treturn sharedTree;\n\t}\n\n\t/**\n\t * Create a new SharedTree.\n\t * @param runtime - data store runtime that owns the new SharedTree\n\t * @param id - optional name for the SharedTree\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string, expensiveValidation: boolean = false): SharedTree {\n\t\tthis.expensiveValidation = expensiveValidation;\n\t\tconst sharedTree = this.createSharedTree(runtime, id);\n\t\tsharedTree.initializeLocal();\n\t\treturn sharedTree;\n\t}\n\n\tprivate createSharedTree(runtime: IFluidDataStoreRuntime, id: string): SharedTree {\n\t\tconst sharedTree = new SharedTree(\n\t\t\truntime,\n\t\t\tid,\n\t\t\tthis.writeFormat,\n\t\t\tthis.summarizeHistory,\n\t\t\tthis.expensiveValidation\n\t\t);\n\t\treturn sharedTree;\n\t}\n}\n\n/**\n * Filename where the snapshot is stored.\n */\nconst snapshotFileName = 'header';\n\n/**\n * Used for version comparison.\n */\nconst sortedWriteVersions = [WriteFormat.v0_0_2, WriteFormat.v0_1_1];\n\n/**\n * The arguments included when the EditCommitted SharedTreeEvent is emitted.\n * @public\n */\nexport interface EditCommittedEventArguments {\n\t/** The ID of the edit committed. */\n\treadonly editId: EditId;\n\t/** Whether or not this is a local edit. */\n\treadonly local: boolean;\n\t/** The tree the edit was committed on. Required for local edit events handled by SharedTreeUndoRedoHandler. */\n\treadonly tree: SharedTree;\n}\n\n/**\n * The arguments included when the {@link SharedTreeEvent.SequencedEditApplied} SharedTreeEvent is emitted.\n * @public\n */\nexport interface SequencedEditAppliedEventArguments {\n\t/** The ID of the edit committed. */\n\treadonly edit: Edit<ChangeInternal>;\n\t/** Whether or not this was a local edit. */\n\treadonly wasLocal: boolean;\n\t/** The tree the edit was applied to. */\n\treadonly tree: SharedTree;\n\t/** The telemetry logger associated with sequenced edit application. */\n\treadonly logger: ITelemetryLogger;\n\t/** The reconciliation path for the edit. See {@link ReconciliationPath} for details. */\n\treadonly reconciliationPath: ReconciliationPath;\n\t/** The outcome of the sequenced edit being applied. */\n\treadonly outcome: EditApplicationOutcome;\n}\n\n/**\n * The outcome of an edit.\n * @public\n */\nexport type EditApplicationOutcome =\n\t| {\n\t\t\t/**\n\t\t\t * The revision view resulting from the edit.\n\t\t\t */\n\t\t\treadonly view: RevisionView;\n\t\t\t/**\n\t\t\t * The status code for the edit that produced the revision.\n\t\t\t */\n\t\t\treadonly status: EditStatus.Applied;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The revision view resulting from the edit.\n\t\t\t */\n\t\t\treadonly failure: TransactionInternal.Failure;\n\t\t\t/**\n\t\t\t * The status code for the edit that produced the revision.\n\t\t\t */\n\t\t\treadonly status: EditStatus.Invalid | EditStatus.Malformed;\n\t };\n\n/**\n * Events which may be emitted by `SharedTree`. See {@link SharedTreeEvent} for documentation of event semantics.\n * @public\n */\nexport interface ISharedTreeEvents extends ISharedObjectEvents {\n\t(event: 'committedEdit', listener: EditCommittedHandler);\n\t(event: 'appliedSequencedEdit', listener: SequencedEditAppliedHandler);\n}\n\n/**\n * Expected type for a handler of the `EditCommitted` event.\n * @public\n */\nexport type EditCommittedHandler = (args: EditCommittedEventArguments) => void;\n\n/**\n * Expected type for a handler of the {@link SharedTreeEvent.SequencedEditApplied} event.\n * @public\n */\nexport type SequencedEditAppliedHandler = (args: SequencedEditAppliedEventArguments) => void;\n\nconst sharedTreeTelemetryProperties: ITelemetryLoggerPropertyBags = { all: { isSharedTreeEvent: true } };\n\n/**\n * A [distributed tree](../Readme.md).\n * @public\n */\nexport class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeIdContext {\n\t/**\n\t * Create a new SharedTree. It will contain the default value (see initialTree).\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedTree {\n\t\treturn runtime.createChannel(id, SharedTreeFactory.Type) as SharedTree;\n\t}\n\n\t/**\n\t * Get a factory for SharedTree to register with the data store.\n\t * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.\n\t *\n\t * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.\n\t * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.\n\t *\n\t * The technical limitations here relate to clients with mixed versions collaborating.\n\t * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.\n\t * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.\n\t * See docs/Breaking-Change-Migration for more details on the consensus scheme.\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.\n\t * This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree\n\t * that was initialized with a newer write version connects to the session. Care must be taken when changing this value,\n\t * as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version\n\t * written.\n\t * See [the write format documentation](../docs/Write-Format.md) for more information.\n\t * @returns A factory that creates `SharedTree`s and loads them from storage.\n\t */\n\tpublic static getFactory(\n\t\twriteFormat: WriteFormat,\n\t\tsummarizeHistory: false | { uploadEditChunks: boolean } = false\n\t): SharedTreeFactory {\n\t\t// \tOn 0.1.1 documents, due to current code limitations, all clients MUST agree on the value of `summarizeHistory`.\n\t\t// Note that this means staged rollout changing this value should not be attempted.\n\t\t// It is possible to update shared-tree to correctly handle such a staged rollout, but that hasn't been implemented.\n\t\t// See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.\n\t\treturn new SharedTreeFactory(writeFormat, summarizeHistory);\n\t}\n\n\tprivate idCompressor: IdCompressor = new IdCompressor(createSessionId(), reservedIdCount);\n\tprivate readonly idNormalizer: NodeIdNormalizer<OpSpaceNodeId> & { tree: SharedTree } = {\n\t\ttree: this,\n\t\tget localSessionId() {\n\t\t\treturn this.tree.idCompressor.localSessionId;\n\t\t},\n\t\tnormalizeToOpSpace: (id) => this.idCompressor.normalizeToOpSpace(id) as OpSpaceNodeId,\n\t\tnormalizeToSessionSpace: (id, sessionId) => this.idCompressor.normalizeToSessionSpace(id, sessionId) as NodeId,\n\t};\n\n\t// The initial tree's definition isn't included in any op by default but it should still be interned. Including it here ensures that.\n\tprivate interner: MutableStringInterner = new MutableStringInterner([initialTree.definition]);\n\n\t/**\n\t * The log of completed edits for this SharedTree.\n\t */\n\tprivate editLog: EditLog<ChangeInternal>;\n\n\t/**\n\t * As an implementation detail, SharedTree uses a log viewer that caches views of different revisions.\n\t * It is not exposed to avoid accidental correctness issues, but `logViewer` is exposed in order to give clients a way\n\t * to access the revision history.\n\t */\n\tprivate cachingLogViewer: CachingLogViewer;\n\n\t/**\n\t * Viewer for trees defined by editLog. This allows access to views of the tree at different revisions (various points in time).\n\t */\n\tpublic get logViewer(): LogViewer {\n\t\treturn this.cachingLogViewer;\n\t}\n\n\tprotected readonly logger: ITelemetryLogger;\n\tprivate readonly sequencedEditAppliedLogger: ITelemetryLogger;\n\n\tprivate readonly encoder_0_0_2: SharedTreeEncoder_0_0_2;\n\tprivate encoder_0_1_1: SharedTreeEncoder_0_1_1;\n\n\t/** Indicates if the client is the oldest member of the quorum. */\n\tprivate currentIsOldest: boolean;\n\n\tprivate readonly processEditResult = (editResult: EditStatus, editId: EditId): void => {\n\t\t// TODO:#44859: Invalid results should be handled by the app\n\t\tthis.emit(SharedTree.eventFromEditResult(editResult), editId);\n\t};\n\n\tprivate readonly processSequencedEditResult = ({\n\t\tedit,\n\t\twasLocal,\n\t\tresult,\n\t\treconciliationPath,\n\t}: SequencedEditResult): void => {\n\t\tconst eventArguments: SequencedEditAppliedEventArguments = {\n\t\t\tedit,\n\t\t\twasLocal,\n\t\t\ttree: this,\n\t\t\tlogger: this.sequencedEditAppliedLogger,\n\t\t\treconciliationPath,\n\t\t\toutcome: result,\n\t\t};\n\t\tthis.emit(SharedTreeEvent.SequencedEditApplied, eventArguments);\n\t};\n\n\tprivate summarizeHistory: boolean;\n\tprivate uploadEditChunks: boolean;\n\n\t/**\n\t * Create a new SharedTreeFactory.\n\t * @param runtime - The runtime the SharedTree will be associated with\n\t * @param id - Unique ID for the SharedTree\n\t * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format\n\t * documentation](../docs/Write-Format.md) for more information.\n\t * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.\n\t * @param expensiveValidation - Enable expensive asserts.\n\t */\n\tpublic constructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tprivate writeFormat: WriteFormat,\n\t\tsummarizeHistory: false | { uploadEditChunks: boolean } = false,\n\t\tprivate readonly expensiveValidation = false\n\t) {\n\t\tsuper(id, runtime, SharedTreeFactory.Attributes);\n\t\tthis.summarizeHistory = summarizeHistory === false ? false : true;\n\t\tthis.uploadEditChunks = summarizeHistory === false ? false : summarizeHistory.uploadEditChunks;\n\n\t\t// This code is somewhat duplicated from OldestClientObserver because it currently depends on the container runtime\n\t\t// which SharedTree does not have access to.\n\t\t// TODO:#55900: Get rid of copy-pasted OldestClientObserver code\n\t\tconst quorum = this.runtime.getQuorum();\n\t\tthis.currentIsOldest = this.computeIsOldest();\n\t\tquorum.on('addMember', this.updateOldest);\n\t\tquorum.on('removeMember', this.updateOldest);\n\t\truntime.on('connected', this.updateOldest);\n\t\truntime.on('disconnected', this.updateOldest);\n\n\t\tthis.logger = ChildLogger.create(runtime.logger, 'SharedTree', sharedTreeTelemetryProperties);\n\t\tthis.sequencedEditAppliedLogger = ChildLogger.create(\n\t\t\tthis.logger,\n\t\t\t'SequencedEditApplied',\n\t\t\tsharedTreeTelemetryProperties\n\t\t);\n\n\t\tconst { editLog, cachingLogViewer } = this.initializeNewEditLogFromSummary(\n\t\t\t{\n\t\t\t\teditChunks: [],\n\t\t\t\teditIds: [],\n\t\t\t},\n\t\t\tundefined,\n\t\t\tthis.idCompressor, // TODO: Attribution info\n\t\t\tthis.processEditResult,\n\t\t\tthis.processSequencedEditResult,\n\t\t\tWriteFormat.v0_1_1\n\t\t);\n\t\tthis.editLog = editLog;\n\t\tthis.cachingLogViewer = cachingLogViewer;\n\t\tthis.encoder_0_0_2 = new SharedTreeEncoder_0_0_2(this.summarizeHistory);\n\t\tthis.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);\n\t}\n\n\tpublic getWriteFormat(): WriteFormat {\n\t\treturn this.writeFormat;\n\t}\n\n\t/**\n\t * Re-computes currentIsOldest and emits an event if it has changed.\n\t * TODO:#55900: Get rid of copy-pasted OldestClientObserver code\n\t */\n\tprivate readonly updateOldest = () => {\n\t\tconst oldest = this.computeIsOldest();\n\t\tif (this.currentIsOldest !== oldest) {\n\t\t\tthis.currentIsOldest = oldest;\n\t\t\tif (oldest) {\n\t\t\t\tthis.emit('becameOldest');\n\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: 'BecameOldestClient' });\n\t\t\t} else {\n\t\t\t\tthis.emit('lostOldest');\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * Computes the oldest client in the quorum, true by default if the container is detached and false by default if the client isn't connected.\n\t * TODO:#55900: Get rid of copy-pasted OldestClientObserver code\n\t */\n\tprivate computeIsOldest(): boolean {\n\t\t// If the container is detached, we are the only ones that know about it and are the oldest by default.\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// If we're not connected we can't be the oldest connected client.\n\t\tif (!this.runtime.connected) {\n\t\t\treturn false;\n\t\t}\n\n\t\tassert(this.runtime.clientId !== undefined, 'Client id should be set if connected.');\n\n\t\tconst quorum = this.runtime.getQuorum();\n\t\tconst selfSequencedClient = quorum.getMember(this.runtime.clientId);\n\t\t// When in readonly mode our clientId will not be present in the quorum.\n\t\tif (selfSequencedClient === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst members = quorum.getMembers();\n\t\tfor (const sequencedClient of members.values()) {\n\t\t\tif (sequencedClient.sequenceNumber < selfSequencedClient.sequenceNumber) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// No member of the quorum was older\n\t\treturn true;\n\t}\n\n\t/**\n\t * @returns the current view of the tree.\n\t */\n\tpublic get currentView(): RevisionView {\n\t\treturn this.logViewer.getRevisionViewInSession(Number.POSITIVE_INFINITY);\n\t}\n\n\t/**\n\t * Generates a node identifier.\n\t * The returned IDs may be used as the identifier of a node in the SharedTree.\n\t * `NodeId`s are *always* unique and stable within the scope of the tree and session that generated them. They are *not* unique within\n\t * a Fluid container, and *cannot* be compared across instances of a SharedTree. They are *not* stable across sessions/lifetimes of a\n\t * SharedTree, and *cannot* be persisted (e.g. stored in payloads, uploaded in blobs, etc.). If stable persistence is needed,\n\t * NodeIdConverter.convertToStableNodeId may be used to return a corresponding UUID that is globally unique and stable.\n\t * @param override - if supplied, calls to `convertToStableNodeId` using the returned node ID will return the override instead of\n\t * the UUID. Calls to `generateNodeId` with the same override always return the same ID. Performance note: passing an override string\n\t * incurs a storage cost that is significantly higher that a node ID without one, and should be avoided if possible.\n\t * @public\n\t */\n\tpublic generateNodeId(override?: string): NodeId {\n\t\treturn this.idCompressor.generateCompressedId(override) as NodeId;\n\t}\n\n\t/**\n\t * Given a NodeId, returns the corresponding stable ID or throws if the supplied node ID was not generated with this tree (`NodeId`s\n\t * may not be used across SharedTree instances, see `generateNodeId` for more).\n\t * The returned value will be a UUID, unless the creation of `id` used an override string (see `generateNodeId` for more).\n\t * The result is safe to persist and re-use across `SharedTree` instances, unlike `NodeId`.\n\t * @public\n\t */\n\tpublic convertToStableNodeId(id: NodeId): StableNodeId {\n\t\treturn (this.idCompressor.tryDecompress(id) as StableNodeId) ?? fail('Node id is not known to this SharedTree');\n\t}\n\n\t/**\n\t * Given a NodeId, attempt to return the corresponding stable ID.\n\t * The returned value will be a UUID, unless the creation of `id` used an override string (see `generateNodeId` for more).\n\t * The returned stable ID is undefined if `id` was never created with this SharedTree. If a stable ID is returned, this does not imply\n\t * that there is a node with `id` in the current revision of the tree, only that `id` was at some point generated by some instance of\n\t * this tree.\n\t * @public\n\t */\n\tpublic tryConvertToStableNodeId(id: NodeId): StableNodeId | undefined {\n\t\treturn this.idCompressor.tryDecompress(id) as StableNodeId | undefined;\n\t}\n\n\t/**\n\t * Given a stable ID, return the corresponding NodeId or throws if the supplied stable ID was never generated with this tree, either\n\t * as a UUID corresponding to a `NodeId` or as an override passed to `generateNodeId`.\n\t * If a stable ID is returned, this does not imply that there is a node with `id` in the current revision of the tree, only that\n\t * `id` was at some point generated by an instance of this SharedTree.\n\t * @public\n\t */\n\tpublic convertToNodeId(id: StableNodeId): NodeId {\n\t\treturn (\n\t\t\t(this.idCompressor.tryRecompress(id) as NodeId) ?? fail('Stable node id is not known to this SharedTree')\n\t\t);\n\t}\n\n\t/**\n\t * Given a stable ID, return the corresponding NodeId or return undefined if the supplied stable ID was never generated with this tree,\n\t * either as a UUID corresponding to a `NodeId` or as an override passed to `generateNodeId`.\n\t * If a stable ID is returned, this does not imply that there is a node with `id` in the current revision of the tree, only that\n\t * `id` was at some point generated by an instance of this SharedTree.\n\t * @public\n\t */\n\tpublic tryConvertToNodeId(id: StableNodeId): NodeId | undefined {\n\t\treturn this.idCompressor.tryRecompress(id) as NodeId | undefined;\n\t}\n\n\t/**\n\t * @returns the edit history of the tree.\n\t * @public\n\t */\n\tpublic get edits(): OrderedEditSet<InternalizedChange> {\n\t\treturn this.editLog as unknown as OrderedEditSet<InternalizedChange>;\n\t}\n\n\tprivate deserializeHandle(serializedHandle: string): IFluidHandle<ArrayBufferLike> {\n\t\tconst deserializeHandle = this.serializer.parse(serializedHandle);\n\t\tassert(typeof deserializeHandle === 'object');\n\t\treturn deserializeHandle as IFluidHandle<ArrayBufferLike>;\n\t}\n\n\t/**\n\t * Uploads the edit chunk and sends the chunk starting revision along with the resulting handle as an op.\n\t */\n\tprivate async uploadEditChunk(\n\t\tedits: readonly EditWithoutId<ChangeInternal>[],\n\t\tstartRevision: number\n\t): Promise<void> {\n\t\tassert(this.writeFormat !== WriteFormat.v0_0_2, 'Edit chunking is not supported in v0_0_2');\n\t\t// SPO attachment blob upload limit is set here:\n\t\t// https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=%2Fsts%2Fstsom%2FPrague%2FSPPragueProtocolConfig.cs&version=GBmaster&line=82&lineEnd=82&lineStartColumn=29&lineEndColumn=116&lineStyle=plain&_a=contents\n\t\t// TODO:#59754: Create chunks based on data buffer size instead of number of edits\n\t\tconst blobUploadSizeLimit = 4194304;\n\n\t\ttry {\n\t\t\tconst chunkContents = this.encoder_0_1_1.encodeEditChunk(\n\t\t\t\tedits,\n\t\t\t\tsequencedIdNormalizer(this.idNormalizer),\n\t\t\t\tthis.interner\n\t\t\t);\n\t\t\tconst serializedContents = serializeHandles(chunkContents, this.serializer, this.handle);\n\t\t\tconst buffer = IsoBuffer.from(serializedContents);\n\t\t\tconst bufferSize = buffer.byteLength;\n\t\t\tassert(\n\t\t\t\tbufferSize <= blobUploadSizeLimit,\n\t\t\t\t`Edit chunk size ${bufferSize} is larger than blob upload size limit of ${blobUploadSizeLimit} bytes.`\n\t\t\t);\n\t\t\tconst editHandle = await this.runtime.uploadBlob(buffer);\n\t\t\tconst handleOp: SharedTreeHandleOp = {\n\t\t\t\teditHandle:\n\t\t\t\t\tserializeHandles(editHandle, this.serializer, this.handle) ??\n\t\t\t\t\tfail('Edit chunk handle could not be serialized.'),\n\t\t\t\tstartRevision,\n\t\t\t\ttype: SharedTreeOpType.Handle,\n\t\t\t\tversion: this.writeFormat,\n\t\t\t};\n\t\t\tthis.submitOp(handleOp);\n\t\t\tthis.emit(SharedTreeDiagnosticEvent.EditChunkUploaded);\n\t\t} catch (error) {\n\t\t\t// If chunk load fails, we will try again later in loadCore on the oldest client so we log the error instead of throwing.\n\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: 'EditChunkUploadFailure',\n\t\t\t\t},\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tpublic summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\treturn createSingleBlobSummary(snapshotFileName, this.saveSerializedSummary({ serializer }));\n\t}\n\n\t/**\n\t * Saves this SharedTree into a serialized summary. This is used for testing.\n\t *\n\t * @param summarizer - Optional summarizer to use. If not passed in, SharedTree's summarizer is used.\n\t * @internal\n\t */\n\tpublic saveSerializedSummary(options?: { serializer?: IFluidSerializer }): string {\n\t\tconst { serializer } = options || {};\n\t\treturn serialize(this.saveSummary(), serializer ?? this.serializer, this.handle);\n\t}\n\n\t/**\n\t * Initialize shared tree with a serialized summary. This is used for testing.\n\t * @returns - statistics about the loaded summary.\n\t * @internal\n\t */\n\tpublic loadSerializedSummary(blobData: string): ITelemetryProperties {\n\t\tconst summary = deserialize(blobData, this.serializer);\n\t\tthis.loadSummary(summary);\n\t\treturn getSummaryStatistics(summary);\n\t}\n\n\t/**\n\t * Saves this SharedTree into a deserialized summary.\n\t * @internal\n\t */\n\tpublic saveSummary(): SharedTreeSummaryBase {\n\t\t// If local changes exist, emulate the sequencing of those changes.\n\t\t// Doing so is necessary so edits created during DataObject.initializingFirstTime are included.\n\t\t// Doing so is safe because it is guaranteed that the DDS has not yet been attached. This is because summary creation is only\n\t\t// ever invoked on a DataObject containing local changes when it is attached for the first time. In post-attach flows, an extra\n\t\t// instance of the DataObject is created for generating summaries and will never have local edits.\n\t\tif (this.editLog.numberOfLocalEdits > 0) {\n\t\t\tassert(\n\t\t\t\tthis.runtime.attachState !== AttachState.Attached,\n\t\t\t\t'Summarizing should not occur with local edits except on first attach.'\n\t\t\t);\n\t\t\tif (this.writeFormat === WriteFormat.v0_1_1) {\n\t\t\t\t// Since we're the first client to attach, we can safely finalize ourselves since we're the only ones who have made IDs.\n\t\t\t\tthis.idCompressor.finalizeCreationRange(this.idCompressor.takeNextCreationRange());\n\t\t\t\tfor (const edit of this.editLog.getLocalEdits()) {\n\t\t\t\t\tthis.internStringsFromEdit(edit);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.editLog.sequenceLocalEdits();\n\t\t}\n\n\t\tassert(this.editLog.numberOfLocalEdits === 0, 'generateSummary must not be called with local edits');\n\t\treturn this.generateSummary();\n\t}\n\n\t/**\n\t * Generates a SharedTree summary for the current state of the tree.\n\t * Will never be called when local edits are present.\n\t */\n\tprivate generateSummary(): SharedTreeSummaryBase {\n\t\ttry {\n\t\t\tswitch (this.writeFormat) {\n\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\treturn this.encoder_0_0_2.encodeSummary(this.editLog, this.currentView, this);\n\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\treturn this.encoder_0_1_1.encodeSummary(\n\t\t\t\t\t\tthis.editLog,\n\t\t\t\t\t\tthis.currentView,\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tthis.idNormalizer,\n\t\t\t\t\t\tthis.interner,\n\t\t\t\t\t\tthis.idCompressor.serialize(false)\n\t\t\t\t\t);\n\t\t\t\tdefault:\n\t\t\t\t\tfail('Unknown version');\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logger?.sendErrorEvent({\n\t\t\t\teventName: 'UnsupportedSummaryWriteFormat',\n\t\t\t\tformatVersion: this.writeFormat,\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Initialize shared tree with a deserialized summary.\n\t * @internal\n\t */\n\tpublic loadSummary(summary: SharedTreeSummaryBase): void {\n\t\tconst { version: loadedSummaryVersion } = summary;\n\n\t\tif (isUpdateRequired(loadedSummaryVersion, this.writeFormat)) {\n\t\t\tthis.submitOp({ type: SharedTreeOpType.Update, version: this.writeFormat });\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: 'RequestVersionUpdate',\n\t\t\t\tversionFrom: loadedSummaryVersion,\n\t\t\t\tversionTo: this.writeFormat,\n\t\t\t});\n\t\t}\n\n\t\tif (compareSummaryFormatVersions(loadedSummaryVersion, this.writeFormat) !== 0) {\n\t\t\t// Write whatever format the loaded summary uses (this is the current agreed-upon format: it may be updated by an update op)\n\t\t\tthis.changeWriteFormat(loadedSummaryVersion);\n\t\t}\n\n\t\tassert(\n\t\t\tthis.idCompressor.getAllIdsFromLocalSession().next().done === true,\n\t\t\t'Summary load should not be executed after local state is created.'\n\t\t);\n\n\t\tlet convertedSummary: SummaryContents;\n\t\tswitch (loadedSummaryVersion) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\tconvertedSummary = this.encoder_0_0_2.decodeSummary(summary as SharedTreeSummary_0_0_2);\n\t\t\t\tbreak;\n\t\t\tcase WriteFormat.v0_1_1: {\n\t\t\t\tconst typedSummary = summary as SharedTreeSummary;\n\t\t\t\t// See comment in factory constructor--ensure we write a consistent type of summary as how the document began.\n\t\t\t\tconst loadedSummaryIncludesHistory = typedSummary.currentTree !== undefined;\n\t\t\t\tif (loadedSummaryIncludesHistory !== this.summarizeHistory) {\n\t\t\t\t\tthis.summarizeHistory = loadedSummaryIncludesHistory;\n\t\t\t\t\tthis.uploadEditChunks = loadedSummaryIncludesHistory;\n\t\t\t\t\tthis.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);\n\t\t\t\t}\n\n\t\t\t\tconvertedSummary = this.encoder_0_1_1.decodeSummary(summary as SharedTreeSummary);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('Unknown version');\n\t\t}\n\n\t\tconst { editHistory, currentTree, idCompressor, interner } = convertedSummary;\n\t\tthis.interner = interner;\n\t\tthis.interner.getOrCreateInternedId(initialTree.definition);\n\t\tif (compareSummaryFormatVersions(loadedSummaryVersion, WriteFormat.v0_1_1) < 0) {\n\t\t\tconst { editIds, editChunks } = editHistory;\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: 'SummaryConversion',\n\t\t\t\tformatVersion: WriteFormat.v0_1_1,\n\t\t\t\thistorySize: editIds.length,\n\t\t\t\ttotalNumberOfChunks: editChunks.length,\n\t\t\t\tuploadedChunks: getNumberOfHandlesFromEditLogSummary(editHistory),\n\t\t\t});\n\t\t}\n\n\t\tthis.initializeNewEditLogFromSummary(\n\t\t\teditHistory,\n\t\t\tcurrentTree,\n\t\t\tidCompressor,\n\t\t\tthis.processEditResult,\n\t\t\tthis.processSequencedEditResult,\n\t\t\tsummary.version\n\t\t);\n\n\t\tif (this.runtime.connected) {\n\t\t\tconst noChunksReadyForUpload = this.editLog.getEditChunksReadyForUpload()[Symbol.iterator]().next().done;\n\t\t\tif (noChunksReadyForUpload === undefined || !noChunksReadyForUpload) {\n\t\t\t\t// A client does not become a member of the quorum until it is within the collaboration window.\n\t\t\t\t//\n\t\t\t\t// The collaboration window is the range from the minimum sequence number enforced by the server and head.\n\t\t\t\t// When a client sends an op, they include the last sequence number the client has processed. We call this the reference\n\t\t\t\t// sequence number.\n\t\t\t\t//\n\t\t\t\t// If there are no members in the quorum, we send a no op op in order to have this client added as a member to the quorum.\n\t\t\t\t// This is required so we can ensure only the oldest client will upload blobs during summary load.\n\t\t\t\tif (this.runtime.getQuorum().getMembers().size === 0) {\n\t\t\t\t\tconst noop: SharedTreeNoOp = {\n\t\t\t\t\t\ttype: SharedTreeOpType.NoOp,\n\t\t\t\t\t\tversion: this.writeFormat,\n\t\t\t\t\t};\n\n\t\t\t\t\tthis.submitOp(noop);\n\t\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: 'NoOpSent' });\n\t\t\t\t} else if (this.currentIsOldest) {\n\t\t\t\t\tthis.uploadCatchUpBlobs();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If this client becomes the oldest, it should take care of uploading catch up blobs.\n\t\t\tthis.on('becameOldest', () => this.uploadCatchUpBlobs());\n\t\t}\n\t}\n\n\tprivate static eventFromEditResult(editStatus: EditStatus): SharedTreeDiagnosticEvent {\n\t\tswitch (editStatus) {\n\t\t\tcase EditStatus.Applied:\n\t\t\t\treturn SharedTreeDiagnosticEvent.AppliedEdit;\n\t\t\tcase EditStatus.Invalid:\n\t\t\t\treturn SharedTreeDiagnosticEvent.DroppedInvalidEdit;\n\t\t\tdefault:\n\t\t\t\treturn SharedTreeDiagnosticEvent.DroppedMalformedEdit;\n\t\t}\n\t}\n\n\t/**\n\t * Initializes a new `EditLog` and `CachingLogViewer` on this `SharedTree`, replacing and disposing of any previously existing ones.\n\t * @returns the initialized values (this is mostly to keep the constructor happy)\n\t */\n\tprivate initializeNewEditLogFromSummary(\n\t\teditHistory: EditLogSummary<ChangeInternal, EditHandle<ChangeInternal>>,\n\t\tcurrentTree: ChangeNode | undefined,\n\t\tidCompressor: IdCompressor,\n\t\teditStatusCallback: EditStatusCallback,\n\t\tsequencedEditResultCallback: SequencedEditResultCallback,\n\t\tversion: WriteFormat\n\t): { editLog: EditLog<ChangeInternal>; cachingLogViewer: CachingLogViewer } {\n\t\tthis.idCompressor = idCompressor;\n\t\t// Dispose the current log viewer if it exists. This ensures that re-used EditAddedHandlers below don't retain references to old\n\t\t// log viewers.\n\t\tthis.cachingLogViewer?.detachFromEditLog();\n\t\tconst indexOfFirstEditInSession =\n\t\t\tversion === WriteFormat.v0_0_2 || (editHistory?.editIds.length === 1 && version === WriteFormat.v0_1_1)\n\t\t\t\t? 0\n\t\t\t\t: editHistory?.editIds.length;\n\n\t\t// Use previously registered EditAddedHandlers if there is an existing EditLog.\n\t\tconst editLog = new EditLog(\n\t\t\teditHistory,\n\t\t\tthis.logger,\n\t\t\tthis.editLog?.editAddedHandlers,\n\t\t\tindexOfFirstEditInSession\n\t\t);\n\n\t\teditLog.on(SharedTreeDiagnosticEvent.UnexpectedHistoryChunk, () => {\n\t\t\tthis.emit(SharedTreeDiagnosticEvent.UnexpectedHistoryChunk);\n\t\t});\n\n\t\tlet knownRevisions: [number, EditCacheEntry][] | undefined;\n\t\tif (currentTree !== undefined) {\n\t\t\tconst currentView = RevisionView.fromTree(currentTree);\n\t\t\t// TODO:#47830: Store multiple checkpoints in summary.\n\t\t\tknownRevisions = [[editLog.length, { view: currentView }]];\n\t\t}\n\n\t\tconst logViewer = new CachingLogViewer(\n\t\t\teditLog,\n\t\t\tRevisionView.fromTree(initialTree, this),\n\t\t\tknownRevisions,\n\t\t\tthis.expensiveValidation,\n\t\t\teditStatusCallback,\n\t\t\tsequencedEditResultCallback,\n\t\t\t0\n\t\t);\n\n\t\tthis.editLog = editLog;\n\t\tthis.cachingLogViewer = logViewer;\n\t\treturn { editLog, cachingLogViewer: logViewer };\n\t}\n\n\t/**\n\t * Upload any full chunks that have yet to be uploaded.\n\t */\n\tprivate uploadCatchUpBlobs(): void {\n\t\tif (this.writeFormat !== WriteFormat.v0_0_2 && this.uploadEditChunks) {\n\t\t\tfor (const [startRevision, chunk] of this.editLog.getEditChunksReadyForUpload()) {\n\t\t\t\tthis.uploadEditChunk(chunk, startRevision)\n\t\t\t\t\t.then(() => {\n\t\t\t\t\t\tthis.emit(SharedTreeDiagnosticEvent.CatchUpBlobUploaded);\n\t\t\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: 'CatchUpBlobUpload', chunkSize: chunk.length });\n\t\t\t\t\t})\n\t\t\t\t\t// It is safe to swallow errors from edit chunk upload because the next summary load will\n\t\t\t\t\t// do another attempt to upload the edit chunks that couldn't previously be uploaded\n\t\t\t\t\t.catch((error) => {});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Compares this shared tree to another for equality. Should only be used for internal correctness testing.\n\t *\n\t * Equality means that the histories as captured by the EditLogs are equivalent.\n\t *\n\t * Equality does not include:\n\t * - if an edit is open\n\t * - the shared tree's id\n\t * - local vs sequenced status of edits\n\t * - registered event listeners\n\t * - state of caches\n\t *\n\t * @internal\n\t * */\n\tpublic equals(sharedTree: SharedTree): boolean {\n\t\tif (!areRevisionViewsSemanticallyEqual(this.currentView, this, sharedTree.currentView, sharedTree)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn this.editLog.equals(sharedTree.editLog);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst summaryLoadPerformanceEvent = PerformanceEvent.start(this.logger, { eventName: 'SummaryLoad' });\n\n\t\ttry {\n\t\t\tconst newBlob = await storage.readBlob(snapshotFileName);\n\t\t\tconst blobData = bufferToString(newBlob, 'utf8');\n\n\t\t\tconst stats = this.loadSerializedSummary(blobData);\n\n\t\t\tsummaryLoadPerformanceEvent.end(stats);\n\t\t} catch (error) {\n\t\t\tsummaryLoadPerformanceEvent.cancel({ eventName: 'SummaryLoadFailure' }, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t */\n\tprotected processCore(message: unknown, local: boolean): void {\n\t\tconst typedMessage = message as Omit<ISequencedDocumentMessage, 'contents'> & {\n\t\t\tcontents: SharedTreeOp_0_0_2 | SharedTreeOp;\n\t\t};\n\t\tthis.cachingLogViewer.setMinimumSequenceNumber(typedMessage.minimumSequenceNumber);\n\t\tconst op = typedMessage.contents;\n\t\tif (op.version === undefined) {\n\t\t\t// Back-compat: some legacy documents may contain trailing ops with an unstamped version; normalize them.\n\t\t\t(op as { version: WriteFormat | undefined }).version = WriteFormat.v0_0_2;\n\t\t}\n\t\tconst { type, version } = op;\n\t\tconst sameVersion = version === this.writeFormat;\n\n\t\t// Edit and handle ops should only be processed if they're the same version as the tree write version.\n\t\t// Update ops should only be processed if they're not the same version.\n\t\tif (sameVersion) {\n\t\t\tif (type === SharedTreeOpType.Handle) {\n\t\t\t\tconst { editHandle, startRevision } = op as SharedTreeHandleOp;\n\t\t\t\tconst baseHandle = this.deserializeHandle(editHandle);\n\t\t\t\tconst decodedHandle: EditHandle<ChangeInternal> = {\n\t\t\t\t\tget: async () => {\n\t\t\t\t\t\tconst contents = await baseHandle.get();\n\t\t\t\t\t\tconst parsedContents: EditChunkContents = JSON.parse(IsoBuffer.from(contents).toString());\n\t\t\t\t\t\treturn this.encoder_0_1_1.decodeEditChunk(\n\t\t\t\t\t\t\tparsedContents,\n\t\t\t\t\t\t\tsequencedIdNormalizer(this.idNormalizer),\n\t\t\t\t\t\t\tthis.interner\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\tbaseHandle,\n\t\t\t\t};\n\t\t\t\tthis.editLog.processEditChunkHandle(decodedHandle, startRevision);\n\t\t\t} else if (type === SharedTreeOpType.Edit) {\n\t\t\t\tif (op.version === WriteFormat.v0_1_1) {\n\t\t\t\t\t// TODO: This cast can be removed on typescript 4.6\n\t\t\t\t\tthis.idCompressor.finalizeCreationRange((op as SharedTreeEditOp).idRange);\n\t\t\t\t}\n\t\t\t\t// TODO: This cast can be removed on typescript 4.6\n\t\t\t\tconst edit = this.parseSequencedEdit(op as SharedTreeEditOp | SharedTreeEditOp_0_0_2);\n\t\t\t\tif (op.version === WriteFormat.v0_1_1) {\n\t\t\t\t\tthis.internStringsFromEdit(edit);\n\t\t\t\t}\n\t\t\t\tthis.processSequencedEdit(edit, typedMessage);\n\t\t\t}\n\t\t} else if (type === SharedTreeOpType.Update) {\n\t\t\tthis.processVersionUpdate(op.version);\n\t\t} else if (compareSummaryFormatVersions(version, this.writeFormat) === 1) {\n\t\t\t// An op version newer than our current version should not be received. If this happens, either an\n\t\t\t// incorrect op version has been written or an update op was skipped.\n\t\t\tconst error = 'Newer op version received by a client that has yet to be updated.';\n\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: 'UnexpectedNewerOpVersion',\n\t\t\t\t},\n\t\t\t\terror\n\t\t\t);\n\t\t\tfail(error);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.registerCore}\n\t */\n\tprotected registerCore(): void {\n\t\t// Do nothing\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect(): void {\n\t\t// Do nothing\n\t}\n\n\t/**\n\t * Parses a sequenced edit. This is only invoked for ops with version matching the current `writeFormat`.\n\t */\n\tprivate parseSequencedEdit(op: SharedTreeEditOp | SharedTreeEditOp_0_0_2): Edit<ChangeInternal> {\n\t\t// TODO:Type Safety: Improve type safety around op sending/parsing (e.g. discriminated union over version field somehow)\n\t\tswitch (op.version) {\n\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\treturn this.encoder_0_0_2.decodeEditOp(op, this.encodeSemiSerializedEdit.bind(this), this);\n\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\treturn this.encoder_0_1_1.decodeEditOp(\n\t\t\t\t\top,\n\t\t\t\t\tthis.encodeSemiSerializedEdit.bind(this),\n\t\t\t\t\tthis.idNormalizer,\n\t\t\t\t\tthis.interner\n\t\t\t\t);\n\t\t\tdefault:\n\t\t\t\tfail('Unknown op version');\n\t\t}\n\t}\n\n\tprivate encodeSemiSerializedEdit<T>(semiSerializedEdit: Edit<T>): Edit<T> {\n\t\t// semiSerializedEdit may have handles which have been replaced by `serializer.encode`.\n\t\t// Since there is no API to un-replace them except via parse, re-stringify the edit, then parse it.\n\t\t// Stringify using JSON, not IFluidSerializer since OPs use JSON directly.\n\t\t// TODO:Performance:#48025: Avoid this serialization round trip.\n\t\tconst encodedEdit: Edit<T> = this.serializer.parse(JSON.stringify(semiSerializedEdit));\n\t\treturn encodedEdit;\n\t}\n\n\tprivate processSequencedEdit(edit: Edit<ChangeInternal>, message: ISequencedDocumentMessage): void {\n\t\tconst { id: editId } = edit;\n\t\tconst wasLocalEdit = this.editLog.isLocalEdit(editId);\n\n\t\t// If the id of the supplied edit matches a non-local edit already present in the log, this would normally be indicative of an error.\n\t\t// However, the @fluidframework packages prior to 0.37.x have a bug which can cause data corruption by sequencing duplicate edits--\n\t\t// see discussion on the following github issue: https://github.com/microsoft/FluidFramework/issues/4399\n\t\t// To work around this issue, we currently tolerate duplicate ops in loaded documents.\n\t\t// This could be strengthened in the future to only apply to documents which may have been impacted.\n\t\tconst shouldIgnoreEdit = this.editLog.tryGetIndexOfId(editId) !== undefined && !wasLocalEdit;\n\t\tif (shouldIgnoreEdit) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (wasLocalEdit) {\n\t\t\tthis.editLog.addSequencedEdit(edit, message);\n\t\t\t// If this client created the edit that filled up a chunk, it is responsible for uploading that chunk.\n\t\t\tif (compareSummaryFormatVersions(this.writeFormat, WriteFormat.v0_0_2) > 0 && this.uploadEditChunks) {\n\t\t\t\tconst lastPair = this.editLog.getLastEditChunk();\n\t\t\t\tif (lastPair !== undefined) {\n\t\t\t\t\tconst [startRevision, chunk] = lastPair;\n\t\t\t\t\tconst edits = assertNotUndefined(chunk.edits);\n\t\t\t\t\tif (edits.length === this.editLog.editsPerChunk) {\n\t\t\t\t\t\tthis.uploadEditChunk(edits, startRevision)\n\t\t\t\t\t\t\t.then(() => {\n\t\t\t\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\t\t\teventName: 'EditChunkUpload',\n\t\t\t\t\t\t\t\t\tchunkSize: edits.length,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t// It is safe to swallow errors from edit chunk upload because the next summary load will\n\t\t\t\t\t\t\t// do another attempt to upload the edit chunks that couldn't previously be uploaded\n\t\t\t\t\t\t\t.catch((error) => {});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.applyEditLocally(edit, message);\n\t\t}\n\t}\n\n\t/**\n\t * Updates SharedTree to the provided version if the version is a valid write version newer than the current version.\n\t * @param version - The version to update to.\n\t */\n\tprivate processVersionUpdate(version: WriteFormat) {\n\t\tif (isUpdateRequired(this.writeFormat, version)) {\n\t\t\tPerformanceEvent.timedExec(\n\t\t\t\tthis.logger,\n\t\t\t\t{ eventName: 'VersionUpdate', version },\n\t\t\t\t() => {\n\t\t\t\t\tif (compareSummaryFormatVersions(version, WriteFormat.v0_1_1) >= 0) {\n\t\t\t\t\t\tthis.upgradeFrom_0_0_2_to_0_1_1();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(`Updating to version ${version} is not supported.`);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.changeWriteFormat(version);\n\n\t\t\t\t\t// The edit log may contain some local edits submitted after the version update op was submitted but\n\t\t\t\t\t// before we receive the message it has been sequenced. Since these edits must be sequenced after the version\n\t\t\t\t\t// update op, they will be discarded. These edits are then re-submitted using the new format.\n\t\t\t\t\tfor (const edit of this.editLog.getLocalEdits()) {\n\t\t\t\t\t\tthis.submitEditOp(edit);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.currentIsOldest) {\n\t\t\t\t\t\tthis.uploadCatchUpBlobs();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tend: true,\n\t\t\t\t\tcancel: 'error',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate upgradeFrom_0_0_2_to_0_1_1(): void {\n\t\t// Reset the string interner, re-populate only with information that there is consensus on\n\t\tthis.interner = new MutableStringInterner([initialTree.definition]);\n\t\tconst oldIdCompressor = this.idCompressor;\n\t\t// Create the IdCompressor that will be used after the upgrade\n\t\tconst newIdCompressor = new IdCompressor(createSessionId(), reservedIdCount); // TODO: attribution info\n\t\tconst newContext = getNodeIdContext(newIdCompressor);\n\t\t// Generate all local IDs in the new compressor that were in the old compressor and preserve their UUIDs.\n\t\t// This will allow the client to continue to use local IDs that were allocated pre-upgrade\n\t\tfor (const localId of oldIdCompressor.getAllIdsFromLocalSession()) {\n\t\t\tnewIdCompressor.generateCompressedId(oldIdCompressor.decompress(localId));\n\t\t}\n\n\t\tconst unifyHistoricalIds = (context: NodeIdContext): void => {\n\t\t\tfor (let i = 0; i < this.editLog.numberOfSequencedEdits; i++) {\n\t\t\t\tconst edit = this.editLog.getEditInSessionAtIndex(i);\n\t\t\t\tconvertEditIds(edit, (id) => context.generateNodeId(this.convertToStableNodeId(id)));\n\t\t\t}\n\t\t};\n\t\t// Construct a temporary \"ghost\" compressor which is used to generate final IDs that will be consistent across all upgrading clients\n\t\tconst ghostIdCompressor = new IdCompressor(ghostSessionId, reservedIdCount); // TODO: attribution info\n\t\tconst ghostContext = getNodeIdContext(ghostIdCompressor);\n\t\tif (this.summarizeHistory) {\n\t\t\t// All clients have the full history, and can therefore all \"generate\" the same final IDs for every ID in the history\n\t\t\t// via the ghost compressor.\n\t\t\tunifyHistoricalIds(ghostContext);\n\t\t\t// The same logic applies to string interning, so intern all the strings in the history (superset of those in the current view)\n\t\t\tfor (let i = 0; i < this.editLog.numberOfSequencedEdits; i++) {\n\t\t\t\tthis.internStringsFromEdit(this.editLog.getEditInSessionAtIndex(i));\n\t\t\t}\n\t\t} else {\n\t\t\t// Clients do not have the full history, but all share the same current view (sequenced). They can all finalize the same final\n\t\t\t// IDs for every ID in the view via the ghost compressor.\n\t\t\t// The same logic applies for the string interner.\n\t\t\tfor (const node of this.logViewer.getRevisionViewInSession(this.editLog.numberOfSequencedEdits)) {\n\t\t\t\tghostContext.generateNodeId(this.convertToStableNodeId(node.identifier));\n\t\t\t\tthis.interner.getOrCreateInternedId(node.definition);\n\t\t\t\tfor (const label of [...node.traits.keys()].sort()) {\n\t\t\t\t\tthis.interner.getOrCreateInternedId(label);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Every node in this client's history can simply be generated in the new compressor as well, preserving the UUID\n\t\t\tunifyHistoricalIds(newContext);\n\t\t}\n\t\t// Finalize any IDs in the ghost compressor into the actual compressor. This simulates all clients reaching a consensus on those IDs\n\t\tnewIdCompressor.finalizeCreationRange(ghostIdCompressor.takeNextCreationRange());\n\t\tthis.idCompressor = newIdCompressor;\n\t}\n\n\t/**\n\t * Applies a set of changes to this tree. The result will be reflected in `SharedTree.currentView`.\n\t * This method does not allow for snapshot isolation, as the changes are always applied to the most recent revision.\n\t * If it is desireable to read from and apply changes to a fixed view that does not change when remote changes arrive, `Checkout`\n\t * should be used instead.\n\t * @public\n\t */\n\tpublic applyEdit(...changes: Change[]): Edit<InternalizedChange>;\n\tpublic applyEdit(changes: Change[]): Edit<InternalizedChange>;\n\tpublic applyEdit(headOrChanges: Change | Change[], ...tail: Change[]): Edit<InternalizedChange> {\n\t\tconst changes = Array.isArray(headOrChanges) ? headOrChanges : [headOrChanges, ...tail];\n\t\tconst id = newEditId();\n\t\tconst internalEdit: Edit<ChangeInternal> = {\n\t\t\tid,\n\t\t\tchanges: changes.map((c) => this.internalizeChange(c)),\n\t\t};\n\t\tthis.submitEditOp(internalEdit);\n\t\tthis.applyEditLocally(internalEdit, undefined);\n\t\treturn internalEdit as unknown as Edit<InternalizedChange>;\n\t}\n\n\t/**\n\t * Merges `edits` from `other` into this SharedTree.\n\t * @param other - Tree containing the edits that should be applied to this one.\n\t * @param edits - Iterable of edits from `other` to apply.\n\t * @param stableIdRemapper - Optional remapper to translate stable identities from `other` into stable identities on this tree.\n\t * Any references that `other` contains to a stable id `foo` will be replaced with references to the id `stableIdRemapper(foo)`.\n\t *\n\t * Payloads on the edits are left intact.\n\t * @returns a list containing `EditId`s for all applied edits.\n\t */\n\tpublic mergeEditsFrom(\n\t\tother: SharedTree,\n\t\tedits: Iterable<Edit<InternalizedChange>>,\n\t\tstableIdRemapper?: (id: StableNodeId) => StableNodeId\n\t): EditId[] {\n\t\tconst idConverter = (id: NodeId) => {\n\t\t\tconst stableId = other.convertToStableNodeId(id);\n\t\t\tconst convertedStableId = stableIdRemapper?.(stableId) ?? stableId;\n\t\t\treturn this.generateNodeId(convertedStableId);\n\t\t};\n\n\t\treturn Array.from(\n\t\t\tedits as unknown as Iterable<Edit<ChangeInternal>>,\n\t\t\t(edit) => this.applyEditInternal(convertEditIds(edit, (id) => idConverter(id))).id\n\t\t);\n\t}\n\n\t/**\n\t * Applies a set of internal changes to this tree. The result will be reflected in `SharedTree.currentView`.\n\t * External users should use one of the more specialized functions, like `applyEdit` which handles constructing the actual `Edit`\n\t * and uses public Change types.\n\t * This is exposed for internal use only.\n\t * @internal\n\t */\n\tpublic applyEditInternal(editOrChanges: Edit<ChangeInternal> | readonly ChangeInternal[]): Edit<ChangeInternal> {\n\t\tlet edit: Edit<ChangeInternal>;\n\t\tif (Array.isArray(editOrChanges)) {\n\t\t\tconst id = newEditId();\n\t\t\tedit = { id, changes: editOrChanges };\n\t\t} else {\n\t\t\tedit = editOrChanges as Edit<ChangeInternal>;\n\t\t}\n\t\tthis.submitEditOp(edit);\n\t\tthis.applyEditLocally(edit, undefined);\n\t\treturn edit;\n\t}\n\n\t/**\n\t * Converts a public Change type to an internal representation.\n\t * This is exposed for internal use only.\n\t * @internal\n\t */\n\tpublic internalizeChange(change: Change): ChangeInternal {\n\t\tswitch (change.type) {\n\t\t\tcase ChangeType.Insert:\n\t\t\t\treturn {\n\t\t\t\t\tsource: change.source as DetachedSequenceId,\n\t\t\t\t\tdestination: deepCloneStablePlace(change.destination),\n\t\t\t\t\ttype: ChangeTypeInternal.Insert,\n\t\t\t\t};\n\t\t\tcase ChangeType.Detach: {\n\t\t\t\tconst detach: DetachInternal = {\n\t\t\t\t\tsource: deepCloneStableRange(change.source),\n\t\t\t\t\ttype: ChangeTypeInternal.Detach,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, detach, 'destination');\n\t\t\t\treturn detach;\n\t\t\t}\n\t\t\tcase ChangeType.Build: {\n\t\t\t\tif (isTreeNodeSequence(change.source)) {\n\t\t\t\t\tconst source = change.source.map((buildNode) =>\n\t\t\t\t\t\tconvertTreeNodes<BuildTreeNode, TreeNode<BuildNodeInternal, NodeId>, number>(\n\t\t\t\t\t\t\tbuildNode,\n\t\t\t\t\t\t\t(nodeData) => internalizeBuildNode(nodeData, this),\n\t\t\t\t\t\t\t(x): x is number => typeof x === 'number'\n\t\t\t\t\t\t)\n\t\t\t\t\t) as TreeNodeSequence<TreeNode<BuildNodeInternal, NodeId> | DetachedSequenceId>;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\tdestination: change.destination as DetachedSequenceId,\n\t\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst source = convertTreeNodes<BuildTreeNode, TreeNode<BuildNodeInternal, NodeId>, number>(\n\t\t\t\t\t\tchange.source,\n\t\t\t\t\t\t(nodeData) => internalizeBuildNode(nodeData, this),\n\t\t\t\t\t\t(x): x is number => typeof x === 'number'\n\t\t\t\t\t) as TreeNode<BuildNodeInternal, NodeId> | DetachedSequenceId;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsource: [source],\n\t\t\t\t\t\tdestination: change.destination as DetachedSequenceId,\n\t\t\t\t\t\ttype: ChangeTypeInternal.Build,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase ChangeType.SetValue:\n\t\t\t\treturn {\n\t\t\t\t\tnodeToModify: change.nodeToModify,\n\t\t\t\t\tpayload: change.payload,\n\t\t\t\t\ttype: ChangeTypeInternal.SetValue,\n\t\t\t\t};\n\t\t\tcase ChangeType.Constraint: {\n\t\t\t\tconst constraint: ConstraintInternal = {\n\t\t\t\t\teffect: change.effect,\n\t\t\t\t\ttoConstrain: change.toConstrain,\n\t\t\t\t\ttype: ChangeTypeInternal.Constraint,\n\t\t\t\t};\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'contentHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'identityHash');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'label');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'length');\n\t\t\t\tcopyPropertyIfDefined(change, constraint, 'parentNode');\n\t\t\t\treturn constraint;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfail('unexpected change type');\n\t\t}\n\t}\n\n\tprivate applyEditLocally(edit: Edit<ChangeInternal>, message: ISequencedDocumentMessage | undefined): void {\n\t\tconst isSequenced = message !== undefined;\n\t\tif (isSequenced) {\n\t\t\t// TODO: This cast can be removed on typescript 4.6\n\t\t\tthis.editLog.addSequencedEdit(edit, message as ISequencedDocumentMessage);\n\t\t} else {\n\t\t\tthis.editLog.addLocalEdit(edit);\n\t\t}\n\n\t\tconst eventArguments: EditCommittedEventArguments = {\n\t\t\teditId: edit.id,\n\t\t\tlocal: !isSequenced,\n\t\t\ttree: this,\n\t\t};\n\t\tthis.emit(SharedTreeEvent.EditCommitted, eventArguments);\n\t}\n\n\t/**\n\t * Reverts a previous edit by applying a new edit containing the inverse of the original edit's changes.\n\t * @param editId - the edit to revert\n\t * @returns the id of the new edit, or undefined if the original edit could not be inverted given the current tree state.\n\t * @public\n\t */\n\tpublic revert(editId: EditId): EditId | undefined {\n\t\tconst index = this.edits.getIndexOfId(editId);\n\t\tconst edit = this.edits.getEditInSessionAtIndex(index);\n\t\tconst before = this.logViewer.getRevisionViewInSession(index);\n\t\tconst changes = this.revertChanges(edit.changes, before);\n\t\tif (changes === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.applyEditInternal(changes).id;\n\t}\n\n\t/**\n\t * Revert the given changes\n\t * @param changes - the changes to revert\n\t * @param before - the revision view before the changes were originally applied\n\t * @returns the inverse of `changes` or undefined if the changes could not be inverted for the given tree state.\n\t * @internal\n\t */\n\tpublic revertChanges(changes: readonly InternalizedChange[], before: RevisionView): ChangeInternal[] | undefined {\n\t\treturn revert(changes as unknown as readonly ChangeInternal[], before);\n\t}\n\n\t/**\n\t * Submits an edit by the local client to the runtime.\n\t */\n\tprivate submitEditOp(edit: Edit<ChangeInternal>): void {\n\t\t// Only submit ops if attached, since op submission can have stateful side effects (e.g. changing the IdCompressor)\n\t\t// Ops will be submitted again when attached (see loadSummary())\n\t\tif (this.isAttached()) {\n\t\t\tswitch (this.writeFormat) {\n\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\tthis.submitOp(this.encoder_0_0_2.encodeEditOp(edit, this.serializeEdit.bind(this), this));\n\t\t\t\t\tbreak;\n\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\tthis.submitOp(\n\t\t\t\t\t\tthis.encoder_0_1_1.encodeEditOp(\n\t\t\t\t\t\t\tedit,\n\t\t\t\t\t\t\tthis.serializeEdit.bind(this),\n\t\t\t\t\t\t\tthis.idCompressor.takeNextCreationRange(),\n\t\t\t\t\t\t\tthis.idNormalizer,\n\t\t\t\t\t\t\tthis.interner\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tfail('Unknown version');\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate serializeEdit<TChange>(preparedEdit: Edit<TChange>): Edit<TChange> {\n\t\treturn this.serializer.encode(preparedEdit, this.handle) as Edit<TChange>;\n\t}\n\n\t/** A type-safe `submitLocalMessage` wrapper to enforce op format */\n\tprivate submitOp(content: SharedTreeOp | SharedTreeOp_0_0_2, localOpMetadata: unknown = undefined): void {\n\t\tassert(\n\t\t\tcompareSummaryFormatVersions(content.version, this.writeFormat) === 0,\n\t\t\t'Attempted to submit op of wrong version'\n\t\t);\n\t\tthis.submitLocalMessage(content, localOpMetadata);\n\t}\n\n\tpublic getRuntime(): IFluidDataStoreRuntime {\n\t\treturn this.runtime;\n\t}\n\n\t/**\n\t * \"Pending local state\" refers to ops submitted to the runtime that have not yet been acked.\n\t * When closing a container, hosts have the option to stash this pending local state somewhere to be reapplied\n\t * later (to avoid data loss).\n\t * If a host then loads a container using that stashed state, this function is called for each stashed op, and is expected to:\n\t * 1. Update this DDS to reflect that state locally.\n\t * 2. Return any `localOpMetadata` that would have been associated with this op.\n\t *\n\t * @param content - op to apply locally.\n\t */\n\tprotected applyStashedOp(op: unknown): void {\n\t\tconst sharedTreeOp = op as SharedTreeOp | SharedTreeOp_0_0_2;\n\t\tswitch (sharedTreeOp.type) {\n\t\t\tcase SharedTreeOpType.Edit: {\n\t\t\t\tswitch (this.writeFormat) {\n\t\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\t\tswitch (sharedTreeOp.version) {\n\t\t\t\t\t\t\tcase WriteFormat.v0_0_2: {\n\t\t\t\t\t\t\t\tconst edit = this.parseSequencedEdit(sharedTreeOp);\n\t\t\t\t\t\t\t\tthis.applyEditLocally(edit, undefined);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\t\t\t\t// TODO:#74390: Implement\n\t\t\t\t\t\t\t\tfail('Received stashed op 0.1.1 before upgrade');\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\t\tswitch (sharedTreeOp.version) {\n\t\t\t\t\t\t\tcase WriteFormat.v0_0_2:\n\t\t\t\t\t\t\t\t// TODO:#74390: Implement\n\t\t\t\t\t\t\t\tfail('v0.1.1 does not support stashed ops.');\n\t\t\t\t\t\t\tcase WriteFormat.v0_1_1:\n\t\t\t\t\t\t\t\t// TODO:#74390: Implement\n\t\t\t\t\t\t\t\tfail('v0.1.1 does not support stashed ops.');\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tfail('Unknown version');\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Handle and update ops are only acknowledged by the client that generated them upon sequencing--no local changes necessary.\n\t\t\tcase SharedTreeOpType.Handle:\n\t\t\tcase SharedTreeOpType.Update:\n\t\t\tcase SharedTreeOpType.NoOp:\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tfail('Unrecognized op');\n\t\t}\n\t}\n\n\tprivate changeWriteFormat(newFormat: WriteFormat): void {\n\t\tthis.writeFormat = newFormat;\n\t\tthis.emit(SharedTreeDiagnosticEvent.WriteVersionChanged, newFormat);\n\t}\n\n\t/**\n\t * Interns all Definitions and TraitLabel_s referenced by the provided edit.\n\t *\n\t * Clients must have consensus on the interned values to guarantee the interned ID is valid.\n\t */\n\tprivate internStringsFromEdit(edit: Edit<ChangeInternal>): void {\n\t\tfor (const change of edit.changes) {\n\t\t\tif (change.type === ChangeTypeInternal.Build) {\n\t\t\t\tfor (const root of change.source) {\n\t\t\t\t\twalkTree<TreeNode<BuildNodeInternal, NodeId>, DetachedSequenceId>(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\t(node) => {\n\t\t\t\t\t\t\tthis.interner.getOrCreateInternedId(node.definition);\n\t\t\t\t\t\t\tfor (const trait of Object.keys(node.traits)) {\n\t\t\t\t\t\t\t\tthis.interner.getOrCreateInternedId(trait);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisDetachedSequenceId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (change.type === ChangeTypeInternal.Insert) {\n\t\t\t\tconst { referenceTrait } = change.destination;\n\t\t\t\tif (referenceTrait !== undefined) {\n\t\t\t\t\tthis.interner.getOrCreateInternedId(referenceTrait.label);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @returns 1 if versionA is newer, -1 if versionB is newer, and 0 if the versions are the same.\n * @throws if either version isn't a valid WriteFormat version.\n */\nfunction compareSummaryFormatVersions(versionA: string, versionB: string): number {\n\tconst versionAIndex = sortedWriteVersions.indexOf(versionA as WriteFormat);\n\tconst versionBIndex = sortedWriteVersions.indexOf(versionB as WriteFormat);\n\n\tif (versionAIndex === -1 || versionBIndex === -1) {\n\t\tfail('Summary version being compared cannot be read.');\n\t}\n\n\tif (versionAIndex < versionBIndex) {\n\t\treturn -1;\n\t} else if (versionAIndex > versionBIndex) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\n/**\n * Checks if the summary version needs to be updated.\n * @returns true if the old version is older than the new version.\n * @throws if the new version isn't a supported WriteFormat version.\n */\nfunction isUpdateRequired(oldVersion: string, newVersion: string): boolean {\n\tconst newVersionIndex = sortedWriteVersions.indexOf(newVersion as WriteFormat);\n\tif (newVersionIndex === -1) {\n\t\tfail('New write version is invalid.');\n\t}\n\n\treturn compareSummaryFormatVersions(oldVersion, newVersion) === -1 ? true : false;\n}\n\nfunction isTreeNodeSequence(source: TreeNodeSequence<BuildNode> | BuildNode): source is TreeNodeSequence<BuildNode> {\n\treturn Array.isArray(source);\n}\n"]}
|
package/lib/SharedTree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedTree.d.ts","sourceRoot":"","sources":["../src/SharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEN,gBAAgB,EAChB,mBAAmB,EAEnB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,EAA6D,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BpB,OAAO,CAAC,aAAa;IAIrB,oEAAoE;IACpE,OAAO,CAAC,QAAQ;IAQT,UAAU,IAAI,sBAAsB;IAI3C;;;;;;;;;OASG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI;IA6C3C,OAAO,CAAC,iBAAiB;IAKzB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;CAuB7B"}
|
package/lib/SharedTree.js
CHANGED
|
@@ -617,9 +617,12 @@ export class SharedTree extends SharedObject {
|
|
|
617
617
|
const typedMessage = message;
|
|
618
618
|
this.cachingLogViewer.setMinimumSequenceNumber(typedMessage.minimumSequenceNumber);
|
|
619
619
|
const op = typedMessage.contents;
|
|
620
|
+
if (op.version === undefined) {
|
|
621
|
+
// Back-compat: some legacy documents may contain trailing ops with an unstamped version; normalize them.
|
|
622
|
+
op.version = WriteFormat.v0_0_2;
|
|
623
|
+
}
|
|
620
624
|
const { type, version } = op;
|
|
621
|
-
const
|
|
622
|
-
const sameVersion = resolvedVersion === this.writeFormat;
|
|
625
|
+
const sameVersion = version === this.writeFormat;
|
|
623
626
|
// Edit and handle ops should only be processed if they're the same version as the tree write version.
|
|
624
627
|
// Update ops should only be processed if they're not the same version.
|
|
625
628
|
if (sameVersion) {
|
|
@@ -652,7 +655,7 @@ export class SharedTree extends SharedObject {
|
|
|
652
655
|
else if (type === SharedTreeOpType.Update) {
|
|
653
656
|
this.processVersionUpdate(op.version);
|
|
654
657
|
}
|
|
655
|
-
else if (compareSummaryFormatVersions(
|
|
658
|
+
else if (compareSummaryFormatVersions(version, this.writeFormat) === 1) {
|
|
656
659
|
// An op version newer than our current version should not be received. If this happens, either an
|
|
657
660
|
// incorrect op version has been written or an update op was skipped.
|
|
658
661
|
const error = 'Newer op version received by a client that has yet to be updated.';
|