@fluidframework/map 2.52.0 → 2.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/directory.d.ts +60 -95
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +420 -319
- package/dist/directory.js.map +1 -1
- package/dist/mapKernel.d.ts.map +1 -1
- package/dist/mapKernel.js +5 -20
- package/dist/mapKernel.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/utils.d.ts +13 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +26 -0
- package/dist/utils.js.map +1 -0
- package/lib/directory.d.ts +60 -95
- package/lib/directory.d.ts.map +1 -1
- package/lib/directory.js +420 -319
- package/lib/directory.js.map +1 -1
- package/lib/mapKernel.d.ts.map +1 -1
- package/lib/mapKernel.js +1 -16
- package/lib/mapKernel.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/utils.d.ts +13 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +21 -0
- package/lib/utils.js.map +1 -0
- package/package.json +18 -18
- package/src/directory.ts +608 -450
- package/src/mapKernel.ts +1 -19
- package/src/packageVersion.ts +1 -1
- package/src/utils.ts +23 -0
package/dist/directory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;AAEH,+DAAiE;AACjE,kEAA8E;AAM9E,0EAGqD;AACrD,oEAAqE;AACrE,kEAAmE;AAKnE,qEAA4E;AAE5E,0EAKqD;AACrD,uEAGkD;AAClD,sEAAmC;AAenC,qDAA+E;AAE/E,sFAAsF;AACtF,oDAAoD;AACpD,MAAM,KAAK,GAAG,yBAAI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AAC,IAAI,cAAc,EAAE,CAAC;YAChD,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;QAC5C,CAAC;QACD,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YAC7C,SAAS,CAAC,OAAO,EAAE,CAAC;QACrB,CAAC;IACF,CAAC;IAEO,wBAAwB,CAAC,SAAuB;QACvD,qHAAqH;QACrH,yEAAyE;QACzE,SAAS,CAAC,SAAS,EAAE,CAAC;QACtB,KAAK,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,IAAI,SAAS,CAAC,cAAc,EAAE,EAAE,CAAC;YAC5D,IAAI,CAAC,wBAAwB,CAAC,YAA4B,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport { RedBlackTree } from \"@fluidframework/merge-tree/internal\";\nimport type {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tSharedObject,\n\tValueType,\n\tbindHandles,\n\tparseHandles,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport path from \"path-browserify\";\n\nimport type {\n\tIDirectory,\n\tIDirectoryEvents,\n\tIDirectoryValueChanged,\n\tISharedDirectory,\n\tISharedDirectoryEvents,\n\tIValueChanged,\n} from \"./interfaces.js\";\nimport type {\n\t// eslint-disable-next-line import/no-deprecated\n\tISerializableValue,\n\tISerializedValue,\n} from \"./internalInterfaces.js\";\nimport { serializeValue, migrateIfSharedSerializable } from \"./localValues.js\";\n\n// We use path-browserify since this code can run safely on the server or the browser.\n// We standardize on using posix slashes everywhere.\nconst posix = path.posix;\n\nconst snapshotFileName = \"header\";\n\n/**\n * Defines the means to process and submit a given op on a directory.\n */\ninterface IDirectoryMessageHandler {\n\t/**\n\t * Apply the given operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The directory operation to apply\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void;\n\n\t/**\n\t * Communicate the operation to remote clients.\n\t * @param op - The directory operation to submit\n\t * @param localOpMetadata - The metadata to be submitted with the message.\n\t */\n\tsubmit(op: IDirectoryOperation, localOpMetadata: unknown): void;\n}\n\n/**\n * Operation indicating a value should be set for a key.\n */\nexport interface IDirectorySetOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"set\";\n\n\t/**\n\t * Directory key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Absolute path of the directory where the modified key is located.\n\t */\n\tpath: string;\n\n\t/**\n\t * Value to be set on the key.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tvalue: ISerializableValue;\n}\n\n/**\n * Operation indicating a key should be deleted from the directory.\n */\nexport interface IDirectoryDeleteOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"delete\";\n\n\t/**\n\t * Directory key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Absolute path of the directory where the modified key is located.\n\t */\n\tpath: string;\n}\n\n/**\n * An operation on a specific key within a directory.\n */\nexport type IDirectoryKeyOperation = IDirectorySetOperation | IDirectoryDeleteOperation;\n\n/**\n * Operation indicating the directory should be cleared.\n */\nexport interface IDirectoryClearOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"clear\";\n\n\t/**\n\t * Absolute path of the directory being cleared.\n\t */\n\tpath: string;\n}\n\n/**\n * An operation on one or more of the keys within a directory.\n */\nexport type IDirectoryStorageOperation = IDirectoryKeyOperation | IDirectoryClearOperation;\n\n/**\n * Operation indicating a subdirectory should be created.\n */\nexport interface IDirectoryCreateSubDirectoryOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"createSubDirectory\";\n\n\t/**\n\t * Absolute path of the directory that will contain the new subdirectory.\n\t */\n\tpath: string;\n\n\t/**\n\t * Name of the new subdirectory.\n\t */\n\tsubdirName: string;\n}\n\n/**\n * Operation indicating a subdirectory should be deleted.\n */\nexport interface IDirectoryDeleteSubDirectoryOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"deleteSubDirectory\";\n\n\t/**\n\t * Absolute path of the directory that contains the directory to be deleted.\n\t */\n\tpath: string;\n\n\t/**\n\t * Name of the subdirectory to be deleted.\n\t */\n\tsubdirName: string;\n}\n\n/**\n * An operation on the subdirectories within a directory.\n */\nexport type IDirectorySubDirectoryOperation =\n\t| IDirectoryCreateSubDirectoryOperation\n\t| IDirectoryDeleteSubDirectoryOperation;\n\n/**\n * Any operation on a directory.\n */\nexport type IDirectoryOperation = IDirectoryStorageOperation | IDirectorySubDirectoryOperation;\n\n/**\n * Create info for the subdirectory.\n *\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n *\n * @legacy\n * @alpha\n */\nexport interface ICreateInfo {\n\t/**\n\t * Sequence number at which this subdirectory was created.\n\t */\n\tcsn: number;\n\n\t/**\n\t * clientids of the clients which created this sub directory.\n\t */\n\tccIds: string[];\n}\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n *\n * @remarks Directly used in\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify\n * | JSON.stringify}, direct result from\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.\n *\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n *\n * @legacy\n * @alpha\n */\nexport interface IDirectoryDataObject {\n\t/**\n\t * Key/value date set by the user.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tstorage?: Record<string, ISerializableValue>;\n\n\t/**\n\t * Recursive sub-directories {@link IDirectoryDataObject | objects}.\n\t */\n\tsubdirectories?: Record<string, IDirectoryDataObject>;\n\n\t/**\n\t * Create info for the sub directory. Since directories with same name can get deleted/created by multiple clients\n\t * asynchronously, this info helps us to determine whether the ops where for the current instance of sub directory\n\t * or not and whether to process them or not based on that. Summaries which were not produced which this change\n\t * will not have this info and in that case we can still run in eventual consistency issues but that is no worse\n\t * than the state before this change.\n\t */\n\tci?: ICreateInfo;\n}\n\n/**\n * {@link IDirectory} storage format.\n *\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n *\n * @legacy\n * @alpha\n */\nexport interface IDirectoryNewStorageFormat {\n\t/**\n\t * Blob IDs representing larger directory data that was serialized.\n\t */\n\tblobs: string[];\n\n\t/**\n\t * Storage content representing directory data that was not serialized.\n\t */\n\tcontent: IDirectoryDataObject;\n}\n\n/**\n * The comparator essentially performs the following procedure to determine the order of subdirectory creation:\n * 1. If subdirectory A has a non-negative 'seq' and subdirectory B has a negative 'seq', subdirectory A is always placed first due to\n * the policy that acknowledged subdirectories precede locally created ones that have not been committed yet.\n *\n * 2. When both subdirectories A and B have a non-negative 'seq', they are compared as follows:\n * - If A and B have different 'seq', they are ordered based on 'seq', and the one with the lower 'seq' will be positioned ahead. Notably this rule\n * should not be applied in the directory ordering, since the lowest 'seq' is -1, when the directory is created locally but not acknowledged yet.\n * - In the case where A and B have equal 'seq', the one with the lower 'clientSeq' will be positioned ahead. This scenario occurs when grouped\n * batching is enabled, and a lower 'clientSeq' indicates that it was processed earlier after the batch was ungrouped.\n *\n * 3. When both subdirectories A and B have a negative 'seq', they are compared as follows:\n * - If A and B have different 'seq', the one with lower 'seq' will be positioned ahead, which indicates the corresponding creation message was\n * acknowledged by the server earlier.\n * - If A and B have equal 'seq', the one with lower 'clientSeq' will be placed at the front. This scenario suggests that both subdirectories A\n * and B were created locally and not acknowledged yet, with the one possessing the lower 'clientSeq' being created earlier.\n *\n * 4. A 'seq' value of zero indicates that the subdirectory was created in detached state, and it is considered acknowledged for the\n * purpose of ordering.\n */\nconst seqDataComparator = (a: SequenceData, b: SequenceData): number => {\n\tif (isAcknowledgedOrDetached(a)) {\n\t\tif (isAcknowledgedOrDetached(b)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\treturn a.seq === b.seq ? a.clientSeq! - b.clientSeq! : a.seq - b.seq;\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t} else {\n\t\tif (isAcknowledgedOrDetached(b)) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\treturn a.seq === b.seq ? a.clientSeq! - b.clientSeq! : a.seq - b.seq;\n\t\t}\n\t}\n};\n\nfunction isAcknowledgedOrDetached(seqData: SequenceData): boolean {\n\treturn seqData.seq >= 0;\n}\n\n/**\n * The combination of sequence numebr and client sequence number of a subdirectory\n */\ninterface SequenceData {\n\tseq: number;\n\tclientSeq?: number;\n}\n\n/**\n * A utility class for tracking associations between keys and their creation indices.\n * This is relevant to support map iteration in insertion order, see\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/%40%40iterator\n *\n * TODO: It can be combined with the creation tracker utilized in SharedMap\n */\nclass DirectoryCreationTracker {\n\tpublic readonly indexToKey: RedBlackTree<SequenceData, string>;\n\n\tpublic readonly keyToIndex: Map<string, SequenceData>;\n\n\tpublic constructor() {\n\t\tthis.indexToKey = new RedBlackTree<SequenceData, string>(seqDataComparator);\n\t\tthis.keyToIndex = new Map<string, SequenceData>();\n\t}\n\n\tpublic set(key: string, seqData: SequenceData): void {\n\t\tthis.indexToKey.put(seqData, key);\n\t\tthis.keyToIndex.set(key, seqData);\n\t}\n\n\tpublic has(keyOrSeqData: string | SequenceData): boolean {\n\t\treturn typeof keyOrSeqData === \"string\"\n\t\t\t? this.keyToIndex.has(keyOrSeqData)\n\t\t\t: this.indexToKey.get(keyOrSeqData) !== undefined;\n\t}\n\n\tpublic delete(keyOrSeqData: string | SequenceData): void {\n\t\tif (this.has(keyOrSeqData)) {\n\t\t\tif (typeof keyOrSeqData === \"string\") {\n\t\t\t\tconst seqData = this.keyToIndex.get(keyOrSeqData) as SequenceData;\n\t\t\t\tthis.keyToIndex.delete(keyOrSeqData);\n\t\t\t\tthis.indexToKey.remove(seqData);\n\t\t\t} else {\n\t\t\t\tconst key = this.indexToKey.get(keyOrSeqData)?.data as string;\n\t\t\t\tthis.indexToKey.remove(keyOrSeqData);\n\t\t\t\tthis.keyToIndex.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves all subdirectories with creation order that satisfy an optional constraint function.\n\t * @param constraint - An optional constraint function that filters keys.\n\t * @returns An array of keys that satisfy the constraint (or all keys if no constraint is provided).\n\t */\n\tpublic keys(constraint?: (key: string) => boolean): string[] {\n\t\tconst keys: string[] = [];\n\t\tthis.indexToKey.mapRange((node) => {\n\t\t\tif (!constraint || constraint(node.data)) {\n\t\t\t\tkeys.push(node.data);\n\t\t\t}\n\t\t\treturn true;\n\t\t}, keys);\n\t\treturn keys;\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.keyToIndex.size;\n\t}\n}\n\n/**\n * {@inheritDoc ISharedDirectory}\n *\n * @example\n *\n * ```typescript\n * mySharedDirectory.createSubDirectory(\"a\").createSubDirectory(\"b\").createSubDirectory(\"c\").set(\"foo\", val1);\n * const mySubDir = mySharedDirectory.getWorkingDirectory(\"/a/b/c\");\n * mySubDir.get(\"foo\"); // returns val1\n * ```\n *\n * @sealed\n */\nexport class SharedDirectory\n\textends SharedObject<ISharedDirectoryEvents>\n\timplements ISharedDirectory\n{\n\t/**\n\t * String representation for the class.\n\t */\n\tpublic [Symbol.toStringTag]: string = \"SharedDirectory\";\n\n\t/**\n\t * {@inheritDoc IDirectory.absolutePath}\n\t */\n\tpublic get absolutePath(): string {\n\t\treturn this.root.absolutePath;\n\t}\n\n\t/**\n\t * Root of the SharedDirectory, most operations on the SharedDirectory itself act on the root.\n\t */\n\tprivate readonly root: SubDirectory = new SubDirectory(\n\t\t{ seq: 0, clientSeq: 0 },\n\t\tnew Set(),\n\t\tthis,\n\t\tthis.runtime,\n\t\tthis.serializer,\n\t\tposix.sep,\n\t\tthis.logger,\n\t);\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandlers = new Map<string, IDirectoryMessageHandler>();\n\n\t/**\n\t * Constructs a new shared directory. If the object is non-local an id and service interfaces will\n\t * be provided.\n\t * @param id - String identifier for the SharedDirectory\n\t * @param runtime - Data store runtime\n\t * @param type - Type identifier\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_directory_\");\n\t\tthis.setMessageHandlers();\n\t\t// Mirror the containedValueChanged op on the SharedDirectory\n\t\tthis.root.on(\"containedValueChanged\", (changed: IValueChanged, local: boolean) => {\n\t\t\tthis.emit(\"containedValueChanged\", changed, local, this);\n\t\t});\n\t\tthis.root.on(\"subDirectoryCreated\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryCreated\", relativePath, local, this);\n\t\t});\n\t\tthis.root.on(\"subDirectoryDeleted\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryDeleted\", relativePath, local, this);\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.get}\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic get<T = any>(key: string): T | undefined {\n\t\treturn this.root.get<T>(key);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.set}\n\t */\n\tpublic set<T = unknown>(key: string, value: T): this {\n\t\tthis.root.set(key, value);\n\t\treturn this;\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tthis.root.dispose(error);\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this.root.disposed;\n\t}\n\n\t/**\n\t * Deletes the given key from within this IDirectory.\n\t * @param key - The key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\treturn this.root.delete(key);\n\t}\n\n\t/**\n\t * Deletes all keys from within this IDirectory.\n\t */\n\tpublic clear(): void {\n\t\tthis.root.clear();\n\t}\n\n\t/**\n\t * Checks whether the given key exists in this IDirectory.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.root.has(key);\n\t}\n\n\t/**\n\t * The number of entries under this IDirectory.\n\t */\n\tpublic get size(): number {\n\t\treturn this.root.size;\n\t}\n\n\t/**\n\t * Issue a callback on each entry under this IDirectory.\n\t * @param callback - Callback to issue\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic forEach(callback: (value: any, key: string, map: Map<string, any>) => void): void {\n\t\t// eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-callback-reference\n\t\tthis.root.forEach(callback);\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\n\t\treturn this.root[Symbol.iterator]();\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic entries(): IterableIterator<[string, any]> {\n\t\treturn this.root.entries();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.countSubDirectory}\n\t */\n\tpublic countSubDirectory(): number {\n\t\treturn this.root.countSubDirectory();\n\t}\n\n\t/**\n\t * Get an iterator over the keys under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.root.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic values(): IterableIterator<any> {\n\t\treturn this.root.values();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.createSubDirectory}\n\t */\n\tpublic createSubDirectory(subdirName: string): IDirectory {\n\t\treturn this.root.createSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getSubDirectory}\n\t */\n\tpublic getSubDirectory(subdirName: string): IDirectory | undefined {\n\t\treturn this.root.getSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.hasSubDirectory}\n\t */\n\tpublic hasSubDirectory(subdirName: string): boolean {\n\t\treturn this.root.hasSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.deleteSubDirectory}\n\t */\n\tpublic deleteSubDirectory(subdirName: string): boolean {\n\t\treturn this.root.deleteSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.subdirectories}\n\t */\n\tpublic subdirectories(): IterableIterator<[string, IDirectory]> {\n\t\treturn this.root.subdirectories();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getWorkingDirectory}\n\t */\n\tpublic getWorkingDirectory(relativePath: string): IDirectory | undefined {\n\t\tconst absolutePath = this.makeAbsolute(relativePath);\n\t\tif (absolutePath === posix.sep) {\n\t\t\treturn this.root;\n\t\t}\n\n\t\tlet currentSubDir = this.root;\n\t\tconst subdirs = absolutePath.slice(1).split(posix.sep);\n\t\tfor (const subdir of subdirs) {\n\t\t\tcurrentSubDir = currentSubDir.getSubDirectory(subdir) as SubDirectory;\n\t\t\tif (!currentSubDir) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t\treturn currentSubDir;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\treturn this.serializeDirectory(this.root, serializer);\n\t}\n\n\t/**\n\t * Submits an operation\n\t * @param op - Op to submit\n\t * @param localOpMetadata - The local metadata associated with the op. We send a unique id that is used to track\n\t * this op while it has not been ack'd. This will be sent when we receive this op back from the server.\n\t */\n\tpublic submitDirectoryMessage(op: IDirectoryOperation, localOpMetadata: unknown): void {\n\t\tthis.submitLocalMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t */\n\tprotected override reSubmitCore(content: unknown, localOpMetadata: unknown): void {\n\t\tconst message = content as IDirectoryOperation;\n\t\tconst handler = this.messageHandlers.get(message.type);\n\t\tassert(handler !== undefined, 0x00d /* Missing message handler for message type */);\n\t\thandler.submit(message, localOpMetadata);\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 data = await readAndParse(storage, snapshotFileName);\n\t\tconst newFormat = data as IDirectoryNewStorageFormat;\n\t\tif (Array.isArray(newFormat.blobs)) {\n\t\t\t// New storage format\n\t\t\tthis.populate(newFormat.content);\n\t\t\tconst blobContents = await Promise.all(\n\t\t\t\tnewFormat.blobs.map(async (blobName) => readAndParse(storage, blobName)),\n\t\t\t);\n\t\t\tfor (const blobContent of blobContents) {\n\t\t\t\tthis.populate(blobContent as IDirectoryDataObject);\n\t\t\t}\n\t\t} else {\n\t\t\t// Old storage format\n\t\t\tthis.populate(data as IDirectoryDataObject);\n\t\t}\n\t}\n\n\t/**\n\t * Populate the directory with the given directory data.\n\t * @param data - A JSON string containing serialized directory data\n\t */\n\tprotected populate(data: IDirectoryDataObject): void {\n\t\tconst stack: [SubDirectory, IDirectoryDataObject][] = [];\n\t\tstack.push([this.root, data]);\n\n\t\twhile (stack.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst [currentSubDir, currentSubDirObject] = stack.pop()!;\n\t\t\tif (currentSubDirObject.subdirectories) {\n\t\t\t\t// Utilize a map to store the seq -> clientSeq for the newly created subdirectory\n\t\t\t\tconst tempSeqNums = new Map<number, number>();\n\t\t\t\tfor (const [subdirName, subdirObject] of Object.entries(\n\t\t\t\t\tcurrentSubDirObject.subdirectories,\n\t\t\t\t)) {\n\t\t\t\t\tlet newSubDir = currentSubDir.getSubDirectory(subdirName) as SubDirectory;\n\t\t\t\t\tlet seqData: SequenceData;\n\t\t\t\t\tif (!newSubDir) {\n\t\t\t\t\t\tconst createInfo = subdirObject.ci;\n\t\t\t\t\t\t// We do not store the client sequence number in the storage because the order has already been\n\t\t\t\t\t\t// guaranteed during the serialization process. As a result, it is only essential to utilize the\n\t\t\t\t\t\t// \"fake\" client sequence number to signify the loading order, and there is no need to retain\n\t\t\t\t\t\t// the actual client sequence number at this point.\n\t\t\t\t\t\tif (createInfo !== undefined && createInfo.csn > 0) {\n\t\t\t\t\t\t\tif (!tempSeqNums.has(createInfo.csn)) {\n\t\t\t\t\t\t\t\ttempSeqNums.set(createInfo.csn, 0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlet fakeClientSeq = tempSeqNums.get(createInfo.csn) as number;\n\t\t\t\t\t\t\tseqData = { seq: createInfo.csn, clientSeq: fakeClientSeq };\n\t\t\t\t\t\t\ttempSeqNums.set(createInfo.csn, ++fakeClientSeq);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * 1. If csn is -1, then initialize it with 0, otherwise we will never process ops for this\n\t\t\t\t\t\t\t * sub directory. This could be done at serialization time too, but we need to maintain\n\t\t\t\t\t\t\t * back compat too and also we will actually know the state when it was serialized.\n\t\t\t\t\t\t\t * 2. We need to make the csn = -1 and csn = 0 share the same counter, there are cases\n\t\t\t\t\t\t\t * where both -1 and 0 coexist within a single document.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tseqData = {\n\t\t\t\t\t\t\t\tseq: 0,\n\t\t\t\t\t\t\t\tclientSeq: ++currentSubDir.localCreationSeq,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnewSubDir = new SubDirectory(\n\t\t\t\t\t\t\tseqData,\n\t\t\t\t\t\t\tcreateInfo === undefined ? new Set() : new Set<string>(createInfo.ccIds),\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\tthis.runtime,\n\t\t\t\t\t\t\tthis.serializer,\n\t\t\t\t\t\t\tposix.join(currentSubDir.absolutePath, subdirName),\n\t\t\t\t\t\t\tthis.logger,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcurrentSubDir.populateSubDirectory(subdirName, newSubDir);\n\t\t\t\t\t\t// Record the newly inserted subdirectory to the creation tracker\n\t\t\t\t\t\tcurrentSubDir.ackedCreationSeqTracker.set(subdirName, {\n\t\t\t\t\t\t\t...seqData,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tstack.push([newSubDir, subdirObject]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentSubDirObject.storage) {\n\t\t\t\tfor (const [key, serializable] of Object.entries(currentSubDirObject.storage)) {\n\t\t\t\t\tconst parsedSerializable = parseHandles(\n\t\t\t\t\t\tserializable,\n\t\t\t\t\t\tthis.serializer,\n\t\t\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\t\t) as ISerializableValue;\n\t\t\t\t\tmigrateIfSharedSerializable(parsedSerializable, this.serializer, this.handle);\n\t\t\t\t\tcurrentSubDir.populateStorage(key, parsedSerializable.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op: IDirectoryOperation = message.contents as IDirectoryOperation;\n\t\t\tconst handler = this.messageHandlers.get(op.type);\n\t\t\tassert(\n\t\t\t\thandler !== undefined,\n\t\t\t\t0x00e /* \"Missing message handler for message type: op may be from a newer version */,\n\t\t\t);\n\t\t\thandler.process(message, op, local, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n\t */\n\tprotected override rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tconst op: IDirectoryOperation = content as IDirectoryOperation;\n\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\tif (subdir) {\n\t\t\tsubdir.rollback(op, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * Converts the given relative path to absolute against the root.\n\t * @param relativePath - The path to convert\n\t */\n\tprivate makeAbsolute(relativePath: string): string {\n\t\treturn posix.resolve(posix.sep, relativePath);\n\t}\n\n\t/**\n\t * This checks if there is pending delete op for local delete for a any subdir in the relative path.\n\t * @param relativePath - path of sub directory.\n\t * @returns `true` if there is pending delete, `false` otherwise.\n\t */\n\tprivate isSubDirectoryDeletePending(relativePath: string): boolean {\n\t\tconst absolutePath = this.makeAbsolute(relativePath);\n\t\tif (absolutePath === posix.sep) {\n\t\t\treturn false;\n\t\t}\n\t\tlet currentParent = this.root;\n\t\tconst pathParts = absolutePath.split(posix.sep).slice(1);\n\t\tfor (const dirName of pathParts) {\n\t\t\tif (currentParent.isSubDirectoryDeletePending(dirName)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tcurrentParent = currentParent.getSubDirectory(dirName) as SubDirectory;\n\t\t\tif (currentParent === undefined) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Set the message handlers for the directory.\n\t */\n\tprivate setMessageHandlers(): void {\n\t\tthis.messageHandlers.set(\"clear\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryClearOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tsubdir.processClearMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryClearOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitClearMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tthis.messageHandlers.set(\"delete\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryDeleteOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tsubdir.processDeleteMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryDeleteOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitKeyMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tthis.messageHandlers.set(\"set\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectorySetOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tmigrateIfSharedSerializable(op.value, this.serializer, this.handle);\n\t\t\t\t\tconst localValue: unknown = local ? undefined : op.value.value;\n\t\t\t\t\tsubdir.processSetMessage(msg, op, localValue, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectorySetOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitKeyMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tthis.messageHandlers.set(\"createSubDirectory\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (parentSubdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tparentSubdir.processCreateSubDirectoryMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryCreateSubDirectoryOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\t// We don't reuse the metadata but send a new one on each submit.\n\t\t\t\t\tparentSubdir.resubmitSubDirectoryMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tthis.messageHandlers.set(\"deleteSubDirectory\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (parentSubdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tparentSubdir.processDeleteSubDirectoryMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryDeleteSubDirectoryOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\t// We don't reuse the metadata but send a new one on each submit.\n\t\t\t\t\tparentSubdir.resubmitSubDirectoryMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(op: unknown): void {\n\t\tconst directoryOp = op as IDirectoryOperation;\n\t\tconst dir = this.getWorkingDirectory(directoryOp.path);\n\t\tswitch (directoryOp.type) {\n\t\t\tcase \"clear\": {\n\t\t\t\tdir?.clear();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"createSubDirectory\": {\n\t\t\t\tdir?.createSubDirectory(directoryOp.subdirName);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"delete\": {\n\t\t\t\tdir?.delete(directoryOp.key);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"deleteSubDirectory\": {\n\t\t\t\tdir?.deleteSubDirectory(directoryOp.subdirName);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"set\": {\n\t\t\t\tmigrateIfSharedSerializable(directoryOp.value, this.serializer, this.handle);\n\t\t\t\tdir?.set(directoryOp.key, directoryOp.value.value);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(directoryOp);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate serializeDirectory(\n\t\troot: SubDirectory,\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tlet counter = 0;\n\t\tconst blobs: string[] = [];\n\n\t\tconst stack: [SubDirectory, IDirectoryDataObject][] = [];\n\t\tconst content: IDirectoryDataObject = {};\n\t\tstack.push([root, content]);\n\n\t\twhile (stack.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst [currentSubDir, currentSubDirObject] = stack.pop()!;\n\t\t\tcurrentSubDirObject.ci = currentSubDir.getSerializableCreateInfo();\n\t\t\tfor (const [key, value] of currentSubDir.getSerializedStorage(serializer)) {\n\t\t\t\tif (!currentSubDirObject.storage) {\n\t\t\t\t\tcurrentSubDirObject.storage = {};\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\tconst result: ISerializableValue = {\n\t\t\t\t\ttype: value.type,\n\t\t\t\t\tvalue: value.value && (JSON.parse(value.value) as object),\n\t\t\t\t};\n\t\t\t\tif (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n\t\t\t\t\tconst extraContent: IDirectoryDataObject = {};\n\t\t\t\t\tlet largeContent = extraContent;\n\t\t\t\t\tif (currentSubDir.absolutePath !== posix.sep) {\n\t\t\t\t\t\tfor (const dir of currentSubDir.absolutePath.slice(1).split(posix.sep)) {\n\t\t\t\t\t\t\tconst subDataObject: IDirectoryDataObject = {};\n\t\t\t\t\t\t\tlargeContent.subdirectories = { [dir]: subDataObject };\n\t\t\t\t\t\t\tlargeContent = subDataObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlargeContent.storage = { [key]: result };\n\t\t\t\t\tconst blobName = `blob${counter}`;\n\t\t\t\t\tcounter++;\n\t\t\t\t\tblobs.push(blobName);\n\t\t\t\t\tbuilder.addBlob(blobName, JSON.stringify(extraContent));\n\t\t\t\t} else {\n\t\t\t\t\tcurrentSubDirObject.storage[key] = result;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [subdirName, subdir] of currentSubDir.subdirectories()) {\n\t\t\t\tif (!currentSubDirObject.subdirectories) {\n\t\t\t\t\tcurrentSubDirObject.subdirectories = {};\n\t\t\t\t}\n\t\t\t\tconst subDataObject: IDirectoryDataObject = {};\n\t\t\t\tcurrentSubDirObject.subdirectories[subdirName] = subDataObject;\n\t\t\t\tstack.push([subdir as SubDirectory, subDataObject]);\n\t\t\t}\n\t\t}\n\n\t\tconst newFormat: IDirectoryNewStorageFormat = {\n\t\t\tblobs,\n\t\t\tcontent,\n\t\t};\n\t\tbuilder.addBlob(snapshotFileName, JSON.stringify(newFormat));\n\n\t\treturn builder.getSummaryTree();\n\t}\n}\n\ninterface IKeyEditLocalOpMetadata {\n\ttype: \"edit\";\n\tpendingMessageId: number;\n\tpreviousValue: unknown;\n}\n\ninterface IClearLocalOpMetadata {\n\ttype: \"clear\";\n\tpendingMessageId: number;\n\tpreviousStorage: Map<string, unknown>;\n}\n\ninterface ICreateSubDirLocalOpMetadata {\n\ttype: \"createSubDir\";\n}\n\ninterface IDeleteSubDirLocalOpMetadata {\n\ttype: \"deleteSubDir\";\n\tsubDirectory: SubDirectory | undefined;\n}\n\ntype SubDirLocalOpMetadata = ICreateSubDirLocalOpMetadata | IDeleteSubDirLocalOpMetadata;\n\n/**\n * Types of local op metadata.\n */\nexport type DirectoryLocalOpMetadata =\n\t| IClearLocalOpMetadata\n\t| IKeyEditLocalOpMetadata\n\t| SubDirLocalOpMetadata;\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction isKeyEditLocalOpMetadata(metadata: any): metadata is IKeyEditLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\tmetadata.type === \"edit\"\n\t);\n}\n\nfunction isClearLocalOpMetadata(metadata: any): metadata is IClearLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\tmetadata.type === \"clear\" &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\ttypeof metadata.previousStorage === \"object\"\n\t);\n}\n\nfunction isSubDirLocalOpMetadata(metadata: any): metadata is SubDirLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\t(metadata.type === \"createSubDir\" || metadata.type === \"deleteSubDir\")\n\t);\n}\n\nfunction isDirectoryLocalOpMetadata(metadata: any): metadata is DirectoryLocalOpMetadata {\n\treturn (\n\t\tisKeyEditLocalOpMetadata(metadata) ||\n\t\tisClearLocalOpMetadata(metadata) ||\n\t\tisSubDirLocalOpMetadata(metadata)\n\t);\n}\n\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\n// eslint-disable-next-line @rushstack/no-new-null\nfunction assertNonNullClientId(clientId: string | null): asserts clientId is string {\n\tassert(clientId !== null, 0x6af /* client id should never be null */);\n}\n\nlet hasLoggedDirectoryInconsistency = false;\n\n/**\n * Node of the directory tree.\n * @sealed\n */\nclass SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirectory {\n\t/**\n\t * Tells if the sub directory is deleted or not.\n\t */\n\tprivate _deleted = false;\n\n\t/**\n\t * String representation for the class.\n\t */\n\tpublic [Symbol.toStringTag]: string = \"SubDirectory\";\n\n\t/**\n\t * The in-memory data the directory is storing.\n\t */\n\tprivate readonly _storage = new Map<string, unknown>();\n\n\t/**\n\t * The subdirectories the directory is holding.\n\t */\n\tprivate readonly _subdirectories = new Map<string, SubDirectory>();\n\n\t/**\n\t * Keys that have been modified locally but not yet ack'd from the server. This is for operations on keys like\n\t * set/delete operations on keys. The value of this map is list of pendingMessageIds at which that key\n\t * was modified. We don't store the type of ops, and behaviour of key ops are different from behaviour of sub\n\t * directory ops, so we have separate map from subDirectories tracker.\n\t */\n\tprivate readonly pendingKeys = new Map<string, number[]>();\n\n\t/**\n\t * Subdirectories that have been deleted locally but not yet ack'd from the server. This maintains the record\n\t * of delete op that are pending or yet to be acked from server. This is maintained just to track the locally\n\t * deleted sub directory.\n\t */\n\tprivate readonly pendingDeleteSubDirectoriesTracker = new Map<string, number>();\n\n\t/**\n\t * Subdirectories that have been created locally but not yet ack'd from the server. This maintains the record\n\t * of create op that are pending or yet to be acked from server. This is maintained just to track the locally\n\t * created sub directory.\n\t */\n\tprivate readonly pendingCreateSubDirectoriesTracker = new Map<string, number>();\n\n\t/**\n\t * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.\n\t */\n\tprivate pendingMessageId: number = -1;\n\n\t/**\n\t * The pending ids of any clears that have been performed locally but not yet ack'd from the server\n\t */\n\tprivate readonly pendingClearMessageIds: number[] = [];\n\n\t/**\n\t * Assigns a unique ID to each subdirectory created locally but pending for acknowledgement, facilitating the tracking\n\t * of the creation order.\n\t */\n\tpublic localCreationSeq: number = 0;\n\n\t/**\n\t * Maintains a bidirectional association between ack'd subdirectories and their seqData.\n\t * This helps to ensure iteration order which is consistent with the JS map spec.\n\t */\n\tpublic readonly ackedCreationSeqTracker: DirectoryCreationTracker;\n\n\t/**\n\t * Similar to {@link ackedCreationSeqTracker}, but for local (unacked) entries.\n\t */\n\tpublic readonly localCreationSeqTracker: DirectoryCreationTracker;\n\n\t/**\n\t * Constructor.\n\t * @param sequenceNumber - Message seq number at which this was created.\n\t * @param clientIds - Ids of client which created this directory.\n\t * @param directory - Reference back to the SharedDirectory to perform operations\n\t * @param runtime - The data store runtime this directory is associated with\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param absolutePath - The absolute path of this IDirectory\n\t */\n\tpublic constructor(\n\t\tprivate readonly seqData: SequenceData,\n\t\tprivate readonly clientIds: Set<string>,\n\t\tprivate readonly directory: SharedDirectory,\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tpublic readonly absolutePath: string,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tsuper();\n\t\tthis.localCreationSeqTracker = new DirectoryCreationTracker();\n\t\tthis.ackedCreationSeqTracker = new DirectoryCreationTracker();\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tthis._deleted = true;\n\t\tthis.emit(\"disposed\", this);\n\t}\n\n\t/**\n\t * Unmark the deleted property only when rolling back delete.\n\t */\n\tprivate undispose(): void {\n\t\tthis._deleted = false;\n\t\tthis.emit(\"undisposed\", this);\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this._deleted;\n\t}\n\n\tprivate throwIfDisposed(): void {\n\t\tif (this._deleted) {\n\t\t\tthrow new UsageError(\"Cannot access Disposed subDirectory\");\n\t\t}\n\t}\n\n\t/**\n\t * Checks whether the given key exists in this IDirectory.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.has(key);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.get}\n\t */\n\tpublic get<T = unknown>(key: string): T | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.get(key) as T | undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.set}\n\t */\n\tpublic set<T = unknown>(key: string, value: T): this {\n\t\tthis.throwIfDisposed();\n\t\t// Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (key === undefined || key === null) {\n\t\t\tthrow new Error(\"Undefined and null keys are not supported\");\n\t\t}\n\n\t\t// Create a local value and serialize it.\n\t\tbindHandles(value, this.serializer, this.directory.handle);\n\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(key, value, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst op: IDirectorySetOperation = {\n\t\t\tkey,\n\t\t\tpath: this.absolutePath,\n\t\t\ttype: \"set\",\n\t\t\tvalue: { type: ValueType[ValueType.Plain], value },\n\t\t};\n\t\tthis.submitKeyMessage(op, previousValue);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.countSubDirectory}\n\t */\n\tpublic countSubDirectory(): number {\n\t\treturn this._subdirectories.size;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.createSubDirectory}\n\t */\n\tpublic createSubDirectory(subdirName: string): IDirectory {\n\t\tthis.throwIfDisposed();\n\t\t// Undefined/null subdirectory names can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (subdirName === undefined || subdirName === null) {\n\t\t\tthrow new Error(\"SubDirectory name may not be undefined or null\");\n\t\t}\n\n\t\tif (subdirName.includes(posix.sep)) {\n\t\t\tthrow new Error(`SubDirectory name may not contain ${posix.sep}`);\n\t\t}\n\n\t\t// Create the sub directory locally first.\n\t\tconst isNew = this.createSubDirectoryCore(\n\t\t\tsubdirName,\n\t\t\ttrue,\n\t\t\tthis.getLocalSeq(),\n\t\t\tthis.runtime.clientId ?? \"detached\",\n\t\t);\n\t\tconst subDir = this._subdirectories.get(subdirName);\n\t\tassert(subDir !== undefined, 0x5aa /* subdirectory should exist after creation */);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn subDir;\n\t\t}\n\n\t\t// Only submit the op, if it is newly created.\n\t\tif (isNew) {\n\t\t\tconst op: IDirectoryCreateSubDirectoryOperation = {\n\t\t\t\tpath: this.absolutePath,\n\t\t\t\tsubdirName,\n\t\t\t\ttype: \"createSubDirectory\",\n\t\t\t};\n\t\t\tthis.submitCreateSubDirectoryMessage(op);\n\t\t}\n\n\t\treturn subDir;\n\t}\n\n\t/**\n\t * Gets the Sequence Data which should be used for local changes.\n\t *\n\t * @remarks While detached, 0 is used rather than -1 to represent a change which should be universally known (as opposed to known\n\t * only by the local client). This ensures that if the directory is later attached, none of its data needs to be updated (the values\n\t * last set while detached will now be known to any new client, until they are changed).\n\t *\n\t * The client sequence number is incremented by 1 for maintaining the internal order of locally created subdirectories\n\t *\n\t * @privateRemarks TODO: Convert these conventions to named constants. The semantics used here match those for merge-tree.\n\t */\n\tprivate getLocalSeq(): SequenceData {\n\t\treturn this.directory.isAttached()\n\t\t\t? { seq: -1, clientSeq: ++this.localCreationSeq }\n\t\t\t: { seq: 0, clientSeq: ++this.localCreationSeq };\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getSubDirectory}\n\t */\n\tpublic getSubDirectory(subdirName: string): IDirectory | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this._subdirectories.get(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.hasSubDirectory}\n\t */\n\tpublic hasSubDirectory(subdirName: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\treturn this._subdirectories.has(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.deleteSubDirectory}\n\t */\n\tpublic deleteSubDirectory(subdirName: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\t// Delete the sub directory locally first.\n\t\tconst subDir = this.deleteSubDirectoryCore(subdirName, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn subDir !== undefined;\n\t\t}\n\n\t\t// Only submit the op, if the directory existed and we deleted it.\n\t\tif (subDir !== undefined) {\n\t\t\tconst op: IDirectoryDeleteSubDirectoryOperation = {\n\t\t\t\tpath: this.absolutePath,\n\t\t\t\tsubdirName,\n\t\t\t\ttype: \"deleteSubDirectory\",\n\t\t\t};\n\n\t\t\tthis.submitDeleteSubDirectoryMessage(op, subDir);\n\t\t}\n\t\treturn subDir !== undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.subdirectories}\n\t */\n\tpublic subdirectories(): IterableIterator<[string, IDirectory]> {\n\t\tthis.throwIfDisposed();\n\t\tconst ackedSubdirsInOrder = this.ackedCreationSeqTracker.keys();\n\t\tconst localSubdirsInOrder = this.localCreationSeqTracker.keys(\n\t\t\t(key) => !this.ackedCreationSeqTracker.has(key),\n\t\t);\n\n\t\tconst subdirNames = [...ackedSubdirsInOrder, ...localSubdirsInOrder];\n\n\t\tif (subdirNames.length !== this._subdirectories.size) {\n\t\t\t// TODO: AB#7022: Hitting this block indicates that the eventual consistency scheme for ordering subdirectories\n\t\t\t// has failed. Fall back to previous directory behavior, which didn't guarantee ordering.\n\t\t\t// It's not currently clear how to reach this state, so log some diagnostics to help understand the issue.\n\t\t\t// This whole block should eventually be replaced by an assert that the two sizes align.\n\t\t\tif (!hasLoggedDirectoryInconsistency) {\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"inconsistentSubdirectoryOrdering\",\n\t\t\t\t\tlocalKeyCount: this.localCreationSeqTracker.size,\n\t\t\t\t\tackedKeyCount: this.ackedCreationSeqTracker.size,\n\t\t\t\t\tsubdirNamesLength: subdirNames.length,\n\t\t\t\t\tsubdirectoriesSize: this._subdirectories.size,\n\t\t\t\t});\n\t\t\t\thasLoggedDirectoryInconsistency = true;\n\t\t\t}\n\n\t\t\treturn this._subdirectories.entries();\n\t\t}\n\n\t\tconst entriesIterator = {\n\t\t\tindex: 0,\n\t\t\tdirs: this._subdirectories,\n\t\t\tnext(): IteratorResult<[string, IDirectory]> {\n\t\t\t\tif (this.index < subdirNames.length) {\n\t\t\t\t\t// Bounds check above guarantees non-null (at least at compile time, assuming all types are respected)\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst subdirName = subdirNames[this.index++]!;\n\t\t\t\t\tconst subdir = this.dirs.get(subdirName);\n\t\t\t\t\tassert(subdir !== undefined, 0x8ac /* Could not find expected sub-directory. */);\n\t\t\t\t\treturn { value: [subdirName, subdir], done: false };\n\t\t\t\t}\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t},\n\t\t\t[Symbol.iterator](): IterableIterator<[string, IDirectory]> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\n\t\treturn entriesIterator;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getWorkingDirectory}\n\t */\n\tpublic getWorkingDirectory(relativePath: string): IDirectory | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this.directory.getWorkingDirectory(this.makeAbsolute(relativePath));\n\t}\n\n\t/**\n\t * This checks if there is pending delete op for local delete for a given child subdirectory.\n\t * @param subDirName - directory name.\n\t * @returns true if there is pending delete.\n\t */\n\tpublic isSubDirectoryDeletePending(subDirName: string): boolean {\n\t\tif (this.pendingDeleteSubDirectoriesTracker.has(subDirName)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Deletes the given key from within this IDirectory.\n\t * @param key - The key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\t// Delete the key locally first.\n\t\tconst previousValue = this.deleteCore(key, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn previousValue !== undefined;\n\t\t}\n\n\t\tconst op: IDirectoryDeleteOperation = {\n\t\t\tkey,\n\t\t\tpath: this.absolutePath,\n\t\t\ttype: \"delete\",\n\t\t};\n\n\t\tthis.submitKeyMessage(op, previousValue);\n\t\treturn previousValue !== undefined;\n\t}\n\n\t/**\n\t * Deletes all keys from within this IDirectory.\n\t */\n\tpublic clear(): void {\n\t\tthis.throwIfDisposed();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\tthis.clearCore(true);\n\t\t\treturn;\n\t\t}\n\n\t\tconst copy = new Map<string, unknown>(this._storage);\n\t\tthis.clearCore(true);\n\t\tconst op: IDirectoryClearOperation = {\n\t\t\tpath: this.absolutePath,\n\t\t\ttype: \"clear\",\n\t\t};\n\t\tthis.submitClearMessage(op, copy);\n\t}\n\n\t/**\n\t * Issue a callback on each entry under this IDirectory.\n\t * @param callback - Callback to issue\n\t */\n\tpublic forEach(\n\t\tcallback: (value: unknown, key: string, map: Map<string, unknown>) => void,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\t// eslint-disable-next-line unicorn/no-array-for-each\n\t\tthis._storage.forEach((value, key) => {\n\t\t\tcallback(value, key, this);\n\t\t});\n\t}\n\n\t/**\n\t * The number of entries under this IDirectory.\n\t */\n\tpublic get size(): number {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.size;\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic entries(): IterableIterator<[string, unknown]> {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.entries();\n\t}\n\n\t/**\n\t * Get an iterator over the keys under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<unknown> {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.values();\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic [Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\tthis.throwIfDisposed();\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Process a clear operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tpublic processClearMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryClearOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (!this.isMessageForCurrentInstanceOfSubDirectory(msg)) {\n\t\t\treturn;\n\t\t}\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tisClearLocalOpMetadata(localOpMetadata),\n\t\t\t\t0x00f /* pendingMessageId is missing from the local client's operation */,\n\t\t\t);\n\t\t\tconst pendingClearMessageId = this.pendingClearMessageIds.shift();\n\t\t\tassert(\n\t\t\t\tpendingClearMessageId === localOpMetadata.pendingMessageId,\n\t\t\t\t0x32a /* pendingMessageId does not match */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tthis.clearExceptPendingKeys(false);\n\t}\n\n\t/**\n\t * Process a delete operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tpublic processDeleteMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryDeleteOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessStorageOperation(op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deleteCore(op.key, local);\n\t}\n\n\t/**\n\t * Process a set operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tpublic processSetMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectorySetOperation,\n\t\tvalue: unknown,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessStorageOperation(op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// needProcessStorageOperation should have returned false if local is true\n\t\t// so we can assume localValue is not undefined\n\t\tthis.setCore(op.key, value, local);\n\t}\n\n\t/**\n\t * Process a create subdirectory operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tpublic processCreateSubDirectoryMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tassertNonNullClientId(msg.clientId);\n\t\tthis.createSubDirectoryCore(\n\t\t\top.subdirName,\n\t\t\tlocal,\n\t\t\t{ seq: msg.sequenceNumber, clientSeq: msg.clientSequenceNumber },\n\t\t\tmsg.clientId,\n\t\t);\n\t}\n\n\t/**\n\t * Process a delete subdirectory operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tpublic processDeleteSubDirectoryMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deleteSubDirectoryCore(op.subdirName, local);\n\t}\n\n\t/**\n\t * Submit a clear operation.\n\t * @param op - The operation\n\t */\n\tprivate submitClearMessage(\n\t\top: IDirectoryClearOperation,\n\t\tpreviousValue: Map<string, unknown>,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tconst pendingMsgId = ++this.pendingMessageId;\n\t\tthis.pendingClearMessageIds.push(pendingMsgId);\n\t\tconst metadata: IClearLocalOpMetadata = {\n\t\t\ttype: \"clear\",\n\t\t\tpendingMessageId: pendingMsgId,\n\t\t\tpreviousStorage: previousValue,\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, metadata);\n\t}\n\n\t/**\n\t * Resubmit a clear operation.\n\t * @param op - The operation\n\t */\n\tpublic resubmitClearMessage(op: IDirectoryClearOperation, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\tisClearLocalOpMetadata(localOpMetadata),\n\t\t\t0x32b /* Invalid localOpMetadata for clear */,\n\t\t);\n\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\tconst pendingClearMessageId = this.pendingClearMessageIds.shift();\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tif (pendingClearMessageId === localOpMetadata.pendingMessageId) {\n\t\t\tthis.submitClearMessage(op, localOpMetadata.previousStorage);\n\t\t}\n\t}\n\n\t/**\n\t * Get a new pending message id for the op and cache it to track the pending op\n\t */\n\tprivate getKeyMessageId(op: IDirectoryKeyOperation): number {\n\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\tconst pendingMessageId = ++this.pendingMessageId;\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingMessageIds === undefined) {\n\t\t\tthis.pendingKeys.set(op.key, [pendingMessageId]);\n\t\t} else {\n\t\t\tpendingMessageIds.push(pendingMessageId);\n\t\t}\n\t\treturn pendingMessageId;\n\t}\n\n\t/**\n\t * Submit a key operation.\n\t * @param op - The operation\n\t * @param previousValue - The value of the key before this op\n\t */\n\tprivate submitKeyMessage(op: IDirectoryKeyOperation, previousValue?: unknown): void {\n\t\tthis.throwIfDisposed();\n\t\tconst pendingMessageId = this.getKeyMessageId(op);\n\t\tconst localMetadata = { type: \"edit\", pendingMessageId, previousValue };\n\t\tthis.directory.submitDirectoryMessage(op, localMetadata);\n\t}\n\n\t/**\n\t * Submit a key message to remote clients based on a previous submit.\n\t * @param op - The map key message\n\t * @param localOpMetadata - Metadata from the previous submit\n\t */\n\tpublic resubmitKeyMessage(op: IDirectoryKeyOperation, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\tisKeyEditLocalOpMetadata(localOpMetadata),\n\t\t\t0x32d /* Invalid localOpMetadata in submit */,\n\t\t);\n\n\t\t// clear the old pending message id\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tif (pendingMessageIds !== undefined) {\n\t\t\tconst index = pendingMessageIds.indexOf(localOpMetadata.pendingMessageId);\n\t\t\tif (index === -1) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpendingMessageIds.splice(index, 1);\n\t\t\tif (pendingMessageIds.length === 0) {\n\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t}\n\t\t\tthis.submitKeyMessage(op, localOpMetadata.previousValue);\n\t\t}\n\t}\n\n\tprivate incrementPendingSubDirCount(map: Map<string, number>, subDirName: string): void {\n\t\tconst count = map.get(subDirName) ?? 0;\n\t\tmap.set(subDirName, count + 1);\n\t}\n\n\tprivate decrementPendingSubDirCount(map: Map<string, number>, subDirName: string): void {\n\t\tconst count = map.get(subDirName) ?? 0;\n\t\tmap.set(subDirName, count - 1);\n\t\tif (count <= 1) {\n\t\t\tmap.delete(subDirName);\n\t\t}\n\t}\n\n\t/**\n\t * Update the count for pending create/delete of the sub directory so that it can be validated on receiving op\n\t * or while resubmitting the op.\n\t */\n\tprivate updatePendingSubDirMessageCount(op: IDirectorySubDirectoryOperation): void {\n\t\tif (op.type === \"deleteSubDirectory\") {\n\t\t\tthis.incrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, op.subdirName);\n\t\t} else if (op.type === \"createSubDirectory\") {\n\t\t\tthis.incrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, op.subdirName);\n\t\t}\n\t}\n\n\t/**\n\t * Submit a create subdirectory operation.\n\t * @param op - The operation\n\t */\n\tprivate submitCreateSubDirectoryMessage(op: IDirectorySubDirectoryOperation): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.updatePendingSubDirMessageCount(op);\n\n\t\tconst localOpMetadata: ICreateSubDirLocalOpMetadata = {\n\t\t\ttype: \"createSubDir\",\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * Submit a delete subdirectory operation.\n\t * @param op - The operation\n\t * @param subDir - Any subdirectory deleted by the op\n\t */\n\tprivate submitDeleteSubDirectoryMessage(\n\t\top: IDirectorySubDirectoryOperation,\n\t\tsubDir: SubDirectory | undefined,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.updatePendingSubDirMessageCount(op);\n\n\t\tconst localOpMetadata: IDeleteSubDirLocalOpMetadata = {\n\t\t\ttype: \"deleteSubDir\",\n\t\t\tsubDirectory: subDir,\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * Submit a subdirectory operation again\n\t * @param op - The operation\n\t * @param localOpMetadata - metadata submitted with the op originally\n\t */\n\tpublic resubmitSubDirectoryMessage(\n\t\top: IDirectorySubDirectoryOperation,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tassert(\n\t\t\tisSubDirLocalOpMetadata(localOpMetadata),\n\t\t\t0x32f /* Invalid localOpMetadata for sub directory op */,\n\t\t);\n\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tif (\n\t\t\tlocalOpMetadata.type === \"createSubDir\" &&\n\t\t\t!this.pendingCreateSubDirectoriesTracker.has(op.subdirName)\n\t\t) {\n\t\t\treturn;\n\t\t} else if (\n\t\t\tlocalOpMetadata.type === \"deleteSubDir\" &&\n\t\t\t!this.pendingDeleteSubDirectoriesTracker.has(op.subdirName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (localOpMetadata.type === \"createSubDir\") {\n\t\t\tthis.decrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, op.subdirName);\n\t\t\tthis.submitCreateSubDirectoryMessage(op);\n\t\t} else {\n\t\t\tthis.decrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, op.subdirName);\n\t\t\tthis.submitDeleteSubDirectoryMessage(op, localOpMetadata.subDirectory);\n\t\t}\n\t}\n\n\t/**\n\t * Get the storage of this subdirectory in a serializable format, to be used in snapshotting.\n\t * @param serializer - The serializer to use to serialize handles in its values.\n\t * @returns The JSONable string representing the storage of this subdirectory\n\t */\n\tpublic *getSerializedStorage(\n\t\tserializer: IFluidSerializer,\n\t): Generator<[string, ISerializedValue], void> {\n\t\tthis.throwIfDisposed();\n\t\tfor (const [key, value] of this._storage) {\n\t\t\tconst serializedValue = serializeValue(value, serializer, this.directory.handle);\n\t\t\tconst res: [string, ISerializedValue] = [key, serializedValue];\n\t\t\tyield res;\n\t\t}\n\t}\n\n\tpublic getSerializableCreateInfo(): ICreateInfo {\n\t\tthis.throwIfDisposed();\n\t\tconst createInfo: ICreateInfo = {\n\t\t\tcsn: this.seqData.seq,\n\t\t\tccIds: [...this.clientIds],\n\t\t};\n\t\treturn createInfo;\n\t}\n\n\t/**\n\t * Populate a key value in this subdirectory's storage, to be used when loading from snapshot.\n\t * @param key - The key to populate\n\t * @param localValue - The local value to populate into it\n\t */\n\tpublic populateStorage(key: string, value: unknown): void {\n\t\tthis.throwIfDisposed();\n\t\tthis._storage.set(key, value);\n\t}\n\n\t/**\n\t * Populate a subdirectory into this subdirectory, to be used when loading from snapshot.\n\t * @param subdirName - The name of the subdirectory to add\n\t * @param newSubDir - The new subdirectory to add\n\t */\n\tpublic populateSubDirectory(subdirName: string, newSubDir: SubDirectory): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.registerEventsOnSubDirectory(newSubDir, subdirName);\n\t\tthis._subdirectories.set(subdirName, newSubDir);\n\t}\n\n\t/**\n\t * Retrieve the local value at the given key. This is used to get value type information stashed on the local\n\t * value so op handlers can be retrieved\n\t * @param key - The key to retrieve from\n\t * @returns The local value\n\t */\n\tpublic getLocalValue<T>(key: string): T {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.get(key) as T;\n\t}\n\n\t/**\n\t * Remove the pendingMessageId from the map tracking it on rollback\n\t * @param map - map tracking the pending messages\n\t * @param key - key of the edit in the op\n\t */\n\tprivate rollbackPendingMessageId(\n\t\tmap: Map<string, number[]>,\n\t\tkey: string,\n\t\tpendingMessageId,\n\t): void {\n\t\tconst pendingMessageIds = map.get(key);\n\t\tconst lastPendingMessageId = pendingMessageIds?.pop();\n\t\tif (!pendingMessageIds || lastPendingMessageId !== pendingMessageId) {\n\t\t\tthrow new Error(\"Rollback op does not match last pending\");\n\t\t}\n\t\tif (pendingMessageIds.length === 0) {\n\t\t\tmap.delete(key);\n\t\t}\n\t}\n\n\t/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\n\t/**\n\t * Rollback a local op\n\t * @param op - The operation to rollback\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic rollback(op: any, localOpMetadata: unknown): void {\n\t\tif (!isDirectoryLocalOpMetadata(localOpMetadata)) {\n\t\t\tthrow new Error(\"Invalid localOpMetadata\");\n\t\t}\n\n\t\tif (op.type === \"clear\" && localOpMetadata.type === \"clear\") {\n\t\t\tfor (const [key, localValue] of localOpMetadata.previousStorage.entries()) {\n\t\t\t\tthis.setCore(key, localValue, true);\n\t\t\t}\n\n\t\t\tconst lastPendingClearId = this.pendingClearMessageIds.pop();\n\t\t\tif (\n\t\t\t\tlastPendingClearId === undefined ||\n\t\t\t\tlastPendingClearId !== localOpMetadata.pendingMessageId\n\t\t\t) {\n\t\t\t\tthrow new Error(\"Rollback op does match last clear\");\n\t\t\t}\n\t\t} else if (\n\t\t\t(op.type === \"delete\" || op.type === \"set\") &&\n\t\t\tlocalOpMetadata.type === \"edit\"\n\t\t) {\n\t\t\tconst key: unknown = op.key;\n\t\t\tassert(key !== undefined, 0x8ad /* \"key\" property is missing from edit operation. */);\n\t\t\tassert(\n\t\t\t\ttypeof key === \"string\",\n\t\t\t\t0x8ae /* \"key\" property in edit operation is misconfigured. Expected a string. */,\n\t\t\t);\n\n\t\t\tif (localOpMetadata.previousValue === undefined) {\n\t\t\t\tthis.deleteCore(key, true);\n\t\t\t} else {\n\t\t\t\tthis.setCore(key, localOpMetadata.previousValue, true);\n\t\t\t}\n\n\t\t\tthis.rollbackPendingMessageId(this.pendingKeys, key, localOpMetadata.pendingMessageId);\n\t\t} else if (op.type === \"createSubDirectory\" && localOpMetadata.type === \"createSubDir\") {\n\t\t\tconst subdirName: unknown = op.subdirName;\n\t\t\tassert(\n\t\t\t\tsubdirName !== undefined,\n\t\t\t\t0x8af /* \"subdirName\" property is missing from \"createSubDirectory\" operation. */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\ttypeof subdirName === \"string\",\n\t\t\t\t0x8b0 /* \"subdirName\" property in \"createSubDirectory\" operation is misconfigured. Expected a string. */,\n\t\t\t);\n\n\t\t\tthis.deleteSubDirectoryCore(subdirName, true);\n\t\t\tthis.decrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, subdirName);\n\t\t} else if (op.type === \"deleteSubDirectory\" && localOpMetadata.type === \"deleteSubDir\") {\n\t\t\tconst subdirName: unknown = op.subdirName;\n\t\t\tassert(\n\t\t\t\tsubdirName !== undefined,\n\t\t\t\t0x8b1 /* \"subdirName\" property is missing from \"deleteSubDirectory\" operation. */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\ttypeof subdirName === \"string\",\n\t\t\t\t0x8b2 /* \"subdirName\" property in \"deleteSubDirectory\" operation is misconfigured. Expected a string. */,\n\t\t\t);\n\n\t\t\tif (localOpMetadata.subDirectory !== undefined) {\n\t\t\t\tthis.undeleteSubDirectoryTree(localOpMetadata.subDirectory);\n\t\t\t\t// don't need to register events because deleting never unregistered\n\t\t\t\tthis._subdirectories.set(subdirName, localOpMetadata.subDirectory);\n\t\t\t\t// Restore the record in creation tracker\n\t\t\t\tif (isAcknowledgedOrDetached(localOpMetadata.subDirectory.seqData)) {\n\t\t\t\t\tthis.ackedCreationSeqTracker.set(subdirName, {\n\t\t\t\t\t\t...localOpMetadata.subDirectory.seqData,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis.localCreationSeqTracker.set(subdirName, {\n\t\t\t\t\t\t...localOpMetadata.subDirectory.seqData,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.emit(\"subDirectoryCreated\", subdirName, true, this);\n\t\t\t}\n\n\t\t\tthis.decrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, subdirName);\n\t\t} else {\n\t\t\tthrow new Error(\"Unsupported op for rollback\");\n\t\t}\n\t}\n\n\t/* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\n\t/**\n\t * Converts the given relative path into an absolute path.\n\t * @param path - Relative path to convert\n\t * @returns The equivalent absolute path\n\t */\n\tprivate makeAbsolute(relativePath: string): string {\n\t\treturn posix.resolve(this.absolutePath, relativePath);\n\t}\n\n\t/**\n\t * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n\t * not process the incoming operation.\n\t * @param op - Operation to check\n\t * @param local - Whether the operation originated from the local client\n\t * @param localOpMetadata - For local client ops, this is the metadata that was submitted with the op.\n\t * For ops from a remote client, this will be undefined.\n\t * @returns True if the operation should be processed, false otherwise\n\t */\n\tprivate needProcessStorageOperation(\n\t\top: IDirectoryKeyOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tconst firstPendingClearMessageId = this.pendingClearMessageIds[0];\n\t\tif (firstPendingClearMessageId !== undefined) {\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tlocalOpMetadata !== undefined &&\n\t\t\t\t\t\tisKeyEditLocalOpMetadata(localOpMetadata) &&\n\t\t\t\t\t\tlocalOpMetadata.pendingMessageId < firstPendingClearMessageId,\n\t\t\t\t\t0x010 /* \"Received out of order storage op when there is an unackd clear message\" */,\n\t\t\t\t);\n\t\t\t\t// Remove all pendingMessageIds lower than first pendingClearMessageId.\n\t\t\t\tconst lowestPendingClearMessageId = firstPendingClearMessageId;\n\t\t\t\tconst pendingKeyMessageIdArray = this.pendingKeys.get(op.key);\n\t\t\t\tif (pendingKeyMessageIdArray !== undefined) {\n\t\t\t\t\tlet index = 0;\n\t\t\t\t\tlet pendingKeyMessageId = pendingKeyMessageIdArray[index];\n\t\t\t\t\twhile (\n\t\t\t\t\t\tpendingKeyMessageId !== undefined &&\n\t\t\t\t\t\tpendingKeyMessageId < lowestPendingClearMessageId\n\t\t\t\t\t) {\n\t\t\t\t\t\tindex += 1;\n\t\t\t\t\t\tpendingKeyMessageId = pendingKeyMessageIdArray[index];\n\t\t\t\t\t}\n\t\t\t\t\tconst newPendingKeyMessageId = pendingKeyMessageIdArray.splice(index);\n\t\t\t\t\tif (newPendingKeyMessageId.length === 0) {\n\t\t\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.pendingKeys.set(op.key, newPendingKeyMessageId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If I have a NACK clear, we can ignore all ops.\n\t\t\treturn false;\n\t\t}\n\n\t\tconst pendingKeyMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingKeyMessageIds !== undefined) {\n\t\t\t// Found an NACK op, clear it from the directory if the latest sequence number in the directory\n\t\t\t// match the message's and don't process the op.\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tlocalOpMetadata !== undefined && isKeyEditLocalOpMetadata(localOpMetadata),\n\t\t\t\t\t0x011 /* pendingMessageId is missing from the local client's operation */,\n\t\t\t\t);\n\t\t\t\tif (pendingKeyMessageIds[0] !== localOpMetadata.pendingMessageId) {\n\t\t\t\t\t// TODO: AB#7742: Hitting this block indicates that the pending message Id received\n\t\t\t\t\t// is not consistent with the \"next\" local op\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"unexpectedPendingMessage\",\n\t\t\t\t\t\texpectedPendingMessage: pendingKeyMessageIds[0],\n\t\t\t\t\t\tactualPendingMessage: localOpMetadata.pendingMessageId,\n\t\t\t\t\t\texpectedPendingMessagesLength: pendingKeyMessageIds.length,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tpendingKeyMessageIds.shift();\n\t\t\t\tif (pendingKeyMessageIds.length === 0) {\n\t\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// If we don't have a NACK op on the key, we need to process the remote ops.\n\t\treturn !local;\n\t}\n\n\t/**\n\t * This return true if the message is for the current instance of this sub directory. As the sub directory\n\t * can be deleted and created again, then this finds if the message is for current instance of directory or not.\n\t * @param msg - message for the directory\n\t */\n\tprivate isMessageForCurrentInstanceOfSubDirectory(msg: ISequencedDocumentMessage): boolean {\n\t\t// If the message is either from the creator of directory or this directory was created when\n\t\t// container was detached or in case this directory is already live(known to other clients)\n\t\t// and the op was created after the directory was created then apply this op.\n\t\treturn (\n\t\t\t(msg.clientId !== null && this.clientIds.has(msg.clientId)) ||\n\t\t\tthis.clientIds.has(\"detached\") ||\n\t\t\t(this.seqData.seq !== -1 && this.seqData.seq <= msg.referenceSequenceNumber)\n\t\t);\n\t}\n\n\t/**\n\t * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n\t * not process the incoming operation.\n\t * @param op - Operation to check\n\t * @param local - Whether the message originated from the local client\n\t * @param message - The message\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation should be processed, false otherwise\n\t */\n\tprivate needProcessSubDirectoryOperation(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectorySubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tassertNonNullClientId(msg.clientId);\n\t\tconst pendingDeleteCount = this.pendingDeleteSubDirectoriesTracker.get(op.subdirName);\n\t\tconst pendingCreateCount = this.pendingCreateSubDirectoriesTracker.get(op.subdirName);\n\t\tif (\n\t\t\t(pendingDeleteCount !== undefined && pendingDeleteCount > 0) ||\n\t\t\t(pendingCreateCount !== undefined && pendingCreateCount > 0)\n\t\t) {\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tisSubDirLocalOpMetadata(localOpMetadata),\n\t\t\t\t\t0x012 /* pendingMessageId is missing from the local client's operation */,\n\t\t\t\t);\n\t\t\t\tif (localOpMetadata.type === \"deleteSubDir\") {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingDeleteCount !== undefined && pendingDeleteCount > 0,\n\t\t\t\t\t\t0x6c2 /* pendingDeleteCount should exist */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\t\t\tthis.pendingDeleteSubDirectoriesTracker,\n\t\t\t\t\t\top.subdirName,\n\t\t\t\t\t);\n\t\t\t\t} else if (localOpMetadata.type === \"createSubDir\") {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingCreateCount !== undefined && pendingCreateCount > 0,\n\t\t\t\t\t\t0x6c3 /* pendingCreateCount should exist */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\t\t\tthis.pendingCreateSubDirectoriesTracker,\n\t\t\t\t\t\top.subdirName,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op.type === \"deleteSubDirectory\") {\n\t\t\t\tconst resetSubDirectoryTree = (directory: SubDirectory | undefined): void => {\n\t\t\t\t\tif (!directory) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// If this is delete op and we have keys in this subDirectory, then we need to delete these\n\t\t\t\t\t// keys except the pending ones as they will be sequenced after this delete.\n\t\t\t\t\tdirectory.clearExceptPendingKeys(local);\n\t\t\t\t\t// In case of delete op, we need to reset the creation seqNum, clientSeqNum and client ids of\n\t\t\t\t\t// creators as the previous directory is getting deleted and we will initialize again when\n\t\t\t\t\t// we will receive op for the create again.\n\t\t\t\t\tdirectory.seqData.seq = -1;\n\t\t\t\t\tdirectory.seqData.clientSeq = -1;\n\t\t\t\t\tdirectory.clientIds.clear();\n\t\t\t\t\t// Do the same thing for the subtree of the directory. If create is not pending for a child, then just\n\t\t\t\t\t// delete it.\n\t\t\t\t\tconst subDirectories = directory.subdirectories();\n\t\t\t\t\tfor (const [subDirName, subDir] of subDirectories) {\n\t\t\t\t\t\tif (directory.pendingCreateSubDirectoriesTracker.has(subDirName)) {\n\t\t\t\t\t\t\tresetSubDirectoryTree(subDir as SubDirectory);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdirectory.deleteSubDirectoryCore(subDirName, false);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst subDirectory = this._subdirectories.get(op.subdirName);\n\t\t\t\t// Clear the creation tracker record\n\t\t\t\tthis.ackedCreationSeqTracker.delete(op.subdirName);\n\t\t\t\tresetSubDirectoryTree(subDirectory);\n\t\t\t}\n\t\t\tif (op.type === \"createSubDirectory\") {\n\t\t\t\tconst dir = this._subdirectories.get(op.subdirName);\n\t\t\t\t// Child sub directory create seq number can't be lower than the parent subdirectory.\n\t\t\t\t// The sequence number for multiple ops can be the same when multiple createSubDirectory occurs with grouped batching enabled, thus <= and not just <.\n\t\t\t\tif (this.seqData.seq !== -1 && this.seqData.seq <= msg.sequenceNumber) {\n\t\t\t\t\tif (dir?.seqData.seq === -1) {\n\t\t\t\t\t\t// Only set the sequence data based on the first message\n\t\t\t\t\t\tdir.seqData.seq = msg.sequenceNumber;\n\t\t\t\t\t\tdir.seqData.clientSeq = msg.clientSequenceNumber;\n\n\t\t\t\t\t\t// set the creation seq in tracker\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!this.ackedCreationSeqTracker.has(op.subdirName) &&\n\t\t\t\t\t\t\t!this.pendingDeleteSubDirectoriesTracker.has(op.subdirName)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthis.ackedCreationSeqTracker.set(op.subdirName, {\n\t\t\t\t\t\t\t\tseq: msg.sequenceNumber,\n\t\t\t\t\t\t\t\tclientSeq: msg.clientSequenceNumber,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (local) {\n\t\t\t\t\t\t\t\tthis.localCreationSeqTracker.delete(op.subdirName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// The client created the dir at or after the dirs seq, so list its client id as a creator.\n\t\t\t\t\tif (\n\t\t\t\t\t\tdir !== undefined &&\n\t\t\t\t\t\t!dir.clientIds.has(msg.clientId) &&\n\t\t\t\t\t\tdir.seqData.seq <= msg.sequenceNumber\n\t\t\t\t\t) {\n\t\t\t\t\t\tdir.clientIds.add(msg.clientId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\treturn !local;\n\t}\n\n\t/**\n\t * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.\n\t */\n\tprivate clearExceptPendingKeys(local: boolean): void {\n\t\t// Assuming the pendingKeys is small and the map is large\n\t\t// we will get the value for the pendingKeys and clear the map\n\t\tconst temp = new Map<string, unknown>();\n\n\t\tfor (const [key] of this.pendingKeys) {\n\t\t\tconst value = this._storage.get(key);\n\t\t\t// If this key is already deleted, then we don't need to add it again.\n\t\t\tif (value !== undefined) {\n\t\t\t\ttemp.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\tthis.clearCore(local);\n\n\t\tfor (const [key, value] of temp.entries()) {\n\t\t\tthis.setCore(key, value, true);\n\t\t}\n\t}\n\n\t/**\n\t * Clear implementation used for both locally sourced clears as well as incoming remote clears.\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate clearCore(local: boolean): void {\n\t\tthis._storage.clear();\n\t\tthis.directory.emit(\"clear\", local, this.directory);\n\t}\n\n\t/**\n\t * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.\n\t * @param key - The key being deleted\n\t * @param local - Whether the message originated from the local client\n\t * @returns Previous local value of the key if it existed, undefined if it did not exist\n\t */\n\tprivate deleteCore(key: string, local: boolean): unknown {\n\t\tconst previousLocalValue = this._storage.get(key);\n\t\tconst previousValue: unknown = previousLocalValue;\n\t\tconst successfullyRemoved = this._storage.delete(key);\n\t\tif (successfullyRemoved) {\n\t\t\tconst event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };\n\t\t\tthis.directory.emit(\"valueChanged\", event, local, this.directory);\n\t\t\tconst containedEvent: IValueChanged = { key, previousValue };\n\t\t\tthis.emit(\"containedValueChanged\", containedEvent, local, this);\n\t\t}\n\t\treturn previousLocalValue;\n\t}\n\n\t/**\n\t * Set implementation used for both locally sourced sets as well as incoming remote sets.\n\t * @param key - The key being set\n\t * @param value - The value being set\n\t * @param local - Whether the message originated from the local client\n\t * @returns Previous local value of the key, if any\n\t */\n\tprivate setCore(key: string, value: unknown, local: boolean): unknown {\n\t\tconst previousLocalValue = this._storage.get(key);\n\t\tconst previousValue: unknown = previousLocalValue;\n\t\tthis._storage.set(key, value);\n\t\tconst event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };\n\t\tthis.directory.emit(\"valueChanged\", event, local, this.directory);\n\t\tconst containedEvent: IValueChanged = { key, previousValue };\n\t\tthis.emit(\"containedValueChanged\", containedEvent, local, this);\n\t\treturn previousLocalValue;\n\t}\n\n\t/**\n\t * Create subdirectory implementation used for both locally sourced creation as well as incoming remote creation.\n\t * @param subdirName - The name of the subdirectory being created\n\t * @param local - Whether the message originated from the local client\n\t * @param seqData - Sequence number and client sequence number at which this directory is created\n\t * @param clientId - Id of client which created this directory.\n\t * @returns True if is newly created, false if it already existed.\n\t */\n\tprivate createSubDirectoryCore(\n\t\tsubdirName: string,\n\t\tlocal: boolean,\n\t\tseqData: SequenceData,\n\t\tclientId: string,\n\t): boolean {\n\t\tconst subdir = this._subdirectories.get(subdirName);\n\t\tif (subdir === undefined) {\n\t\t\tconst absolutePath = posix.join(this.absolutePath, subdirName);\n\t\t\tconst subDir = new SubDirectory(\n\t\t\t\t{ ...seqData },\n\t\t\t\tnew Set([clientId]),\n\t\t\t\tthis.directory,\n\t\t\t\tthis.runtime,\n\t\t\t\tthis.serializer,\n\t\t\t\tabsolutePath,\n\t\t\t\tthis.logger,\n\t\t\t);\n\t\t\t/**\n\t\t\t * Store the sequence numbers of newly created subdirectory to the proper creation tracker, based\n\t\t\t * on whether the creation behavior has been ack'd or not\n\t\t\t */\n\t\t\tif (isAcknowledgedOrDetached(seqData)) {\n\t\t\t\tthis.ackedCreationSeqTracker.set(subdirName, { ...seqData });\n\t\t\t} else {\n\t\t\t\tthis.localCreationSeqTracker.set(subdirName, { ...seqData });\n\t\t\t}\n\n\t\t\tthis.registerEventsOnSubDirectory(subDir, subdirName);\n\t\t\tthis._subdirectories.set(subdirName, subDir);\n\t\t\tthis.emit(\"subDirectoryCreated\", subdirName, local, this);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tsubdir.clientIds.add(clientId);\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate registerEventsOnSubDirectory(subDirectory: SubDirectory, subDirName: string): void {\n\t\tsubDirectory.on(\"subDirectoryCreated\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryCreated\", posix.join(subDirName, relativePath), local, this);\n\t\t});\n\t\tsubDirectory.on(\"subDirectoryDeleted\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryDeleted\", posix.join(subDirName, relativePath), local, this);\n\t\t});\n\t}\n\n\t/**\n\t * Delete subdirectory implementation used for both locally sourced creation as well as incoming remote creation.\n\t * @param subdirName - The name of the subdirectory being deleted\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate deleteSubDirectoryCore(\n\t\tsubdirName: string,\n\t\tlocal: boolean,\n\t): SubDirectory | undefined {\n\t\tconst previousValue = this._subdirectories.get(subdirName);\n\t\t// This should make the subdirectory structure unreachable so it can be GC'd and won't appear in snapshots\n\t\t// Might want to consider cleaning out the structure more exhaustively though? But not when rollback.\n\t\tif (previousValue !== undefined) {\n\t\t\tthis._subdirectories.delete(subdirName);\n\t\t\t/**\n\t\t\t * Remove the corresponding record from the proper creation tracker, based on whether the subdirectory has been\n\t\t\t * ack'd already or still not committed yet (could be both).\n\t\t\t */\n\t\t\tif (this.ackedCreationSeqTracker.has(subdirName)) {\n\t\t\t\tthis.ackedCreationSeqTracker.delete(subdirName);\n\t\t\t}\n\t\t\tif (this.localCreationSeqTracker.has(subdirName)) {\n\t\t\t\tthis.localCreationSeqTracker.delete(subdirName);\n\t\t\t}\n\t\t\tthis.disposeSubDirectoryTree(previousValue);\n\t\t\tthis.emit(\"subDirectoryDeleted\", subdirName, local, this);\n\t\t}\n\t\treturn previousValue;\n\t}\n\n\tprivate disposeSubDirectoryTree(directory: IDirectory | undefined): void {\n\t\tif (!directory) {\n\t\t\treturn;\n\t\t}\n\t\t// Dispose the subdirectory tree. This will dispose the subdirectories from bottom to top.\n\t\tconst subDirectories = directory.subdirectories();\n\t\tfor (const [_, subDirectory] of subDirectories) {\n\t\t\tthis.disposeSubDirectoryTree(subDirectory);\n\t\t}\n\t\tif (typeof directory.dispose === \"function\") {\n\t\t\tdirectory.dispose();\n\t\t}\n\t}\n\n\tprivate undeleteSubDirectoryTree(directory: SubDirectory): void {\n\t\t// Restore deleted subdirectory tree. Need to undispose the current directory first, then get access to the iterator.\n\t\t// This will unmark \"deleted\" from the subdirectories from top to bottom.\n\t\tdirectory.undispose();\n\t\tfor (const [_, subDirectory] of directory.subdirectories()) {\n\t\t\tthis.undeleteSubDirectoryTree(subDirectory as SubDirectory);\n\t\t}\n\t}\n}\n"]}
|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ACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport { RedBlackTree } from \"@fluidframework/merge-tree/internal\";\nimport type {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tSharedObject,\n\tValueType,\n\tbindHandles,\n\tparseHandles,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport path from \"path-browserify\";\n\nimport type {\n\tIDirectory,\n\tIDirectoryEvents,\n\tIDirectoryValueChanged,\n\tISharedDirectory,\n\tISharedDirectoryEvents,\n\tIValueChanged,\n} from \"./interfaces.js\";\nimport type {\n\t// eslint-disable-next-line import/no-deprecated\n\tISerializableValue,\n\tISerializedValue,\n} from \"./internalInterfaces.js\";\nimport { serializeValue, migrateIfSharedSerializable } from \"./localValues.js\";\nimport { findLast, findLastIndex } from \"./utils.js\";\n\n// We use path-browserify since this code can run safely on the server or the browser.\n// We standardize on using posix slashes everywhere.\nconst posix = path.posix;\n\nconst snapshotFileName = \"header\";\n\n/**\n * Defines the means to process and submit a given op on a directory.\n */\ninterface IDirectoryMessageHandler {\n\t/**\n\t * Apply the given operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The directory operation to apply\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: DirectoryLocalOpMetadata | undefined,\n\t): void;\n\n\t/**\n\t * Resubmit a previously submitted operation that was not delivered.\n\t * @param op - The directory operation to resubmit\n\t * @param localOpMetadata - The metadata that was originally submitted with the message.\n\t */\n\tresubmit(op: IDirectoryOperation, localOpMetadata: DirectoryLocalOpMetadata): void;\n}\n\n/**\n * Operation indicating a value should be set for a key.\n */\nexport interface IDirectorySetOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"set\";\n\n\t/**\n\t * Directory key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Absolute path of the directory where the modified key is located.\n\t */\n\tpath: string;\n\n\t/**\n\t * Value to be set on the key.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tvalue: ISerializableValue;\n}\n\n/**\n * Operation indicating a key should be deleted from the directory.\n */\nexport interface IDirectoryDeleteOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"delete\";\n\n\t/**\n\t * Directory key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Absolute path of the directory where the modified key is located.\n\t */\n\tpath: string;\n}\n\n/**\n * An operation on a specific key within a directory.\n */\nexport type IDirectoryKeyOperation = IDirectorySetOperation | IDirectoryDeleteOperation;\n\n/**\n * Operation indicating the directory should be cleared.\n */\nexport interface IDirectoryClearOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"clear\";\n\n\t/**\n\t * Absolute path of the directory being cleared.\n\t */\n\tpath: string;\n}\n\n/**\n * An operation on one or more of the keys within a directory.\n */\nexport type IDirectoryStorageOperation = IDirectoryKeyOperation | IDirectoryClearOperation;\n\n/**\n * Operation indicating a subdirectory should be created.\n */\nexport interface IDirectoryCreateSubDirectoryOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"createSubDirectory\";\n\n\t/**\n\t * Absolute path of the directory that will contain the new subdirectory.\n\t */\n\tpath: string;\n\n\t/**\n\t * Name of the new subdirectory.\n\t */\n\tsubdirName: string;\n}\n\n/**\n * Operation indicating a subdirectory should be deleted.\n */\nexport interface IDirectoryDeleteSubDirectoryOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"deleteSubDirectory\";\n\n\t/**\n\t * Absolute path of the directory that contains the directory to be deleted.\n\t */\n\tpath: string;\n\n\t/**\n\t * Name of the subdirectory to be deleted.\n\t */\n\tsubdirName: string;\n}\n\n/**\n * An operation on the subdirectories within a directory.\n */\nexport type IDirectorySubDirectoryOperation =\n\t| IDirectoryCreateSubDirectoryOperation\n\t| IDirectoryDeleteSubDirectoryOperation;\n\n/**\n * Any operation on a directory.\n */\nexport type IDirectoryOperation = IDirectoryStorageOperation | IDirectorySubDirectoryOperation;\n\ninterface PendingKeySet {\n\ttype: \"set\";\n\tpath: string;\n\tvalue: unknown;\n}\n\ninterface PendingKeyDelete {\n\ttype: \"delete\";\n\tpath: string;\n\tkey: string;\n}\n\ninterface PendingClear {\n\ttype: \"clear\";\n\tpath: string;\n}\n\n/**\n * Represents the \"lifetime\" of a series of pending set operations before the pending\n * set operations are ack'd.\n */\ninterface PendingKeyLifetime {\n\ttype: \"lifetime\";\n\tkey: string;\n\tpath: string;\n\t/**\n\t * A non-empty array of pending key sets that occurred during this lifetime. If the list\n\t * becomes empty (e.g. during processing or rollback), the lifetime no longer exists and\n\t * must be removed from the pending data.\n\t */\n\tkeySets: PendingKeySet[];\n}\n\n/**\n * A member of the pendingStorageData array, which tracks outstanding changes and can be used to\n * compute optimistic values. Local sets are aggregated into lifetimes.\n */\ntype PendingStorageEntry = PendingKeyLifetime | PendingKeyDelete | PendingClear;\n\n/**\n * Create info for the subdirectory.\n *\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n *\n * @legacy\n * @alpha\n */\nexport interface ICreateInfo {\n\t/**\n\t * Sequence number at which this subdirectory was created.\n\t */\n\tcsn: number;\n\n\t/**\n\t * clientids of the clients which created this sub directory.\n\t */\n\tccIds: string[];\n}\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n *\n * @remarks Directly used in\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify\n * | JSON.stringify}, direct result from\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.\n *\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n *\n * @legacy\n * @alpha\n */\nexport interface IDirectoryDataObject {\n\t/**\n\t * Key/value date set by the user.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tstorage?: Record<string, ISerializableValue>;\n\n\t/**\n\t * Recursive sub-directories {@link IDirectoryDataObject | objects}.\n\t */\n\tsubdirectories?: Record<string, IDirectoryDataObject>;\n\n\t/**\n\t * Create info for the sub directory. Since directories with same name can get deleted/created by multiple clients\n\t * asynchronously, this info helps us to determine whether the ops where for the current instance of sub directory\n\t * or not and whether to process them or not based on that. Summaries which were not produced which this change\n\t * will not have this info and in that case we can still run in eventual consistency issues but that is no worse\n\t * than the state before this change.\n\t */\n\tci?: ICreateInfo;\n}\n\n/**\n * {@link IDirectory} storage format.\n *\n * @deprecated - This interface will no longer be exported in the future(AB#8004).\n *\n * @legacy\n * @alpha\n */\nexport interface IDirectoryNewStorageFormat {\n\t/**\n\t * Blob IDs representing larger directory data that was serialized.\n\t */\n\tblobs: string[];\n\n\t/**\n\t * Storage content representing directory data that was not serialized.\n\t */\n\tcontent: IDirectoryDataObject;\n}\n\n/**\n * The comparator essentially performs the following procedure to determine the order of subdirectory creation:\n * 1. If subdirectory A has a non-negative 'seq' and subdirectory B has a negative 'seq', subdirectory A is always placed first due to\n * the policy that acknowledged subdirectories precede locally created ones that have not been committed yet.\n *\n * 2. When both subdirectories A and B have a non-negative 'seq', they are compared as follows:\n * - If A and B have different 'seq', they are ordered based on 'seq', and the one with the lower 'seq' will be positioned ahead. Notably this rule\n * should not be applied in the directory ordering, since the lowest 'seq' is -1, when the directory is created locally but not acknowledged yet.\n * - In the case where A and B have equal 'seq', the one with the lower 'clientSeq' will be positioned ahead. This scenario occurs when grouped\n * batching is enabled, and a lower 'clientSeq' indicates that it was processed earlier after the batch was ungrouped.\n *\n * 3. When both subdirectories A and B have a negative 'seq', they are compared as follows:\n * - If A and B have different 'seq', the one with lower 'seq' will be positioned ahead, which indicates the corresponding creation message was\n * acknowledged by the server earlier.\n * - If A and B have equal 'seq', the one with lower 'clientSeq' will be placed at the front. This scenario suggests that both subdirectories A\n * and B were created locally and not acknowledged yet, with the one possessing the lower 'clientSeq' being created earlier.\n *\n * 4. A 'seq' value of zero indicates that the subdirectory was created in detached state, and it is considered acknowledged for the\n * purpose of ordering.\n */\nconst seqDataComparator = (a: SequenceData, b: SequenceData): number => {\n\tif (isAcknowledgedOrDetached(a)) {\n\t\tif (isAcknowledgedOrDetached(b)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\treturn a.seq === b.seq ? a.clientSeq! - b.clientSeq! : a.seq - b.seq;\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t} else {\n\t\tif (isAcknowledgedOrDetached(b)) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\treturn a.seq === b.seq ? a.clientSeq! - b.clientSeq! : a.seq - b.seq;\n\t\t}\n\t}\n};\n\nfunction isAcknowledgedOrDetached(seqData: SequenceData): boolean {\n\treturn seqData.seq >= 0;\n}\n\n/**\n * The combination of sequence numebr and client sequence number of a subdirectory\n */\ninterface SequenceData {\n\tseq: number;\n\tclientSeq?: number;\n}\n\n/**\n * A utility class for tracking associations between keys and their creation indices.\n * This is relevant to support map iteration in insertion order, see\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/%40%40iterator\n *\n * TODO: It can be combined with the creation tracker utilized in SharedMap\n */\nclass DirectoryCreationTracker {\n\tpublic readonly indexToKey: RedBlackTree<SequenceData, string>;\n\n\tpublic readonly keyToIndex: Map<string, SequenceData>;\n\n\tpublic constructor() {\n\t\tthis.indexToKey = new RedBlackTree<SequenceData, string>(seqDataComparator);\n\t\tthis.keyToIndex = new Map<string, SequenceData>();\n\t}\n\n\tpublic set(key: string, seqData: SequenceData): void {\n\t\tthis.indexToKey.put(seqData, key);\n\t\tthis.keyToIndex.set(key, seqData);\n\t}\n\n\tpublic has(keyOrSeqData: string | SequenceData): boolean {\n\t\treturn typeof keyOrSeqData === \"string\"\n\t\t\t? this.keyToIndex.has(keyOrSeqData)\n\t\t\t: this.indexToKey.get(keyOrSeqData) !== undefined;\n\t}\n\n\tpublic delete(keyOrSeqData: string | SequenceData): void {\n\t\tif (this.has(keyOrSeqData)) {\n\t\t\tif (typeof keyOrSeqData === \"string\") {\n\t\t\t\tconst seqData = this.keyToIndex.get(keyOrSeqData) as SequenceData;\n\t\t\t\tthis.keyToIndex.delete(keyOrSeqData);\n\t\t\t\tthis.indexToKey.remove(seqData);\n\t\t\t} else {\n\t\t\t\tconst key = this.indexToKey.get(keyOrSeqData)?.data as string;\n\t\t\t\tthis.indexToKey.remove(keyOrSeqData);\n\t\t\t\tthis.keyToIndex.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves all subdirectories with creation order that satisfy an optional constraint function.\n\t * @param constraint - An optional constraint function that filters keys.\n\t * @returns An array of keys that satisfy the constraint (or all keys if no constraint is provided).\n\t */\n\tpublic keys(constraint?: (key: string) => boolean): string[] {\n\t\tconst keys: string[] = [];\n\t\tthis.indexToKey.mapRange((node) => {\n\t\t\tif (!constraint || constraint(node.data)) {\n\t\t\t\tkeys.push(node.data);\n\t\t\t}\n\t\t\treturn true;\n\t\t}, keys);\n\t\treturn keys;\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.keyToIndex.size;\n\t}\n}\n\n/**\n * {@inheritDoc ISharedDirectory}\n *\n * @example\n *\n * ```typescript\n * mySharedDirectory.createSubDirectory(\"a\").createSubDirectory(\"b\").createSubDirectory(\"c\").set(\"foo\", val1);\n * const mySubDir = mySharedDirectory.getWorkingDirectory(\"/a/b/c\");\n * mySubDir.get(\"foo\"); // returns val1\n * ```\n *\n * @sealed\n */\nexport class SharedDirectory\n\textends SharedObject<ISharedDirectoryEvents>\n\timplements ISharedDirectory\n{\n\t/**\n\t * String representation for the class.\n\t */\n\tpublic [Symbol.toStringTag]: string = \"SharedDirectory\";\n\n\t/**\n\t * {@inheritDoc IDirectory.absolutePath}\n\t */\n\tpublic get absolutePath(): string {\n\t\treturn this.root.absolutePath;\n\t}\n\n\t/**\n\t * Root of the SharedDirectory, most operations on the SharedDirectory itself act on the root.\n\t */\n\tprivate readonly root: SubDirectory = new SubDirectory(\n\t\t{ seq: 0, clientSeq: 0 },\n\t\tnew Set(),\n\t\tthis,\n\t\tthis.runtime,\n\t\tthis.serializer,\n\t\tposix.sep,\n\t\tthis.logger,\n\t);\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandlers = new Map<string, IDirectoryMessageHandler>();\n\n\t/**\n\t * Constructs a new shared directory. If the object is non-local an id and service interfaces will\n\t * be provided.\n\t * @param id - String identifier for the SharedDirectory\n\t * @param runtime - Data store runtime\n\t * @param type - Type identifier\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_directory_\");\n\t\tthis.setMessageHandlers();\n\t\t// Mirror the containedValueChanged op on the SharedDirectory\n\t\tthis.root.on(\"containedValueChanged\", (changed: IValueChanged, local: boolean) => {\n\t\t\tthis.emit(\"containedValueChanged\", changed, local, this);\n\t\t});\n\t\tthis.root.on(\"subDirectoryCreated\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryCreated\", relativePath, local, this);\n\t\t});\n\t\tthis.root.on(\"subDirectoryDeleted\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryDeleted\", relativePath, local, this);\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.get}\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic get<T = any>(key: string): T | undefined {\n\t\treturn this.root.get<T>(key);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.set}\n\t */\n\tpublic set<T = unknown>(key: string, value: T): this {\n\t\tthis.root.set(key, value);\n\t\treturn this;\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tthis.root.dispose(error);\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this.root.disposed;\n\t}\n\n\t/**\n\t * Deletes the given key from within this IDirectory.\n\t * @param key - The key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\treturn this.root.delete(key);\n\t}\n\n\t/**\n\t * Deletes all keys from within this IDirectory.\n\t */\n\tpublic clear(): void {\n\t\tthis.root.clear();\n\t}\n\n\t/**\n\t * Checks whether the given key exists in this IDirectory.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.root.has(key);\n\t}\n\n\t/**\n\t * The number of entries under this IDirectory.\n\t */\n\tpublic get size(): number {\n\t\treturn this.root.size;\n\t}\n\n\t/**\n\t * Issue a callback on each entry under this IDirectory.\n\t * @param callback - Callback to issue\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic forEach(callback: (value: any, key: string, map: Map<string, any>) => void): void {\n\t\t// eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-callback-reference\n\t\tthis.root.forEach(callback);\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\n\t\treturn this.root[Symbol.iterator]();\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic entries(): IterableIterator<[string, any]> {\n\t\treturn this.root.entries();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.countSubDirectory}\n\t */\n\tpublic countSubDirectory(): number {\n\t\treturn this.root.countSubDirectory();\n\t}\n\n\t/**\n\t * Get an iterator over the keys under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.root.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic values(): IterableIterator<any> {\n\t\treturn this.root.values();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.createSubDirectory}\n\t */\n\tpublic createSubDirectory(subdirName: string): IDirectory {\n\t\treturn this.root.createSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getSubDirectory}\n\t */\n\tpublic getSubDirectory(subdirName: string): IDirectory | undefined {\n\t\treturn this.root.getSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.hasSubDirectory}\n\t */\n\tpublic hasSubDirectory(subdirName: string): boolean {\n\t\treturn this.root.hasSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.deleteSubDirectory}\n\t */\n\tpublic deleteSubDirectory(subdirName: string): boolean {\n\t\treturn this.root.deleteSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.subdirectories}\n\t */\n\tpublic subdirectories(): IterableIterator<[string, IDirectory]> {\n\t\treturn this.root.subdirectories();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getWorkingDirectory}\n\t */\n\tpublic getWorkingDirectory(relativePath: string): IDirectory | undefined {\n\t\tconst absolutePath = this.makeAbsolute(relativePath);\n\t\tif (absolutePath === posix.sep) {\n\t\t\treturn this.root;\n\t\t}\n\n\t\tlet currentSubDir = this.root;\n\t\tconst subdirs = absolutePath.slice(1).split(posix.sep);\n\t\tfor (const subdir of subdirs) {\n\t\t\tcurrentSubDir = currentSubDir.getSubDirectory(subdir) as SubDirectory;\n\t\t\tif (!currentSubDir) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t\treturn currentSubDir;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\treturn this.serializeDirectory(this.root, serializer);\n\t}\n\n\t/**\n\t * Submits an operation\n\t * @param op - Op to submit\n\t * @param localOpMetadata - The local metadata associated with the op. We send a unique id that is used to track\n\t * this op while it has not been ack'd. This will be sent when we receive this op back from the server.\n\t */\n\tpublic submitDirectoryMessage(\n\t\top: IDirectoryOperation,\n\t\tlocalOpMetadata: DirectoryLocalOpMetadata,\n\t): void {\n\t\tthis.submitLocalMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t */\n\tprotected override reSubmitCore(\n\t\tcontent: unknown,\n\t\tlocalOpMetadata: DirectoryLocalOpMetadata,\n\t): void {\n\t\tconst message = content as IDirectoryOperation;\n\t\tconst handler = this.messageHandlers.get(message.type);\n\t\tassert(handler !== undefined, 0x00d /* Missing message handler for message type */);\n\t\thandler.resubmit(message, localOpMetadata);\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 data = await readAndParse(storage, snapshotFileName);\n\t\tconst newFormat = data as IDirectoryNewStorageFormat;\n\t\tif (Array.isArray(newFormat.blobs)) {\n\t\t\t// New storage format\n\t\t\tthis.populate(newFormat.content);\n\t\t\tconst blobContents = await Promise.all(\n\t\t\t\tnewFormat.blobs.map(async (blobName) => readAndParse(storage, blobName)),\n\t\t\t);\n\t\t\tfor (const blobContent of blobContents) {\n\t\t\t\tthis.populate(blobContent as IDirectoryDataObject);\n\t\t\t}\n\t\t} else {\n\t\t\t// Old storage format\n\t\t\tthis.populate(data as IDirectoryDataObject);\n\t\t}\n\t}\n\n\t/**\n\t * Populate the directory with the given directory data.\n\t * @param data - A JSON string containing serialized directory data\n\t */\n\tprotected populate(data: IDirectoryDataObject): void {\n\t\tconst stack: [SubDirectory, IDirectoryDataObject][] = [];\n\t\tstack.push([this.root, data]);\n\n\t\twhile (stack.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst [currentSubDir, currentSubDirObject] = stack.pop()!;\n\t\t\tif (currentSubDirObject.subdirectories) {\n\t\t\t\t// Utilize a map to store the seq -> clientSeq for the newly created subdirectory\n\t\t\t\tconst tempSeqNums = new Map<number, number>();\n\t\t\t\tfor (const [subdirName, subdirObject] of Object.entries(\n\t\t\t\t\tcurrentSubDirObject.subdirectories,\n\t\t\t\t)) {\n\t\t\t\t\tlet newSubDir = currentSubDir.getSubDirectory(subdirName) as SubDirectory;\n\t\t\t\t\tlet seqData: SequenceData;\n\t\t\t\t\tif (!newSubDir) {\n\t\t\t\t\t\tconst createInfo = subdirObject.ci;\n\t\t\t\t\t\t// We do not store the client sequence number in the storage because the order has already been\n\t\t\t\t\t\t// guaranteed during the serialization process. As a result, it is only essential to utilize the\n\t\t\t\t\t\t// \"fake\" client sequence number to signify the loading order, and there is no need to retain\n\t\t\t\t\t\t// the actual client sequence number at this point.\n\t\t\t\t\t\tif (createInfo !== undefined && createInfo.csn > 0) {\n\t\t\t\t\t\t\tif (!tempSeqNums.has(createInfo.csn)) {\n\t\t\t\t\t\t\t\ttempSeqNums.set(createInfo.csn, 0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlet fakeClientSeq = tempSeqNums.get(createInfo.csn) as number;\n\t\t\t\t\t\t\tseqData = { seq: createInfo.csn, clientSeq: fakeClientSeq };\n\t\t\t\t\t\t\ttempSeqNums.set(createInfo.csn, ++fakeClientSeq);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * 1. If csn is -1, then initialize it with 0, otherwise we will never process ops for this\n\t\t\t\t\t\t\t * sub directory. This could be done at serialization time too, but we need to maintain\n\t\t\t\t\t\t\t * back compat too and also we will actually know the state when it was serialized.\n\t\t\t\t\t\t\t * 2. We need to make the csn = -1 and csn = 0 share the same counter, there are cases\n\t\t\t\t\t\t\t * where both -1 and 0 coexist within a single document.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tseqData = {\n\t\t\t\t\t\t\t\tseq: 0,\n\t\t\t\t\t\t\t\tclientSeq: ++currentSubDir.localCreationSeq,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnewSubDir = new SubDirectory(\n\t\t\t\t\t\t\tseqData,\n\t\t\t\t\t\t\tcreateInfo === undefined ? new Set() : new Set<string>(createInfo.ccIds),\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\tthis.runtime,\n\t\t\t\t\t\t\tthis.serializer,\n\t\t\t\t\t\t\tposix.join(currentSubDir.absolutePath, subdirName),\n\t\t\t\t\t\t\tthis.logger,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcurrentSubDir.populateSubDirectory(subdirName, newSubDir);\n\t\t\t\t\t\t// Record the newly inserted subdirectory to the creation tracker\n\t\t\t\t\t\tcurrentSubDir.ackedCreationSeqTracker.set(subdirName, {\n\t\t\t\t\t\t\t...seqData,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tstack.push([newSubDir, subdirObject]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentSubDirObject.storage) {\n\t\t\t\tfor (const [key, serializable] of Object.entries(currentSubDirObject.storage)) {\n\t\t\t\t\tconst parsedSerializable = parseHandles(\n\t\t\t\t\t\tserializable,\n\t\t\t\t\t\tthis.serializer,\n\t\t\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\t\t) as ISerializableValue;\n\t\t\t\t\tmigrateIfSharedSerializable(parsedSerializable, this.serializer, this.handle);\n\t\t\t\t\tcurrentSubDir.populateStorage(key, parsedSerializable.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: DirectoryLocalOpMetadata | undefined,\n\t): void {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op: IDirectoryOperation = message.contents as IDirectoryOperation;\n\t\t\tconst handler = this.messageHandlers.get(op.type);\n\t\t\tassert(\n\t\t\t\thandler !== undefined,\n\t\t\t\t0x00e /* \"Missing message handler for message type: op may be from a newer version */,\n\t\t\t);\n\t\t\thandler.process(message, op, local, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n\t */\n\tprotected override rollback(\n\t\tcontent: unknown,\n\t\tlocalOpMetadata: DirectoryLocalOpMetadata,\n\t): void {\n\t\tconst op: IDirectoryOperation = content as IDirectoryOperation;\n\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\tif (subdir) {\n\t\t\tsubdir.rollback(op, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * Converts the given relative path to absolute against the root.\n\t * @param relativePath - The path to convert\n\t */\n\tprivate makeAbsolute(relativePath: string): string {\n\t\treturn posix.resolve(posix.sep, relativePath);\n\t}\n\n\t/**\n\t * This checks if there is pending delete op for local delete for a any subdir in the relative path.\n\t * @param relativePath - path of sub directory.\n\t * @returns `true` if there is pending delete, `false` otherwise.\n\t */\n\tprivate isSubDirectoryDeletePending(relativePath: string): boolean {\n\t\tconst absolutePath = this.makeAbsolute(relativePath);\n\t\tif (absolutePath === posix.sep) {\n\t\t\treturn false;\n\t\t}\n\t\tlet currentParent = this.root;\n\t\tconst pathParts = absolutePath.split(posix.sep).slice(1);\n\t\tfor (const dirName of pathParts) {\n\t\t\tif (currentParent.isSubDirectoryDeletePending(dirName)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tcurrentParent = currentParent.getSubDirectory(dirName) as SubDirectory;\n\t\t\tif (currentParent === undefined) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Set the message handlers for the directory.\n\t */\n\tprivate setMessageHandlers(): void {\n\t\tthis.messageHandlers.set(\"clear\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryClearOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: ClearLocalOpMetadata | undefined,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tsubdir.processClearMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tresubmit: (op: IDirectoryClearOperation, localOpMetadata: ClearLocalOpMetadata) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitClearMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tthis.messageHandlers.set(\"delete\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryDeleteOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: EditLocalOpMetadata | undefined,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tsubdir.processDeleteMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tresubmit: (op: IDirectoryDeleteOperation, localOpMetadata: EditLocalOpMetadata) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitKeyMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tthis.messageHandlers.set(\"set\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectorySetOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: EditLocalOpMetadata | undefined,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tmigrateIfSharedSerializable(op.value, this.serializer, this.handle);\n\t\t\t\t\tconst localValue: unknown = local ? undefined : op.value.value;\n\t\t\t\t\tsubdir.processSetMessage(msg, op, localValue, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tresubmit: (op: IDirectorySetOperation, localOpMetadata: EditLocalOpMetadata) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitKeyMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tthis.messageHandlers.set(\"createSubDirectory\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: SubDirLocalOpMetadata | undefined,\n\t\t\t) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (parentSubdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tparentSubdir.processCreateSubDirectoryMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tresubmit: (\n\t\t\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\t\t\tlocalOpMetadata: SubDirLocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\t// We don't reuse the metadata but send a new one on each submit.\n\t\t\t\t\tparentSubdir.resubmitSubDirectoryMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tthis.messageHandlers.set(\"deleteSubDirectory\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: SubDirLocalOpMetadata | undefined,\n\t\t\t) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (parentSubdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tparentSubdir.processDeleteSubDirectoryMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tresubmit: (\n\t\t\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\t\t\tlocalOpMetadata: SubDirLocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\t// We don't reuse the metadata but send a new one on each submit.\n\t\t\t\t\tparentSubdir.resubmitSubDirectoryMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(op: unknown): void {\n\t\tconst directoryOp = op as IDirectoryOperation;\n\t\tconst dir = this.getWorkingDirectory(directoryOp.path);\n\t\tswitch (directoryOp.type) {\n\t\t\tcase \"clear\": {\n\t\t\t\tdir?.clear();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"createSubDirectory\": {\n\t\t\t\tdir?.createSubDirectory(directoryOp.subdirName);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"delete\": {\n\t\t\t\tdir?.delete(directoryOp.key);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"deleteSubDirectory\": {\n\t\t\t\tdir?.deleteSubDirectory(directoryOp.subdirName);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"set\": {\n\t\t\t\tmigrateIfSharedSerializable(directoryOp.value, this.serializer, this.handle);\n\t\t\t\tdir?.set(directoryOp.key, directoryOp.value.value);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(directoryOp);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate serializeDirectory(\n\t\troot: SubDirectory,\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tlet counter = 0;\n\t\tconst blobs: string[] = [];\n\n\t\tconst stack: [SubDirectory, IDirectoryDataObject][] = [];\n\t\tconst content: IDirectoryDataObject = {};\n\t\tstack.push([root, content]);\n\n\t\twhile (stack.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst [currentSubDir, currentSubDirObject] = stack.pop()!;\n\t\t\tcurrentSubDirObject.ci = currentSubDir.getSerializableCreateInfo();\n\t\t\tfor (const [key, value] of currentSubDir.getSerializedStorage(serializer)) {\n\t\t\t\tif (!currentSubDirObject.storage) {\n\t\t\t\t\tcurrentSubDirObject.storage = {};\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\tconst result: ISerializableValue = {\n\t\t\t\t\ttype: value.type,\n\t\t\t\t\tvalue: value.value && (JSON.parse(value.value) as object),\n\t\t\t\t};\n\t\t\t\tif (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n\t\t\t\t\tconst extraContent: IDirectoryDataObject = {};\n\t\t\t\t\tlet largeContent = extraContent;\n\t\t\t\t\tif (currentSubDir.absolutePath !== posix.sep) {\n\t\t\t\t\t\tfor (const dir of currentSubDir.absolutePath.slice(1).split(posix.sep)) {\n\t\t\t\t\t\t\tconst subDataObject: IDirectoryDataObject = {};\n\t\t\t\t\t\t\tlargeContent.subdirectories = { [dir]: subDataObject };\n\t\t\t\t\t\t\tlargeContent = subDataObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlargeContent.storage = { [key]: result };\n\t\t\t\t\tconst blobName = `blob${counter}`;\n\t\t\t\t\tcounter++;\n\t\t\t\t\tblobs.push(blobName);\n\t\t\t\t\tbuilder.addBlob(blobName, JSON.stringify(extraContent));\n\t\t\t\t} else {\n\t\t\t\t\tcurrentSubDirObject.storage[key] = result;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [subdirName, subdir] of currentSubDir.subdirectories()) {\n\t\t\t\tif (!currentSubDirObject.subdirectories) {\n\t\t\t\t\tcurrentSubDirObject.subdirectories = {};\n\t\t\t\t}\n\t\t\t\tconst subDataObject: IDirectoryDataObject = {};\n\t\t\t\tcurrentSubDirObject.subdirectories[subdirName] = subDataObject;\n\t\t\t\tstack.push([subdir as SubDirectory, subDataObject]);\n\t\t\t}\n\t\t}\n\n\t\tconst newFormat: IDirectoryNewStorageFormat = {\n\t\t\tblobs,\n\t\t\tcontent,\n\t\t};\n\t\tbuilder.addBlob(snapshotFileName, JSON.stringify(newFormat));\n\n\t\treturn builder.getSummaryTree();\n\t}\n}\n\ninterface ICreateSubDirLocalOpMetadata {\n\ttype: \"createSubDir\";\n}\n\ninterface IDeleteSubDirLocalOpMetadata {\n\ttype: \"deleteSubDir\";\n\tsubDirectory: SubDirectory | undefined;\n}\n\ntype SubDirLocalOpMetadata = ICreateSubDirLocalOpMetadata | IDeleteSubDirLocalOpMetadata;\n\ntype EditLocalOpMetadata = PendingKeySet | PendingKeyDelete;\n\ntype ClearLocalOpMetadata = PendingClear;\n\ntype StorageLocalOpMetadata = EditLocalOpMetadata | ClearLocalOpMetadata;\n\n/**\n * Types of local op metadata.\n */\nexport type DirectoryLocalOpMetadata = StorageLocalOpMetadata | SubDirLocalOpMetadata;\n\n// eslint-disable-next-line @rushstack/no-new-null\nfunction assertNonNullClientId(clientId: string | null): asserts clientId is string {\n\tassert(clientId !== null, 0x6af /* client id should never be null */);\n}\n\nlet hasLoggedDirectoryInconsistency = false;\n\n/**\n * Node of the directory tree.\n * @sealed\n */\nclass SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirectory {\n\t/**\n\t * Tells if the sub directory is deleted or not.\n\t */\n\tprivate _deleted = false;\n\n\t/**\n\t * String representation for the class.\n\t */\n\tpublic [Symbol.toStringTag]: string = \"SubDirectory\";\n\n\t/**\n\t * The subdirectories the directory is holding.\n\t */\n\tprivate readonly _subdirectories = new Map<string, SubDirectory>();\n\n\t/**\n\t * Subdirectories that have been deleted locally but not yet ack'd from the server. This maintains the record\n\t * of delete op that are pending or yet to be acked from server. This is maintained just to track the locally\n\t * deleted sub directory.\n\t */\n\tprivate readonly pendingDeleteSubDirectoriesTracker = new Map<string, number>();\n\n\t/**\n\t * Subdirectories that have been created locally but not yet ack'd from the server. This maintains the record\n\t * of create op that are pending or yet to be acked from server. This is maintained just to track the locally\n\t * created sub directory.\n\t */\n\tprivate readonly pendingCreateSubDirectoriesTracker = new Map<string, number>();\n\n\t/**\n\t * Assigns a unique ID to each subdirectory created locally but pending for acknowledgement, facilitating the tracking\n\t * of the creation order.\n\t */\n\tpublic localCreationSeq: number = 0;\n\n\t/**\n\t * Maintains a bidirectional association between ack'd subdirectories and their seqData.\n\t * This helps to ensure iteration order which is consistent with the JS map spec.\n\t */\n\tpublic readonly ackedCreationSeqTracker: DirectoryCreationTracker;\n\n\t/**\n\t * Similar to {@link ackedCreationSeqTracker}, but for local (unacked) entries.\n\t */\n\tpublic readonly localCreationSeqTracker: DirectoryCreationTracker;\n\n\t/**\n\t * Constructor.\n\t * @param sequenceNumber - Message seq number at which this was created.\n\t * @param clientIds - Ids of client which created this directory.\n\t * @param directory - Reference back to the SharedDirectory to perform operations\n\t * @param runtime - The data store runtime this directory is associated with\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param absolutePath - The absolute path of this IDirectory\n\t */\n\tpublic constructor(\n\t\tprivate readonly seqData: SequenceData,\n\t\tprivate readonly clientIds: Set<string>,\n\t\tprivate readonly directory: SharedDirectory,\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tpublic readonly absolutePath: string,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tsuper();\n\t\tthis.localCreationSeqTracker = new DirectoryCreationTracker();\n\t\tthis.ackedCreationSeqTracker = new DirectoryCreationTracker();\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tthis._deleted = true;\n\t\tthis.emit(\"disposed\", this);\n\t}\n\n\t/**\n\t * Unmark the deleted property only when rolling back delete.\n\t */\n\tprivate undispose(): void {\n\t\tthis._deleted = false;\n\t\tthis.emit(\"undisposed\", this);\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this._deleted;\n\t}\n\n\tprivate throwIfDisposed(): void {\n\t\tif (this._deleted) {\n\t\t\tthrow new UsageError(\"Cannot access Disposed subDirectory\");\n\t\t}\n\t}\n\n\t/**\n\t * Checks whether the given key exists in this IDirectory.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\treturn this.optimisticallyHas(key);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.get}\n\t */\n\tpublic get<T = unknown>(key: string): T | undefined {\n\t\treturn this.getOptimisticValue(key) as T | undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.set}\n\t */\n\tpublic set<T = unknown>(key: string, value: T): this {\n\t\tthis.throwIfDisposed();\n\t\t// Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (key === undefined || key === null) {\n\t\t\tthrow new Error(\"Undefined and null keys are not supported\");\n\t\t}\n\t\tconst previousOptimisticLocalValue = this.getOptimisticValue(key);\n\n\t\t// Create a local value and serialize it.\n\t\tbindHandles(value, this.serializer, this.directory.handle);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\tthis.sequencedStorageData.set(key, value);\n\t\t\tconst event: IDirectoryValueChanged = {\n\t\t\t\tkey,\n\t\t\t\tpath: this.absolutePath,\n\t\t\t\tpreviousValue: previousOptimisticLocalValue,\n\t\t\t};\n\t\t\tthis.directory.emit(\"valueChanged\", event, true, this.directory);\n\t\t\tconst containedEvent: IValueChanged = {\n\t\t\t\tkey,\n\t\t\t\tpreviousValue: previousOptimisticLocalValue,\n\t\t\t};\n\t\t\tthis.emit(\"containedValueChanged\", containedEvent, true, this);\n\t\t\treturn this;\n\t\t}\n\n\t\t// A new pending key lifetime is created if:\n\t\t// 1. There isn't any pending entry for the key yet\n\t\t// 2. The most recent pending entry for the key was a deletion (as this terminates the prior lifetime)\n\t\t// 3. A clear was sent after the last pending entry for the key (which also terminates the prior lifetime)\n\t\tlet latestPendingEntry = findLast(\n\t\t\tthis.pendingStorageData,\n\t\t\t(entry) => entry.type === \"clear\" || entry.key === key,\n\t\t);\n\t\tif (\n\t\t\tlatestPendingEntry === undefined ||\n\t\t\tlatestPendingEntry.type === \"delete\" ||\n\t\t\tlatestPendingEntry.type === \"clear\"\n\t\t) {\n\t\t\tlatestPendingEntry = { type: \"lifetime\", path: this.absolutePath, key, keySets: [] };\n\t\t\tthis.pendingStorageData.push(latestPendingEntry);\n\t\t}\n\t\tconst pendingKeySet: PendingKeySet = {\n\t\t\ttype: \"set\",\n\t\t\tpath: this.absolutePath,\n\t\t\tvalue,\n\t\t};\n\t\tlatestPendingEntry.keySets.push(pendingKeySet);\n\n\t\tconst op: IDirectoryOperation = {\n\t\t\tkey,\n\t\t\tpath: this.absolutePath,\n\t\t\ttype: \"set\",\n\t\t\tvalue: { type: ValueType[ValueType.Plain], value },\n\t\t};\n\t\tthis.submitKeyMessage(op, pendingKeySet);\n\n\t\tconst directoryValueChanged: IDirectoryValueChanged = {\n\t\t\tkey,\n\t\t\tpath: this.absolutePath,\n\t\t\tpreviousValue: previousOptimisticLocalValue,\n\t\t};\n\t\tthis.directory.emit(\"valueChanged\", directoryValueChanged, true, this.directory);\n\t\tconst valueChanged: IValueChanged = {\n\t\t\tkey,\n\t\t\tpreviousValue: previousOptimisticLocalValue,\n\t\t};\n\t\tthis.emit(\"containedValueChanged\", valueChanged, true, this);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.countSubDirectory}\n\t */\n\tpublic countSubDirectory(): number {\n\t\treturn this._subdirectories.size;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.createSubDirectory}\n\t */\n\tpublic createSubDirectory(subdirName: string): IDirectory {\n\t\tthis.throwIfDisposed();\n\t\t// Undefined/null subdirectory names can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (subdirName === undefined || subdirName === null) {\n\t\t\tthrow new Error(\"SubDirectory name may not be undefined or null\");\n\t\t}\n\n\t\tif (subdirName.includes(posix.sep)) {\n\t\t\tthrow new Error(`SubDirectory name may not contain ${posix.sep}`);\n\t\t}\n\n\t\t// Create the sub directory locally first.\n\t\tconst isNew = this.createSubDirectoryCore(\n\t\t\tsubdirName,\n\t\t\ttrue,\n\t\t\tthis.getLocalSeq(),\n\t\t\tthis.runtime.clientId ?? \"detached\",\n\t\t);\n\t\tconst subDir = this._subdirectories.get(subdirName);\n\t\tassert(subDir !== undefined, 0x5aa /* subdirectory should exist after creation */);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn subDir;\n\t\t}\n\n\t\t// Only submit the op, if it is newly created.\n\t\tif (isNew) {\n\t\t\tconst op: IDirectoryCreateSubDirectoryOperation = {\n\t\t\t\tpath: this.absolutePath,\n\t\t\t\tsubdirName,\n\t\t\t\ttype: \"createSubDirectory\",\n\t\t\t};\n\t\t\tthis.submitCreateSubDirectoryMessage(op);\n\t\t}\n\n\t\treturn subDir;\n\t}\n\n\t/**\n\t * Gets the Sequence Data which should be used for local changes.\n\t *\n\t * @remarks While detached, 0 is used rather than -1 to represent a change which should be universally known (as opposed to known\n\t * only by the local client). This ensures that if the directory is later attached, none of its data needs to be updated (the values\n\t * last set while detached will now be known to any new client, until they are changed).\n\t *\n\t * The client sequence number is incremented by 1 for maintaining the internal order of locally created subdirectories\n\t *\n\t * @privateRemarks TODO: Convert these conventions to named constants. The semantics used here match those for merge-tree.\n\t */\n\tprivate getLocalSeq(): SequenceData {\n\t\treturn this.directory.isAttached()\n\t\t\t? { seq: -1, clientSeq: ++this.localCreationSeq }\n\t\t\t: { seq: 0, clientSeq: ++this.localCreationSeq };\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getSubDirectory}\n\t */\n\tpublic getSubDirectory(subdirName: string): IDirectory | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this._subdirectories.get(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.hasSubDirectory}\n\t */\n\tpublic hasSubDirectory(subdirName: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\treturn this._subdirectories.has(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.deleteSubDirectory}\n\t */\n\tpublic deleteSubDirectory(subdirName: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\t// Delete the sub directory locally first.\n\t\tconst subDir = this.deleteSubDirectoryCore(subdirName, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn subDir !== undefined;\n\t\t}\n\n\t\t// Only submit the op, if the directory existed and we deleted it.\n\t\tif (subDir !== undefined) {\n\t\t\tconst op: IDirectoryDeleteSubDirectoryOperation = {\n\t\t\t\tpath: this.absolutePath,\n\t\t\t\tsubdirName,\n\t\t\t\ttype: \"deleteSubDirectory\",\n\t\t\t};\n\n\t\t\tthis.submitDeleteSubDirectoryMessage(op, subDir);\n\t\t}\n\t\treturn subDir !== undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.subdirectories}\n\t */\n\tpublic subdirectories(): IterableIterator<[string, IDirectory]> {\n\t\tthis.throwIfDisposed();\n\t\tconst ackedSubdirsInOrder = this.ackedCreationSeqTracker.keys();\n\t\tconst localSubdirsInOrder = this.localCreationSeqTracker.keys(\n\t\t\t(key) => !this.ackedCreationSeqTracker.has(key),\n\t\t);\n\n\t\tconst subdirNames = [...ackedSubdirsInOrder, ...localSubdirsInOrder];\n\n\t\tif (subdirNames.length !== this._subdirectories.size) {\n\t\t\t// TODO: AB#7022: Hitting this block indicates that the eventual consistency scheme for ordering subdirectories\n\t\t\t// has failed. Fall back to previous directory behavior, which didn't guarantee ordering.\n\t\t\t// It's not currently clear how to reach this state, so log some diagnostics to help understand the issue.\n\t\t\t// This whole block should eventually be replaced by an assert that the two sizes align.\n\t\t\tif (!hasLoggedDirectoryInconsistency) {\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"inconsistentSubdirectoryOrdering\",\n\t\t\t\t\tlocalKeyCount: this.localCreationSeqTracker.size,\n\t\t\t\t\tackedKeyCount: this.ackedCreationSeqTracker.size,\n\t\t\t\t\tsubdirNamesLength: subdirNames.length,\n\t\t\t\t\tsubdirectoriesSize: this._subdirectories.size,\n\t\t\t\t});\n\t\t\t\thasLoggedDirectoryInconsistency = true;\n\t\t\t}\n\n\t\t\treturn this._subdirectories.entries();\n\t\t}\n\n\t\tconst entriesIterator = {\n\t\t\tindex: 0,\n\t\t\tdirs: this._subdirectories,\n\t\t\tnext(): IteratorResult<[string, IDirectory]> {\n\t\t\t\tif (this.index < subdirNames.length) {\n\t\t\t\t\t// Bounds check above guarantees non-null (at least at compile time, assuming all types are respected)\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst subdirName = subdirNames[this.index++]!;\n\t\t\t\t\tconst subdir = this.dirs.get(subdirName);\n\t\t\t\t\tassert(subdir !== undefined, 0x8ac /* Could not find expected sub-directory. */);\n\t\t\t\t\treturn { value: [subdirName, subdir], done: false };\n\t\t\t\t}\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t},\n\t\t\t[Symbol.iterator](): IterableIterator<[string, IDirectory]> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\n\t\treturn entriesIterator;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getWorkingDirectory}\n\t */\n\tpublic getWorkingDirectory(relativePath: string): IDirectory | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this.directory.getWorkingDirectory(this.makeAbsolute(relativePath));\n\t}\n\n\t/**\n\t * This checks if there is pending delete op for local delete for a given child subdirectory.\n\t * @param subDirName - directory name.\n\t * @returns true if there is pending delete.\n\t */\n\tpublic isSubDirectoryDeletePending(subDirName: string): boolean {\n\t\tif (this.pendingDeleteSubDirectoriesTracker.has(subDirName)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Deletes the given key from within this IDirectory.\n\t * @param key - The key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\tconst previousOptimisticLocalValue = this.getOptimisticValue(key);\n\n\t\tif (!this.directory.isAttached()) {\n\t\t\tconst successfullyRemoved = this.sequencedStorageData.delete(key);\n\t\t\t// Only emit if we actually deleted something.\n\t\t\tif (previousOptimisticLocalValue !== undefined && successfullyRemoved) {\n\t\t\t\tconst event: IDirectoryValueChanged = {\n\t\t\t\t\tkey,\n\t\t\t\t\tpath: this.absolutePath,\n\t\t\t\t\tpreviousValue: previousOptimisticLocalValue,\n\t\t\t\t};\n\t\t\t\tthis.directory.emit(\"valueChanged\", event, true, this.directory);\n\t\t\t\tconst containedEvent: IValueChanged = {\n\t\t\t\t\tkey,\n\t\t\t\t\tpreviousValue: previousOptimisticLocalValue,\n\t\t\t\t};\n\t\t\t\tthis.emit(\"containedValueChanged\", containedEvent, true, this);\n\t\t\t}\n\t\t\treturn successfullyRemoved;\n\t\t}\n\n\t\tconst pendingKeyDelete: PendingKeyDelete = {\n\t\t\ttype: \"delete\",\n\t\t\tpath: this.absolutePath,\n\t\t\tkey,\n\t\t};\n\t\tthis.pendingStorageData.push(pendingKeyDelete);\n\n\t\tconst op: IDirectoryOperation = {\n\t\t\tkey,\n\t\t\ttype: \"delete\",\n\t\t\tpath: this.absolutePath,\n\t\t};\n\t\tthis.submitKeyMessage(op, pendingKeyDelete);\n\t\t// Only emit if we locally believe we deleted something. Otherwise we still send the op\n\t\t// (permitting speculative deletion even if we don't see anything locally) but don't emit\n\t\t// a valueChanged since we in fact did not locally observe a value change.\n\t\tif (previousOptimisticLocalValue !== undefined) {\n\t\t\tconst event: IDirectoryValueChanged = {\n\t\t\t\tkey,\n\t\t\t\tpath: this.absolutePath,\n\t\t\t\tpreviousValue: previousOptimisticLocalValue,\n\t\t\t};\n\t\t\tthis.directory.emit(\"valueChanged\", event, true, this.directory);\n\t\t\tconst containedEvent: IValueChanged = {\n\t\t\t\tkey,\n\t\t\t\tpreviousValue: previousOptimisticLocalValue,\n\t\t\t};\n\t\t\tthis.emit(\"containedValueChanged\", containedEvent, true, this);\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Deletes all keys from within this IDirectory.\n\t */\n\tpublic clear(): void {\n\t\tthis.throwIfDisposed();\n\n\t\tif (!this.directory.isAttached()) {\n\t\t\tthis.sequencedStorageData.clear();\n\t\t\tthis.directory.emit(\"clear\", true, this.directory);\n\t\t\treturn;\n\t\t}\n\n\t\tconst pendingClear: PendingClear = {\n\t\t\ttype: \"clear\",\n\t\t\tpath: this.absolutePath,\n\t\t};\n\t\tthis.pendingStorageData.push(pendingClear);\n\n\t\tthis.directory.emit(\"clear\", true, this.directory);\n\t\tconst op: IDirectoryOperation = {\n\t\t\ttype: \"clear\",\n\t\t\tpath: this.absolutePath,\n\t\t};\n\t\tthis.submitClearMessage(op, pendingClear);\n\t}\n\n\t/**\n\t * Issue a callback on each entry under this IDirectory.\n\t * @param callback - Callback to issue\n\t */\n\tpublic forEach(\n\t\tcallback: (value: unknown, key: string, map: Map<string, unknown>) => void,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tfor (const [key, localValue] of this.internalIterator()) {\n\t\t\tcallback((localValue as { value: unknown }).value, key, this);\n\t\t}\n\t}\n\n\t/**\n\t * The number of entries under this IDirectory.\n\t */\n\tpublic get size(): number {\n\t\tthis.throwIfDisposed();\n\t\treturn [...this.internalIterator()].length;\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic entries(): IterableIterator<[string, unknown]> {\n\t\tthis.throwIfDisposed();\n\t\tconst internalIterator = this.internalIterator();\n\t\tconst next = (): IteratorResult<[string, unknown]> => {\n\t\t\tconst nextResult = internalIterator.next();\n\t\t\tif (nextResult.done) {\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t}\n\t\t\t// Unpack the stored value\n\t\t\tconst [key, localValue] = nextResult.value;\n\t\t\treturn { value: [key, localValue], done: false };\n\t\t};\n\n\t\tconst iterator = {\n\t\t\tnext,\n\t\t\t[Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the keys under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\tthis.throwIfDisposed();\n\t\tconst internalIterator = this.internalIterator();\n\t\tconst next = (): IteratorResult<string> => {\n\t\t\tconst nextResult = internalIterator.next();\n\t\t\tif (nextResult.done) {\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t}\n\t\t\tconst [key] = nextResult.value;\n\t\t\treturn { value: key, done: false };\n\t\t};\n\t\tconst iterator = {\n\t\t\tnext,\n\t\t\t[Symbol.iterator](): IterableIterator<string> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the values under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<unknown> {\n\t\tthis.throwIfDisposed();\n\t\tconst internalIterator = this.internalIterator();\n\t\tconst next = (): IteratorResult<unknown> => {\n\t\t\tconst nextResult = internalIterator.next();\n\t\t\tif (nextResult.done) {\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t}\n\t\t\tconst [, localValue] = nextResult.value;\n\t\t\treturn { value: localValue, done: false };\n\t\t};\n\t\tconst iterator = {\n\t\t\tnext,\n\t\t\t[Symbol.iterator](): IterableIterator<unknown> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic [Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\tthis.throwIfDisposed();\n\t\treturn this.internalIterator();\n\t}\n\n\t/**\n\t * The data this SubDirectory instance is storing, but only including sequenced values (no local pending\n\t * modifications are included).\n\t */\n\tprivate readonly sequencedStorageData = new Map<string, unknown>();\n\n\t/**\n\t * A data structure containing all local pending storage modifications, which is used in combination\n\t * with the sequencedStorageData to compute optimistic values.\n\t *\n\t * Pending sets are aggregated into \"lifetimes\", which permit correct relative iteration order\n\t * even across remote operations and rollbacks.\n\t */\n\tprivate readonly pendingStorageData: PendingStorageEntry[] = [];\n\n\t/**\n\t * An internal iterator that iterates over the entries in the directory.\n\t */\n\tprivate readonly internalIterator = (): IterableIterator<[string, unknown]> => {\n\t\t// We perform iteration in two steps - first by iterating over members of the sequenced storage data that are not\n\t\t// optimistically deleted or cleared, and then over the pending data lifetimes that have not subsequently\n\t\t// been deleted or cleared. In total, this give an ordering of members based on when they were initially\n\t\t// added to the sub directory (even if they were later modified), similar to the native Map.\n\t\tconst sequencedStorageDataIterator = this.sequencedStorageData.keys();\n\t\tconst pendingStorageDataIterator = this.pendingStorageData.values();\n\t\tconst next = (): IteratorResult<[string, unknown]> => {\n\t\t\tlet nextSequencedKey = sequencedStorageDataIterator.next();\n\t\t\twhile (!nextSequencedKey.done) {\n\t\t\t\tconst key = nextSequencedKey.value;\n\t\t\t\t// If we have any pending deletes or clears, then we won't iterate to this key yet (if at all).\n\t\t\t\t// Either it is optimistically deleted and will not be part of the iteration, or it was\n\t\t\t\t// re-added later and we'll iterate to it when we get to the pending data.\n\t\t\t\tif (\n\t\t\t\t\t!this.pendingStorageData.some(\n\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\tentry.type === \"clear\" || (entry.type === \"delete\" && entry.key === key),\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tassert(this.has(key), 0xc03 /* key should exist in sequenced or pending data */);\n\t\t\t\t\tconst optimisticValue = this.getOptimisticValue(key);\n\t\t\t\t\treturn { value: [key, optimisticValue], done: false };\n\t\t\t\t}\n\t\t\t\tnextSequencedKey = sequencedStorageDataIterator.next();\n\t\t\t}\n\n\t\t\tlet nextPending = pendingStorageDataIterator.next();\n\t\t\twhile (!nextPending.done) {\n\t\t\t\tconst nextPendingEntry = nextPending.value;\n\t\t\t\t// A lifetime entry may need to be iterated.\n\t\t\t\tif (nextPendingEntry.type === \"lifetime\") {\n\t\t\t\t\tconst nextPendingEntryIndex = this.pendingStorageData.indexOf(nextPendingEntry);\n\t\t\t\t\tconst mostRecentDeleteOrClearIndex = findLastIndex(\n\t\t\t\t\t\tthis.pendingStorageData,\n\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\tentry.type === \"clear\" ||\n\t\t\t\t\t\t\t(entry.type === \"delete\" && entry.key === nextPendingEntry.key),\n\t\t\t\t\t);\n\t\t\t\t\t// Only iterate the pending entry now if it hasn't been deleted or cleared.\n\t\t\t\t\tif (nextPendingEntryIndex > mostRecentDeleteOrClearIndex) {\n\t\t\t\t\t\tconst latestPendingValue =\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\tnextPendingEntry.keySets[nextPendingEntry.keySets.length - 1]!;\n\t\t\t\t\t\t// Skip iterating if we would have would have already iterated it as part of the sequenced data.\n\t\t\t\t\t\t// This is not a perfect check in the case the map has changed since the iterator was created\n\t\t\t\t\t\t// (e.g. if a remote client added the same key in the meantime).\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!this.sequencedStorageData.has(nextPendingEntry.key) ||\n\t\t\t\t\t\t\tmostRecentDeleteOrClearIndex !== -1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn { value: [nextPendingEntry.key, latestPendingValue.value], done: false };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnextPending = pendingStorageDataIterator.next();\n\t\t\t}\n\n\t\t\treturn { value: undefined, done: true };\n\t\t};\n\n\t\tconst iterator = {\n\t\t\tnext,\n\t\t\t[Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t};\n\n\t/**\n\t * Compute the optimistic local value for a given key. This combines the sequenced data with\n\t * any pending changes that have not yet been sequenced.\n\t */\n\tprivate readonly getOptimisticValue = (key: string): unknown => {\n\t\tconst latestPendingEntry = findLast(\n\t\t\tthis.pendingStorageData,\n\t\t\t(entry) => entry.type === \"clear\" || entry.key === key,\n\t\t);\n\n\t\tif (latestPendingEntry === undefined) {\n\t\t\treturn this.sequencedStorageData.get(key);\n\t\t} else if (latestPendingEntry.type === \"lifetime\") {\n\t\t\tconst latestPendingSet =\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tlatestPendingEntry.keySets[latestPendingEntry.keySets.length - 1]!;\n\t\t\treturn latestPendingSet.value;\n\t\t} else {\n\t\t\t// Delete or clear\n\t\t\treturn undefined;\n\t\t}\n\t};\n\n\t/**\n\t * Determine if the directory optimistically has the key.\n\t * This will return true even if the value is undefined.\n\t */\n\tprivate readonly optimisticallyHas = (key: string): boolean => {\n\t\tconst latestPendingEntry = findLast(\n\t\t\tthis.pendingStorageData,\n\t\t\t(entry) => entry.type === \"clear\" || entry.key === key,\n\t\t);\n\n\t\treturn latestPendingEntry === undefined\n\t\t\t? this.sequencedStorageData.has(key)\n\t\t\t: latestPendingEntry.type === \"lifetime\";\n\t};\n\n\t/**\n\t * Process a clear operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tpublic processClearMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryClearOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: ClearLocalOpMetadata | undefined,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (!this.isMessageForCurrentInstanceOfSubDirectory(msg)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (local) {\n\t\t\tthis.sequencedStorageData.clear();\n\t\t\tconst pendingClear = this.pendingStorageData.shift();\n\t\t\tassert(\n\t\t\t\tpendingClear !== undefined &&\n\t\t\t\t\tpendingClear.type === \"clear\" &&\n\t\t\t\t\tpendingClear === localOpMetadata,\n\t\t\t\t0xc04 /* Got a local clear message we weren't expecting */,\n\t\t\t);\n\t\t} else {\n\t\t\t// For pending set operations, collect the previous values before clearing sequenced data\n\t\t\tconst pendingSets: { key: string; previousValue: unknown }[] = [];\n\t\t\tfor (const entry of this.pendingStorageData) {\n\t\t\t\tif (entry.type === \"lifetime\") {\n\t\t\t\t\tconst previousValue = this.sequencedStorageData.get(entry.key);\n\t\t\t\t\tpendingSets.push({ key: entry.key, previousValue });\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.sequencedStorageData.clear();\n\n\t\t\t// Only emit for remote ops, we would have already emitted for local ops. Only emit if there\n\t\t\t// is no optimistically-applied local pending clear that would supersede this remote clear.\n\t\t\tif (!this.pendingStorageData.some((entry) => entry.type === \"clear\")) {\n\t\t\t\tthis.directory.emit(\"clear\", local, this.directory);\n\t\t\t}\n\n\t\t\t// For pending set operations, emit valueChanged events\n\t\t\tfor (const { key, previousValue } of pendingSets) {\n\t\t\t\tthis.directory.emit(\n\t\t\t\t\t\"valueChanged\",\n\t\t\t\t\t{\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tpreviousValue,\n\t\t\t\t\t},\n\t\t\t\t\tlocal,\n\t\t\t\t\tthis.directory,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process a delete operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tpublic processDeleteMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryDeleteOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: EditLocalOpMetadata | undefined,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (!this.isMessageForCurrentInstanceOfSubDirectory(msg)) {\n\t\t\treturn;\n\t\t}\n\t\tif (local) {\n\t\t\tconst pendingEntryIndex = this.pendingStorageData.findIndex(\n\t\t\t\t(entry) => entry.type !== \"clear\" && entry.key === op.key,\n\t\t\t);\n\t\t\tconst pendingEntry = this.pendingStorageData[pendingEntryIndex];\n\t\t\tassert(\n\t\t\t\tpendingEntry !== undefined &&\n\t\t\t\t\tpendingEntry.type === \"delete\" &&\n\t\t\t\t\tpendingEntry.key === op.key,\n\t\t\t\t0xc05 /* Got a local delete message we weren't expecting */,\n\t\t\t);\n\t\t\tthis.pendingStorageData.splice(pendingEntryIndex, 1);\n\t\t\tthis.sequencedStorageData.delete(op.key);\n\t\t} else {\n\t\t\tconst previousValue: unknown = this.sequencedStorageData.get(op.key);\n\t\t\tthis.sequencedStorageData.delete(op.key);\n\t\t\t// Suppress the event if local changes would cause the incoming change to be invisible optimistically.\n\t\t\tif (\n\t\t\t\t!this.pendingStorageData.some(\n\t\t\t\t\t(entry) => entry.type === \"clear\" || entry.key === op.key,\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tconst event: IDirectoryValueChanged = {\n\t\t\t\t\tkey: op.key,\n\t\t\t\t\tpath: this.absolutePath,\n\t\t\t\t\tpreviousValue,\n\t\t\t\t};\n\t\t\t\tthis.directory.emit(\"valueChanged\", event, local, this.directory);\n\t\t\t\tconst containedEvent: IValueChanged = { key: op.key, previousValue };\n\t\t\t\tthis.emit(\"containedValueChanged\", containedEvent, local, this);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process a set operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tpublic processSetMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectorySetOperation,\n\t\tvalue: unknown,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: EditLocalOpMetadata | undefined,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (!this.isMessageForCurrentInstanceOfSubDirectory(msg)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { key } = op;\n\n\t\tif (local) {\n\t\t\tconst pendingEntryIndex = this.pendingStorageData.findIndex(\n\t\t\t\t(entry) => entry.type !== \"clear\" && entry.key === key,\n\t\t\t);\n\t\t\tconst pendingEntry = this.pendingStorageData[pendingEntryIndex];\n\t\t\tassert(\n\t\t\t\tpendingEntry !== undefined && pendingEntry.type === \"lifetime\",\n\t\t\t\t0xc06 /* Couldn't match local set message to pending lifetime */,\n\t\t\t);\n\t\t\tconst pendingKeySet = pendingEntry.keySets.shift();\n\t\t\tassert(\n\t\t\t\tpendingKeySet !== undefined && pendingKeySet === localOpMetadata,\n\t\t\t\t0xc07 /* Got a local set message we weren't expecting */,\n\t\t\t);\n\t\t\tif (pendingEntry.keySets.length === 0) {\n\t\t\t\tthis.pendingStorageData.splice(pendingEntryIndex, 1);\n\t\t\t}\n\n\t\t\tthis.sequencedStorageData.set(key, pendingKeySet.value);\n\t\t} else {\n\t\t\t// Get the previous value before setting the new value\n\t\t\tconst previousValue: unknown = this.sequencedStorageData.get(key);\n\t\t\tthis.sequencedStorageData.set(key, value);\n\n\t\t\t// Suppress the event if local changes would cause the incoming change to be invisible optimistically.\n\t\t\tif (\n\t\t\t\t!this.pendingStorageData.some((entry) => entry.type === \"clear\" || entry.key === key)\n\t\t\t) {\n\t\t\t\tconst event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };\n\t\t\t\tthis.directory.emit(\"valueChanged\", event, local, this.directory);\n\t\t\t\tconst containedEvent: IValueChanged = { key, previousValue };\n\t\t\t\tthis.emit(\"containedValueChanged\", containedEvent, local, this);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process a create subdirectory operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tpublic processCreateSubDirectoryMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: SubDirLocalOpMetadata | undefined,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tassertNonNullClientId(msg.clientId);\n\t\tthis.createSubDirectoryCore(\n\t\t\top.subdirName,\n\t\t\tlocal,\n\t\t\t{ seq: msg.sequenceNumber, clientSeq: msg.clientSequenceNumber },\n\t\t\tmsg.clientId,\n\t\t);\n\t}\n\n\t/**\n\t * Process a delete subdirectory operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tpublic processDeleteSubDirectoryMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: SubDirLocalOpMetadata | undefined,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deleteSubDirectoryCore(op.subdirName, local);\n\t}\n\n\t/**\n\t * Submit a clear operation.\n\t * @param op - The operation\n\t * @param localOpMetadata - The pending operation metadata\n\t */\n\tprivate submitClearMessage(\n\t\top: IDirectoryClearOperation,\n\t\tlocalOpMetadata: ClearLocalOpMetadata,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.directory.submitDirectoryMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * Resubmit a clear operation.\n\t * @param op - The operation\n\t */\n\tpublic resubmitClearMessage(\n\t\top: IDirectoryClearOperation,\n\t\tlocalOpMetadata: ClearLocalOpMetadata,\n\t): void {\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tconst pendingEntryIndex = this.pendingStorageData.findIndex(\n\t\t\t(entry) => entry.type === \"clear\",\n\t\t);\n\t\tconst pendingEntry = this.pendingStorageData[pendingEntryIndex];\n\t\tif (pendingEntry !== undefined) {\n\t\t\tthis.submitClearMessage(op, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * Submit a key operation.\n\t * @param op - The operation\n\t * @param localOpMetadata - The pending operation metadata\n\t */\n\tprivate submitKeyMessage(\n\t\top: IDirectoryKeyOperation,\n\t\tlocalOpMetadata: PendingKeySet | PendingKeyDelete,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.directory.submitDirectoryMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * Submit a key message to remote clients based on a previous submit.\n\t * @param op - The map key message\n\t * @param localOpMetadata - Metadata from the previous submit\n\t */\n\tpublic resubmitKeyMessage(\n\t\top: IDirectoryKeyOperation,\n\t\tlocalOpMetadata: EditLocalOpMetadata,\n\t): void {\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tconst pendingEntryIndex = this.pendingStorageData.findIndex(\n\t\t\t(entry) => entry.type !== \"clear\" && entry.key === op.key,\n\t\t);\n\t\tconst pendingEntry = this.pendingStorageData[pendingEntryIndex];\n\t\tif (pendingEntry !== undefined) {\n\t\t\tthis.submitKeyMessage(op, localOpMetadata as PendingKeySet | PendingKeyDelete);\n\t\t}\n\t}\n\n\tprivate incrementPendingSubDirCount(map: Map<string, number>, subDirName: string): void {\n\t\tconst count = map.get(subDirName) ?? 0;\n\t\tmap.set(subDirName, count + 1);\n\t}\n\n\tprivate decrementPendingSubDirCount(map: Map<string, number>, subDirName: string): void {\n\t\tconst count = map.get(subDirName) ?? 0;\n\t\tmap.set(subDirName, count - 1);\n\t\tif (count <= 1) {\n\t\t\tmap.delete(subDirName);\n\t\t}\n\t}\n\n\t/**\n\t * Update the count for pending create/delete of the sub directory so that it can be validated on receiving op\n\t * or while resubmitting the op.\n\t */\n\tprivate updatePendingSubDirMessageCount(op: IDirectorySubDirectoryOperation): void {\n\t\tif (op.type === \"deleteSubDirectory\") {\n\t\t\tthis.incrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, op.subdirName);\n\t\t} else if (op.type === \"createSubDirectory\") {\n\t\t\tthis.incrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, op.subdirName);\n\t\t}\n\t}\n\n\t/**\n\t * Submit a create subdirectory operation.\n\t * @param op - The operation\n\t */\n\tprivate submitCreateSubDirectoryMessage(op: IDirectorySubDirectoryOperation): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.updatePendingSubDirMessageCount(op);\n\n\t\tconst localOpMetadata: ICreateSubDirLocalOpMetadata = {\n\t\t\ttype: \"createSubDir\",\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * Submit a delete subdirectory operation.\n\t * @param op - The operation\n\t * @param subDir - Any subdirectory deleted by the op\n\t */\n\tprivate submitDeleteSubDirectoryMessage(\n\t\top: IDirectorySubDirectoryOperation,\n\t\tsubDir: SubDirectory,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.updatePendingSubDirMessageCount(op);\n\n\t\tconst localOpMetadata: IDeleteSubDirLocalOpMetadata = {\n\t\t\ttype: \"deleteSubDir\",\n\t\t\tsubDirectory: subDir,\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * Submit a subdirectory operation again\n\t * @param op - The operation\n\t * @param localOpMetadata - metadata submitted with the op originally\n\t */\n\tpublic resubmitSubDirectoryMessage(\n\t\top: IDirectorySubDirectoryOperation,\n\t\tlocalOpMetadata: SubDirLocalOpMetadata,\n\t): void {\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tif (\n\t\t\tlocalOpMetadata.type === \"createSubDir\" &&\n\t\t\t!this.pendingCreateSubDirectoriesTracker.has(op.subdirName)\n\t\t) {\n\t\t\treturn;\n\t\t} else if (\n\t\t\tlocalOpMetadata.type === \"deleteSubDir\" &&\n\t\t\t!this.pendingDeleteSubDirectoriesTracker.has(op.subdirName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (localOpMetadata.type === \"createSubDir\") {\n\t\t\tthis.decrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, op.subdirName);\n\t\t\tthis.submitCreateSubDirectoryMessage(op);\n\t\t} else if (localOpMetadata.type === \"deleteSubDir\") {\n\t\t\tthis.decrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, op.subdirName);\n\t\t\tassert(\n\t\t\t\tlocalOpMetadata.subDirectory !== undefined,\n\t\t\t\t0xc08 /* localOpMetadata.subDirectory should be defined */,\n\t\t\t);\n\t\t\tthis.submitDeleteSubDirectoryMessage(op, localOpMetadata.subDirectory);\n\t\t}\n\t}\n\n\t/**\n\t * Get the storage of this subdirectory in a serializable format, to be used in snapshotting.\n\t * @param serializer - The serializer to use to serialize handles in its values.\n\t * @returns The JSONable string representing the storage of this subdirectory\n\t */\n\tpublic *getSerializedStorage(\n\t\tserializer: IFluidSerializer,\n\t): Generator<[string, ISerializedValue], void> {\n\t\tthis.throwIfDisposed();\n\t\tfor (const [key, value] of this.sequencedStorageData.entries()) {\n\t\t\tconst serializedValue = serializeValue(value, serializer, this.directory.handle);\n\t\t\tconst res: [string, ISerializedValue] = [key, serializedValue];\n\t\t\tyield res;\n\t\t}\n\t}\n\n\tpublic getSerializableCreateInfo(): ICreateInfo {\n\t\tthis.throwIfDisposed();\n\t\tconst createInfo: ICreateInfo = {\n\t\t\tcsn: this.seqData.seq,\n\t\t\tccIds: [...this.clientIds],\n\t\t};\n\t\treturn createInfo;\n\t}\n\n\t/**\n\t * Populate a key value in this subdirectory's storage, to be used when loading from snapshot.\n\t * @param key - The key to populate\n\t * @param localValue - The local value to populate into it\n\t */\n\tpublic populateStorage(key: string, value: unknown): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.sequencedStorageData.set(key, value);\n\t}\n\n\t/**\n\t * Populate a subdirectory into this subdirectory, to be used when loading from snapshot.\n\t * @param subdirName - The name of the subdirectory to add\n\t * @param newSubDir - The new subdirectory to add\n\t */\n\tpublic populateSubDirectory(subdirName: string, newSubDir: SubDirectory): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.registerEventsOnSubDirectory(newSubDir, subdirName);\n\t\tthis._subdirectories.set(subdirName, newSubDir);\n\t}\n\n\t/**\n\t * Rollback a local op\n\t * @param op - The operation to rollback\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic rollback(op: any, localOpMetadata: DirectoryLocalOpMetadata): void {\n\t\tconst directoryOp = op as IDirectoryOperation;\n\n\t\tif (directoryOp.type === \"clear\") {\n\t\t\t// A pending clear will be last in the list, since it terminates all prior lifetimes.\n\t\t\tconst pendingClear = this.pendingStorageData.pop();\n\t\t\tassert(\n\t\t\t\tpendingClear !== undefined &&\n\t\t\t\t\tpendingClear.type === \"clear\" &&\n\t\t\t\t\tlocalOpMetadata.type === \"clear\",\n\t\t\t\t0xc09 /* Unexpected clear rollback */,\n\t\t\t);\n\t\t\tfor (const [key] of this.internalIterator()) {\n\t\t\t\tconst event: IDirectoryValueChanged = {\n\t\t\t\t\tkey,\n\t\t\t\t\tpath: this.absolutePath,\n\t\t\t\t\tpreviousValue: undefined,\n\t\t\t\t};\n\t\t\t\tthis.directory.emit(\"valueChanged\", event, true, this.directory);\n\t\t\t\tconst containedEvent: IValueChanged = { key, previousValue: undefined };\n\t\t\t\tthis.emit(\"containedValueChanged\", containedEvent, true, this);\n\t\t\t}\n\t\t} else if (\n\t\t\t(directoryOp.type === \"delete\" || directoryOp.type === \"set\") &&\n\t\t\t(localOpMetadata.type === \"set\" || localOpMetadata.type === \"delete\")\n\t\t) {\n\t\t\t// A pending set/delete may not be last in the list, as the lifetimes' order is based on when\n\t\t\t// they were created, not when they were last modified.\n\t\t\tconst pendingEntryIndex = findLastIndex(\n\t\t\t\tthis.pendingStorageData,\n\t\t\t\t(entry) => entry.type !== \"clear\" && entry.key === directoryOp.key,\n\t\t\t);\n\t\t\tconst pendingEntry = this.pendingStorageData[pendingEntryIndex];\n\t\t\tassert(\n\t\t\t\tpendingEntry !== undefined &&\n\t\t\t\t\t(pendingEntry.type === \"delete\" || pendingEntry.type === \"lifetime\"),\n\t\t\t\t0xc0a /* Unexpected pending data for set/delete op */,\n\t\t\t);\n\t\t\tif (pendingEntry.type === \"delete\") {\n\t\t\t\tassert(pendingEntry === localOpMetadata, 0xc0b /* Unexpected delete rollback */);\n\t\t\t\tthis.pendingStorageData.splice(pendingEntryIndex, 1);\n\t\t\t\t// Only emit if rolling back the delete actually results in a value becoming visible.\n\t\t\t\tif (this.getOptimisticValue(directoryOp.key) !== undefined) {\n\t\t\t\t\tconst event: IDirectoryValueChanged = {\n\t\t\t\t\t\tkey: directoryOp.key,\n\t\t\t\t\t\tpath: this.absolutePath,\n\t\t\t\t\t\tpreviousValue: undefined,\n\t\t\t\t\t};\n\t\t\t\t\tthis.directory.emit(\"valueChanged\", event, true, this.directory);\n\t\t\t\t\tconst containedEvent: IValueChanged = {\n\t\t\t\t\t\tkey: directoryOp.key,\n\t\t\t\t\t\tpreviousValue: undefined,\n\t\t\t\t\t};\n\t\t\t\t\tthis.emit(\"containedValueChanged\", containedEvent, true, this);\n\t\t\t\t}\n\t\t\t} else if (pendingEntry.type === \"lifetime\") {\n\t\t\t\tconst pendingKeySet = pendingEntry.keySets.pop();\n\t\t\t\tassert(\n\t\t\t\t\tpendingKeySet !== undefined && pendingKeySet === localOpMetadata,\n\t\t\t\t\t0xc0c /* Unexpected set rollback */,\n\t\t\t\t);\n\t\t\t\tif (pendingEntry.keySets.length === 0) {\n\t\t\t\t\tthis.pendingStorageData.splice(pendingEntryIndex, 1);\n\t\t\t\t}\n\t\t\t\tconst event: IDirectoryValueChanged = {\n\t\t\t\t\tkey: directoryOp.key,\n\t\t\t\t\tpath: this.absolutePath,\n\t\t\t\t\tpreviousValue: pendingKeySet.value,\n\t\t\t\t};\n\t\t\t\tthis.directory.emit(\"valueChanged\", event, true, this.directory);\n\t\t\t\tconst containedEvent: IValueChanged = {\n\t\t\t\t\tkey: directoryOp.key,\n\t\t\t\t\tpreviousValue: pendingKeySet.value,\n\t\t\t\t};\n\t\t\t\tthis.emit(\"containedValueChanged\", containedEvent, true, this);\n\t\t\t}\n\t\t} else if (\n\t\t\tdirectoryOp.type === \"createSubDirectory\" &&\n\t\t\tlocalOpMetadata.type === \"createSubDir\"\n\t\t) {\n\t\t\tconst subdirName: unknown = directoryOp.subdirName;\n\t\t\tassert(\n\t\t\t\tsubdirName !== undefined,\n\t\t\t\t0x8af /* \"subdirName\" property is missing from \"createSubDirectory\" operation. */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\ttypeof subdirName === \"string\",\n\t\t\t\t0x8b0 /* \"subdirName\" property in \"createSubDirectory\" operation is misconfigured. Expected a string. */,\n\t\t\t);\n\n\t\t\tthis.deleteSubDirectoryCore(subdirName, true);\n\t\t\tthis.decrementPendingSubDirCount(this.pendingCreateSubDirectoriesTracker, subdirName);\n\t\t} else if (\n\t\t\tdirectoryOp.type === \"deleteSubDirectory\" &&\n\t\t\tlocalOpMetadata.type === \"deleteSubDir\"\n\t\t) {\n\t\t\tconst subdirName: unknown = directoryOp.subdirName;\n\t\t\tassert(\n\t\t\t\tsubdirName !== undefined,\n\t\t\t\t0x8b1 /* \"subdirName\" property is missing from \"deleteSubDirectory\" operation. */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\ttypeof subdirName === \"string\",\n\t\t\t\t0x8b2 /* \"subdirName\" property in \"deleteSubDirectory\" operation is misconfigured. Expected a string. */,\n\t\t\t);\n\n\t\t\tif (localOpMetadata.subDirectory !== undefined) {\n\t\t\t\tthis.undeleteSubDirectoryTree(localOpMetadata.subDirectory);\n\t\t\t\t// don't need to register events because deleting never unregistered\n\t\t\t\tthis._subdirectories.set(subdirName, localOpMetadata.subDirectory);\n\t\t\t\t// Restore the record in creation tracker\n\t\t\t\tif (isAcknowledgedOrDetached(localOpMetadata.subDirectory.seqData)) {\n\t\t\t\t\tthis.ackedCreationSeqTracker.set(subdirName, {\n\t\t\t\t\t\t...localOpMetadata.subDirectory.seqData,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis.localCreationSeqTracker.set(subdirName, {\n\t\t\t\t\t\t...localOpMetadata.subDirectory.seqData,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis.emit(\"subDirectoryCreated\", subdirName, true, this);\n\t\t\t}\n\n\t\t\tthis.decrementPendingSubDirCount(this.pendingDeleteSubDirectoriesTracker, subdirName);\n\t\t} else {\n\t\t\tthrow new Error(\"Unsupported op for rollback\");\n\t\t}\n\t}\n\n\t/**\n\t * Converts the given relative path into an absolute path.\n\t * @param path - Relative path to convert\n\t * @returns The equivalent absolute path\n\t */\n\tprivate makeAbsolute(relativePath: string): string {\n\t\treturn posix.resolve(this.absolutePath, relativePath);\n\t}\n\n\t/**\n\t * This return true if the message is for the current instance of this sub directory. As the sub directory\n\t * can be deleted and created again, then this finds if the message is for current instance of directory or not.\n\t * @param msg - message for the directory\n\t */\n\tprivate isMessageForCurrentInstanceOfSubDirectory(msg: ISequencedDocumentMessage): boolean {\n\t\t// If the message is either from the creator of directory or this directory was created when\n\t\t// container was detached or in case this directory is already live(known to other clients)\n\t\t// and the op was created after the directory was created then apply this op.\n\t\treturn (\n\t\t\t(msg.clientId !== null && this.clientIds.has(msg.clientId)) ||\n\t\t\tthis.clientIds.has(\"detached\") ||\n\t\t\t(this.seqData.seq !== -1 && this.seqData.seq <= msg.referenceSequenceNumber)\n\t\t);\n\t}\n\n\t/**\n\t * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n\t * not process the incoming operation.\n\t * @param op - Operation to check\n\t * @param local - Whether the message originated from the local client\n\t * @param message - The message\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation should be processed, false otherwise\n\t */\n\tprivate needProcessSubDirectoryOperation(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectorySubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: SubDirLocalOpMetadata | undefined,\n\t): boolean {\n\t\tassertNonNullClientId(msg.clientId);\n\t\tconst pendingDeleteCount = this.pendingDeleteSubDirectoriesTracker.get(op.subdirName);\n\t\tconst pendingCreateCount = this.pendingCreateSubDirectoriesTracker.get(op.subdirName);\n\t\tif (\n\t\t\t(pendingDeleteCount !== undefined && pendingDeleteCount > 0) ||\n\t\t\t(pendingCreateCount !== undefined && pendingCreateCount > 0)\n\t\t) {\n\t\t\tif (local) {\n\t\t\t\tassert(localOpMetadata !== undefined, 0xc0d /* localOpMetadata should be defined */);\n\t\t\t\tif (localOpMetadata.type === \"deleteSubDir\") {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingDeleteCount !== undefined && pendingDeleteCount > 0,\n\t\t\t\t\t\t0x6c2 /* pendingDeleteCount should exist */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\t\t\tthis.pendingDeleteSubDirectoriesTracker,\n\t\t\t\t\t\top.subdirName,\n\t\t\t\t\t);\n\t\t\t\t} else if (localOpMetadata.type === \"createSubDir\") {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingCreateCount !== undefined && pendingCreateCount > 0,\n\t\t\t\t\t\t0x6c3 /* pendingCreateCount should exist */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\t\t\tthis.pendingCreateSubDirectoriesTracker,\n\t\t\t\t\t\top.subdirName,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op.type === \"deleteSubDirectory\") {\n\t\t\t\tconst resetSubDirectoryTree = (directory: SubDirectory | undefined): void => {\n\t\t\t\t\tif (!directory) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// If this is delete op and we have keys in this subDirectory, then we need to delete these\n\t\t\t\t\t// keys except the pending ones as they will be sequenced after this delete.\n\t\t\t\t\tdirectory.sequencedStorageData.clear();\n\t\t\t\t\tdirectory.emit(\"clear\", true, directory);\n\n\t\t\t\t\t// In case of delete op, we need to reset the creation seqNum, clientSeqNum and client ids of\n\t\t\t\t\t// creators as the previous directory is getting deleted and we will initialize again when\n\t\t\t\t\t// we will receive op for the create again.\n\t\t\t\t\tdirectory.seqData.seq = -1;\n\t\t\t\t\tdirectory.seqData.clientSeq = -1;\n\t\t\t\t\tdirectory.clientIds.clear();\n\t\t\t\t\t// Do the same thing for the subtree of the directory. If create is not pending for a child, then just\n\t\t\t\t\t// delete it.\n\t\t\t\t\tconst subDirectories = directory.subdirectories();\n\t\t\t\t\tfor (const [subDirName, subDir] of subDirectories) {\n\t\t\t\t\t\tif (directory.pendingCreateSubDirectoriesTracker.has(subDirName)) {\n\t\t\t\t\t\t\tresetSubDirectoryTree(subDir as SubDirectory);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdirectory.deleteSubDirectoryCore(subDirName, false);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst subDirectory = this._subdirectories.get(op.subdirName);\n\t\t\t\t// Clear the creation tracker record\n\t\t\t\tthis.ackedCreationSeqTracker.delete(op.subdirName);\n\t\t\t\tresetSubDirectoryTree(subDirectory);\n\t\t\t}\n\t\t\tif (op.type === \"createSubDirectory\") {\n\t\t\t\tconst dir = this._subdirectories.get(op.subdirName);\n\t\t\t\t// Child sub directory create seq number can't be lower than the parent subdirectory.\n\t\t\t\t// The sequence number for multiple ops can be the same when multiple createSubDirectory occurs with grouped batching enabled, thus <= and not just <.\n\t\t\t\tif (this.seqData.seq !== -1 && this.seqData.seq <= msg.sequenceNumber) {\n\t\t\t\t\tif (dir?.seqData.seq === -1) {\n\t\t\t\t\t\t// Only set the sequence data based on the first message\n\t\t\t\t\t\tdir.seqData.seq = msg.sequenceNumber;\n\t\t\t\t\t\tdir.seqData.clientSeq = msg.clientSequenceNumber;\n\n\t\t\t\t\t\t// set the creation seq in tracker\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!this.ackedCreationSeqTracker.has(op.subdirName) &&\n\t\t\t\t\t\t\t!this.pendingDeleteSubDirectoriesTracker.has(op.subdirName)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthis.ackedCreationSeqTracker.set(op.subdirName, {\n\t\t\t\t\t\t\t\tseq: msg.sequenceNumber,\n\t\t\t\t\t\t\t\tclientSeq: msg.clientSequenceNumber,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (local) {\n\t\t\t\t\t\t\t\tthis.localCreationSeqTracker.delete(op.subdirName);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// The client created the dir at or after the dirs seq, so list its client id as a creator.\n\t\t\t\t\tif (\n\t\t\t\t\t\tdir !== undefined &&\n\t\t\t\t\t\t!dir.clientIds.has(msg.clientId) &&\n\t\t\t\t\t\tdir.seqData.seq <= msg.sequenceNumber\n\t\t\t\t\t) {\n\t\t\t\t\t\tdir.clientIds.add(msg.clientId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\treturn !local;\n\t}\n\n\t/**\n\t * Create subdirectory implementation used for both locally sourced creation as well as incoming remote creation.\n\t * @param subdirName - The name of the subdirectory being created\n\t * @param local - Whether the message originated from the local client\n\t * @param seqData - Sequence number and client sequence number at which this directory is created\n\t * @param clientId - Id of client which created this directory.\n\t * @returns True if is newly created, false if it already existed.\n\t */\n\tprivate createSubDirectoryCore(\n\t\tsubdirName: string,\n\t\tlocal: boolean,\n\t\tseqData: SequenceData,\n\t\tclientId: string,\n\t): boolean {\n\t\tconst subdir = this._subdirectories.get(subdirName);\n\t\tif (subdir === undefined) {\n\t\t\tconst absolutePath = posix.join(this.absolutePath, subdirName);\n\t\t\tconst subDir = new SubDirectory(\n\t\t\t\t{ ...seqData },\n\t\t\t\tnew Set([clientId]),\n\t\t\t\tthis.directory,\n\t\t\t\tthis.runtime,\n\t\t\t\tthis.serializer,\n\t\t\t\tabsolutePath,\n\t\t\t\tthis.logger,\n\t\t\t);\n\t\t\t/**\n\t\t\t * Store the sequence numbers of newly created subdirectory to the proper creation tracker, based\n\t\t\t * on whether the creation behavior has been ack'd or not\n\t\t\t */\n\t\t\tif (isAcknowledgedOrDetached(seqData)) {\n\t\t\t\tthis.ackedCreationSeqTracker.set(subdirName, { ...seqData });\n\t\t\t} else {\n\t\t\t\tthis.localCreationSeqTracker.set(subdirName, { ...seqData });\n\t\t\t}\n\n\t\t\tthis.registerEventsOnSubDirectory(subDir, subdirName);\n\t\t\tthis._subdirectories.set(subdirName, subDir);\n\t\t\tthis.emit(\"subDirectoryCreated\", subdirName, local, this);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tsubdir.clientIds.add(clientId);\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate registerEventsOnSubDirectory(subDirectory: SubDirectory, subDirName: string): void {\n\t\tsubDirectory.on(\"subDirectoryCreated\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryCreated\", posix.join(subDirName, relativePath), local, this);\n\t\t});\n\t\tsubDirectory.on(\"subDirectoryDeleted\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryDeleted\", posix.join(subDirName, relativePath), local, this);\n\t\t});\n\t}\n\n\t/**\n\t * Delete subdirectory implementation used for both locally sourced creation as well as incoming remote creation.\n\t * @param subdirName - The name of the subdirectory being deleted\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate deleteSubDirectoryCore(\n\t\tsubdirName: string,\n\t\tlocal: boolean,\n\t): SubDirectory | undefined {\n\t\tconst previousValue = this._subdirectories.get(subdirName);\n\t\t// This should make the subdirectory structure unreachable so it can be GC'd and won't appear in snapshots\n\t\t// Might want to consider cleaning out the structure more exhaustively though? But not when rollback.\n\t\tif (previousValue !== undefined) {\n\t\t\tthis._subdirectories.delete(subdirName);\n\t\t\t/**\n\t\t\t * Remove the corresponding record from the proper creation tracker, based on whether the subdirectory has been\n\t\t\t * ack'd already or still not committed yet (could be both).\n\t\t\t */\n\t\t\tif (this.ackedCreationSeqTracker.has(subdirName)) {\n\t\t\t\tthis.ackedCreationSeqTracker.delete(subdirName);\n\t\t\t}\n\t\t\tif (this.localCreationSeqTracker.has(subdirName)) {\n\t\t\t\tthis.localCreationSeqTracker.delete(subdirName);\n\t\t\t}\n\t\t\tthis.disposeSubDirectoryTree(previousValue);\n\t\t\tthis.emit(\"subDirectoryDeleted\", subdirName, local, this);\n\t\t}\n\t\treturn previousValue;\n\t}\n\n\tprivate disposeSubDirectoryTree(directory: IDirectory | undefined): void {\n\t\tif (!directory) {\n\t\t\treturn;\n\t\t}\n\t\t// Dispose the subdirectory tree. This will dispose the subdirectories from bottom to top.\n\t\tconst subDirectories = directory.subdirectories();\n\t\tfor (const [_, subDirectory] of subDirectories) {\n\t\t\tthis.disposeSubDirectoryTree(subDirectory);\n\t\t}\n\t\tif (typeof directory.dispose === \"function\") {\n\t\t\tdirectory.dispose();\n\t\t}\n\t}\n\n\tprivate undeleteSubDirectoryTree(directory: SubDirectory): void {\n\t\t// Restore deleted subdirectory tree. Need to undispose the current directory first, then get access to the iterator.\n\t\t// This will unmark \"deleted\" from the subdirectories from top to bottom.\n\t\tdirectory.undispose();\n\t\tfor (const [_, subDirectory] of directory.subdirectories()) {\n\t\t\tthis.undeleteSubDirectoryTree(subDirectory as SubDirectory);\n\t\t}\n\t}\n}\n"]}
|