@fluidframework/container-runtime 2.0.2 → 2.1.0-276326
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/README.md +9 -0
- package/api-extractor/api-extractor.legacy.json +4 -0
- package/api-report/container-runtime.beta.api.md +0 -64
- package/api-report/{container-runtime.alpha.api.md → container-runtime.legacy.alpha.api.md} +0 -64
- package/api-report/container-runtime.public.api.md +0 -64
- package/container-runtime.test-files.tar +0 -0
- package/dist/blobManager.d.ts +1 -0
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js.map +1 -1
- package/dist/channelCollection.d.ts +1 -0
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +1 -0
- package/dist/channelCollection.js.map +1 -1
- package/dist/containerRuntime.d.ts +19 -2
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +14 -2
- package/dist/containerRuntime.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +4 -2
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +5 -2
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +11 -2
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +2 -3
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +0 -6
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +1 -2
- package/dist/gc/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -1
- package/dist/messageTypes.d.ts +1 -0
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js +1 -0
- package/dist/messageTypes.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +4 -0
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +8 -4
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +18 -16
- package/dist/opLifecycle/outbox.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingStateManager.d.ts +8 -6
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +18 -14
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/summary/documentSchema.d.ts +8 -0
- package/dist/summary/documentSchema.d.ts.map +1 -1
- package/dist/summary/documentSchema.js +2 -0
- package/dist/summary/documentSchema.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -0
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -0
- package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/summarizer.d.ts +1 -0
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +1 -0
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +29 -0
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryCollection.d.ts +10 -0
- package/dist/summary/summaryCollection.d.ts.map +1 -1
- package/dist/summary/summaryCollection.js +1 -0
- package/dist/summary/summaryCollection.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +8 -0
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js.map +1 -1
- package/lib/blobManager.d.ts +1 -0
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js.map +1 -1
- package/lib/channelCollection.d.ts +1 -0
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +1 -0
- package/lib/channelCollection.js.map +1 -1
- package/lib/containerRuntime.d.ts +19 -2
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +14 -2
- package/lib/containerRuntime.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +4 -2
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +6 -3
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +11 -2
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +1 -2
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +1 -7
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/index.d.ts +1 -1
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +1 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/messageTypes.d.ts +1 -0
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js +1 -0
- package/lib/messageTypes.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +4 -0
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +8 -4
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +18 -16
- package/lib/opLifecycle/outbox.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingStateManager.d.ts +8 -6
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +18 -14
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/summary/documentSchema.d.ts +8 -0
- package/lib/summary/documentSchema.d.ts.map +1 -1
- package/lib/summary/documentSchema.js +2 -0
- package/lib/summary/documentSchema.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -0
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts +1 -0
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/summarizer.d.ts +1 -0
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +1 -0
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +29 -0
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryCollection.d.ts +10 -0
- package/lib/summary/summaryCollection.d.ts.map +1 -1
- package/lib/summary/summaryCollection.js +1 -0
- package/lib/summary/summaryCollection.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +8 -0
- package/lib/summary/summaryFormat.d.ts.map +1 -1
- package/lib/summary/summaryFormat.js.map +1 -1
- package/package.json +28 -92
- package/src/blobManager.ts +1 -0
- package/src/channelCollection.ts +1 -0
- package/src/containerRuntime.ts +23 -2
- package/src/gc/garbageCollection.ts +8 -2
- package/src/gc/gcConfigs.ts +6 -3
- package/src/gc/gcDefinitions.ts +11 -2
- package/src/gc/gcTelemetry.ts +0 -7
- package/src/gc/index.ts +0 -1
- package/src/messageTypes.ts +1 -0
- package/src/opLifecycle/batchManager.ts +4 -0
- package/src/opLifecycle/outbox.ts +19 -21
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +25 -20
- package/src/summary/documentSchema.ts +8 -0
- package/src/summary/orderedClientElection.ts +1 -0
- package/src/summary/runWhileConnectedCoordinator.ts +1 -0
- package/src/summary/summarizer.ts +1 -0
- package/src/summary/summarizerTypes.ts +29 -0
- package/src/summary/summaryCollection.ts +10 -0
- package/src/summary/summaryFormat.ts +8 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizer.js","sourceRoot":"","sources":["../../src/summary/summarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAEjE,kEAA+D;AAC/D,uEAOkD;AAKlD,iEAA2D;AAC3D,uEAAmE;AAiBnE,+DAA+D;AAE/D,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C,MAAa,kBACZ,SAAQ,uBAAY;IAMpB,YACC,YAAoB,EACX,SAAkB,KAAK;QAEhC,KAAK,CAAC,YAAY,CAAC,CAAC;QAFX,WAAM,GAAN,MAAM,CAAiB;QALxB,cAAS,GAAG,gBAAgB,CAAC;QAC7B,aAAQ,GAAG,IAAI,CAAC;IAOzB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,KAAU,EAAE,SAAkB,KAAK,EAAE,MAA2B;QAC3E,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9E,OAAO,IAAA,0BAAe,EAAqB,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;CACD;AAlBD,gDAkBC;AAEM,MAAM,wBAAwB,GAAG,CAAC,YAAoB,EAAE,MAAe,EAAE,EAAE,CACjF,IAAI,kBAAkB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AADjC,QAAA,wBAAwB,4BACS;AAE9C;;;;;GAKG;AACH,MAAa,UAAW,SAAQ,gCAAoC;IACnE,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;IASD;IACC;;OAEG;IACc,OAA2B,EAC3B,m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AY,CAAC,OAAO;wBACzB,cAAc,CAAC,aAAa;qBAC5B,CAAC,CAAC;oBACH,MAAM,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;oBACxC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBAChC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACd,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;oBACjB,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;gBACpD,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;gBACjB,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,MAAM,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;YAEJ,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IAEM,gBAAgB,CAAC,OAAiC;QACxD,IACC,IAAI,CAAC,SAAS;YACd,IAAI,CAAC,iBAAiB,KAAK,SAAS;YACpC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAC9B,CAAC;YACF,MAAM,IAAI,qBAAU,CAAC,gDAAgD,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAEM,oBAAoB,CAAE,gBAAyB;QACrD,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACtD,CAAC;CACD;AA7RD,gCA6RC","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 { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIFluidErrorBase,\n\tITelemetryLoggerExt,\n\tLoggingError,\n\tUsageError,\n\tcreateChildLogger,\n\twrapErrorAndLog,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ISummaryConfiguration } from \"../containerRuntime.js\";\n\nimport { ICancellableSummarizerController } from \"./runWhileConnectedCoordinator.js\";\nimport { RunningSummarizer } from \"./runningSummarizer.js\";\nimport { SummarizeHeuristicData } from \"./summarizerHeuristics.js\";\nimport {\n\tEnqueueSummarizeResult,\n\tIConnectableRuntime,\n\tIEnqueueSummarizeOptions,\n\tIOnDemandSummarizeOptions,\n\tISummarizeEventProps,\n\tISummarizeHeuristicData,\n\tISummarizeResults,\n\tISummarizer,\n\tISummarizerEvents,\n\tISummarizerInternalsProvider,\n\tISummarizerRuntime,\n\tISummarizingWarning,\n\tSummarizerStopReason,\n} from \"./summarizerTypes.js\";\nimport { SummaryCollection } from \"./summaryCollection.js\";\nimport { SummarizeResultBuilder } from \"./summaryGenerator.js\";\n\nconst summarizingError = \"summarizingError\";\n\nexport class SummarizingWarning\n\textends LoggingError\n\timplements ISummarizingWarning, IFluidErrorBase\n{\n\treadonly errorType = summarizingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\terrorMessage: string,\n\t\treadonly logged: boolean = false,\n\t) {\n\t\tsuper(errorMessage);\n\t}\n\n\tstatic wrap(error: any, logged: boolean = false, logger: ITelemetryLoggerExt) {\n\t\tconst newErrorFn = (errMsg: string) => new SummarizingWarning(errMsg, logged);\n\t\treturn wrapErrorAndLog<SummarizingWarning>(error, newErrorFn, logger);\n\t}\n}\n\nexport const createSummarizingWarning = (errorMessage: string, logged: boolean) =>\n\tnew SummarizingWarning(errorMessage, logged);\n\n/**\n * Summarizer is responsible for coordinating when to generate and send summaries.\n * It is the main entry point for summary work.\n * It is created only by summarizing container (i.e. one with clientType === \"summarizer\")\n * @alpha\n */\nexport class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {\n\tpublic get ISummarizer() {\n\t\treturn this;\n\t}\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate runningSummarizer?: RunningSummarizer;\n\tprivate _disposed: boolean = false;\n\tprivate starting: boolean = false;\n\n\tprivate readonly stopDeferred = new Deferred<SummarizerStopReason>();\n\n\tconstructor(\n\t\t/** Reference to runtime that created this object.\n\t\t * i.e. runtime with clientType === \"summarizer\"\n\t\t */\n\t\tprivate readonly runtime: ISummarizerRuntime,\n\t\tprivate readonly configurationGetter: () => ISummaryConfiguration,\n\t\t/** Represents an object that can generate summary.\n\t\t * In practical terms, it's same runtime (this.runtime) with clientType === \"summarizer\".\n\t\t */\n\t\tprivate readonly internalsProvider: ISummarizerInternalsProvider,\n\t\thandleContext: IFluidHandleContext,\n\t\tpublic readonly summaryCollection: SummaryCollection,\n\t\tprivate readonly runCoordinatorCreateFn: (\n\t\t\truntime: IConnectableRuntime,\n\t\t) => Promise<ICancellableSummarizerController>,\n\t) {\n\t\tsuper();\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: this.runtime.baseLogger,\n\t\t\tnamespace: \"Summarizer\",\n\t\t});\n\t}\n\n\tpublic async run(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\ttry {\n\t\t\treturn await this.runCore(onBehalfOf);\n\t\t} catch (error) {\n\t\t\tthis.stop(\"summarizerException\");\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t} finally {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\t/**\n\t * Stops the summarizer from running. This will complete\n\t * the run promise, and also close the container.\n\t * @param reason - reason code for stopping\n\t */\n\tpublic stop(reason: SummarizerStopReason) {\n\t\tthis.stopDeferred.resolve(reason);\n\t}\n\n\tpublic close() {\n\t\t// This will result in \"summarizerClientDisconnected\" stop reason recorded in telemetry,\n\t\t// unless stop() was called earlier\n\t\tthis.dispose();\n\t\tthis.runtime.disposeFn();\n\t}\n\n\tprivate async runCore(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\tconst runCoordinator: ICancellableSummarizerController = await this.runCoordinatorCreateFn(\n\t\t\tthis.runtime,\n\t\t);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopP = Promise.race([runCoordinator.waitCancelled, this.stopDeferred.promise]);\n\t\tvoid stopP.then((reason) => {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"StoppingSummarizer\",\n\t\t\t\tonBehalfOf,\n\t\t\t\treason,\n\t\t\t});\n\t\t});\n\n\t\tif (runCoordinator.cancelled) {\n\t\t\treturn runCoordinator.waitCancelled;\n\t\t}\n\n\t\tconst runningSummarizer = await this.start(onBehalfOf, runCoordinator);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopReason = await stopP;\n\n\t\t// There are two possible approaches here:\n\t\t// 1. Propagate cancellation from this.stopDeferred to runCoordinator. This will ensure that we move to the exit\n\t\t// faster, including breaking out of the RunningSummarizer.trySummarize() faster.\n\t\t// We could create new coordinator and pass it to waitStop() -> trySummarizeOnce(\"lastSummary\") flow.\n\t\t// The con of this approach is that we might cancel active summary, and lastSummary will fail because it\n\t\t// did not wait for ack/nack from previous summary. Plus we disregard any 429 kind of info from service\n\t\t// that way (i.e. trySummarize() loop might have been waiting for 5 min because storage told us so).\n\t\t// In general, it's more wasted resources.\n\t\t// 2. We can not do it and make waitStop() do last summary only if there was no active summary. This ensures\n\t\t// that client behaves properly (from server POV) and we do not waste resources. But, it may mean we wait\n\t\t// substantially longer for trySummarize() retries to play out and thus this summary loop may run into\n\t\t// conflict with new summarizer client starting on different client.\n\t\t// As of now, #2 is implemented. It's more forward looking, as issue #7279 suggests changing design for new\n\t\t// summarizer client to not be created until current summarizer fully moves to exit, and that would reduce\n\t\t// cons of #2 substantially.\n\n\t\t// Cleanup after running\n\t\tawait runningSummarizer.waitStop(\n\t\t\t!runCoordinator.cancelled && Summarizer.stopReasonCanRunLastSummary(stopReason),\n\t\t);\n\n\t\t// Propagate reason and ensure that if someone is waiting for cancellation token, they are moving to exit\n\t\trunCoordinator.stop(stopReason);\n\n\t\treturn stopReason;\n\t}\n\n\t/**\n\t * Should we try to run a last summary for the given stop reason?\n\t * Currently only allows \"parentNotConnected\"\n\t * @param stopReason - SummarizerStopReason\n\t * @returns `true` if the stop reason can run a last summary, otherwise `false`.\n\t */\n\tpublic static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean {\n\t\treturn stopReason === \"parentNotConnected\";\n\t}\n\n\tprivate _heuristicData: ISummarizeHeuristicData | undefined;\n\n\t/**\n\t * Put the summarizer in a started state, including creating and initializing the RunningSummarizer.\n\t * The start request can come either from the SummaryManager (in the auto-summarize case) or from the user\n\t * (in the on-demand case).\n\t * @param onBehalfOf - ID of the client that requested that the summarizer start\n\t * @param runCoordinator - cancellation token\n\t * @param newConfig - Summary configuration to override the existing config when invoking the RunningSummarizer.\n\t * @returns A promise that is fulfilled when the RunningSummarizer is ready.\n\t */\n\tprivate async start(\n\t\tonBehalfOf: string,\n\t\trunCoordinator: ICancellableSummarizerController,\n\t): Promise<RunningSummarizer> {\n\t\tif (this.runningSummarizer) {\n\t\t\tif (this.runningSummarizer.disposed) {\n\t\t\t\tthrow new UsageError(\"Starting a disposed summarizer\");\n\t\t\t}\n\t\t\treturn this.runningSummarizer;\n\t\t}\n\t\tif (this.starting) {\n\t\t\tthrow new UsageError(\"Attempting to start a summarizer that is already starting\");\n\t\t}\n\t\tthis.starting = true;\n\t\t// Initialize values and first ack (time is not exact)\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"RunningSummarizer\",\n\t\t\tonBehalfOf,\n\t\t\tinitSummarySeqNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\tconfig: JSON.stringify(this.configurationGetter()),\n\t\t});\n\n\t\t// Summarizing container ID (with clientType === \"summarizer\")\n\t\tconst clientId = this.runtime.clientId;\n\t\tif (clientId === undefined) {\n\t\t\tthrow new UsageError(\"clientId should be defined if connected.\");\n\t\t}\n\n\t\tthis._heuristicData = new SummarizeHeuristicData(\n\t\t\tthis.runtime.deltaManager.lastSequenceNumber,\n\t\t\t{\n\t\t\t\t/** summary attempt baseline for heuristics */\n\t\t\t\trefSequenceNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\t\tsummaryTime: Date.now(),\n\t\t\t} as const,\n\t\t);\n\n\t\tconst runningSummarizer = await RunningSummarizer.start(\n\t\t\tthis.logger,\n\t\t\tthis.summaryCollection.createWatcher(clientId),\n\t\t\tthis.configurationGetter(),\n\t\t\tasync (...args) => this.internalsProvider.submitSummary(...args), // submitSummaryCallback\n\t\t\tasync (...args) => this.internalsProvider.refreshLatestSummaryAck(...args), // refreshLatestSummaryAckCallback\n\t\t\tthis._heuristicData,\n\t\t\tthis.summaryCollection,\n\t\t\trunCoordinator /* cancellationToken */,\n\t\t\t(reason) => runCoordinator.stop(reason) /* stopSummarizerCallback */,\n\t\t\tthis.runtime,\n\t\t);\n\t\tthis.runningSummarizer = runningSummarizer;\n\t\tthis.runningSummarizer.on(\"summarize\", this.handleSummarizeEvent);\n\t\tthis.starting = false;\n\t\treturn runningSummarizer;\n\t}\n\n\tprivate readonly handleSummarizeEvent = (eventProps: ISummarizeEventProps) => {\n\t\tthis.emit(\"summarize\", eventProps);\n\t};\n\n\t/**\n\t * Disposes of resources after running. This cleanup will\n\t * clear any outstanding timers and reset some of the state\n\t * properties.\n\t * Called by ContainerRuntime when it is disposed, as well as at the end the run().\n\t */\n\tpublic dispose() {\n\t\t// Given that the call can come from own ContainerRuntime, ensure that we stop all the processes.\n\t\tthis.stop(\"summarizerClientDisconnected\");\n\n\t\tthis._disposed = true;\n\t\tif (this.runningSummarizer) {\n\t\t\tthis.runningSummarizer.off(\"summarize\", this.handleSummarizeEvent);\n\t\t\tthis.runningSummarizer.dispose();\n\t\t\tthis.runningSummarizer = undefined;\n\t\t}\n\t}\n\n\tpublic summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults {\n\t\ttry {\n\t\t\tif (this._disposed || this.runningSummarizer?.disposed) {\n\t\t\t\tthrow new UsageError(\"Summarizer is already disposed.\");\n\t\t\t}\n\t\t\tif (\n\t\t\t\tthis.runtime.summarizerClientId !== undefined &&\n\t\t\t\tthis.runtime.summarizerClientId !== this.runtime.clientId\n\t\t\t) {\n\t\t\t\t// If there is an elected summarizer, and it's not this one, don't allow on-demand summary.\n\t\t\t\t// This is to prevent the on-demand summary and heuristic-based summary from stepping on\n\t\t\t\t// each other.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"On-demand summary attempted while an elected summarizer is present\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst builder = new SummarizeResultBuilder();\n\t\t\tif (this.runningSummarizer) {\n\t\t\t\t// Summarizer is already running. Go ahead and start.\n\t\t\t\treturn this.runningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t}\n\n\t\t\t// Summarizer isn't running, so we need to start it, which is an async operation.\n\t\t\t// Manage the promise related to creating the cancellation token here.\n\t\t\t// The promises related to starting, summarizing,\n\t\t\t// and submitting are communicated to the caller through the results builder.\n\t\t\tconst coordinatorCreateP = this.runCoordinatorCreateFn(this.runtime);\n\n\t\t\tcoordinatorCreateP\n\t\t\t\t.then((runCoordinator) => {\n\t\t\t\t\t// Successfully created the cancellation token. Start the summarizer.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst startP = this.start(this.runtime.clientId!, runCoordinator);\n\t\t\t\t\tstartP\n\t\t\t\t\t\t.then(async (runningSummarizer) => {\n\t\t\t\t\t\t\t// Successfully started the summarizer. Run it.\n\t\t\t\t\t\t\trunningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t\t\t\t\t// Wait for a command to stop or loss of connectivity before tearing down the summarizer and client.\n\t\t\t\t\t\t\tconst stopReason = await Promise.race([\n\t\t\t\t\t\t\t\tthis.stopDeferred.promise,\n\t\t\t\t\t\t\t\trunCoordinator.waitCancelled,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tawait runningSummarizer.waitStop(false);\n\t\t\t\t\t\t\trunCoordinator.stop(stopReason);\n\t\t\t\t\t\t\tthis.close();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((reason) => {\n\t\t\t\t\t\t\tbuilder.fail(\"Failed to start summarizer\", reason);\n\t\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch((reason) => {\n\t\t\t\t\tbuilder.fail(\"Failed to create cancellation token\", reason);\n\t\t\t\t});\n\n\t\t\treturn builder.build();\n\t\t} catch (error) {\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t}\n\t}\n\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tif (\n\t\t\tthis._disposed ||\n\t\t\tthis.runningSummarizer === undefined ||\n\t\t\tthis.runningSummarizer.disposed\n\t\t) {\n\t\t\tthrow new UsageError(\"Summarizer is not running or already disposed.\");\n\t\t}\n\t\treturn this.runningSummarizer.enqueueSummarize(options);\n\t}\n\n\tpublic recordSummaryAttempt?(summaryRefSeqNum?: number) {\n\t\tthis._heuristicData?.recordAttempt(summaryRefSeqNum);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"summarizer.js","sourceRoot":"","sources":["../../src/summary/summarizer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAEjE,kEAA+D;AAC/D,uEAOkD;AAKlD,iEAA2D;AAC3D,uEAAmE;AAiBnE,+DAA+D;AAE/D,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C,MAAa,kBACZ,SAAQ,uBAAY;IAMpB,YACC,YAAoB,EACX,SAAkB,KAAK;QAEhC,KAAK,CAAC,YAAY,CAAC,CAAC;QAFX,WAAM,GAAN,MAAM,CAAiB;QALxB,cAAS,GAAG,gBAAgB,C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AC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IAEM,gBAAgB,CAAC,OAAiC;QACxD,IACC,IAAI,CAAC,SAAS;YACd,IAAI,CAAC,iBAAiB,KAAK,SAAS;YACpC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAC9B,CAAC;YACF,MAAM,IAAI,qBAAU,CAAC,gDAAgD,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAEM,oBAAoB,CAAE,gBAAyB;QACrD,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACtD,CAAC;CACD;AA7RD,gCA6RC","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 { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIFluidErrorBase,\n\tITelemetryLoggerExt,\n\tLoggingError,\n\tUsageError,\n\tcreateChildLogger,\n\twrapErrorAndLog,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ISummaryConfiguration } from \"../containerRuntime.js\";\n\nimport { ICancellableSummarizerController } from \"./runWhileConnectedCoordinator.js\";\nimport { RunningSummarizer } from \"./runningSummarizer.js\";\nimport { SummarizeHeuristicData } from \"./summarizerHeuristics.js\";\nimport {\n\tEnqueueSummarizeResult,\n\tIConnectableRuntime,\n\tIEnqueueSummarizeOptions,\n\tIOnDemandSummarizeOptions,\n\tISummarizeEventProps,\n\tISummarizeHeuristicData,\n\tISummarizeResults,\n\tISummarizer,\n\tISummarizerEvents,\n\tISummarizerInternalsProvider,\n\tISummarizerRuntime,\n\tISummarizingWarning,\n\tSummarizerStopReason,\n} from \"./summarizerTypes.js\";\nimport { SummaryCollection } from \"./summaryCollection.js\";\nimport { SummarizeResultBuilder } from \"./summaryGenerator.js\";\n\nconst summarizingError = \"summarizingError\";\n\nexport class SummarizingWarning\n\textends LoggingError\n\timplements ISummarizingWarning, IFluidErrorBase\n{\n\treadonly errorType = summarizingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\terrorMessage: string,\n\t\treadonly logged: boolean = false,\n\t) {\n\t\tsuper(errorMessage);\n\t}\n\n\tstatic wrap(error: any, logged: boolean = false, logger: ITelemetryLoggerExt) {\n\t\tconst newErrorFn = (errMsg: string) => new SummarizingWarning(errMsg, logged);\n\t\treturn wrapErrorAndLog<SummarizingWarning>(error, newErrorFn, logger);\n\t}\n}\n\nexport const createSummarizingWarning = (errorMessage: string, logged: boolean) =>\n\tnew SummarizingWarning(errorMessage, logged);\n\n/**\n * Summarizer is responsible for coordinating when to generate and send summaries.\n * It is the main entry point for summary work.\n * It is created only by summarizing container (i.e. one with clientType === \"summarizer\")\n * @legacy\n * @alpha\n */\nexport class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {\n\tpublic get ISummarizer() {\n\t\treturn this;\n\t}\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate runningSummarizer?: RunningSummarizer;\n\tprivate _disposed: boolean = false;\n\tprivate starting: boolean = false;\n\n\tprivate readonly stopDeferred = new Deferred<SummarizerStopReason>();\n\n\tconstructor(\n\t\t/** Reference to runtime that created this object.\n\t\t * i.e. runtime with clientType === \"summarizer\"\n\t\t */\n\t\tprivate readonly runtime: ISummarizerRuntime,\n\t\tprivate readonly configurationGetter: () => ISummaryConfiguration,\n\t\t/** Represents an object that can generate summary.\n\t\t * In practical terms, it's same runtime (this.runtime) with clientType === \"summarizer\".\n\t\t */\n\t\tprivate readonly internalsProvider: ISummarizerInternalsProvider,\n\t\thandleContext: IFluidHandleContext,\n\t\tpublic readonly summaryCollection: SummaryCollection,\n\t\tprivate readonly runCoordinatorCreateFn: (\n\t\t\truntime: IConnectableRuntime,\n\t\t) => Promise<ICancellableSummarizerController>,\n\t) {\n\t\tsuper();\n\t\tthis.logger = createChildLogger({\n\t\t\tlogger: this.runtime.baseLogger,\n\t\t\tnamespace: \"Summarizer\",\n\t\t});\n\t}\n\n\tpublic async run(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\ttry {\n\t\t\treturn await this.runCore(onBehalfOf);\n\t\t} catch (error) {\n\t\t\tthis.stop(\"summarizerException\");\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t} finally {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\t/**\n\t * Stops the summarizer from running. This will complete\n\t * the run promise, and also close the container.\n\t * @param reason - reason code for stopping\n\t */\n\tpublic stop(reason: SummarizerStopReason) {\n\t\tthis.stopDeferred.resolve(reason);\n\t}\n\n\tpublic close() {\n\t\t// This will result in \"summarizerClientDisconnected\" stop reason recorded in telemetry,\n\t\t// unless stop() was called earlier\n\t\tthis.dispose();\n\t\tthis.runtime.disposeFn();\n\t}\n\n\tprivate async runCore(onBehalfOf: string): Promise<SummarizerStopReason> {\n\t\tconst runCoordinator: ICancellableSummarizerController = await this.runCoordinatorCreateFn(\n\t\t\tthis.runtime,\n\t\t);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopP = Promise.race([runCoordinator.waitCancelled, this.stopDeferred.promise]);\n\t\tvoid stopP.then((reason) => {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"StoppingSummarizer\",\n\t\t\t\tonBehalfOf,\n\t\t\t\treason,\n\t\t\t});\n\t\t});\n\n\t\tif (runCoordinator.cancelled) {\n\t\t\treturn runCoordinator.waitCancelled;\n\t\t}\n\n\t\tconst runningSummarizer = await this.start(onBehalfOf, runCoordinator);\n\n\t\t// Wait for either external signal to cancel, or loss of connectivity.\n\t\tconst stopReason = await stopP;\n\n\t\t// There are two possible approaches here:\n\t\t// 1. Propagate cancellation from this.stopDeferred to runCoordinator. This will ensure that we move to the exit\n\t\t// faster, including breaking out of the RunningSummarizer.trySummarize() faster.\n\t\t// We could create new coordinator and pass it to waitStop() -> trySummarizeOnce(\"lastSummary\") flow.\n\t\t// The con of this approach is that we might cancel active summary, and lastSummary will fail because it\n\t\t// did not wait for ack/nack from previous summary. Plus we disregard any 429 kind of info from service\n\t\t// that way (i.e. trySummarize() loop might have been waiting for 5 min because storage told us so).\n\t\t// In general, it's more wasted resources.\n\t\t// 2. We can not do it and make waitStop() do last summary only if there was no active summary. This ensures\n\t\t// that client behaves properly (from server POV) and we do not waste resources. But, it may mean we wait\n\t\t// substantially longer for trySummarize() retries to play out and thus this summary loop may run into\n\t\t// conflict with new summarizer client starting on different client.\n\t\t// As of now, #2 is implemented. It's more forward looking, as issue #7279 suggests changing design for new\n\t\t// summarizer client to not be created until current summarizer fully moves to exit, and that would reduce\n\t\t// cons of #2 substantially.\n\n\t\t// Cleanup after running\n\t\tawait runningSummarizer.waitStop(\n\t\t\t!runCoordinator.cancelled && Summarizer.stopReasonCanRunLastSummary(stopReason),\n\t\t);\n\n\t\t// Propagate reason and ensure that if someone is waiting for cancellation token, they are moving to exit\n\t\trunCoordinator.stop(stopReason);\n\n\t\treturn stopReason;\n\t}\n\n\t/**\n\t * Should we try to run a last summary for the given stop reason?\n\t * Currently only allows \"parentNotConnected\"\n\t * @param stopReason - SummarizerStopReason\n\t * @returns `true` if the stop reason can run a last summary, otherwise `false`.\n\t */\n\tpublic static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean {\n\t\treturn stopReason === \"parentNotConnected\";\n\t}\n\n\tprivate _heuristicData: ISummarizeHeuristicData | undefined;\n\n\t/**\n\t * Put the summarizer in a started state, including creating and initializing the RunningSummarizer.\n\t * The start request can come either from the SummaryManager (in the auto-summarize case) or from the user\n\t * (in the on-demand case).\n\t * @param onBehalfOf - ID of the client that requested that the summarizer start\n\t * @param runCoordinator - cancellation token\n\t * @param newConfig - Summary configuration to override the existing config when invoking the RunningSummarizer.\n\t * @returns A promise that is fulfilled when the RunningSummarizer is ready.\n\t */\n\tprivate async start(\n\t\tonBehalfOf: string,\n\t\trunCoordinator: ICancellableSummarizerController,\n\t): Promise<RunningSummarizer> {\n\t\tif (this.runningSummarizer) {\n\t\t\tif (this.runningSummarizer.disposed) {\n\t\t\t\tthrow new UsageError(\"Starting a disposed summarizer\");\n\t\t\t}\n\t\t\treturn this.runningSummarizer;\n\t\t}\n\t\tif (this.starting) {\n\t\t\tthrow new UsageError(\"Attempting to start a summarizer that is already starting\");\n\t\t}\n\t\tthis.starting = true;\n\t\t// Initialize values and first ack (time is not exact)\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"RunningSummarizer\",\n\t\t\tonBehalfOf,\n\t\t\tinitSummarySeqNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\tconfig: JSON.stringify(this.configurationGetter()),\n\t\t});\n\n\t\t// Summarizing container ID (with clientType === \"summarizer\")\n\t\tconst clientId = this.runtime.clientId;\n\t\tif (clientId === undefined) {\n\t\t\tthrow new UsageError(\"clientId should be defined if connected.\");\n\t\t}\n\n\t\tthis._heuristicData = new SummarizeHeuristicData(\n\t\t\tthis.runtime.deltaManager.lastSequenceNumber,\n\t\t\t{\n\t\t\t\t/** summary attempt baseline for heuristics */\n\t\t\t\trefSequenceNumber: this.runtime.deltaManager.initialSequenceNumber,\n\t\t\t\tsummaryTime: Date.now(),\n\t\t\t} as const,\n\t\t);\n\n\t\tconst runningSummarizer = await RunningSummarizer.start(\n\t\t\tthis.logger,\n\t\t\tthis.summaryCollection.createWatcher(clientId),\n\t\t\tthis.configurationGetter(),\n\t\t\tasync (...args) => this.internalsProvider.submitSummary(...args), // submitSummaryCallback\n\t\t\tasync (...args) => this.internalsProvider.refreshLatestSummaryAck(...args), // refreshLatestSummaryAckCallback\n\t\t\tthis._heuristicData,\n\t\t\tthis.summaryCollection,\n\t\t\trunCoordinator /* cancellationToken */,\n\t\t\t(reason) => runCoordinator.stop(reason) /* stopSummarizerCallback */,\n\t\t\tthis.runtime,\n\t\t);\n\t\tthis.runningSummarizer = runningSummarizer;\n\t\tthis.runningSummarizer.on(\"summarize\", this.handleSummarizeEvent);\n\t\tthis.starting = false;\n\t\treturn runningSummarizer;\n\t}\n\n\tprivate readonly handleSummarizeEvent = (eventProps: ISummarizeEventProps) => {\n\t\tthis.emit(\"summarize\", eventProps);\n\t};\n\n\t/**\n\t * Disposes of resources after running. This cleanup will\n\t * clear any outstanding timers and reset some of the state\n\t * properties.\n\t * Called by ContainerRuntime when it is disposed, as well as at the end the run().\n\t */\n\tpublic dispose() {\n\t\t// Given that the call can come from own ContainerRuntime, ensure that we stop all the processes.\n\t\tthis.stop(\"summarizerClientDisconnected\");\n\n\t\tthis._disposed = true;\n\t\tif (this.runningSummarizer) {\n\t\t\tthis.runningSummarizer.off(\"summarize\", this.handleSummarizeEvent);\n\t\t\tthis.runningSummarizer.dispose();\n\t\t\tthis.runningSummarizer = undefined;\n\t\t}\n\t}\n\n\tpublic summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults {\n\t\ttry {\n\t\t\tif (this._disposed || this.runningSummarizer?.disposed) {\n\t\t\t\tthrow new UsageError(\"Summarizer is already disposed.\");\n\t\t\t}\n\t\t\tif (\n\t\t\t\tthis.runtime.summarizerClientId !== undefined &&\n\t\t\t\tthis.runtime.summarizerClientId !== this.runtime.clientId\n\t\t\t) {\n\t\t\t\t// If there is an elected summarizer, and it's not this one, don't allow on-demand summary.\n\t\t\t\t// This is to prevent the on-demand summary and heuristic-based summary from stepping on\n\t\t\t\t// each other.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"On-demand summary attempted while an elected summarizer is present\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst builder = new SummarizeResultBuilder();\n\t\t\tif (this.runningSummarizer) {\n\t\t\t\t// Summarizer is already running. Go ahead and start.\n\t\t\t\treturn this.runningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t}\n\n\t\t\t// Summarizer isn't running, so we need to start it, which is an async operation.\n\t\t\t// Manage the promise related to creating the cancellation token here.\n\t\t\t// The promises related to starting, summarizing,\n\t\t\t// and submitting are communicated to the caller through the results builder.\n\t\t\tconst coordinatorCreateP = this.runCoordinatorCreateFn(this.runtime);\n\n\t\t\tcoordinatorCreateP\n\t\t\t\t.then((runCoordinator) => {\n\t\t\t\t\t// Successfully created the cancellation token. Start the summarizer.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tconst startP = this.start(this.runtime.clientId!, runCoordinator);\n\t\t\t\t\tstartP\n\t\t\t\t\t\t.then(async (runningSummarizer) => {\n\t\t\t\t\t\t\t// Successfully started the summarizer. Run it.\n\t\t\t\t\t\t\trunningSummarizer.summarizeOnDemand(options, builder);\n\t\t\t\t\t\t\t// Wait for a command to stop or loss of connectivity before tearing down the summarizer and client.\n\t\t\t\t\t\t\tconst stopReason = await Promise.race([\n\t\t\t\t\t\t\t\tthis.stopDeferred.promise,\n\t\t\t\t\t\t\t\trunCoordinator.waitCancelled,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tawait runningSummarizer.waitStop(false);\n\t\t\t\t\t\t\trunCoordinator.stop(stopReason);\n\t\t\t\t\t\t\tthis.close();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((reason) => {\n\t\t\t\t\t\t\tbuilder.fail(\"Failed to start summarizer\", reason);\n\t\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch((reason) => {\n\t\t\t\t\tbuilder.fail(\"Failed to create cancellation token\", reason);\n\t\t\t\t});\n\n\t\t\treturn builder.build();\n\t\t} catch (error) {\n\t\t\tthrow SummarizingWarning.wrap(error, false /* logged */, this.logger);\n\t\t}\n\t}\n\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tif (\n\t\t\tthis._disposed ||\n\t\t\tthis.runningSummarizer === undefined ||\n\t\t\tthis.runningSummarizer.disposed\n\t\t) {\n\t\t\tthrow new UsageError(\"Summarizer is not running or already disposed.\");\n\t\t}\n\t\treturn this.runningSummarizer.enqueueSummarize(options);\n\t}\n\n\tpublic recordSummaryAttempt?(summaryRefSeqNum?: number) {\n\t\tthis._heuristicData?.recordAttempt(summaryRefSeqNum);\n\t}\n}\n"]}
|
|
@@ -14,6 +14,7 @@ import { SummarizeReason } from "./summaryGenerator.js";
|
|
|
14
14
|
/**
|
|
15
15
|
* Similar to AbortSignal, but using promise instead of events
|
|
16
16
|
* @param T - cancellation reason type
|
|
17
|
+
* @legacy
|
|
17
18
|
* @alpha
|
|
18
19
|
*/
|
|
19
20
|
export interface ICancellationToken<T> {
|
|
@@ -27,11 +28,13 @@ export interface ICancellationToken<T> {
|
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
29
30
|
* Similar to AbortSignal, but using promise instead of events
|
|
31
|
+
* @legacy
|
|
30
32
|
* @alpha
|
|
31
33
|
*/
|
|
32
34
|
export type ISummaryCancellationToken = ICancellationToken<SummarizerStopReason>;
|
|
33
35
|
/**
|
|
34
36
|
* Data required to update internal tracking state after receiving a Summary Ack.
|
|
37
|
+
* @legacy
|
|
35
38
|
* @alpha
|
|
36
39
|
*/
|
|
37
40
|
export interface IRefreshSummaryAckOptions {
|
|
@@ -45,6 +48,7 @@ export interface IRefreshSummaryAckOptions {
|
|
|
45
48
|
readonly summaryLogger: ITelemetryLoggerExt;
|
|
46
49
|
}
|
|
47
50
|
/**
|
|
51
|
+
* @legacy
|
|
48
52
|
* @alpha
|
|
49
53
|
*/
|
|
50
54
|
export interface ISummarizerInternalsProvider {
|
|
@@ -61,6 +65,7 @@ export interface ISummarizingWarning extends ContainerWarning {
|
|
|
61
65
|
readonly logged: boolean;
|
|
62
66
|
}
|
|
63
67
|
/**
|
|
68
|
+
* @legacy
|
|
64
69
|
* @alpha
|
|
65
70
|
*/
|
|
66
71
|
export interface IConnectableRuntime {
|
|
@@ -70,6 +75,7 @@ export interface IConnectableRuntime {
|
|
|
70
75
|
once(event: "connected" | "disconnected" | "dispose", listener: () => void): this;
|
|
71
76
|
}
|
|
72
77
|
/**
|
|
78
|
+
* @legacy
|
|
73
79
|
* @alpha
|
|
74
80
|
*/
|
|
75
81
|
export interface ISummarizerRuntime extends IConnectableRuntime {
|
|
@@ -84,6 +90,7 @@ export interface ISummarizerRuntime extends IConnectableRuntime {
|
|
|
84
90
|
}
|
|
85
91
|
/**
|
|
86
92
|
* Options affecting summarize behavior.
|
|
93
|
+
* @legacy
|
|
87
94
|
* @alpha
|
|
88
95
|
*/
|
|
89
96
|
export interface ISummarizeOptions {
|
|
@@ -91,6 +98,7 @@ export interface ISummarizeOptions {
|
|
|
91
98
|
readonly fullTree?: boolean;
|
|
92
99
|
}
|
|
93
100
|
/**
|
|
101
|
+
* @legacy
|
|
94
102
|
* @alpha
|
|
95
103
|
*/
|
|
96
104
|
export interface ISubmitSummaryOptions extends ISummarizeOptions {
|
|
@@ -104,6 +112,7 @@ export interface ISubmitSummaryOptions extends ISummarizeOptions {
|
|
|
104
112
|
readonly latestSummaryRefSeqNum: number;
|
|
105
113
|
}
|
|
106
114
|
/**
|
|
115
|
+
* @legacy
|
|
107
116
|
* @alpha
|
|
108
117
|
*/
|
|
109
118
|
export interface IOnDemandSummarizeOptions extends ISummarizeOptions {
|
|
@@ -114,6 +123,7 @@ export interface IOnDemandSummarizeOptions extends ISummarizeOptions {
|
|
|
114
123
|
}
|
|
115
124
|
/**
|
|
116
125
|
* Options to use when enqueueing a summarize attempt.
|
|
126
|
+
* @legacy
|
|
117
127
|
* @alpha
|
|
118
128
|
*/
|
|
119
129
|
export interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {
|
|
@@ -130,6 +140,7 @@ export interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {
|
|
|
130
140
|
/**
|
|
131
141
|
* In addition to the normal summary tree + stats, this contains additional stats
|
|
132
142
|
* only relevant at the root of the tree.
|
|
143
|
+
* @legacy
|
|
133
144
|
* @alpha
|
|
134
145
|
*/
|
|
135
146
|
export interface IGeneratedSummaryStats extends ISummaryStats {
|
|
@@ -148,6 +159,7 @@ export interface IGeneratedSummaryStats extends ISummaryStats {
|
|
|
148
159
|
}
|
|
149
160
|
/**
|
|
150
161
|
* Type for summarization failures that are retriable.
|
|
162
|
+
* @legacy
|
|
151
163
|
* @alpha
|
|
152
164
|
*/
|
|
153
165
|
export interface IRetriableFailureError extends Error {
|
|
@@ -155,6 +167,7 @@ export interface IRetriableFailureError extends Error {
|
|
|
155
167
|
}
|
|
156
168
|
/**
|
|
157
169
|
* Base results for all submitSummary attempts.
|
|
170
|
+
* @legacy
|
|
158
171
|
* @alpha
|
|
159
172
|
*/
|
|
160
173
|
export interface IBaseSummarizeResult {
|
|
@@ -167,6 +180,7 @@ export interface IBaseSummarizeResult {
|
|
|
167
180
|
}
|
|
168
181
|
/**
|
|
169
182
|
* Results of submitSummary after generating the summary tree.
|
|
183
|
+
* @legacy
|
|
170
184
|
* @alpha
|
|
171
185
|
*/
|
|
172
186
|
export interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, "stage"> {
|
|
@@ -180,6 +194,7 @@ export interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, "
|
|
|
180
194
|
}
|
|
181
195
|
/**
|
|
182
196
|
* Results of submitSummary after uploading the tree to storage.
|
|
197
|
+
* @legacy
|
|
183
198
|
* @alpha
|
|
184
199
|
*/
|
|
185
200
|
export interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, "stage"> {
|
|
@@ -191,6 +206,7 @@ export interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, "
|
|
|
191
206
|
}
|
|
192
207
|
/**
|
|
193
208
|
* Results of submitSummary after submitting the summarize op.
|
|
209
|
+
* @legacy
|
|
194
210
|
* @alpha
|
|
195
211
|
*/
|
|
196
212
|
export interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, "stage" | "error"> {
|
|
@@ -215,22 +231,26 @@ export interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, "stag
|
|
|
215
231
|
* 3. "upload" - the summary was uploaded to storage, and the result contains the server-provided handle
|
|
216
232
|
*
|
|
217
233
|
* 4. "submit" - the summarize op was submitted, and the result contains the op client sequence number.
|
|
234
|
+
* @legacy
|
|
218
235
|
* @alpha
|
|
219
236
|
*/
|
|
220
237
|
export type SubmitSummaryResult = IBaseSummarizeResult | IGenerateSummaryTreeResult | IUploadSummaryResult | ISubmitSummaryOpResult;
|
|
221
238
|
/**
|
|
222
239
|
* The stages of Summarize, used to describe how far progress succeeded in case of a failure at a later stage.
|
|
240
|
+
* @legacy
|
|
223
241
|
* @alpha
|
|
224
242
|
*/
|
|
225
243
|
export type SummaryStage = SubmitSummaryResult["stage"] | "unknown";
|
|
226
244
|
/**
|
|
227
245
|
* The data in summarizer result when submit summary stage fails.
|
|
246
|
+
* @legacy
|
|
228
247
|
* @alpha
|
|
229
248
|
*/
|
|
230
249
|
export interface SubmitSummaryFailureData {
|
|
231
250
|
stage: SummaryStage;
|
|
232
251
|
}
|
|
233
252
|
/**
|
|
253
|
+
* @legacy
|
|
234
254
|
* @alpha
|
|
235
255
|
*/
|
|
236
256
|
export interface IBroadcastSummaryResult {
|
|
@@ -238,6 +258,7 @@ export interface IBroadcastSummaryResult {
|
|
|
238
258
|
readonly broadcastDuration: number;
|
|
239
259
|
}
|
|
240
260
|
/**
|
|
261
|
+
* @legacy
|
|
241
262
|
* @alpha
|
|
242
263
|
*/
|
|
243
264
|
export interface IAckSummaryResult {
|
|
@@ -245,6 +266,7 @@ export interface IAckSummaryResult {
|
|
|
245
266
|
readonly ackNackDuration: number;
|
|
246
267
|
}
|
|
247
268
|
/**
|
|
269
|
+
* @legacy
|
|
248
270
|
* @alpha
|
|
249
271
|
*/
|
|
250
272
|
export interface INackSummaryResult {
|
|
@@ -252,6 +274,7 @@ export interface INackSummaryResult {
|
|
|
252
274
|
readonly ackNackDuration: number;
|
|
253
275
|
}
|
|
254
276
|
/**
|
|
277
|
+
* @legacy
|
|
255
278
|
* @alpha
|
|
256
279
|
*/
|
|
257
280
|
export type SummarizeResultPart<TSuccess, TFailure = undefined> = {
|
|
@@ -264,6 +287,7 @@ export type SummarizeResultPart<TSuccess, TFailure = undefined> = {
|
|
|
264
287
|
error: IRetriableFailureError;
|
|
265
288
|
};
|
|
266
289
|
/**
|
|
290
|
+
* @legacy
|
|
267
291
|
* @alpha
|
|
268
292
|
*/
|
|
269
293
|
export interface ISummarizeResults {
|
|
@@ -275,6 +299,7 @@ export interface ISummarizeResults {
|
|
|
275
299
|
readonly receivedSummaryAckOrNack: Promise<SummarizeResultPart<IAckSummaryResult, INackSummaryResult>>;
|
|
276
300
|
}
|
|
277
301
|
/**
|
|
302
|
+
* @legacy
|
|
278
303
|
* @alpha
|
|
279
304
|
*/
|
|
280
305
|
export type EnqueueSummarizeResult = (ISummarizeResults & {
|
|
@@ -301,6 +326,7 @@ export type EnqueueSummarizeResult = (ISummarizeResults & {
|
|
|
301
326
|
readonly overridden?: undefined;
|
|
302
327
|
};
|
|
303
328
|
/**
|
|
329
|
+
* @legacy
|
|
304
330
|
* @alpha
|
|
305
331
|
*/
|
|
306
332
|
export type SummarizerStopReason =
|
|
@@ -329,6 +355,7 @@ export type SummarizerStopReason =
|
|
|
329
355
|
*/
|
|
330
356
|
| "latestSummaryStateStale";
|
|
331
357
|
/**
|
|
358
|
+
* @legacy
|
|
332
359
|
* @alpha
|
|
333
360
|
*/
|
|
334
361
|
export interface ISummarizeEventProps {
|
|
@@ -338,12 +365,14 @@ export interface ISummarizeEventProps {
|
|
|
338
365
|
error?: any;
|
|
339
366
|
}
|
|
340
367
|
/**
|
|
368
|
+
* @legacy
|
|
341
369
|
* @alpha
|
|
342
370
|
*/
|
|
343
371
|
export interface ISummarizerEvents extends IEvent {
|
|
344
372
|
(event: "summarize", listener: (props: ISummarizeEventProps) => void): any;
|
|
345
373
|
}
|
|
346
374
|
/**
|
|
375
|
+
* @legacy
|
|
347
376
|
* @alpha
|
|
348
377
|
*/
|
|
349
378
|
export interface ISummarizer extends IEventProvider<ISummarizerEvents> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerTypes.d.ts","sourceRoot":"","sources":["../../src/summary/summarizerTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,MAAM,EACN,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EACN,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EACN,mBAAmB,EACnB,2BAA2B,EAC3B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,EACN,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD
|
|
1
|
+
{"version":3,"file":"summarizerTypes.d.ts","sourceRoot":"","sources":["../../src/summary/summarizerTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,MAAM,EACN,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EACN,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,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AAM,WAAW,yBAA0B,SAAQ,2BAA2B;IAC7E,0CAA0C;IAC1C,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,kDAAkD;IAClD,4BAA4B,EAAE,MAAM,MAAM,CAAC;CAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarizerTypes.js","sourceRoot":"","sources":["../../src/summary/summarizerTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDeltaManager,\n\tContainerWarning,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tIEvent,\n\tIEventProvider,\n\tITelemetryBaseProperties,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ISummaryStats } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tITelemetryLoggerPropertyBag,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ISummaryConfigurationHeuristics } from \"../containerRuntime.js\";\n\nimport {\n\tISummaryAckMessage,\n\tISummaryNackMessage,\n\tISummaryOpMessage,\n} from \"./summaryCollection.js\";\nimport { SummarizeReason } from \"./summaryGenerator.js\";\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @param T - cancellation reason type\n * @alpha\n */\nexport interface ICancellationToken<T> {\n\t/** Tells if this cancellable token is cancelled */\n\treadonly cancelled: boolean;\n\t/**\n\t * Promise that gets fulfilled when this cancellable token is cancelled\n\t * @returns reason of cancellation\n\t */\n\treadonly waitCancelled: Promise<T>;\n}\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @alpha\n */\nexport type ISummaryCancellationToken = ICancellationToken<SummarizerStopReason>;\n\n/**\n * Data required to update internal tracking state after receiving a Summary Ack.\n * @alpha\n */\nexport interface IRefreshSummaryAckOptions {\n\t/** Handle from the ack's summary op. */\n\treadonly proposalHandle: string | undefined;\n\t/** Handle from the summary ack just received */\n\treadonly ackHandle: string;\n\t/** Reference sequence number from the ack's summary op */\n\treadonly summaryRefSeq: number;\n\t/** Telemetry logger to which telemetry events will be forwarded. */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizerInternalsProvider {\n\t/** Encapsulates the work to walk the internals of the running container to generate a summary */\n\tsubmitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;\n\n\t/** Callback whenever a new SummaryAck is received, to update internal tracking state */\n\trefreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport interface ISummarizingWarning extends ContainerWarning {\n\treadonly errorType: \"summarizingError\";\n\treadonly logged: boolean;\n}\n\n/**\n * @alpha\n */\nexport interface IConnectableRuntime {\n\treadonly disposed: boolean;\n\treadonly connected: boolean;\n\treadonly clientId: string | undefined;\n\tonce(event: \"connected\" | \"disconnected\" | \"dispose\", listener: () => void): this;\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizerRuntime extends IConnectableRuntime {\n\treadonly baseLogger: ITelemetryBaseLogger;\n\t/** clientId of parent (non-summarizing) container that owns summarizer container */\n\treadonly summarizerClientId: string | undefined;\n\treadonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\tdisposeFn(): void;\n\tcloseFn(): void;\n\ton(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n\toff(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n}\n\n/**\n * Options affecting summarize behavior.\n * @alpha\n */\nexport interface ISummarizeOptions {\n\t/** True to generate the full tree with no handle reuse optimizations; defaults to false */\n\treadonly fullTree?: boolean;\n}\n\n/**\n * @alpha\n */\nexport interface ISubmitSummaryOptions extends ISummarizeOptions {\n\t/** Logger to use for correlated summary events */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n\t/** Tells when summary process should be cancelled */\n\treadonly cancellationToken: ISummaryCancellationToken;\n\t/** Summarization may be attempted multiple times. This tells whether this is the final summarization attempt. */\n\treadonly finalAttempt?: boolean;\n\t/** The sequence number of the latest summary used to validate if summary state is correct before summarizing */\n\treadonly latestSummaryRefSeqNum: number;\n}\n\n/**\n * @alpha\n */\nexport interface IOnDemandSummarizeOptions extends ISummarizeOptions {\n\t/** Reason for generating summary. */\n\treadonly reason: string;\n\t/** In case of a failure, will attempt to retry based on if the failure is retriable. */\n\treadonly retryOnFailure?: boolean;\n}\n\n/**\n * Options to use when enqueueing a summarize attempt.\n * @alpha\n */\nexport interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {\n\t/** If specified, The summarize attempt will not occur until after this sequence number. */\n\treadonly afterSequenceNumber?: number;\n\n\t/**\n\t * True to override the existing enqueued summarize attempt if there is one.\n\t * This will guarantee that this attempt gets enqueued. If override is false,\n\t * than an existing enqueued summarize attempt will block a new one from being\n\t * enqueued. There can only be one enqueued at a time. Defaults to false.\n\t */\n\treadonly override?: boolean;\n}\n\n/**\n * In addition to the normal summary tree + stats, this contains additional stats\n * only relevant at the root of the tree.\n * @alpha\n */\nexport interface IGeneratedSummaryStats extends ISummaryStats {\n\t/** The total number of data stores in the container. */\n\treadonly dataStoreCount: number;\n\t/** The number of data stores that were summarized in this summary. */\n\treadonly summarizedDataStoreCount: number;\n\t/** The number of data stores whose GC reference state was updated in this summary. */\n\treadonly gcStateUpdatedDataStoreCount?: number;\n\t/** The size of the gc blobs in this summary. */\n\treadonly gcTotalBlobsSize?: number;\n\t/** The number of gc blobs in this summary. */\n\treadonly gcBlobNodeCount?: number;\n\t/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */\n\treadonly summaryNumber: number;\n}\n\n/**\n * Type for summarization failures that are retriable.\n * @alpha\n */\nexport interface IRetriableFailureError extends Error {\n\treadonly retryAfterSeconds?: number;\n}\n\n/**\n * Base results for all submitSummary attempts.\n * @alpha\n */\nexport interface IBaseSummarizeResult {\n\treadonly stage: \"base\";\n\t/** Retriable error object related to failed summarize attempt. */\n\treadonly error: IRetriableFailureError | undefined;\n\t/** Reference sequence number as of the generate summary attempt. */\n\treadonly referenceSequenceNumber: number;\n\treadonly minimumSequenceNumber: number;\n}\n\n/**\n * Results of submitSummary after generating the summary tree.\n * @alpha\n */\nexport interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, \"stage\"> {\n\treadonly stage: \"generate\";\n\t/** Generated summary tree. */\n\treadonly summaryTree: ISummaryTree;\n\t/** Stats for generated summary tree. */\n\treadonly summaryStats: IGeneratedSummaryStats;\n\t/** Time it took to generate the summary tree and stats. */\n\treadonly generateDuration: number;\n}\n\n/**\n * Results of submitSummary after uploading the tree to storage.\n * @alpha\n */\nexport interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, \"stage\"> {\n\treadonly stage: \"upload\";\n\t/** The handle returned by storage pointing to the uploaded summary tree. */\n\treadonly handle: string;\n\t/** Time it took to upload the summary tree to storage. */\n\treadonly uploadDuration: number;\n}\n\n/**\n * Results of submitSummary after submitting the summarize op.\n * @alpha\n */\nexport interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, \"stage\" | \"error\"> {\n\treadonly stage: \"submit\";\n\t/** The client sequence number of the summarize op submitted for the summary. */\n\treadonly clientSequenceNumber: number;\n\t/** Time it took to submit the summarize op to the broadcasting service. */\n\treadonly submitOpDuration: number;\n}\n\n/**\n * Strict type representing result of a submitSummary attempt.\n * The result consists of 4 possible stages, each with its own data.\n * The data is cumulative, so each stage will contain the data from the previous stages.\n * If the final \"submitted\" stage is not reached, the result may contain the error object.\n *\n * Stages:\n *\n * 1. \"base\" - stopped before the summary tree was even generated, and the result only contains the base data\n *\n * 2. \"generate\" - the summary tree was generated, and the result will contain that tree + stats\n *\n * 3. \"upload\" - the summary was uploaded to storage, and the result contains the server-provided handle\n *\n * 4. \"submit\" - the summarize op was submitted, and the result contains the op client sequence number.\n * @alpha\n */\nexport type SubmitSummaryResult =\n\t| IBaseSummarizeResult\n\t| IGenerateSummaryTreeResult\n\t| IUploadSummaryResult\n\t| ISubmitSummaryOpResult;\n\n/**\n * The stages of Summarize, used to describe how far progress succeeded in case of a failure at a later stage.\n * @alpha\n */\nexport type SummaryStage = SubmitSummaryResult[\"stage\"] | \"unknown\";\n\n/**\n * The data in summarizer result when submit summary stage fails.\n * @alpha\n */\nexport interface SubmitSummaryFailureData {\n\tstage: SummaryStage;\n}\n\n/**\n * @alpha\n */\nexport interface IBroadcastSummaryResult {\n\treadonly summarizeOp: ISummaryOpMessage;\n\treadonly broadcastDuration: number;\n}\n\n/**\n * @alpha\n */\nexport interface IAckSummaryResult {\n\treadonly summaryAckOp: ISummaryAckMessage;\n\treadonly ackNackDuration: number;\n}\n\n/**\n * @alpha\n */\nexport interface INackSummaryResult {\n\treadonly summaryNackOp: ISummaryNackMessage;\n\treadonly ackNackDuration: number;\n}\n\n/**\n * @alpha\n */\nexport type SummarizeResultPart<TSuccess, TFailure = undefined> =\n\t| {\n\t\t\tsuccess: true;\n\t\t\tdata: TSuccess;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\tdata: TFailure | undefined;\n\t\t\tmessage: string;\n\t\t\terror: IRetriableFailureError;\n\t };\n\n/**\n * @alpha\n */\nexport interface ISummarizeResults {\n\t/** Resolves when we generate, upload, and submit the summary. */\n\treadonly summarySubmitted: Promise<\n\t\tSummarizeResultPart<SubmitSummaryResult, SubmitSummaryFailureData>\n\t>;\n\t/** Resolves when we observe our summarize op broadcast. */\n\treadonly summaryOpBroadcasted: Promise<SummarizeResultPart<IBroadcastSummaryResult>>;\n\t/** Resolves when we receive a summaryAck or summaryNack. */\n\treadonly receivedSummaryAckOrNack: Promise<\n\t\tSummarizeResultPart<IAckSummaryResult, INackSummaryResult>\n\t>;\n}\n\n/**\n * @alpha\n */\nexport type EnqueueSummarizeResult =\n\t| (ISummarizeResults & {\n\t\t\t/**\n\t\t\t * Indicates that another summarize attempt is not already enqueued,\n\t\t\t * and this attempt has been enqueued.\n\t\t\t */\n\t\t\treadonly alreadyEnqueued?: undefined;\n\t })\n\t| (ISummarizeResults & {\n\t\t\t/** Indicates that another summarize attempt was already enqueued. */\n\t\t\treadonly alreadyEnqueued: true;\n\t\t\t/**\n\t\t\t * Indicates that the other enqueued summarize attempt was abandoned,\n\t\t\t * and this attempt has been enqueued enqueued.\n\t\t\t */\n\t\t\treadonly overridden: true;\n\t })\n\t| {\n\t\t\t/** Indicates that another summarize attempt was already enqueued. */\n\t\t\treadonly alreadyEnqueued: true;\n\t\t\t/**\n\t\t\t * Indicates that the other enqueued summarize attempt remains enqueued,\n\t\t\t * and this attempt has not been enqueued.\n\t\t\t */\n\t\t\treadonly overridden?: undefined;\n\t };\n\n/**\n * @alpha\n */\nexport type SummarizerStopReason =\n\t/** Summarizer client failed to summarize in all attempts. */\n\t| \"failToSummarize\"\n\t/** Parent client reported that it is no longer connected. */\n\t| \"parentNotConnected\"\n\t/**\n\t * Parent client reported that it is no longer elected the summarizer.\n\t * This is the normal flow; a disconnect will always trigger the parent\n\t * client to no longer be elected as responsible for summaries. Then it\n\t * tries to stop its spawned summarizer client.\n\t */\n\t| \"notElectedParent\"\n\t/**\n\t * We are not already running the summarizer and we are not the current elected client id.\n\t */\n\t| \"notElectedClient\"\n\t/** Summarizer client was disconnected */\n\t| \"summarizerClientDisconnected\"\n\t/** running summarizer threw an exception */\n\t| \"summarizerException\"\n\t/**\n\t * The previous summary state on the summarizer is not the most recently acked summary. this also happens when the\n\t * first submitSummary attempt fails for any reason and there's a 2nd summary attempt without an ack\n\t */\n\t| \"latestSummaryStateStale\";\n\n/**\n * @alpha\n */\nexport interface ISummarizeEventProps {\n\tresult: \"success\" | \"failure\" | \"canceled\";\n\tcurrentAttempt: number;\n\tmaxAttempts: number;\n\terror?: any;\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizerEvents extends IEvent {\n\t(event: \"summarize\", listener: (props: ISummarizeEventProps) => void);\n}\n\n/**\n * @alpha\n */\nexport interface ISummarizer extends IEventProvider<ISummarizerEvents> {\n\t/**\n\t * Allows {@link ISummarizer} to be used with our {@link @fluidframework/core-interfaces#FluidObject} pattern.\n\t */\n\treadonly ISummarizer?: ISummarizer;\n\n\t/*\n\t * Asks summarizer to move to exit.\n\t * Summarizer will finish current processes, which may take a while.\n\t * For example, summarizer may complete last summary before exiting.\n\t */\n\tstop(reason: SummarizerStopReason): void;\n\n\t/* Closes summarizer. Any pending processes (summary in flight) are abandoned. */\n\tclose(): void;\n\n\trun(onBehalfOf: string): Promise<SummarizerStopReason>;\n\n\t/**\n\t * Attempts to generate a summary on demand. If already running, takes no action.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an alreadyRunning promise if a summarize attempt is already in progress,\n\t * which will resolve when the current attempt completes. At that point caller can\n\t * decide to try again or not. Otherwise, it will return an object containing promises\n\t * that resolve as the summarize attempt progresses. They will resolve with success\n\t * false if a failure is encountered.\n\t */\n\tsummarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;\n\t/**\n\t * Enqueue an attempt to summarize after the specified sequence number.\n\t * If afterSequenceNumber is provided, the summarize attempt is \"enqueued\"\n\t * to run once an eligible op comes in with sequenceNumber \\>= afterSequenceNumber.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an object containing an alreadyEnqueued flag to indicate if another\n\t * summarize attempt has already been enqueued. It also may contain an overridden flag\n\t * when alreadyEnqueued is true, that indicates whether this attempt forced the\n\t * previous attempt to abort. If this attempt becomes enqueued, it returns an object\n\t * containing promises that resolve as the summarize attempt progresses. They will\n\t * resolve with success false if a failure is encountered.\n\t */\n\tenqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;\n}\n\n/** Data about an attempt to summarize used for heuristics. */\nexport interface ISummarizeAttempt {\n\t/** Reference sequence number when summary was generated or attempted */\n\treadonly refSequenceNumber: number;\n\n\t/** Time of summary attempt after it was sent or attempted */\n\treadonly summaryTime: number;\n\n\t/** Sequence number of summary op */\n\tsummarySequenceNumber?: number;\n}\n\n/** Data relevant for summary heuristics. */\nexport interface ISummarizeHeuristicData {\n\t/** Latest received op sequence number */\n\tlastOpSequenceNumber: number;\n\n\t/** Most recent summary attempt from this client */\n\treadonly lastAttempt: ISummarizeAttempt;\n\n\t/** Most recent summary that received an ack */\n\treadonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\n\t/** Number of runtime ops since last summary */\n\tnumRuntimeOps: number;\n\n\t/** Number of non-runtime ops since last summary */\n\tnumNonRuntimeOps: number;\n\n\t/** Cumulative size in bytes of all the ops since the last summary */\n\ttotalOpsSize: number;\n\n\t/** Wether or not this instance contains adjusted metrics due to missing op data */\n\thasMissingOpData: boolean;\n\n\t/**\n\t * Updates lastAttempt and lastSuccessfulAttempt based on the last summary.\n\t * @param lastSummary - last ack summary\n\t */\n\tupdateWithLastSummaryAckInfo(lastSummary: ISummarizeAttempt): void;\n\n\t/**\n\t * Records a summary attempt. If the attempt was successfully sent,\n\t * provide the reference sequence number, otherwise it will be set\n\t * to the last seen op sequence number.\n\t * @param referenceSequenceNumber - reference sequence number of sent summary\n\t */\n\trecordAttempt(referenceSequenceNumber?: number): void;\n\n\t/** Mark that the last sent summary attempt has received an ack */\n\tmarkLastAttemptAsSuccessful(): void;\n\n\topsSinceLastSummary: number;\n}\n\n/** Responsible for running heuristics determining when to summarize. */\nexport interface ISummarizeHeuristicRunner {\n\t/** Start specific heuristic trackers (ex: idle timer) */\n\tstart(): void;\n\n\t/** Runs the heuristics to determine if it should try to summarize */\n\trun(): void;\n\n\t/** Runs a different heuristic to check if it should summarize before closing */\n\tshouldRunLastSummary(): boolean;\n\n\t/** Disposes of resources */\n\tdispose(): void;\n}\n\ntype ISummarizeTelemetryRequiredProperties =\n\t/** Reason code for attempting to summarize */\n\t\"summarizeReason\";\n\ntype ISummarizeTelemetryOptionalProperties =\n\t/** Number of attempts within the last time window, used for calculating the throttle delay. */\n\t| \"summaryAttempts\"\n\t/** Summarization may be attempted multiple times. This tells whether this is the final summarization attempt */\n\t| \"finalAttempt\"\n\t| keyof ISummarizeOptions;\n\nexport type ISummarizeTelemetryProperties = Pick<\n\tITelemetryBaseProperties,\n\tISummarizeTelemetryRequiredProperties\n> &\n\tPartial<Pick<ITelemetryBaseProperties, ISummarizeTelemetryOptionalProperties>>;\n\n/** Strategy used to heuristically determine when we should run a summary */\nexport interface ISummaryHeuristicStrategy {\n\t/** Summarize reason for this summarize heuristic strategy (ex: \"maxTime\") */\n\tsummarizeReason: Readonly<SummarizeReason>;\n\n\t/**\n\t * Determines if this strategy's summarize criteria been met\n\t * @param configuration - summary configuration we are to check against\n\t * @param heuristicData - heuristic data used to confirm conditions are met\n\t */\n\tshouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean;\n}\n\ntype SummaryGeneratorRequiredTelemetryProperties =\n\t/** True to generate the full tree with no handle reuse optimizations */\n\t| \"fullTree\"\n\t/** Time since we last attempted to generate a summary */\n\t| \"timeSinceLastAttempt\"\n\t/** Time since we last successfully generated a summary */\n\t| \"timeSinceLastSummary\";\n\ntype SummaryGeneratorOptionalTelemetryProperties =\n\t/** Reference sequence number as of the generate summary attempt. */\n\t| \"referenceSequenceNumber\"\n\t/** minimum sequence number (at the reference sequence number) */\n\t| \"minimumSequenceNumber\"\n\t/** Delta between the current reference sequence number and the reference sequence number of the last attempt */\n\t| \"opsSinceLastAttempt\"\n\t/** Delta between the current reference sequence number and the reference sequence number of the last summary */\n\t| \"opsSinceLastSummary\"\n\t/**\n\t * Delta in sum of op sizes between the current reference sequence number and the reference\n\t * sequence number of the last summary\n\t */\n\t| \"opsSizesSinceLastSummary\"\n\t/** Delta between the number of non-runtime ops since the last summary */\n\t| \"nonRuntimeOpsSinceLastSummary\"\n\t/** Delta between the number of runtime ops since the last summary */\n\t| \"runtimeOpsSinceLastSummary\"\n\t/** Wether or not this instance contains adjusted metrics due to missing op data */\n\t| \"hasMissingOpData\"\n\t/** Time it took to generate the summary tree and stats. */\n\t| \"generateDuration\"\n\t/** The handle returned by storage pointing to the uploaded summary tree. */\n\t| \"handle\"\n\t/** Time it took to upload the summary tree to storage. */\n\t| \"uploadDuration\"\n\t/** The client sequence number of the summarize op submitted for the summary. */\n\t| \"clientSequenceNumber\"\n\t/** Time it took for this summary to be acked after it was generated */\n\t| \"ackWaitDuration\"\n\t/** Reference sequence number of the ack/nack message */\n\t| \"ackNackSequenceNumber\"\n\t/** Actual sequence number of the summary op proposal. */\n\t| \"summarySequenceNumber\"\n\t/** Optional Retry-After time in seconds. If specified, the client should wait this many seconds before retrying. */\n\t| \"nackRetryAfter\"\n\t/** The stage at which the submit summary method failed at. This can help determine what type of failure we have */\n\t| \"stage\";\n\nexport type SummaryGeneratorTelemetry = Pick<\n\tITelemetryBaseProperties,\n\tSummaryGeneratorRequiredTelemetryProperties\n> &\n\tPartial<Pick<ITelemetryBaseProperties, SummaryGeneratorOptionalTelemetryProperties>>;\n\nexport interface ISummarizeRunnerTelemetry extends ITelemetryLoggerPropertyBag {\n\t/** Number of times the summarizer run. */\n\tsummarizeCount: () => number;\n\t/** Number of successful attempts to summarize. */\n\tsummarizerSuccessfulAttempts: () => number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"summarizerTypes.js","sourceRoot":"","sources":["../../src/summary/summarizerTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDeltaManager,\n\tContainerWarning,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tIEvent,\n\tIEventProvider,\n\tITelemetryBaseProperties,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ISummaryStats } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tITelemetryLoggerPropertyBag,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ISummaryConfigurationHeuristics } from \"../containerRuntime.js\";\n\nimport {\n\tISummaryAckMessage,\n\tISummaryNackMessage,\n\tISummaryOpMessage,\n} from \"./summaryCollection.js\";\nimport { SummarizeReason } from \"./summaryGenerator.js\";\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @param T - cancellation reason type\n * @legacy\n * @alpha\n */\nexport interface ICancellationToken<T> {\n\t/** Tells if this cancellable token is cancelled */\n\treadonly cancelled: boolean;\n\t/**\n\t * Promise that gets fulfilled when this cancellable token is cancelled\n\t * @returns reason of cancellation\n\t */\n\treadonly waitCancelled: Promise<T>;\n}\n\n/**\n * Similar to AbortSignal, but using promise instead of events\n * @legacy\n * @alpha\n */\nexport type ISummaryCancellationToken = ICancellationToken<SummarizerStopReason>;\n\n/**\n * Data required to update internal tracking state after receiving a Summary Ack.\n * @legacy\n * @alpha\n */\nexport interface IRefreshSummaryAckOptions {\n\t/** Handle from the ack's summary op. */\n\treadonly proposalHandle: string | undefined;\n\t/** Handle from the summary ack just received */\n\treadonly ackHandle: string;\n\t/** Reference sequence number from the ack's summary op */\n\treadonly summaryRefSeq: number;\n\t/** Telemetry logger to which telemetry events will be forwarded. */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummarizerInternalsProvider {\n\t/** Encapsulates the work to walk the internals of the running container to generate a summary */\n\tsubmitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;\n\n\t/** Callback whenever a new SummaryAck is received, to update internal tracking state */\n\trefreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void>;\n}\n\n/**\n * @internal\n */\nexport interface ISummarizingWarning extends ContainerWarning {\n\treadonly errorType: \"summarizingError\";\n\treadonly logged: boolean;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IConnectableRuntime {\n\treadonly disposed: boolean;\n\treadonly connected: boolean;\n\treadonly clientId: string | undefined;\n\tonce(event: \"connected\" | \"disconnected\" | \"dispose\", listener: () => void): this;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummarizerRuntime extends IConnectableRuntime {\n\treadonly baseLogger: ITelemetryBaseLogger;\n\t/** clientId of parent (non-summarizing) container that owns summarizer container */\n\treadonly summarizerClientId: string | undefined;\n\treadonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\tdisposeFn(): void;\n\tcloseFn(): void;\n\ton(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n\toff(\n\t\tevent: \"op\",\n\t\tlistener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void,\n\t): this;\n}\n\n/**\n * Options affecting summarize behavior.\n * @legacy\n * @alpha\n */\nexport interface ISummarizeOptions {\n\t/** True to generate the full tree with no handle reuse optimizations; defaults to false */\n\treadonly fullTree?: boolean;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISubmitSummaryOptions extends ISummarizeOptions {\n\t/** Logger to use for correlated summary events */\n\treadonly summaryLogger: ITelemetryLoggerExt;\n\t/** Tells when summary process should be cancelled */\n\treadonly cancellationToken: ISummaryCancellationToken;\n\t/** Summarization may be attempted multiple times. This tells whether this is the final summarization attempt. */\n\treadonly finalAttempt?: boolean;\n\t/** The sequence number of the latest summary used to validate if summary state is correct before summarizing */\n\treadonly latestSummaryRefSeqNum: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IOnDemandSummarizeOptions extends ISummarizeOptions {\n\t/** Reason for generating summary. */\n\treadonly reason: string;\n\t/** In case of a failure, will attempt to retry based on if the failure is retriable. */\n\treadonly retryOnFailure?: boolean;\n}\n\n/**\n * Options to use when enqueueing a summarize attempt.\n * @legacy\n * @alpha\n */\nexport interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {\n\t/** If specified, The summarize attempt will not occur until after this sequence number. */\n\treadonly afterSequenceNumber?: number;\n\n\t/**\n\t * True to override the existing enqueued summarize attempt if there is one.\n\t * This will guarantee that this attempt gets enqueued. If override is false,\n\t * than an existing enqueued summarize attempt will block a new one from being\n\t * enqueued. There can only be one enqueued at a time. Defaults to false.\n\t */\n\treadonly override?: boolean;\n}\n\n/**\n * In addition to the normal summary tree + stats, this contains additional stats\n * only relevant at the root of the tree.\n * @legacy\n * @alpha\n */\nexport interface IGeneratedSummaryStats extends ISummaryStats {\n\t/** The total number of data stores in the container. */\n\treadonly dataStoreCount: number;\n\t/** The number of data stores that were summarized in this summary. */\n\treadonly summarizedDataStoreCount: number;\n\t/** The number of data stores whose GC reference state was updated in this summary. */\n\treadonly gcStateUpdatedDataStoreCount?: number;\n\t/** The size of the gc blobs in this summary. */\n\treadonly gcTotalBlobsSize?: number;\n\t/** The number of gc blobs in this summary. */\n\treadonly gcBlobNodeCount?: number;\n\t/** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */\n\treadonly summaryNumber: number;\n}\n\n/**\n * Type for summarization failures that are retriable.\n * @legacy\n * @alpha\n */\nexport interface IRetriableFailureError extends Error {\n\treadonly retryAfterSeconds?: number;\n}\n\n/**\n * Base results for all submitSummary attempts.\n * @legacy\n * @alpha\n */\nexport interface IBaseSummarizeResult {\n\treadonly stage: \"base\";\n\t/** Retriable error object related to failed summarize attempt. */\n\treadonly error: IRetriableFailureError | undefined;\n\t/** Reference sequence number as of the generate summary attempt. */\n\treadonly referenceSequenceNumber: number;\n\treadonly minimumSequenceNumber: number;\n}\n\n/**\n * Results of submitSummary after generating the summary tree.\n * @legacy\n * @alpha\n */\nexport interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, \"stage\"> {\n\treadonly stage: \"generate\";\n\t/** Generated summary tree. */\n\treadonly summaryTree: ISummaryTree;\n\t/** Stats for generated summary tree. */\n\treadonly summaryStats: IGeneratedSummaryStats;\n\t/** Time it took to generate the summary tree and stats. */\n\treadonly generateDuration: number;\n}\n\n/**\n * Results of submitSummary after uploading the tree to storage.\n * @legacy\n * @alpha\n */\nexport interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, \"stage\"> {\n\treadonly stage: \"upload\";\n\t/** The handle returned by storage pointing to the uploaded summary tree. */\n\treadonly handle: string;\n\t/** Time it took to upload the summary tree to storage. */\n\treadonly uploadDuration: number;\n}\n\n/**\n * Results of submitSummary after submitting the summarize op.\n * @legacy\n * @alpha\n */\nexport interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, \"stage\" | \"error\"> {\n\treadonly stage: \"submit\";\n\t/** The client sequence number of the summarize op submitted for the summary. */\n\treadonly clientSequenceNumber: number;\n\t/** Time it took to submit the summarize op to the broadcasting service. */\n\treadonly submitOpDuration: number;\n}\n\n/**\n * Strict type representing result of a submitSummary attempt.\n * The result consists of 4 possible stages, each with its own data.\n * The data is cumulative, so each stage will contain the data from the previous stages.\n * If the final \"submitted\" stage is not reached, the result may contain the error object.\n *\n * Stages:\n *\n * 1. \"base\" - stopped before the summary tree was even generated, and the result only contains the base data\n *\n * 2. \"generate\" - the summary tree was generated, and the result will contain that tree + stats\n *\n * 3. \"upload\" - the summary was uploaded to storage, and the result contains the server-provided handle\n *\n * 4. \"submit\" - the summarize op was submitted, and the result contains the op client sequence number.\n * @legacy\n * @alpha\n */\nexport type SubmitSummaryResult =\n\t| IBaseSummarizeResult\n\t| IGenerateSummaryTreeResult\n\t| IUploadSummaryResult\n\t| ISubmitSummaryOpResult;\n\n/**\n * The stages of Summarize, used to describe how far progress succeeded in case of a failure at a later stage.\n * @legacy\n * @alpha\n */\nexport type SummaryStage = SubmitSummaryResult[\"stage\"] | \"unknown\";\n\n/**\n * The data in summarizer result when submit summary stage fails.\n * @legacy\n * @alpha\n */\nexport interface SubmitSummaryFailureData {\n\tstage: SummaryStage;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IBroadcastSummaryResult {\n\treadonly summarizeOp: ISummaryOpMessage;\n\treadonly broadcastDuration: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IAckSummaryResult {\n\treadonly summaryAckOp: ISummaryAckMessage;\n\treadonly ackNackDuration: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface INackSummaryResult {\n\treadonly summaryNackOp: ISummaryNackMessage;\n\treadonly ackNackDuration: number;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport type SummarizeResultPart<TSuccess, TFailure = undefined> =\n\t| {\n\t\t\tsuccess: true;\n\t\t\tdata: TSuccess;\n\t }\n\t| {\n\t\t\tsuccess: false;\n\t\t\tdata: TFailure | undefined;\n\t\t\tmessage: string;\n\t\t\terror: IRetriableFailureError;\n\t };\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummarizeResults {\n\t/** Resolves when we generate, upload, and submit the summary. */\n\treadonly summarySubmitted: Promise<\n\t\tSummarizeResultPart<SubmitSummaryResult, SubmitSummaryFailureData>\n\t>;\n\t/** Resolves when we observe our summarize op broadcast. */\n\treadonly summaryOpBroadcasted: Promise<SummarizeResultPart<IBroadcastSummaryResult>>;\n\t/** Resolves when we receive a summaryAck or summaryNack. */\n\treadonly receivedSummaryAckOrNack: Promise<\n\t\tSummarizeResultPart<IAckSummaryResult, INackSummaryResult>\n\t>;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport type EnqueueSummarizeResult =\n\t| (ISummarizeResults & {\n\t\t\t/**\n\t\t\t * Indicates that another summarize attempt is not already enqueued,\n\t\t\t * and this attempt has been enqueued.\n\t\t\t */\n\t\t\treadonly alreadyEnqueued?: undefined;\n\t })\n\t| (ISummarizeResults & {\n\t\t\t/** Indicates that another summarize attempt was already enqueued. */\n\t\t\treadonly alreadyEnqueued: true;\n\t\t\t/**\n\t\t\t * Indicates that the other enqueued summarize attempt was abandoned,\n\t\t\t * and this attempt has been enqueued enqueued.\n\t\t\t */\n\t\t\treadonly overridden: true;\n\t })\n\t| {\n\t\t\t/** Indicates that another summarize attempt was already enqueued. */\n\t\t\treadonly alreadyEnqueued: true;\n\t\t\t/**\n\t\t\t * Indicates that the other enqueued summarize attempt remains enqueued,\n\t\t\t * and this attempt has not been enqueued.\n\t\t\t */\n\t\t\treadonly overridden?: undefined;\n\t };\n\n/**\n * @legacy\n * @alpha\n */\nexport type SummarizerStopReason =\n\t/** Summarizer client failed to summarize in all attempts. */\n\t| \"failToSummarize\"\n\t/** Parent client reported that it is no longer connected. */\n\t| \"parentNotConnected\"\n\t/**\n\t * Parent client reported that it is no longer elected the summarizer.\n\t * This is the normal flow; a disconnect will always trigger the parent\n\t * client to no longer be elected as responsible for summaries. Then it\n\t * tries to stop its spawned summarizer client.\n\t */\n\t| \"notElectedParent\"\n\t/**\n\t * We are not already running the summarizer and we are not the current elected client id.\n\t */\n\t| \"notElectedClient\"\n\t/** Summarizer client was disconnected */\n\t| \"summarizerClientDisconnected\"\n\t/** running summarizer threw an exception */\n\t| \"summarizerException\"\n\t/**\n\t * The previous summary state on the summarizer is not the most recently acked summary. this also happens when the\n\t * first submitSummary attempt fails for any reason and there's a 2nd summary attempt without an ack\n\t */\n\t| \"latestSummaryStateStale\";\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummarizeEventProps {\n\tresult: \"success\" | \"failure\" | \"canceled\";\n\tcurrentAttempt: number;\n\tmaxAttempts: number;\n\terror?: any;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummarizerEvents extends IEvent {\n\t(event: \"summarize\", listener: (props: ISummarizeEventProps) => void);\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface ISummarizer extends IEventProvider<ISummarizerEvents> {\n\t/**\n\t * Allows {@link ISummarizer} to be used with our {@link @fluidframework/core-interfaces#FluidObject} pattern.\n\t */\n\treadonly ISummarizer?: ISummarizer;\n\n\t/*\n\t * Asks summarizer to move to exit.\n\t * Summarizer will finish current processes, which may take a while.\n\t * For example, summarizer may complete last summary before exiting.\n\t */\n\tstop(reason: SummarizerStopReason): void;\n\n\t/* Closes summarizer. Any pending processes (summary in flight) are abandoned. */\n\tclose(): void;\n\n\trun(onBehalfOf: string): Promise<SummarizerStopReason>;\n\n\t/**\n\t * Attempts to generate a summary on demand. If already running, takes no action.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an alreadyRunning promise if a summarize attempt is already in progress,\n\t * which will resolve when the current attempt completes. At that point caller can\n\t * decide to try again or not. Otherwise, it will return an object containing promises\n\t * that resolve as the summarize attempt progresses. They will resolve with success\n\t * false if a failure is encountered.\n\t */\n\tsummarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;\n\t/**\n\t * Enqueue an attempt to summarize after the specified sequence number.\n\t * If afterSequenceNumber is provided, the summarize attempt is \"enqueued\"\n\t * to run once an eligible op comes in with sequenceNumber \\>= afterSequenceNumber.\n\t * @param options - options controlling the summarize attempt\n\t * @returns an object containing an alreadyEnqueued flag to indicate if another\n\t * summarize attempt has already been enqueued. It also may contain an overridden flag\n\t * when alreadyEnqueued is true, that indicates whether this attempt forced the\n\t * previous attempt to abort. If this attempt becomes enqueued, it returns an object\n\t * containing promises that resolve as the summarize attempt progresses. They will\n\t * resolve with success false if a failure is encountered.\n\t */\n\tenqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;\n}\n\n/** Data about an attempt to summarize used for heuristics. */\nexport interface ISummarizeAttempt {\n\t/** Reference sequence number when summary was generated or attempted */\n\treadonly refSequenceNumber: number;\n\n\t/** Time of summary attempt after it was sent or attempted */\n\treadonly summaryTime: number;\n\n\t/** Sequence number of summary op */\n\tsummarySequenceNumber?: number;\n}\n\n/** Data relevant for summary heuristics. */\nexport interface ISummarizeHeuristicData {\n\t/** Latest received op sequence number */\n\tlastOpSequenceNumber: number;\n\n\t/** Most recent summary attempt from this client */\n\treadonly lastAttempt: ISummarizeAttempt;\n\n\t/** Most recent summary that received an ack */\n\treadonly lastSuccessfulSummary: Readonly<ISummarizeAttempt>;\n\n\t/** Number of runtime ops since last summary */\n\tnumRuntimeOps: number;\n\n\t/** Number of non-runtime ops since last summary */\n\tnumNonRuntimeOps: number;\n\n\t/** Cumulative size in bytes of all the ops since the last summary */\n\ttotalOpsSize: number;\n\n\t/** Wether or not this instance contains adjusted metrics due to missing op data */\n\thasMissingOpData: boolean;\n\n\t/**\n\t * Updates lastAttempt and lastSuccessfulAttempt based on the last summary.\n\t * @param lastSummary - last ack summary\n\t */\n\tupdateWithLastSummaryAckInfo(lastSummary: ISummarizeAttempt): void;\n\n\t/**\n\t * Records a summary attempt. If the attempt was successfully sent,\n\t * provide the reference sequence number, otherwise it will be set\n\t * to the last seen op sequence number.\n\t * @param referenceSequenceNumber - reference sequence number of sent summary\n\t */\n\trecordAttempt(referenceSequenceNumber?: number): void;\n\n\t/** Mark that the last sent summary attempt has received an ack */\n\tmarkLastAttemptAsSuccessful(): void;\n\n\topsSinceLastSummary: number;\n}\n\n/** Responsible for running heuristics determining when to summarize. */\nexport interface ISummarizeHeuristicRunner {\n\t/** Start specific heuristic trackers (ex: idle timer) */\n\tstart(): void;\n\n\t/** Runs the heuristics to determine if it should try to summarize */\n\trun(): void;\n\n\t/** Runs a different heuristic to check if it should summarize before closing */\n\tshouldRunLastSummary(): boolean;\n\n\t/** Disposes of resources */\n\tdispose(): void;\n}\n\ntype ISummarizeTelemetryRequiredProperties =\n\t/** Reason code for attempting to summarize */\n\t\"summarizeReason\";\n\ntype ISummarizeTelemetryOptionalProperties =\n\t/** Number of attempts within the last time window, used for calculating the throttle delay. */\n\t| \"summaryAttempts\"\n\t/** Summarization may be attempted multiple times. This tells whether this is the final summarization attempt */\n\t| \"finalAttempt\"\n\t| keyof ISummarizeOptions;\n\nexport type ISummarizeTelemetryProperties = Pick<\n\tITelemetryBaseProperties,\n\tISummarizeTelemetryRequiredProperties\n> &\n\tPartial<Pick<ITelemetryBaseProperties, ISummarizeTelemetryOptionalProperties>>;\n\n/** Strategy used to heuristically determine when we should run a summary */\nexport interface ISummaryHeuristicStrategy {\n\t/** Summarize reason for this summarize heuristic strategy (ex: \"maxTime\") */\n\tsummarizeReason: Readonly<SummarizeReason>;\n\n\t/**\n\t * Determines if this strategy's summarize criteria been met\n\t * @param configuration - summary configuration we are to check against\n\t * @param heuristicData - heuristic data used to confirm conditions are met\n\t */\n\tshouldRunSummary(\n\t\tconfiguration: ISummaryConfigurationHeuristics,\n\t\theuristicData: ISummarizeHeuristicData,\n\t): boolean;\n}\n\ntype SummaryGeneratorRequiredTelemetryProperties =\n\t/** True to generate the full tree with no handle reuse optimizations */\n\t| \"fullTree\"\n\t/** Time since we last attempted to generate a summary */\n\t| \"timeSinceLastAttempt\"\n\t/** Time since we last successfully generated a summary */\n\t| \"timeSinceLastSummary\";\n\ntype SummaryGeneratorOptionalTelemetryProperties =\n\t/** Reference sequence number as of the generate summary attempt. */\n\t| \"referenceSequenceNumber\"\n\t/** minimum sequence number (at the reference sequence number) */\n\t| \"minimumSequenceNumber\"\n\t/** Delta between the current reference sequence number and the reference sequence number of the last attempt */\n\t| \"opsSinceLastAttempt\"\n\t/** Delta between the current reference sequence number and the reference sequence number of the last summary */\n\t| \"opsSinceLastSummary\"\n\t/**\n\t * Delta in sum of op sizes between the current reference sequence number and the reference\n\t * sequence number of the last summary\n\t */\n\t| \"opsSizesSinceLastSummary\"\n\t/** Delta between the number of non-runtime ops since the last summary */\n\t| \"nonRuntimeOpsSinceLastSummary\"\n\t/** Delta between the number of runtime ops since the last summary */\n\t| \"runtimeOpsSinceLastSummary\"\n\t/** Wether or not this instance contains adjusted metrics due to missing op data */\n\t| \"hasMissingOpData\"\n\t/** Time it took to generate the summary tree and stats. */\n\t| \"generateDuration\"\n\t/** The handle returned by storage pointing to the uploaded summary tree. */\n\t| \"handle\"\n\t/** Time it took to upload the summary tree to storage. */\n\t| \"uploadDuration\"\n\t/** The client sequence number of the summarize op submitted for the summary. */\n\t| \"clientSequenceNumber\"\n\t/** Time it took for this summary to be acked after it was generated */\n\t| \"ackWaitDuration\"\n\t/** Reference sequence number of the ack/nack message */\n\t| \"ackNackSequenceNumber\"\n\t/** Actual sequence number of the summary op proposal. */\n\t| \"summarySequenceNumber\"\n\t/** Optional Retry-After time in seconds. If specified, the client should wait this many seconds before retrying. */\n\t| \"nackRetryAfter\"\n\t/** The stage at which the submit summary method failed at. This can help determine what type of failure we have */\n\t| \"stage\";\n\nexport type SummaryGeneratorTelemetry = Pick<\n\tITelemetryBaseProperties,\n\tSummaryGeneratorRequiredTelemetryProperties\n> &\n\tPartial<Pick<ITelemetryBaseProperties, SummaryGeneratorOptionalTelemetryProperties>>;\n\nexport interface ISummarizeRunnerTelemetry extends ITelemetryLoggerPropertyBag {\n\t/** Number of times the summarizer run. */\n\tsummarizeCount: () => number;\n\t/** Number of successful attempts to summarize. */\n\tsummarizerSuccessfulAttempts: () => number;\n}\n"]}
|
|
@@ -9,6 +9,7 @@ import { IDocumentMessage, ISummaryAck, ISummaryContent, ISummaryNack, MessageTy
|
|
|
9
9
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
10
10
|
/**
|
|
11
11
|
* Interface for summary op messages with typed contents.
|
|
12
|
+
* @legacy
|
|
12
13
|
* @alpha
|
|
13
14
|
*/
|
|
14
15
|
export interface ISummaryOpMessage extends ISequencedDocumentMessage {
|
|
@@ -17,6 +18,7 @@ export interface ISummaryOpMessage extends ISequencedDocumentMessage {
|
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Interface for summary ack messages with typed contents.
|
|
21
|
+
* @legacy
|
|
20
22
|
* @alpha
|
|
21
23
|
*/
|
|
22
24
|
export interface ISummaryAckMessage extends ISequencedDocumentMessage {
|
|
@@ -25,6 +27,7 @@ export interface ISummaryAckMessage extends ISequencedDocumentMessage {
|
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* Interface for summary nack messages with typed contents.
|
|
30
|
+
* @legacy
|
|
28
31
|
* @alpha
|
|
29
32
|
*/
|
|
30
33
|
export interface ISummaryNackMessage extends ISequencedDocumentMessage {
|
|
@@ -34,6 +37,7 @@ export interface ISummaryNackMessage extends ISequencedDocumentMessage {
|
|
|
34
37
|
/**
|
|
35
38
|
* A single summary which can be tracked as it goes through its life cycle.
|
|
36
39
|
* The life cycle is: Local to Broadcast to Acked/Nacked.
|
|
40
|
+
* @legacy
|
|
37
41
|
* @alpha
|
|
38
42
|
*/
|
|
39
43
|
export interface ISummary {
|
|
@@ -44,6 +48,7 @@ export interface ISummary {
|
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* A single summary which has already been acked by the server.
|
|
51
|
+
* @legacy
|
|
47
52
|
* @alpha
|
|
48
53
|
*/
|
|
49
54
|
export interface IAckedSummary {
|
|
@@ -52,6 +57,7 @@ export interface IAckedSummary {
|
|
|
52
57
|
}
|
|
53
58
|
/**
|
|
54
59
|
* Watches summaries created by a specific client.
|
|
60
|
+
* @legacy
|
|
55
61
|
* @alpha
|
|
56
62
|
*/
|
|
57
63
|
export interface IClientSummaryWatcher extends IDisposable {
|
|
@@ -59,14 +65,17 @@ export interface IClientSummaryWatcher extends IDisposable {
|
|
|
59
65
|
waitFlushed(): Promise<IAckedSummary | undefined>;
|
|
60
66
|
}
|
|
61
67
|
/**
|
|
68
|
+
* @legacy
|
|
62
69
|
* @alpha
|
|
63
70
|
*/
|
|
64
71
|
export type OpActionEventName = MessageType.Summarize | MessageType.SummaryAck | MessageType.SummaryNack | "default";
|
|
65
72
|
/**
|
|
73
|
+
* @legacy
|
|
66
74
|
* @alpha
|
|
67
75
|
*/
|
|
68
76
|
export type OpActionEventListener = (op: ISequencedDocumentMessage) => void;
|
|
69
77
|
/**
|
|
78
|
+
* @legacy
|
|
70
79
|
* @alpha
|
|
71
80
|
*/
|
|
72
81
|
export interface ISummaryCollectionOpEvents extends IEvent {
|
|
@@ -76,6 +85,7 @@ export interface ISummaryCollectionOpEvents extends IEvent {
|
|
|
76
85
|
* Data structure that looks at the op stream to track summaries as they
|
|
77
86
|
* are broadcast, acked and nacked.
|
|
78
87
|
* It provides functionality for watching specific summaries.
|
|
88
|
+
* @legacy
|
|
79
89
|
* @alpha
|
|
80
90
|
*/
|
|
81
91
|
export declare class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEvents> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryCollection.d.ts","sourceRoot":"","sources":["../../src/summary/summaryCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EACN,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E
|
|
1
|
+
{"version":3,"file":"summaryCollection.d.ts","sourceRoot":"","sources":["../../src/summary/summaryCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EACN,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,yBAAyB;IACnE,IAAI,EAAE,WAAW,CAAC,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C,gBAAgB;IA2CxB,OAAO,CAAC,iBAAiB;CASzB"}
|
|
@@ -125,6 +125,7 @@ class ClientSummaryWatcher {
|
|
|
125
125
|
* Data structure that looks at the op stream to track summaries as they
|
|
126
126
|
* are broadcast, acked and nacked.
|
|
127
127
|
* It provides functionality for watching specific summaries.
|
|
128
|
+
* @legacy
|
|
128
129
|
* @alpha
|
|
129
130
|
*/
|
|
130
131
|
class SummaryCollection extends client_utils_1.TypedEventEmitter {
|