/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { SummarizerStopReason } from "@fluidframework/container-runtime-definitions/internal"; import type { IConnectableRuntime, ISummaryCancellationToken } from "../summarizerTypes.js"; /** * Similar to AbortController, but using promise instead of events * @internal */ export interface ICancellableSummarizerController extends ISummaryCancellationToken { stop(reason: SummarizerStopReason): void; } /** * Can be useful in testing as well as in places where caller does not use cancellation. * This object implements ISummaryCancellationToken interface but cancellation is never leveraged. * @internal */ export declare const neverCancelledSummaryToken: ISummaryCancellationToken; /** * Helper class to coordinate something that needs to run only while connected. * This provides promises that resolve as it starts or stops. Stopping happens * when disconnected or if stop() is called. */ export declare class RunWhileConnectedCoordinator implements ICancellableSummarizerController { private readonly runtime; private readonly active; private _cancelled; private readonly stopDeferred; get cancelled(): boolean; /** * Returns a promise that resolves once stopped either externally or by disconnect. */ get waitCancelled(): Promise; static create(runtime: IConnectableRuntime, active: () => boolean): Promise; protected constructor(runtime: IConnectableRuntime, active: () => boolean); /** * Starts and waits for a promise which resolves when connected. * The promise will also resolve if stopped either externally or by disconnect. * * We only listen on disconnected event for clientType === "summarizer" container! * And only do it here - no other place should check it! That way we have only one place * that controls policy and it's easy to change policy in the future if we want to! * We do not listen for "main" (aka interactive) container disconnect here, as it's * responsibility of SummaryManager to decide if that's material or not. There are cases * like "lastSummary", or main client experiencing nacks / disconnects due to hitting limit * of non-summarized ops, where can make determination to continue with summary even if main * client is disconnected. */ protected waitStart(): Promise; /** * Stops running. */ stop(reason: SummarizerStopReason): void; } //# sourceMappingURL=runWhileConnectedCoordinator.d.ts.map