@fluidframework/container-runtime 2.70.0-360374 → 2.70.0-361092
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/api-report/container-runtime.legacy.beta.api.md +0 -3
- package/container-runtime.test-files.tar +0 -0
- package/dist/blobManager/blobManager.d.ts +11 -11
- package/dist/blobManager/blobManager.d.ts.map +1 -1
- package/dist/blobManager/blobManager.js +16 -16
- package/dist/blobManager/blobManager.js.map +1 -1
- package/dist/blobManager/index.d.ts +1 -1
- package/dist/blobManager/index.d.ts.map +1 -1
- package/dist/blobManager/index.js.map +1 -1
- package/dist/containerRuntime.d.ts +40 -25
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +24 -16
- package/dist/containerRuntime.js.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +0 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/lib/blobManager/blobManager.d.ts +11 -11
- package/lib/blobManager/blobManager.d.ts.map +1 -1
- package/lib/blobManager/blobManager.js +16 -16
- package/lib/blobManager/blobManager.js.map +1 -1
- package/lib/blobManager/index.d.ts +1 -1
- package/lib/blobManager/index.d.ts.map +1 -1
- package/lib/blobManager/index.js.map +1 -1
- package/lib/containerRuntime.d.ts +40 -25
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +24 -16
- package/lib/containerRuntime.js.map +1 -1
- package/lib/index.d.ts +0 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +0 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/package.json +23 -37
- package/src/blobManager/blobManager.ts +27 -27
- package/src/blobManager/index.ts +1 -0
- package/src/containerRuntime.ts +55 -32
- package/src/index.ts +0 -6
- package/src/packageVersion.ts +1 -1
- package/src/summary/orderedClientElection.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,6 @@
|
|
|
5
5
|
export { type ContainerRuntimeOptions, type ContainerRuntimeOptionsInternal, type ISummaryRuntimeOptions, type IContainerRuntimeOptions, type IContainerRuntimeOptionsInternal, loadContainerRuntime, type LoadContainerRuntimeParams, agentSchedulerId, ContainerRuntime, DeletedResponseHeaderKey, TombstoneResponseHeaderKey, InactiveResponseHeaderKey, type RuntimeHeaderData, } from "./containerRuntime.js";
|
|
6
6
|
export type { ICompressionRuntimeOptions } from "./compressionDefinitions.js";
|
|
7
7
|
export { CompressionAlgorithms, disabledCompressionConfig } from "./compressionDefinitions.js";
|
|
8
|
-
export type {
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Import from `@fluidframework/runtime-definitions/legacy` instead.
|
|
11
|
-
*/
|
|
12
|
-
MinimumVersionForCollab, } from "@fluidframework/runtime-definitions/internal";
|
|
13
8
|
export { ContainerMessageType, type UnknownContainerRuntimeMessage, } from "./messageTypes.js";
|
|
14
9
|
export type { IBlobManagerLoadInfo } from "./blobManager/index.js";
|
|
15
10
|
export { FluidDataStoreRegistry } from "./dataStoreRegistry.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,+BAA+B,EACpC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,gCAAgC,EACrC,oBAAoB,EACpB,KAAK,0BAA0B,EAC/B,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EACzB,KAAK,iBAAiB,GACtB,MA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B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,UAAU,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EACN,wBAAwB,EACxB,6BAA6B,EAC7B,gCAAgC,EAChC,mCAAmC,EACnC,sCAAsC,GACtC,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAc+B;AAR9B,2HAAA,oBAAoB,OAAA;AAEpB,uHAAA,gBAAgB,OAAA;AAChB,uHAAA,gBAAgB,OAAA;AAChB,+HAAA,wBAAwB,OAAA;AACxB,iIAAA,0BAA0B,OAAA;AAC1B,gIAAA,yBAAyB,OAAA;AAI1B,yEAA+F;AAAtF,kIAAA,qBAAqB,OAAA;AAAE,sIAAA,yBAAyB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAc+B;AAR9B,2HAAA,oBAAoB,OAAA;AAEpB,uHAAA,gBAAgB,OAAA;AAChB,uHAAA,gBAAgB,OAAA;AAChB,+HAAA,wBAAwB,OAAA;AACxB,iIAAA,0BAA0B,OAAA;AAC1B,gIAAA,yBAAyB,OAAA;AAI1B,yEAA+F;AAAtF,kIAAA,qBAAqB,OAAA;AAAE,sIAAA,yBAAyB,OAAA;AACzD,qDAG2B;AAF1B,uHAAA,oBAAoB,OAAA;AAIrB,+DAAgE;AAAvD,8HAAA,sBAAsB,OAAA;AAC/B,+DAIgC;AAH/B,gIAAA,wBAAwB,OAAA;AACxB,gIAAA,wBAAwB,OAAA;AACxB,sIAAA,8BAA8B,OAAA;AAE/B,0CAWuB;AAVtB,sGAAA,UAAU,OAAA;AAWX,+CAmE4B;AA9D3B,sHAAA,0BAA0B,OAAA;AAC1B,sGAAA,UAAU,OAAA;AACV,6GAAA,iBAAiB,OAAA;AA2CjB,wHAAA,4BAA4B,OAAA;AAC5B,qHAAA,yBAAyB,OAAA;AAezB,uHAAA,2BAA2B,OAAA;AAE5B,mDAA+E;AAArD,gHAAA,oBAAoB,OAAA;AAC9C,2EAMsC;AALrC,sIAAA,wBAAwB,OAAA;AACxB,2IAAA,6BAA6B,OAAA;AAC7B,8IAAA,gCAAgC,OAAA;AAChC,iJAAA,mCAAmC,OAAA;AACnC,oJAAA,sCAAsC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ContainerRuntimeOptions,\n\ttype ContainerRuntimeOptionsInternal,\n\ttype ISummaryRuntimeOptions,\n\ttype IContainerRuntimeOptions,\n\ttype IContainerRuntimeOptionsInternal,\n\tloadContainerRuntime,\n\ttype LoadContainerRuntimeParams,\n\tagentSchedulerId,\n\tContainerRuntime,\n\tDeletedResponseHeaderKey,\n\tTombstoneResponseHeaderKey,\n\tInactiveResponseHeaderKey,\n\ttype RuntimeHeaderData,\n} from \"./containerRuntime.js\";\nexport type { ICompressionRuntimeOptions } from \"./compressionDefinitions.js\";\nexport { CompressionAlgorithms, disabledCompressionConfig } from \"./compressionDefinitions.js\";\nexport {\n\tContainerMessageType,\n\ttype UnknownContainerRuntimeMessage,\n} from \"./messageTypes.js\";\nexport type { IBlobManagerLoadInfo } from \"./blobManager/index.js\";\nexport { FluidDataStoreRegistry } from \"./dataStoreRegistry.js\";\nexport {\n\tdetectOutboundReferences,\n\tChannelCollectionFactory,\n\tAllowTombstoneRequestHeaderKey,\n} from \"./channelCollection.js\";\nexport {\n\tGCNodeType,\n\ttype IGCMetadata,\n\ttype GCFeatureMatrix,\n\ttype GCVersion,\n\ttype IGarbageCollectionRuntime,\n\ttype IGCRuntimeOptions,\n\ttype IMarkPhaseStats,\n\ttype ISweepPhaseStats,\n\ttype IGCNodeUpdatedProps,\n\ttype IGCStats,\n} from \"./gc/index.js\";\nexport {\n\ttype IAckedSummary,\n\ttype ISummarizer,\n\ttype ISummarizeResults,\n\ttype ISummaryCancellationToken,\n\tneverCancelledSummaryToken,\n\tSummarizer,\n\tSummaryCollection,\n\ttype EnqueueSummarizeResult,\n\ttype IAckSummaryResult,\n\ttype IBaseSummarizeResult,\n\ttype IBroadcastSummaryResult,\n\ttype ICancellationToken,\n\ttype IConnectableRuntime,\n\ttype IContainerRuntimeMetadata,\n\ttype ICreateContainerMetadata,\n\ttype IEnqueueSummarizeOptions,\n\ttype IGenerateSummaryTreeResult,\n\ttype IGeneratedSummaryStats,\n\ttype INackSummaryResult,\n\ttype IOnDemandSummarizeOptions,\n\ttype IRefreshSummaryAckOptions,\n\ttype ISubmitSummaryOpResult,\n\ttype ISubmitSummaryOptions,\n\ttype ISerializedElection,\n\ttype ISummarizeOptions,\n\ttype ISummarizerInternalsProvider,\n\ttype ISummarizerRuntime,\n\ttype ISummarizingWarning,\n\ttype IUploadSummaryResult,\n\ttype SubmitSummaryResult,\n\ttype SummarizeResultPart,\n\ttype IClientSummaryWatcher,\n\ttype ISummary,\n\ttype ISummaryCollectionOpEvents,\n\ttype ISummaryAckMessage,\n\ttype ISummaryMetadataMessage,\n\ttype ISummaryNackMessage,\n\ttype ISummaryOpMessage,\n\ttype OpActionEventListener,\n\ttype OpActionEventName,\n\ttype ICancellableSummarizerController,\n\ttype SubmitSummaryFailureData,\n\ttype SummaryStage,\n\ttype IRetriableFailureError,\n\ttype IdCompressorMode,\n\ttype IDocumentSchema,\n\ttype IDocumentSchemaInfo,\n\ttype DocumentSchemaValueType,\n\ttype IDocumentSchemaCurrent,\n\tcurrentDocumentVersionSchema,\n\tDocumentsSchemaController,\n\ttype IDocumentSchemaChangeMessageIncoming,\n\ttype IDocumentSchemaChangeMessageOutgoing,\n\ttype IDocumentSchemaFeatures,\n\ttype ReadFluidDataStoreAttributes,\n\ttype IFluidDataStoreAttributes0,\n\ttype IFluidDataStoreAttributes1,\n\ttype IFluidDataStoreAttributes2,\n\ttype OmitAttributesVersions,\n\ttype ISummaryBaseConfiguration,\n\ttype ISummaryConfigurationHeuristics,\n\ttype ISummaryConfigurationDisableSummarizer,\n\ttype ISummaryConfigurationDisableHeuristics,\n\ttype ISummaryConfigurationWithSummaryOnRequest,\n\ttype ISummaryConfiguration,\n\tDefaultSummaryConfiguration,\n} from \"./summary/index.js\";\nexport { type IChunkedOp, unpackRuntimeMessage } from \"./opLifecycle/index.js\";\nexport {\n\truntimeCoreCompatDetails,\n\truntimeCompatDetailsForLoader,\n\truntimeCompatDetailsForDataStore,\n\tloaderSupportRequirementsForRuntime,\n\tdataStoreSupportRequirementsForRuntime,\n} from \"./runtimeLayerCompatState.js\";\n"]}
|
package/dist/legacy.d.ts
CHANGED
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/container-runtime";
|
|
8
|
-
export declare const pkgVersion = "2.70.0-
|
|
8
|
+
export declare const pkgVersion = "2.70.0-361092";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/container-runtime";
|
|
11
|
-
exports.pkgVersion = "2.70.0-
|
|
11
|
+
exports.pkgVersion = "2.70.0-361092";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,mCAAmC,CAAC;AAC9C,QAAA,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.70.0-
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,mCAAmC,CAAC;AAC9C,QAAA,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.70.0-361092\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orderedClientElection.js","sourceRoot":"","sources":["../../src/summary/orderedClientElection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAA2C;AAE3C,+DAAiE;AAOjE,kEAA6D;AAM7D,uEAIkD;AAElD,6DAA4D;AAoF5D;;;;;;GAMG;AACH,MAAa,uBACZ,SAAQ,gCAAiD;IAqBzD,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC5B,CAAC;IACD,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;IACpC,CAAC;IAED,YACC,MAA4B,EAC5B,YAAyE,EACzE,MAAiD;QAEjD,KAAK,EAAE,CAAC;QA9BT;;WAEG;QACc,cAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;QAC9D;;WAEG;QACc,aAAQ,GAAkB;YAC1C,cAAc,EAAE,CAAC,CAAC;YAClB,WAAW,EAAE,SAAS;YACtB,aAAa,EAAE,SAAS;SACxB,CAA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AAqB,KAAK,EAC1B,MAAe;QAEf,IAAI,IAAI,CAAC,uBAAuB,IAAI,SAAS,EAAE,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBAChC,SAAS;gBACT,QAAQ,EAAE,MAAM,EAAE,QAAQ;gBAC1B,cAAc;gBACd,eAAe,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ;gBAC7C,eAAe,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ;gBAC7C,UAAU,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;gBACpE,kBAAkB,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,yCAAoB;gBACxE,MAAM;aACN,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;CACD;AA7VD,sDA6VC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @rushstack/no-new-null */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tIEvent,\n\tIEventProvider,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIClient,\n\tIQuorumClients,\n\tISequencedClient,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tUsageError,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { summarizerClientType } from \"./summarizerTypes.js\";\n\n// helper types for recursive readonly.\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type ImmutablePrimitives = undefined | null | boolean | string | number | Function;\nexport type Immutable<T> = T extends ImmutablePrimitives\n\t? T\n\t: T extends (infer A)[]\n\t\t? readonly Immutable<A>[]\n\t\t: T extends Map<infer K, infer V>\n\t\t\t? ReadonlyMap<Immutable<K>, Immutable<V>>\n\t\t\t: T extends Set<infer V>\n\t\t\t\t? ReadonlySet<Immutable<V>>\n\t\t\t\t: { readonly [K in keyof T]: Immutable<T[K]> };\n\n/**\n * Minimum information for a client tracked for election consideration.\n */\nexport interface ITrackedClient {\n\treadonly clientId: string;\n\treadonly sequenceNumber: number;\n\treadonly client: Immutable<IClient>;\n}\n\n/**\n * Common contract for link nodes within an OrderedClientCollection.\n */\nexport interface ILinkNode {\n\treadonly sequenceNumber: number;\n\tyoungerClient: ILinkedClient | undefined;\n}\n\n/**\n * Placeholder root node within an OrderedClientCollection; does not represent a client.\n */\nexport interface IRootLinkNode extends ILinkNode {\n\treadonly sequenceNumber: -1;\n\treadonly olderClient: undefined;\n}\n\n/**\n * Additional information required to keep track of the client within the doubly-linked list.\n */\nexport interface ILinkedClient extends ILinkNode, ITrackedClient {\n\tolderClient: LinkNode;\n}\n\n/**\n * Any link node within OrderedClientCollection including the placeholder root node.\n */\nexport type LinkNode = IRootLinkNode | ILinkedClient;\n\n/**\n * Events raised by an OrderedClientCollection.\n */\nexport interface IOrderedClientCollectionEvents extends IEvent {\n\t/**\n\t * Event fires when client is being added.\n\t */\n\t(\n\t\tevent: \"addClient\" | \"removeClient\",\n\t\tlistener: (client: ILinkedClient, sequenceNumber: number) => void,\n\t);\n}\n\n/**\n * Contract for a sorted collection of all clients in the quorum.\n */\nexport interface IOrderedClientCollection\n\textends IEventProvider<IOrderedClientCollectionEvents> {\n\t/**\n\t * Count of clients in the collection.\n\t */\n\treadonly count: number;\n\t/**\n\t * Pointer to the oldest client in the collection.\n\t */\n\treadonly oldestClient: ILinkedClient | undefined;\n\t/**\n\t * Returns a sorted array of all the clients in the collection.\n\t */\n\tgetAllClients(): ILinkedClient[];\n}\n\n/**\n * Tracks clients in the Quorum. It maintains their order using their join op\n * sequence numbers.\n * Internally, the collection of clients is maintained in a doubly-linked list,\n * with pointers to both the first and last nodes.\n * The first (root) node is a placeholder to simplify logic and reduce null checking.\n */\nexport class OrderedClientCollection\n\textends TypedEventEmitter<IOrderedClientCollectionEvents>\n\timplements IOrderedClientCollection\n{\n\t/**\n\t * Collection of ALL clients currently in the quorum, with client ids as keys.\n\t */\n\tprivate readonly clientMap = new Map<string, ILinkedClient>();\n\t/**\n\t * Placeholder head node of linked list, for simplified null checking.\n\t */\n\tprivate readonly rootNode: IRootLinkNode = {\n\t\tsequenceNumber: -1,\n\t\tolderClient: undefined,\n\t\tyoungerClient: undefined,\n\t};\n\t/**\n\t * Pointer to end of linked list, for optimized client adds.\n\t */\n\tprivate _youngestClient: LinkNode = this.rootNode;\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic get count(): number {\n\t\treturn this.clientMap.size;\n\t}\n\tpublic get oldestClient(): ILinkedClient | undefined {\n\t\treturn this.rootNode.youngerClient;\n\t}\n\n\tconstructor(\n\t\tlogger: ITelemetryBaseLogger,\n\t\tdeltaManager: Pick<IDeltaManager<unknown, unknown>, \"lastSequenceNumber\">,\n\t\tquorum: Pick<IQuorumClients, \"getMembers\" | \"on\">,\n\t) {\n\t\tsuper();\n\t\tthis.logger = createChildLogger({ logger, namespace: \"OrderedClientCollection\" });\n\t\tconst members = quorum.getMembers();\n\t\tfor (const [clientId, client] of members) {\n\t\t\tthis.addClient(clientId, client);\n\t\t}\n\n\t\tquorum.on(\"addMember\", (clientId, client) => {\n\t\t\tconst newClient = this.addClient(clientId, client);\n\t\t\tthis.emit(\"addClient\", newClient, deltaManager.lastSequenceNumber);\n\t\t});\n\t\tquorum.on(\"removeMember\", (clientId) => {\n\t\t\tconst sequenceNumber = deltaManager.lastSequenceNumber;\n\t\t\tconst removeClient = this.removeClient(clientId);\n\t\t\tif (removeClient === undefined) {\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"ClientNotFound\",\n\t\t\t\t\tclientId,\n\t\t\t\t\tsequenceNumber,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.emit(\"removeClient\", removeClient, sequenceNumber);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate addClient(clientId: string, client: ISequencedClient): ITrackedClient {\n\t\t// Normal case is adding the latest client, which will bypass loop.\n\t\t// Find where it belongs otherwise (maybe possible during initial load?).\n\t\tassert(\n\t\t\tclient.sequenceNumber > -1,\n\t\t\t0x1f6 /* \"Negative client sequence number not allowed\" */,\n\t\t);\n\t\tlet currClient = this._youngestClient;\n\t\twhile (currClient.sequenceNumber > client.sequenceNumber) {\n\t\t\tassert(\n\t\t\t\tcurrClient.olderClient !== undefined,\n\t\t\t\t0x1f7 /* \"Previous client should always be defined\" */,\n\t\t\t);\n\t\t\t// Note: If adding a client older than the elected client, it will not be automatically elected.\n\t\t\tcurrClient = currClient.olderClient;\n\t\t}\n\n\t\t// Now currClient is the node right before where the new client node should be.\n\t\tconst newClient: ILinkedClient = {\n\t\t\tclientId,\n\t\t\tsequenceNumber: client.sequenceNumber,\n\t\t\tclient: { ...client.client }, // shallow clone\n\t\t\tolderClient: currClient,\n\t\t\tyoungerClient: currClient.youngerClient,\n\t\t};\n\n\t\t// Update prev node to point to this new node.\n\t\tnewClient.olderClient.youngerClient = newClient;\n\n\t\tif (newClient.youngerClient === undefined) {\n\t\t\t// Update linked list end pointer to youngest client.\n\t\t\tthis._youngestClient = newClient;\n\t\t} else {\n\t\t\t// Update next node to point back to this new node.\n\t\t\tnewClient.youngerClient.olderClient = newClient;\n\t\t}\n\n\t\tthis.clientMap.set(clientId, newClient);\n\t\treturn newClient;\n\t}\n\n\tprivate removeClient(clientId: string): ITrackedClient | undefined {\n\t\tconst removeClient = this.clientMap.get(clientId);\n\t\tif (removeClient === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update prev node to point to next node.\n\t\tremoveClient.olderClient.youngerClient = removeClient.youngerClient;\n\n\t\tif (removeClient.youngerClient === undefined) {\n\t\t\t// Update linked list end pointer to youngest client.\n\t\t\tthis._youngestClient = removeClient.olderClient;\n\t\t} else {\n\t\t\t// Update next node to point back to previous node.\n\t\t\tremoveClient.youngerClient.olderClient = removeClient.olderClient;\n\t\t}\n\n\t\tthis.clientMap.delete(clientId);\n\t\treturn removeClient;\n\t}\n\n\t/**\n\t * Returns an array of all clients being tracked in order from oldest to newest.\n\t */\n\tpublic getAllClients(): ILinkedClient[] {\n\t\tconst result: ILinkedClient[] = [];\n\t\tlet currClient: LinkNode = this.rootNode;\n\t\twhile (currClient.youngerClient !== undefined) {\n\t\t\tresult.push(currClient.youngerClient);\n\t\t\tcurrClient = currClient.youngerClient;\n\t\t}\n\t\treturn result;\n\t}\n}\n\n/**\n * Events raised by an OrderedClientElection.\n */\nexport interface IOrderedClientElectionEvents extends IEvent {\n\t/**\n\t * Event fires when the currently elected client changes.\n\t */\n\t(\n\t\tevent: \"election\",\n\t\tlistener: (\n\t\t\t/**\n\t\t\t * Newly elected client.\n\t\t\t */\n\t\t\tclient: ITrackedClient | undefined,\n\t\t\t/**\n\t\t\t * Sequence number where election took place.\n\t\t\t */\n\t\t\tsequenceNumber: number,\n\t\t\t/**\n\t\t\t * Previously elected client.\n\t\t\t */\n\t\t\tprevClient: ITrackedClient | undefined,\n\t\t) => void,\n\t);\n}\n\n/**\n * Serialized state of IOrderedClientElection.\n * @internal\n */\nexport interface ISerializedElection {\n\t/**\n\t * Sequence number at the time of the latest election.\n\t */\n\treadonly electionSequenceNumber: number;\n\n\t/**\n\t * Most recently elected client id. This is either:\n\t *\n\t * 1. the interactive elected parent client, in which case electedClientId === electedParentId,\n\t * and the SummaryManager on the elected client will spawn a summarizer client, or\n\t *\n\t * 2. the non-interactive summarizer client itself.\n\t */\n\treadonly electedClientId: string | undefined;\n\n\t/**\n\t * Most recently elected parent client id. This is always an interactive client.\n\t */\n\treadonly electedParentId: string | undefined;\n}\n\n/**\n * Contract for maintaining a deterministic client election based on eligibility.\n */\nexport interface IOrderedClientElection extends IEventProvider<IOrderedClientElectionEvents> {\n\t/**\n\t * Count of eligible clients in the collection.\n\t */\n\treadonly eligibleCount: number;\n\n\t/**\n\t * Currently elected client. This is either:\n\t *\n\t * 1. the interactive elected parent client, in which case electedClientId === electedParentId,\n\t * and the SummaryManager on the elected client will spawn a summarizer client, or\n\t *\n\t * 2. the non-interactive summarizer client itself.\n\t */\n\treadonly electedClient: ITrackedClient | undefined;\n\t/**\n\t * Currently elected parent client. This is always an interactive client.\n\t */\n\treadonly electedParent: ITrackedClient | undefined;\n\t/**\n\t * Sequence number of most recent election.\n\t */\n\treadonly electionSequenceNumber: number;\n\t/**\n\t * Resets the currently elected client back to the oldest eligible client.\n\t */\n\tresetElectedClient(sequenceNumber: number): void;\n\t/**\n\t * Peeks at what the next elected client would be if incrementElectedClient were called.\n\t */\n\tpeekNextElectedClient(): ITrackedClient | undefined;\n\t/**\n\t * Returns a sorted array of all the eligible clients in the collection.\n\t */\n\tgetAllEligibleClients(): ITrackedClient[];\n\t/**\n\t * Serialize election data\n\t */\n\tserialize(): ISerializedElection;\n}\n\n/**\n * Adapter for OrderedClientCollection, with the purpose of deterministically maintaining\n * a currently elected client, excluding ineligible clients, in a distributed fashion.\n * This can be true as long as incrementElectedClient and resetElectedClient calls\n * are called under the same conditions for all clients.\n */\nexport class OrderedClientElection\n\textends TypedEventEmitter<IOrderedClientElectionEvents>\n\timplements IOrderedClientElection\n{\n\tprivate _eligibleCount: number = 0;\n\tprivate _electedClient: ILinkedClient | undefined;\n\tprivate _electedParent: ILinkedClient | undefined;\n\tprivate _electionSequenceNumber: number;\n\n\tpublic get eligibleCount(): number {\n\t\treturn this._eligibleCount;\n\t}\n\tpublic get electionSequenceNumber(): number {\n\t\treturn this._electionSequenceNumber;\n\t}\n\n\t/**\n\t * OrderedClientCollection tracks electedClient and electedParent separately. This allows us to handle the case\n\t * where a new interactive parent client has been elected, but the summarizer is still doing work, so\n\t * a new summarizer should not yet be spawned. In this case, changing electedParent will cause SummaryManager\n\t * to stop the current summarizer, but a new summarizer will not be spawned until the old summarizer client has\n\t * left the quorum.\n\t *\n\t * Details:\n\t *\n\t * electedParent is the interactive client that has been elected to spawn a summarizer. It is typically the oldest\n\t * eligible interactive client in the quorum. Only the electedParent is permitted to spawn a summarizer.\n\t * Once elected, this client will remain the electedParent until it leaves the quorum or the summarizer that\n\t * it spawned stops producing summaries, at which point a new electedParent will be chosen.\n\t *\n\t * electedClient is the non-interactive summarizer client if one exists. If not, then electedClient is equal to\n\t * electedParent. If electedParent === electedClient, this is the signal for electedParent to spawn a new\n\t * electedClient. Once a summarizer client becomes electedClient, a new summarizer will not be spawned until\n\t * electedClient leaves the quorum.\n\t *\n\t * A typical sequence looks like this:\n\t *\n\t * i. Begin by electing A. electedParent === A, electedClient === A.\n\t *\n\t * ii. SummaryManager running on A spawns a summarizer client, A'. electedParent === A, electedClient === A'\n\t *\n\t * iii. A' stops producing summaries. A new parent client, B, is elected. electedParent === B, electedClient === A'\n\t *\n\t * iv. SummaryManager running on A detects the change to electedParent and tells the summarizer to stop, but A'\n\t * is in mid-summarization. No new summarizer is spawned, as electedParent !== electedClient.\n\t *\n\t * v. A' completes its summary, and the summarizer and backing client are torn down.\n\t *\n\t * vi. A' leaves the quorum, and B takes its place as electedClient. electedParent === B, electedClient === B\n\t *\n\t * vii. SummaryManager running on B spawns a summarizer client, B'. electedParent === B, electedClient === B'\n\t */\n\tpublic get electedClient(): ILinkedClient | undefined {\n\t\treturn this._electedClient;\n\t}\n\tpublic get electedParent(): ILinkedClient | undefined {\n\t\treturn this._electedParent;\n\t}\n\n\tconstructor(\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly orderedClientCollection: IOrderedClientCollection,\n\t\t/**\n\t\t * Serialized state from summary or current sequence number at time of load if new.\n\t\t */\n\t\tinitialState: ISerializedElection | number,\n\t\tprivate readonly isEligibleFn: (c: ITrackedClient) => boolean,\n\t\tprivate readonly recordPerformanceEvents: boolean = false,\n\t) {\n\t\tsuper();\n\t\tlet initialClient: ILinkedClient | undefined;\n\t\tlet initialParent: ILinkedClient | undefined;\n\t\tfor (const client of orderedClientCollection.getAllClients()) {\n\t\t\tthis.addClient(client, 0);\n\t\t\tif (typeof initialState !== \"number\") {\n\t\t\t\tif (client.clientId === initialState.electedClientId) {\n\t\t\t\t\tinitialClient = client;\n\t\t\t\t\tif (\n\t\t\t\t\t\tinitialState.electedParentId === undefined &&\n\t\t\t\t\t\tclient.client.details.type !== summarizerClientType\n\t\t\t\t\t) {\n\t\t\t\t\t\t// If there was no elected parent in the serialized data, use this one.\n\t\t\t\t\t\tinitialParent = client;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (client.clientId === initialState.electedParentId) {\n\t\t\t\t\tinitialParent = client;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\torderedClientCollection.on(\"addClient\", (client, seq) => this.addClient(client, seq));\n\t\torderedClientCollection.on(\"removeClient\", (client, seq) =>\n\t\t\tthis.removeClient(client, seq),\n\t\t);\n\n\t\tif (typeof initialState === \"number\") {\n\t\t\tthis._electionSequenceNumber = initialState;\n\t\t} else {\n\t\t\t// Override the initially elected client with the initial state.\n\t\t\tif (initialClient?.clientId !== initialState.electedClientId) {\n\t\t\t\t// Cannot find initially elected client, so elect undefined.\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"InitialElectedClientNotFound\",\n\t\t\t\t\telectionSequenceNumber: initialState.electionSequenceNumber,\n\t\t\t\t\texpectedClientId: initialState.electedClientId,\n\t\t\t\t\telectedClientId: initialClient?.clientId,\n\t\t\t\t\tclientCount: orderedClientCollection.count,\n\t\t\t\t});\n\t\t\t} else if (initialClient !== undefined && !isEligibleFn(initialClient)) {\n\t\t\t\t// Initially elected client is ineligible, so elect next eligible client.\n\t\t\t\tinitialClient = initialParent = this.findFirstEligibleParent(initialParent);\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"InitialElectedClientIneligible\",\n\t\t\t\t\telectionSequenceNumber: initialState.electionSequenceNumber,\n\t\t\t\t\texpectedClientId: initialState.electedClientId,\n\t\t\t\t\telectedClientId: initialClient?.clientId,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis._electedParent = initialParent;\n\t\t\tthis._electedClient = initialClient;\n\t\t\tthis._electionSequenceNumber = initialState.electionSequenceNumber;\n\t\t}\n\t}\n\n\t/**\n\t * Tries changing the elected client, raising an event if it is different.\n\t * Note that this function does no eligibility or suitability checks. If we get here, then\n\t * we will set _electedClient, and we will set _electedParent if this is an interactive client.\n\t */\n\tprivate tryElectingClient(\n\t\tclient: ILinkedClient | undefined,\n\t\tsequenceNumber: number,\n\t\treason: string,\n\t): void {\n\t\tthis.sendPerformanceEvent(\n\t\t\t\"TryElectingClient\",\n\t\t\tclient,\n\t\t\tsequenceNumber,\n\t\t\tfalse /* forceSend */,\n\t\t\treason,\n\t\t);\n\t\tlet change = false;\n\t\tconst isSummarizerClient = client?.client.details.type === summarizerClientType;\n\t\tconst prevClient = this._electedClient;\n\t\tif (this._electedClient !== client) {\n\t\t\tthis.sendPerformanceEvent(\n\t\t\t\t\"ClientElected\",\n\t\t\t\tclient,\n\t\t\t\tsequenceNumber,\n\t\t\t\ttrue /* forceSend */,\n\t\t\t\treason,\n\t\t\t);\n\t\t\t// Changing the elected client. Record the sequence number and note that we have to fire an event.\n\t\t\tthis._electionSequenceNumber = sequenceNumber;\n\t\t\tthis._electedClient = client;\n\t\t\tchange = true;\n\t\t}\n\t\tif (this._electedParent !== client && !isSummarizerClient) {\n\t\t\tthis.sendPerformanceEvent(\n\t\t\t\t\"InteractiveClientElected\",\n\t\t\t\tclient,\n\t\t\t\tsequenceNumber,\n\t\t\t\ttrue /* forceSend */,\n\t\t\t\treason,\n\t\t\t);\n\t\t\t// Changing the elected parent as well.\n\t\t\tthis._electedParent = client;\n\t\t\tchange = true;\n\t\t}\n\t\tif (change) {\n\t\t\tthis.emit(\"election\", client, sequenceNumber, prevClient);\n\t\t}\n\t}\n\n\tprivate tryElectingParent(\n\t\tclient: ILinkedClient | undefined,\n\t\tsequenceNumber: number,\n\t\treason: string,\n\t): void {\n\t\tthis.sendPerformanceEvent(\n\t\t\t\"TryElectingParent\",\n\t\t\tclient,\n\t\t\tsequenceNumber,\n\t\t\tfalse /* forceSend */,\n\t\t\treason,\n\t\t);\n\t\tif (this._electedParent !== client) {\n\t\t\tthis.sendPerformanceEvent(\n\t\t\t\t\"ParentElected\",\n\t\t\t\tclient,\n\t\t\t\tsequenceNumber,\n\t\t\t\ttrue /* forceSend */,\n\t\t\t\treason,\n\t\t\t);\n\t\t\tthis._electedParent = client;\n\t\t\tthis.emit(\"election\", this._electedClient, sequenceNumber, this._electedClient);\n\t\t}\n\t}\n\n\t/**\n\t * Helper function to find the first eligible parent client starting with the passed in client,\n\t * or undefined if none are eligible.\n\t * @param client - client to start checking\n\t * @returns oldest eligible client starting with passed in client or undefined if none.\n\t */\n\tprivate findFirstEligibleParent(\n\t\tclient: ILinkedClient | undefined,\n\t): ILinkedClient | undefined {\n\t\tlet candidateClient = client;\n\t\twhile (\n\t\t\tcandidateClient !== undefined &&\n\t\t\t(!this.isEligibleFn(candidateClient) ||\n\t\t\t\tcandidateClient.client.details.type === summarizerClientType)\n\t\t) {\n\t\t\tcandidateClient = candidateClient.youngerClient;\n\t\t}\n\t\treturn candidateClient;\n\t}\n\n\t/**\n\t * Updates tracking for when a new client is added to the collection.\n\t * Will automatically elect that new client if none is elected currently.\n\t * @param client - client added to the collection\n\t * @param sequenceNumber - sequence number when client was added\n\t */\n\tprivate addClient(client: ILinkedClient, sequenceNumber: number): void {\n\t\tthis.sendPerformanceEvent(\"AddClient\", client, sequenceNumber);\n\t\tif (this.isEligibleFn(client)) {\n\t\t\tthis._eligibleCount++;\n\t\t\tconst newClientIsSummarizer = client.client.details.type === summarizerClientType;\n\t\t\tconst electedClientIsSummarizer =\n\t\t\t\tthis._electedClient?.client.details.type === summarizerClientType;\n\t\t\t// Note that we allow a summarizer client to supersede an interactive client as elected client.\n\t\t\tif (\n\t\t\t\tthis._electedClient === undefined ||\n\t\t\t\t(!electedClientIsSummarizer && newClientIsSummarizer)\n\t\t\t) {\n\t\t\t\tthis.tryElectingClient(client, sequenceNumber, \"AddClient\");\n\t\t\t} else if (this._electedParent === undefined && !newClientIsSummarizer) {\n\t\t\t\t// This is an odd case. If the _electedClient is set, the _electedParent should be as well.\n\t\t\t\tthis.tryElectingParent(client, sequenceNumber, \"AddClient\");\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Updates tracking for when an existing client is removed from the collection.\n\t * Will automatically elect next oldest client if currently elected is removed.\n\t * @param client - client removed from the collection\n\t * @param sequenceNumber - sequence number when client was removed\n\t */\n\tprivate removeClient(client: ILinkedClient, sequenceNumber: number): void {\n\t\tthis.sendPerformanceEvent(\"RemoveClient\", client, sequenceNumber);\n\t\tif (this.isEligibleFn(client)) {\n\t\t\tthis._eligibleCount--;\n\t\t\tif (this._electedClient === client) {\n\t\t\t\t// Removing the _electedClient. There are 2 possible cases:\n\t\t\t\tif (this._electedParent === client) {\n\t\t\t\t\t// 1. The _electedClient is an interactive client that has left the quorum.\n\t\t\t\t\t// Automatically shift to next oldest client.\n\t\t\t\t\tconst nextClient =\n\t\t\t\t\t\tthis.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n\t\t\t\t\t\tthis.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n\t\t\t\t\tthis.tryElectingClient(nextClient, sequenceNumber, \"RemoveClient\");\n\t\t\t\t} else {\n\t\t\t\t\t// 2. The _electedClient is a summarizer that we've been allowing to finish its work.\n\t\t\t\t\t// Let the _electedParent become the _electedClient so that it can start its own summarizer.\n\t\t\t\t\tif (this._electedClient.client.details.type !== summarizerClientType) {\n\t\t\t\t\t\tthrow new UsageError(\"Elected client should be a summarizer client 1\");\n\t\t\t\t\t}\n\t\t\t\t\tthis.tryElectingClient(\n\t\t\t\t\t\tthis._electedParent,\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t\t\"RemoveSummarizerClient\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (this._electedParent === client) {\n\t\t\t\t// Removing the _electedParent (but not _electedClient).\n\t\t\t\t// Shift to the next oldest parent, but do not replace the _electedClient,\n\t\t\t\t// which is a summarizer that is still doing work.\n\t\t\t\tif (this._electedClient?.client.details.type !== summarizerClientType) {\n\t\t\t\t\tthrow new UsageError(\"Elected client should be a summarizer client 2\");\n\t\t\t\t}\n\t\t\t\tconst nextParent =\n\t\t\t\t\tthis.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n\t\t\t\t\tthis.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n\t\t\t\tthis.tryElectingParent(nextParent, sequenceNumber, \"RemoveClient\");\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic getAllEligibleClients(): ITrackedClient[] {\n\t\treturn this.orderedClientCollection\n\t\t\t.getAllClients()\n\t\t\t.filter((client) => this.isEligibleFn(client));\n\t}\n\n\t/**\n\t * (Re-)start election with the oldest client in the quorum. This is called if we need to summarize\n\t * and no client has been elected.\n\t */\n\tpublic resetElectedClient(sequenceNumber: number): void {\n\t\tconst firstClient = this.findFirstEligibleParent(\n\t\t\tthis.orderedClientCollection.oldestClient,\n\t\t);\n\t\tif (this._electedClient === undefined || this._electedClient === this._electedParent) {\n\t\t\tthis.tryElectingClient(firstClient, sequenceNumber, \"ResetElectedClient\");\n\t\t} else {\n\t\t\t// The _electedClient is a summarizer and should not be replaced until it leaves the quorum.\n\t\t\t// Changing the _electedParent will stop the summarizer.\n\t\t\tthis.tryElectingParent(firstClient, sequenceNumber, \"ResetElectedClient\");\n\t\t}\n\t}\n\n\tpublic peekNextElectedClient(): ITrackedClient | undefined {\n\t\treturn (\n\t\t\tthis.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n\t\t\tthis.findFirstEligibleParent(this.orderedClientCollection.oldestClient)\n\t\t);\n\t}\n\n\tpublic serialize(): ISerializedElection {\n\t\treturn {\n\t\t\telectionSequenceNumber: this.electionSequenceNumber,\n\t\t\telectedClientId: this.electedClient?.clientId,\n\t\t\telectedParentId: this.electedParent?.clientId,\n\t\t};\n\t}\n\n\tprivate sendPerformanceEvent(\n\t\teventName: string,\n\t\tclient: ILinkedClient | undefined,\n\t\tsequenceNumber: number,\n\t\tforceSend: boolean = false,\n\t\treason?: string,\n\t): void {\n\t\tif (this.recordPerformanceEvents || forceSend) {\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName,\n\t\t\t\tclientId: client?.clientId,\n\t\t\t\tsequenceNumber,\n\t\t\t\telectedClientId: this.electedClient?.clientId,\n\t\t\t\telectedParentId: this.electedParent?.clientId,\n\t\t\t\tisEligible: client === undefined ? false : this.isEligibleFn(client),\n\t\t\t\tisSummarizerClient: client?.client.details.type === summarizerClientType,\n\t\t\t\treason,\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"orderedClientElection.js","sourceRoot":"","sources":["../../src/summary/orderedClientElection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAA2C;AAE3C,+DAAiE;AAOjE,kEAA6D;AAM7D,uEAIkD;AAElD,6DAA4D;AAoF5D;;;;;;GAMG;AACH,MAAa,uBACZ,SAAQ,gCAAiD;IAqBzD,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC5B,CAAC;IACD,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;IACpC,CAAC;IAED,YACC,MAA4B,EAC5B,YAAyE,EACzE,MAAiD;QAEjD,KAAK,EAAE,CAAC;QA9BT;;WAEG;QACc,cAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;QAC9D;;WAEG;QACc,aAAQ,GAAkB;YAC1C,cAAc,EAAE,CAAC,CAAC;YAClB,WAAW,EAAE,SAAS;YACtB,aAAa,EAAE,SAAS;SACxB,CAAC;QACF;;WAEG;QACK,oBAAe,GAAa,IAAI,CAAC,QAAQ,CAAC;QAgBjD,IAAI,CAAC,MAA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YAC/C,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBAChC,SAAS;gBACT,QAAQ,EAAE,MAAM,EAAE,QAAQ;gBAC1B,cAAc;gBACd,eAAe,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ;gBAC7C,eAAe,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ;gBAC7C,UAAU,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;gBACpE,kBAAkB,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,yCAAoB;gBACxE,MAAM;aACN,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;CACD;AA7VD,sDA6VC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @rushstack/no-new-null */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tIEvent,\n\tIEventProvider,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIClient,\n\tIQuorumClients,\n\tISequencedClient,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tUsageError,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { summarizerClientType } from \"./summarizerTypes.js\";\n\n// helper types for recursive readonly.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types\nexport type ImmutablePrimitives = undefined | null | boolean | string | number | Function;\nexport type Immutable<T> = T extends ImmutablePrimitives\n\t? T\n\t: T extends (infer A)[]\n\t\t? readonly Immutable<A>[]\n\t\t: T extends Map<infer K, infer V>\n\t\t\t? ReadonlyMap<Immutable<K>, Immutable<V>>\n\t\t\t: T extends Set<infer V>\n\t\t\t\t? ReadonlySet<Immutable<V>>\n\t\t\t\t: { readonly [K in keyof T]: Immutable<T[K]> };\n\n/**\n * Minimum information for a client tracked for election consideration.\n */\nexport interface ITrackedClient {\n\treadonly clientId: string;\n\treadonly sequenceNumber: number;\n\treadonly client: Immutable<IClient>;\n}\n\n/**\n * Common contract for link nodes within an OrderedClientCollection.\n */\nexport interface ILinkNode {\n\treadonly sequenceNumber: number;\n\tyoungerClient: ILinkedClient | undefined;\n}\n\n/**\n * Placeholder root node within an OrderedClientCollection; does not represent a client.\n */\nexport interface IRootLinkNode extends ILinkNode {\n\treadonly sequenceNumber: -1;\n\treadonly olderClient: undefined;\n}\n\n/**\n * Additional information required to keep track of the client within the doubly-linked list.\n */\nexport interface ILinkedClient extends ILinkNode, ITrackedClient {\n\tolderClient: LinkNode;\n}\n\n/**\n * Any link node within OrderedClientCollection including the placeholder root node.\n */\nexport type LinkNode = IRootLinkNode | ILinkedClient;\n\n/**\n * Events raised by an OrderedClientCollection.\n */\nexport interface IOrderedClientCollectionEvents extends IEvent {\n\t/**\n\t * Event fires when client is being added.\n\t */\n\t(\n\t\tevent: \"addClient\" | \"removeClient\",\n\t\tlistener: (client: ILinkedClient, sequenceNumber: number) => void,\n\t);\n}\n\n/**\n * Contract for a sorted collection of all clients in the quorum.\n */\nexport interface IOrderedClientCollection\n\textends IEventProvider<IOrderedClientCollectionEvents> {\n\t/**\n\t * Count of clients in the collection.\n\t */\n\treadonly count: number;\n\t/**\n\t * Pointer to the oldest client in the collection.\n\t */\n\treadonly oldestClient: ILinkedClient | undefined;\n\t/**\n\t * Returns a sorted array of all the clients in the collection.\n\t */\n\tgetAllClients(): ILinkedClient[];\n}\n\n/**\n * Tracks clients in the Quorum. It maintains their order using their join op\n * sequence numbers.\n * Internally, the collection of clients is maintained in a doubly-linked list,\n * with pointers to both the first and last nodes.\n * The first (root) node is a placeholder to simplify logic and reduce null checking.\n */\nexport class OrderedClientCollection\n\textends TypedEventEmitter<IOrderedClientCollectionEvents>\n\timplements IOrderedClientCollection\n{\n\t/**\n\t * Collection of ALL clients currently in the quorum, with client ids as keys.\n\t */\n\tprivate readonly clientMap = new Map<string, ILinkedClient>();\n\t/**\n\t * Placeholder head node of linked list, for simplified null checking.\n\t */\n\tprivate readonly rootNode: IRootLinkNode = {\n\t\tsequenceNumber: -1,\n\t\tolderClient: undefined,\n\t\tyoungerClient: undefined,\n\t};\n\t/**\n\t * Pointer to end of linked list, for optimized client adds.\n\t */\n\tprivate _youngestClient: LinkNode = this.rootNode;\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic get count(): number {\n\t\treturn this.clientMap.size;\n\t}\n\tpublic get oldestClient(): ILinkedClient | undefined {\n\t\treturn this.rootNode.youngerClient;\n\t}\n\n\tconstructor(\n\t\tlogger: ITelemetryBaseLogger,\n\t\tdeltaManager: Pick<IDeltaManager<unknown, unknown>, \"lastSequenceNumber\">,\n\t\tquorum: Pick<IQuorumClients, \"getMembers\" | \"on\">,\n\t) {\n\t\tsuper();\n\t\tthis.logger = createChildLogger({ logger, namespace: \"OrderedClientCollection\" });\n\t\tconst members = quorum.getMembers();\n\t\tfor (const [clientId, client] of members) {\n\t\t\tthis.addClient(clientId, client);\n\t\t}\n\n\t\tquorum.on(\"addMember\", (clientId, client) => {\n\t\t\tconst newClient = this.addClient(clientId, client);\n\t\t\tthis.emit(\"addClient\", newClient, deltaManager.lastSequenceNumber);\n\t\t});\n\t\tquorum.on(\"removeMember\", (clientId) => {\n\t\t\tconst sequenceNumber = deltaManager.lastSequenceNumber;\n\t\t\tconst removeClient = this.removeClient(clientId);\n\t\t\tif (removeClient === undefined) {\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"ClientNotFound\",\n\t\t\t\t\tclientId,\n\t\t\t\t\tsequenceNumber,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.emit(\"removeClient\", removeClient, sequenceNumber);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate addClient(clientId: string, client: ISequencedClient): ITrackedClient {\n\t\t// Normal case is adding the latest client, which will bypass loop.\n\t\t// Find where it belongs otherwise (maybe possible during initial load?).\n\t\tassert(\n\t\t\tclient.sequenceNumber > -1,\n\t\t\t0x1f6 /* \"Negative client sequence number not allowed\" */,\n\t\t);\n\t\tlet currClient = this._youngestClient;\n\t\twhile (currClient.sequenceNumber > client.sequenceNumber) {\n\t\t\tassert(\n\t\t\t\tcurrClient.olderClient !== undefined,\n\t\t\t\t0x1f7 /* \"Previous client should always be defined\" */,\n\t\t\t);\n\t\t\t// Note: If adding a client older than the elected client, it will not be automatically elected.\n\t\t\tcurrClient = currClient.olderClient;\n\t\t}\n\n\t\t// Now currClient is the node right before where the new client node should be.\n\t\tconst newClient: ILinkedClient = {\n\t\t\tclientId,\n\t\t\tsequenceNumber: client.sequenceNumber,\n\t\t\tclient: { ...client.client }, // shallow clone\n\t\t\tolderClient: currClient,\n\t\t\tyoungerClient: currClient.youngerClient,\n\t\t};\n\n\t\t// Update prev node to point to this new node.\n\t\tnewClient.olderClient.youngerClient = newClient;\n\n\t\tif (newClient.youngerClient === undefined) {\n\t\t\t// Update linked list end pointer to youngest client.\n\t\t\tthis._youngestClient = newClient;\n\t\t} else {\n\t\t\t// Update next node to point back to this new node.\n\t\t\tnewClient.youngerClient.olderClient = newClient;\n\t\t}\n\n\t\tthis.clientMap.set(clientId, newClient);\n\t\treturn newClient;\n\t}\n\n\tprivate removeClient(clientId: string): ITrackedClient | undefined {\n\t\tconst removeClient = this.clientMap.get(clientId);\n\t\tif (removeClient === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Update prev node to point to next node.\n\t\tremoveClient.olderClient.youngerClient = removeClient.youngerClient;\n\n\t\tif (removeClient.youngerClient === undefined) {\n\t\t\t// Update linked list end pointer to youngest client.\n\t\t\tthis._youngestClient = removeClient.olderClient;\n\t\t} else {\n\t\t\t// Update next node to point back to previous node.\n\t\t\tremoveClient.youngerClient.olderClient = removeClient.olderClient;\n\t\t}\n\n\t\tthis.clientMap.delete(clientId);\n\t\treturn removeClient;\n\t}\n\n\t/**\n\t * Returns an array of all clients being tracked in order from oldest to newest.\n\t */\n\tpublic getAllClients(): ILinkedClient[] {\n\t\tconst result: ILinkedClient[] = [];\n\t\tlet currClient: LinkNode = this.rootNode;\n\t\twhile (currClient.youngerClient !== undefined) {\n\t\t\tresult.push(currClient.youngerClient);\n\t\t\tcurrClient = currClient.youngerClient;\n\t\t}\n\t\treturn result;\n\t}\n}\n\n/**\n * Events raised by an OrderedClientElection.\n */\nexport interface IOrderedClientElectionEvents extends IEvent {\n\t/**\n\t * Event fires when the currently elected client changes.\n\t */\n\t(\n\t\tevent: \"election\",\n\t\tlistener: (\n\t\t\t/**\n\t\t\t * Newly elected client.\n\t\t\t */\n\t\t\tclient: ITrackedClient | undefined,\n\t\t\t/**\n\t\t\t * Sequence number where election took place.\n\t\t\t */\n\t\t\tsequenceNumber: number,\n\t\t\t/**\n\t\t\t * Previously elected client.\n\t\t\t */\n\t\t\tprevClient: ITrackedClient | undefined,\n\t\t) => void,\n\t);\n}\n\n/**\n * Serialized state of IOrderedClientElection.\n * @internal\n */\nexport interface ISerializedElection {\n\t/**\n\t * Sequence number at the time of the latest election.\n\t */\n\treadonly electionSequenceNumber: number;\n\n\t/**\n\t * Most recently elected client id. This is either:\n\t *\n\t * 1. the interactive elected parent client, in which case electedClientId === electedParentId,\n\t * and the SummaryManager on the elected client will spawn a summarizer client, or\n\t *\n\t * 2. the non-interactive summarizer client itself.\n\t */\n\treadonly electedClientId: string | undefined;\n\n\t/**\n\t * Most recently elected parent client id. This is always an interactive client.\n\t */\n\treadonly electedParentId: string | undefined;\n}\n\n/**\n * Contract for maintaining a deterministic client election based on eligibility.\n */\nexport interface IOrderedClientElection extends IEventProvider<IOrderedClientElectionEvents> {\n\t/**\n\t * Count of eligible clients in the collection.\n\t */\n\treadonly eligibleCount: number;\n\n\t/**\n\t * Currently elected client. This is either:\n\t *\n\t * 1. the interactive elected parent client, in which case electedClientId === electedParentId,\n\t * and the SummaryManager on the elected client will spawn a summarizer client, or\n\t *\n\t * 2. the non-interactive summarizer client itself.\n\t */\n\treadonly electedClient: ITrackedClient | undefined;\n\t/**\n\t * Currently elected parent client. This is always an interactive client.\n\t */\n\treadonly electedParent: ITrackedClient | undefined;\n\t/**\n\t * Sequence number of most recent election.\n\t */\n\treadonly electionSequenceNumber: number;\n\t/**\n\t * Resets the currently elected client back to the oldest eligible client.\n\t */\n\tresetElectedClient(sequenceNumber: number): void;\n\t/**\n\t * Peeks at what the next elected client would be if incrementElectedClient were called.\n\t */\n\tpeekNextElectedClient(): ITrackedClient | undefined;\n\t/**\n\t * Returns a sorted array of all the eligible clients in the collection.\n\t */\n\tgetAllEligibleClients(): ITrackedClient[];\n\t/**\n\t * Serialize election data\n\t */\n\tserialize(): ISerializedElection;\n}\n\n/**\n * Adapter for OrderedClientCollection, with the purpose of deterministically maintaining\n * a currently elected client, excluding ineligible clients, in a distributed fashion.\n * This can be true as long as incrementElectedClient and resetElectedClient calls\n * are called under the same conditions for all clients.\n */\nexport class OrderedClientElection\n\textends TypedEventEmitter<IOrderedClientElectionEvents>\n\timplements IOrderedClientElection\n{\n\tprivate _eligibleCount: number = 0;\n\tprivate _electedClient: ILinkedClient | undefined;\n\tprivate _electedParent: ILinkedClient | undefined;\n\tprivate _electionSequenceNumber: number;\n\n\tpublic get eligibleCount(): number {\n\t\treturn this._eligibleCount;\n\t}\n\tpublic get electionSequenceNumber(): number {\n\t\treturn this._electionSequenceNumber;\n\t}\n\n\t/**\n\t * OrderedClientCollection tracks electedClient and electedParent separately. This allows us to handle the case\n\t * where a new interactive parent client has been elected, but the summarizer is still doing work, so\n\t * a new summarizer should not yet be spawned. In this case, changing electedParent will cause SummaryManager\n\t * to stop the current summarizer, but a new summarizer will not be spawned until the old summarizer client has\n\t * left the quorum.\n\t *\n\t * Details:\n\t *\n\t * electedParent is the interactive client that has been elected to spawn a summarizer. It is typically the oldest\n\t * eligible interactive client in the quorum. Only the electedParent is permitted to spawn a summarizer.\n\t * Once elected, this client will remain the electedParent until it leaves the quorum or the summarizer that\n\t * it spawned stops producing summaries, at which point a new electedParent will be chosen.\n\t *\n\t * electedClient is the non-interactive summarizer client if one exists. If not, then electedClient is equal to\n\t * electedParent. If electedParent === electedClient, this is the signal for electedParent to spawn a new\n\t * electedClient. Once a summarizer client becomes electedClient, a new summarizer will not be spawned until\n\t * electedClient leaves the quorum.\n\t *\n\t * A typical sequence looks like this:\n\t *\n\t * i. Begin by electing A. electedParent === A, electedClient === A.\n\t *\n\t * ii. SummaryManager running on A spawns a summarizer client, A'. electedParent === A, electedClient === A'\n\t *\n\t * iii. A' stops producing summaries. A new parent client, B, is elected. electedParent === B, electedClient === A'\n\t *\n\t * iv. SummaryManager running on A detects the change to electedParent and tells the summarizer to stop, but A'\n\t * is in mid-summarization. No new summarizer is spawned, as electedParent !== electedClient.\n\t *\n\t * v. A' completes its summary, and the summarizer and backing client are torn down.\n\t *\n\t * vi. A' leaves the quorum, and B takes its place as electedClient. electedParent === B, electedClient === B\n\t *\n\t * vii. SummaryManager running on B spawns a summarizer client, B'. electedParent === B, electedClient === B'\n\t */\n\tpublic get electedClient(): ILinkedClient | undefined {\n\t\treturn this._electedClient;\n\t}\n\tpublic get electedParent(): ILinkedClient | undefined {\n\t\treturn this._electedParent;\n\t}\n\n\tconstructor(\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly orderedClientCollection: IOrderedClientCollection,\n\t\t/**\n\t\t * Serialized state from summary or current sequence number at time of load if new.\n\t\t */\n\t\tinitialState: ISerializedElection | number,\n\t\tprivate readonly isEligibleFn: (c: ITrackedClient) => boolean,\n\t\tprivate readonly recordPerformanceEvents: boolean = false,\n\t) {\n\t\tsuper();\n\t\tlet initialClient: ILinkedClient | undefined;\n\t\tlet initialParent: ILinkedClient | undefined;\n\t\tfor (const client of orderedClientCollection.getAllClients()) {\n\t\t\tthis.addClient(client, 0);\n\t\t\tif (typeof initialState !== \"number\") {\n\t\t\t\tif (client.clientId === initialState.electedClientId) {\n\t\t\t\t\tinitialClient = client;\n\t\t\t\t\tif (\n\t\t\t\t\t\tinitialState.electedParentId === undefined &&\n\t\t\t\t\t\tclient.client.details.type !== summarizerClientType\n\t\t\t\t\t) {\n\t\t\t\t\t\t// If there was no elected parent in the serialized data, use this one.\n\t\t\t\t\t\tinitialParent = client;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (client.clientId === initialState.electedParentId) {\n\t\t\t\t\tinitialParent = client;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\torderedClientCollection.on(\"addClient\", (client, seq) => this.addClient(client, seq));\n\t\torderedClientCollection.on(\"removeClient\", (client, seq) =>\n\t\t\tthis.removeClient(client, seq),\n\t\t);\n\n\t\tif (typeof initialState === \"number\") {\n\t\t\tthis._electionSequenceNumber = initialState;\n\t\t} else {\n\t\t\t// Override the initially elected client with the initial state.\n\t\t\tif (initialClient?.clientId !== initialState.electedClientId) {\n\t\t\t\t// Cannot find initially elected client, so elect undefined.\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"InitialElectedClientNotFound\",\n\t\t\t\t\telectionSequenceNumber: initialState.electionSequenceNumber,\n\t\t\t\t\texpectedClientId: initialState.electedClientId,\n\t\t\t\t\telectedClientId: initialClient?.clientId,\n\t\t\t\t\tclientCount: orderedClientCollection.count,\n\t\t\t\t});\n\t\t\t} else if (initialClient !== undefined && !isEligibleFn(initialClient)) {\n\t\t\t\t// Initially elected client is ineligible, so elect next eligible client.\n\t\t\t\tinitialClient = initialParent = this.findFirstEligibleParent(initialParent);\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"InitialElectedClientIneligible\",\n\t\t\t\t\telectionSequenceNumber: initialState.electionSequenceNumber,\n\t\t\t\t\texpectedClientId: initialState.electedClientId,\n\t\t\t\t\telectedClientId: initialClient?.clientId,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis._electedParent = initialParent;\n\t\t\tthis._electedClient = initialClient;\n\t\t\tthis._electionSequenceNumber = initialState.electionSequenceNumber;\n\t\t}\n\t}\n\n\t/**\n\t * Tries changing the elected client, raising an event if it is different.\n\t * Note that this function does no eligibility or suitability checks. If we get here, then\n\t * we will set _electedClient, and we will set _electedParent if this is an interactive client.\n\t */\n\tprivate tryElectingClient(\n\t\tclient: ILinkedClient | undefined,\n\t\tsequenceNumber: number,\n\t\treason: string,\n\t): void {\n\t\tthis.sendPerformanceEvent(\n\t\t\t\"TryElectingClient\",\n\t\t\tclient,\n\t\t\tsequenceNumber,\n\t\t\tfalse /* forceSend */,\n\t\t\treason,\n\t\t);\n\t\tlet change = false;\n\t\tconst isSummarizerClient = client?.client.details.type === summarizerClientType;\n\t\tconst prevClient = this._electedClient;\n\t\tif (this._electedClient !== client) {\n\t\t\tthis.sendPerformanceEvent(\n\t\t\t\t\"ClientElected\",\n\t\t\t\tclient,\n\t\t\t\tsequenceNumber,\n\t\t\t\ttrue /* forceSend */,\n\t\t\t\treason,\n\t\t\t);\n\t\t\t// Changing the elected client. Record the sequence number and note that we have to fire an event.\n\t\t\tthis._electionSequenceNumber = sequenceNumber;\n\t\t\tthis._electedClient = client;\n\t\t\tchange = true;\n\t\t}\n\t\tif (this._electedParent !== client && !isSummarizerClient) {\n\t\t\tthis.sendPerformanceEvent(\n\t\t\t\t\"InteractiveClientElected\",\n\t\t\t\tclient,\n\t\t\t\tsequenceNumber,\n\t\t\t\ttrue /* forceSend */,\n\t\t\t\treason,\n\t\t\t);\n\t\t\t// Changing the elected parent as well.\n\t\t\tthis._electedParent = client;\n\t\t\tchange = true;\n\t\t}\n\t\tif (change) {\n\t\t\tthis.emit(\"election\", client, sequenceNumber, prevClient);\n\t\t}\n\t}\n\n\tprivate tryElectingParent(\n\t\tclient: ILinkedClient | undefined,\n\t\tsequenceNumber: number,\n\t\treason: string,\n\t): void {\n\t\tthis.sendPerformanceEvent(\n\t\t\t\"TryElectingParent\",\n\t\t\tclient,\n\t\t\tsequenceNumber,\n\t\t\tfalse /* forceSend */,\n\t\t\treason,\n\t\t);\n\t\tif (this._electedParent !== client) {\n\t\t\tthis.sendPerformanceEvent(\n\t\t\t\t\"ParentElected\",\n\t\t\t\tclient,\n\t\t\t\tsequenceNumber,\n\t\t\t\ttrue /* forceSend */,\n\t\t\t\treason,\n\t\t\t);\n\t\t\tthis._electedParent = client;\n\t\t\tthis.emit(\"election\", this._electedClient, sequenceNumber, this._electedClient);\n\t\t}\n\t}\n\n\t/**\n\t * Helper function to find the first eligible parent client starting with the passed in client,\n\t * or undefined if none are eligible.\n\t * @param client - client to start checking\n\t * @returns oldest eligible client starting with passed in client or undefined if none.\n\t */\n\tprivate findFirstEligibleParent(\n\t\tclient: ILinkedClient | undefined,\n\t): ILinkedClient | undefined {\n\t\tlet candidateClient = client;\n\t\twhile (\n\t\t\tcandidateClient !== undefined &&\n\t\t\t(!this.isEligibleFn(candidateClient) ||\n\t\t\t\tcandidateClient.client.details.type === summarizerClientType)\n\t\t) {\n\t\t\tcandidateClient = candidateClient.youngerClient;\n\t\t}\n\t\treturn candidateClient;\n\t}\n\n\t/**\n\t * Updates tracking for when a new client is added to the collection.\n\t * Will automatically elect that new client if none is elected currently.\n\t * @param client - client added to the collection\n\t * @param sequenceNumber - sequence number when client was added\n\t */\n\tprivate addClient(client: ILinkedClient, sequenceNumber: number): void {\n\t\tthis.sendPerformanceEvent(\"AddClient\", client, sequenceNumber);\n\t\tif (this.isEligibleFn(client)) {\n\t\t\tthis._eligibleCount++;\n\t\t\tconst newClientIsSummarizer = client.client.details.type === summarizerClientType;\n\t\t\tconst electedClientIsSummarizer =\n\t\t\t\tthis._electedClient?.client.details.type === summarizerClientType;\n\t\t\t// Note that we allow a summarizer client to supersede an interactive client as elected client.\n\t\t\tif (\n\t\t\t\tthis._electedClient === undefined ||\n\t\t\t\t(!electedClientIsSummarizer && newClientIsSummarizer)\n\t\t\t) {\n\t\t\t\tthis.tryElectingClient(client, sequenceNumber, \"AddClient\");\n\t\t\t} else if (this._electedParent === undefined && !newClientIsSummarizer) {\n\t\t\t\t// This is an odd case. If the _electedClient is set, the _electedParent should be as well.\n\t\t\t\tthis.tryElectingParent(client, sequenceNumber, \"AddClient\");\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Updates tracking for when an existing client is removed from the collection.\n\t * Will automatically elect next oldest client if currently elected is removed.\n\t * @param client - client removed from the collection\n\t * @param sequenceNumber - sequence number when client was removed\n\t */\n\tprivate removeClient(client: ILinkedClient, sequenceNumber: number): void {\n\t\tthis.sendPerformanceEvent(\"RemoveClient\", client, sequenceNumber);\n\t\tif (this.isEligibleFn(client)) {\n\t\t\tthis._eligibleCount--;\n\t\t\tif (this._electedClient === client) {\n\t\t\t\t// Removing the _electedClient. There are 2 possible cases:\n\t\t\t\tif (this._electedParent === client) {\n\t\t\t\t\t// 1. The _electedClient is an interactive client that has left the quorum.\n\t\t\t\t\t// Automatically shift to next oldest client.\n\t\t\t\t\tconst nextClient =\n\t\t\t\t\t\tthis.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n\t\t\t\t\t\tthis.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n\t\t\t\t\tthis.tryElectingClient(nextClient, sequenceNumber, \"RemoveClient\");\n\t\t\t\t} else {\n\t\t\t\t\t// 2. The _electedClient is a summarizer that we've been allowing to finish its work.\n\t\t\t\t\t// Let the _electedParent become the _electedClient so that it can start its own summarizer.\n\t\t\t\t\tif (this._electedClient.client.details.type !== summarizerClientType) {\n\t\t\t\t\t\tthrow new UsageError(\"Elected client should be a summarizer client 1\");\n\t\t\t\t\t}\n\t\t\t\t\tthis.tryElectingClient(\n\t\t\t\t\t\tthis._electedParent,\n\t\t\t\t\t\tsequenceNumber,\n\t\t\t\t\t\t\"RemoveSummarizerClient\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (this._electedParent === client) {\n\t\t\t\t// Removing the _electedParent (but not _electedClient).\n\t\t\t\t// Shift to the next oldest parent, but do not replace the _electedClient,\n\t\t\t\t// which is a summarizer that is still doing work.\n\t\t\t\tif (this._electedClient?.client.details.type !== summarizerClientType) {\n\t\t\t\t\tthrow new UsageError(\"Elected client should be a summarizer client 2\");\n\t\t\t\t}\n\t\t\t\tconst nextParent =\n\t\t\t\t\tthis.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n\t\t\t\t\tthis.findFirstEligibleParent(this.orderedClientCollection.oldestClient);\n\t\t\t\tthis.tryElectingParent(nextParent, sequenceNumber, \"RemoveClient\");\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic getAllEligibleClients(): ITrackedClient[] {\n\t\treturn this.orderedClientCollection\n\t\t\t.getAllClients()\n\t\t\t.filter((client) => this.isEligibleFn(client));\n\t}\n\n\t/**\n\t * (Re-)start election with the oldest client in the quorum. This is called if we need to summarize\n\t * and no client has been elected.\n\t */\n\tpublic resetElectedClient(sequenceNumber: number): void {\n\t\tconst firstClient = this.findFirstEligibleParent(\n\t\t\tthis.orderedClientCollection.oldestClient,\n\t\t);\n\t\tif (this._electedClient === undefined || this._electedClient === this._electedParent) {\n\t\t\tthis.tryElectingClient(firstClient, sequenceNumber, \"ResetElectedClient\");\n\t\t} else {\n\t\t\t// The _electedClient is a summarizer and should not be replaced until it leaves the quorum.\n\t\t\t// Changing the _electedParent will stop the summarizer.\n\t\t\tthis.tryElectingParent(firstClient, sequenceNumber, \"ResetElectedClient\");\n\t\t}\n\t}\n\n\tpublic peekNextElectedClient(): ITrackedClient | undefined {\n\t\treturn (\n\t\t\tthis.findFirstEligibleParent(this._electedParent?.youngerClient) ??\n\t\t\tthis.findFirstEligibleParent(this.orderedClientCollection.oldestClient)\n\t\t);\n\t}\n\n\tpublic serialize(): ISerializedElection {\n\t\treturn {\n\t\t\telectionSequenceNumber: this.electionSequenceNumber,\n\t\t\telectedClientId: this.electedClient?.clientId,\n\t\t\telectedParentId: this.electedParent?.clientId,\n\t\t};\n\t}\n\n\tprivate sendPerformanceEvent(\n\t\teventName: string,\n\t\tclient: ILinkedClient | undefined,\n\t\tsequenceNumber: number,\n\t\tforceSend: boolean = false,\n\t\treason?: string,\n\t): void {\n\t\tif (this.recordPerformanceEvents || forceSend) {\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName,\n\t\t\t\tclientId: client?.clientId,\n\t\t\t\tsequenceNumber,\n\t\t\t\telectedClientId: this.electedClient?.clientId,\n\t\t\t\telectedParentId: this.electedParent?.clientId,\n\t\t\t\tisEligible: client === undefined ? false : this.isEligibleFn(client),\n\t\t\t\tisSummarizerClient: client?.client.details.type === summarizerClientType,\n\t\t\t\treason,\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
|
|
@@ -66,7 +66,7 @@ interface UploadedBlob {
|
|
|
66
66
|
* Omits attached blobs since they are fully uploaded and don't need to be saved and restored.
|
|
67
67
|
* Omits uploading and attaching states since upon restore we will need to restart those processes.
|
|
68
68
|
*/
|
|
69
|
-
type SerializableLocalBlobRecord = (Omit<LocalOnlyBlob, "blob"> & {
|
|
69
|
+
export type SerializableLocalBlobRecord = (Omit<LocalOnlyBlob, "blob"> & {
|
|
70
70
|
blob: string;
|
|
71
71
|
}) | (Omit<UploadedBlob, "blob"> & {
|
|
72
72
|
blob: string;
|
|
@@ -99,7 +99,7 @@ export declare class BlobManager {
|
|
|
99
99
|
* Local IDs for any pending blobs we loaded with and have not yet started the upload/attach flow for.
|
|
100
100
|
*/
|
|
101
101
|
private readonly pendingOnlyLocalIds;
|
|
102
|
-
private readonly
|
|
102
|
+
private readonly sendBlobAttachMessage;
|
|
103
103
|
private readonly routeContext;
|
|
104
104
|
private readonly storage;
|
|
105
105
|
private readonly blobRequested;
|
|
@@ -112,16 +112,16 @@ export declare class BlobManager {
|
|
|
112
112
|
blobManagerLoadInfo: IBlobManagerLoadInfo;
|
|
113
113
|
readonly storage: Pick<IContainerStorageService, "createBlob" | "readBlob">;
|
|
114
114
|
/**
|
|
115
|
-
* Submit a BlobAttach
|
|
116
|
-
* deleted. The BlobAttach
|
|
115
|
+
* Submit a BlobAttach message. When a blob is uploaded, there is a short grace period before which the blob is
|
|
116
|
+
* deleted. The BlobAttach message notifies the server that blob is in use. The server will then not delete the
|
|
117
117
|
* the blob as long as it is listed as referenced in future summaries. The summarizing client will know to
|
|
118
|
-
* include the storage ID in the summary when it sees the
|
|
118
|
+
* include the storage ID in the summary when it sees the message.
|
|
119
119
|
*
|
|
120
|
-
* The
|
|
121
|
-
* knowledge of which they cannot request the blob from storage. It's important that this
|
|
122
|
-
* before any
|
|
120
|
+
* The message will also include a local ID to inform all clients of the relation to the storage ID, without
|
|
121
|
+
* knowledge of which they cannot request the blob from storage. It's important that this message is sequenced
|
|
122
|
+
* before any messages that reference the local ID, otherwise, an invalid handle could be added to the document.
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
sendBlobAttachMessage: (localId: string, storageId: string) => void;
|
|
125
125
|
readonly blobRequested: (blobPath: string) => void;
|
|
126
126
|
readonly isBlobDeleted: (blobPath: string) => boolean;
|
|
127
127
|
readonly runtime: IBlobManagerRuntime;
|
|
@@ -165,9 +165,9 @@ export declare class BlobManager {
|
|
|
165
165
|
*/
|
|
166
166
|
private readonly uploadAndAttach;
|
|
167
167
|
/**
|
|
168
|
-
* Resubmit a BlobAttach op. Used to add storage IDs to
|
|
168
|
+
* Resubmit a BlobAttach op. Used to add storage IDs to messages that were
|
|
169
169
|
* submitted to runtime while disconnected.
|
|
170
|
-
* @param metadata -
|
|
170
|
+
* @param metadata - message metadata containing storage and/or local IDs
|
|
171
171
|
*/
|
|
172
172
|
reSubmit(metadata: Record<string, unknown> | undefined): void;
|
|
173
173
|
processBlobAttachMessage(message: ISequencedMessageEnvelope, local: boolean): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobManager.d.ts","sourceRoot":"","sources":["../../src/blobManager/blobManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEN,KA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A8B;IAazB,UAAU,CACtB,IAAI,EAAE,eAAe,EACrB,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,kCAAkC,CAAC,eAAe,CAAC,CAAC;YAmBjD,kBAAkB;YAoBlB,gBAAgB;IAU9B,OAAO,CAAC,4BAA4B;IA0BpC;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAsL9B;IAEF;;;;OAIG;IACI,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI;IAsB7D,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IA4BlF,SAAS,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,GAAG,qBAAqB;IAI7E;;;;;OAKG;IACI,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,sBAAsB;IAcjE;;;;;;;;;;;;;;;;OAgBG;IACI,qBAAqB,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IA2CxF;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;;;;OAKG;IACH,SAAgB,kBAAkB,yBAA0B,IAAI,MAAM,EAAE,MAAM,CAAC,KAAG,IAAI,CAuBpF;IAEF;;;;;OAKG;IACH,SAAgB,iBAAiB,QAAa,QAAQ,IAAI,CAAC,CAOzD;IAEF;;;;OAIG;IACI,eAAe,IAAI,aAAa,GAAG,SAAS;CA4BnD;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,YAAa,MAAM,KAAG,MACtB,CAAC;AAWtC;;GAEG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM,gCACL,CAAC"}
|
|
@@ -106,7 +106,7 @@ export class BlobManager {
|
|
|
106
106
|
* rejects on error during upload or if the signal is aborted.
|
|
107
107
|
*
|
|
108
108
|
* Most of the time this should be expected to exit in uploaded state, but if we are loading from pending
|
|
109
|
-
* state we may see an attach
|
|
109
|
+
* state we may see an attach message from the client that generated the pending state, which can complete the
|
|
110
110
|
* attach while the upload is outstanding.
|
|
111
111
|
*/
|
|
112
112
|
const ensureUploaded = async () => {
|
|
@@ -181,7 +181,7 @@ export class BlobManager {
|
|
|
181
181
|
const localBlobRecord = this.localBlobCache.get(localId);
|
|
182
182
|
if (localBlobRecord?.state === "attached") {
|
|
183
183
|
// In normal creation flows, the blob will be in uploaded state here. But if we are loading from pending
|
|
184
|
-
// state and see an attach
|
|
184
|
+
// state and see an attach message from the client that generated the pending state, we may have reached
|
|
185
185
|
// attached state in the middle of the upload attempt. In that case there's no more work to do and we
|
|
186
186
|
// can just return.
|
|
187
187
|
return true;
|
|
@@ -215,7 +215,7 @@ export class BlobManager {
|
|
|
215
215
|
resolve(true);
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
|
-
// Although we already checked for TTL expiry above, the
|
|
218
|
+
// Although we already checked for TTL expiry above, the message we're about to send may later be asked
|
|
219
219
|
// to resubmit. Before we resubmit, we check again for TTL expiry - this listener is how we learn if
|
|
220
220
|
// we discovered expiry in the resubmit flow.
|
|
221
221
|
const onBlobExpired = (_localId) => {
|
|
@@ -238,7 +238,7 @@ export class BlobManager {
|
|
|
238
238
|
this.internalEvents.on("processedBlobAttach", onProcessedBlobAttach);
|
|
239
239
|
this.internalEvents.on("blobExpired", onBlobExpired);
|
|
240
240
|
signal?.addEventListener("abort", onSignalAbort);
|
|
241
|
-
this.
|
|
241
|
+
this.sendBlobAttachMessage(localId, localBlobRecord.storageId);
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
};
|
|
@@ -289,10 +289,10 @@ export class BlobManager {
|
|
|
289
289
|
// TODO: Determine if Promise.all is ergonomic at the callsite. Would Promise.allSettled be better?
|
|
290
290
|
await Promise.all(localIdsToUpload.map(async (localId) => this.uploadAndAttach(localId)));
|
|
291
291
|
};
|
|
292
|
-
const { routeContext, blobManagerLoadInfo, storage,
|
|
292
|
+
const { routeContext, blobManagerLoadInfo, storage, sendBlobAttachMessage, blobRequested, isBlobDeleted, runtime, pendingBlobs, localIdGenerator, createBlobPayloadPending, } = props;
|
|
293
293
|
this.routeContext = routeContext;
|
|
294
294
|
this.storage = storage;
|
|
295
|
-
this.
|
|
295
|
+
this.sendBlobAttachMessage = sendBlobAttachMessage;
|
|
296
296
|
this.blobRequested = blobRequested;
|
|
297
297
|
this.isBlobDeleted = isBlobDeleted;
|
|
298
298
|
this.runtime = runtime;
|
|
@@ -370,7 +370,7 @@ export class BlobManager {
|
|
|
370
370
|
// Handles for detached blobs are not payload pending, though they should also always be present
|
|
371
371
|
// in the localBlobCache and therefore should never need to refer to storage.
|
|
372
372
|
assert(payloadPending, 0x11f /* "requesting unknown blobs" */);
|
|
373
|
-
// If we didn't find it in the redirectTable and it's payloadPending, assume the attach
|
|
373
|
+
// If we didn't find it in the redirectTable and it's payloadPending, assume the attach message is coming
|
|
374
374
|
// eventually and wait. We do this even if the local client doesn't have the blob payloadPending flag
|
|
375
375
|
// enabled, in case a remote client does have it enabled. This wait may be infinite if the uploading
|
|
376
376
|
// client failed the upload and doesn't exist anymore.
|
|
@@ -454,16 +454,16 @@ export class BlobManager {
|
|
|
454
454
|
return blobHandle;
|
|
455
455
|
}
|
|
456
456
|
/**
|
|
457
|
-
* Resubmit a BlobAttach op. Used to add storage IDs to
|
|
457
|
+
* Resubmit a BlobAttach op. Used to add storage IDs to messages that were
|
|
458
458
|
* submitted to runtime while disconnected.
|
|
459
|
-
* @param metadata -
|
|
459
|
+
* @param metadata - message metadata containing storage and/or local IDs
|
|
460
460
|
*/
|
|
461
461
|
reSubmit(metadata) {
|
|
462
462
|
assert(isBlobMetadata(metadata), 0xc01 /* Expected blob metadata for a BlobAttach op */);
|
|
463
463
|
const { localId, blobId: storageId } = metadata;
|
|
464
464
|
// Any blob that we're actively trying to advance to attached state must be in attaching state.
|
|
465
465
|
// Decline to resubmit for anything else.
|
|
466
|
-
// For example, we might be asked to resubmit stashed
|
|
466
|
+
// For example, we might be asked to resubmit stashed messages for blobs that never had their handle
|
|
467
467
|
// attached - these won't have a localBlobCache entry because we filter them out when generating
|
|
468
468
|
// pending state. We shouldn't try to attach them since they won't be accessible to the customer
|
|
469
469
|
// and would just be considered garbage immediately.
|
|
@@ -476,7 +476,7 @@ export class BlobManager {
|
|
|
476
476
|
this.internalEvents.emit("blobExpired", localId);
|
|
477
477
|
}
|
|
478
478
|
else {
|
|
479
|
-
this.
|
|
479
|
+
this.sendBlobAttachMessage(localId, storageId);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
}
|
|
@@ -489,9 +489,9 @@ export class BlobManager {
|
|
|
489
489
|
state: "attached",
|
|
490
490
|
blob: maybeLocalBlobRecord.blob,
|
|
491
491
|
};
|
|
492
|
-
// Processing a blob attach
|
|
492
|
+
// Processing a blob attach message is authoritative and may stomp on any existing state. Other
|
|
493
493
|
// callsites that update localBlobCache entries must take proper caution to handle the case
|
|
494
|
-
// that a blob attach
|
|
494
|
+
// that a blob attach message is processed concurrently.
|
|
495
495
|
this.localBlobCache.set(localId, attachedBlobRecord);
|
|
496
496
|
// Note there may or may not be an entry in pendingBlobsWithAttachedHandles for this localId,
|
|
497
497
|
// in particular for the non-payloadPending case since we should be reaching this point
|
|
@@ -551,7 +551,7 @@ export class BlobManager {
|
|
|
551
551
|
const localId = getLocalIdFromGCNodePath(route);
|
|
552
552
|
// If the blob hasn't already been deleted, log an error because this should never happen.
|
|
553
553
|
// If the blob has already been deleted, log a telemetry event. This can happen because multiple GC
|
|
554
|
-
// sweep
|
|
554
|
+
// sweep messages can contain the same data store. It would be interesting to track how often this happens.
|
|
555
555
|
const alreadyDeleted = this.isBlobDeleted(route);
|
|
556
556
|
const storageId = this.redirectTable.get(localId);
|
|
557
557
|
if (storageId === undefined) {
|
|
@@ -614,8 +614,8 @@ export class BlobManager {
|
|
|
614
614
|
// We downgrade uploading blobs to localOnly, and attaching blobs to uploaded. In the case of
|
|
615
615
|
// uploading blobs, we don't have a way to retrieve the eventual storageId so the upload will
|
|
616
616
|
// need to be restarted anyway. In the case of attaching blobs, we can't know whether the
|
|
617
|
-
// BlobAttach
|
|
618
|
-
// remain prepared to handle seeing the ack of the original
|
|
617
|
+
// BlobAttach message will eventually be ack'd. So we assume we'll need to send another message, but also
|
|
618
|
+
// remain prepared to handle seeing the ack of the original message after loading from pending state.
|
|
619
619
|
pendingBlobs[localId] =
|
|
620
620
|
localBlobRecord.state === "localOnly" || localBlobRecord.state === "uploading"
|
|
621
621
|
? {
|