/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { ISummarizeResult } from "@fluidframework/runtime-definitions/internal";
import { IRefreshSummaryResult } from "../summary/index.js";
import { IGCStats, IGarbageCollectorConfigs } from "./gcDefinitions.js";
import { IGarbageCollectionSnapshotData, IGarbageCollectionState } from "./gcSummaryDefinitions.js";
export declare const gcStateBlobKey = "__gc_root";
/**
 * The GC data that is tracked for a summary.
 */
export interface IGCSummaryTrackingData {
    serializedGCState: string | undefined;
    serializedTombstones: string | undefined;
    serializedDeletedNodes: string | undefined;
}
/**
 * Encapsulates the garbage collection state that is tracked across summaries.
 * It maintains the GC state as per the latest summary in by the server. It updates state when a summary tracked by this
 * client is acked by the server or from a snapshot is downloaded from the server.
 * On summarize, it decides whether to write new state or re-use previous summary's state.
 */
export declare class GCSummaryStateTracker {
    private readonly configs;
    private latestSummaryData;
    private pendingSummaryData;
    updatedDSCountSinceLastSummary: number;
    /** API for ensuring the correct auto-recovery mitigations */
    autoRecovery: {
        requestFullGCOnNextRun: () => void;
        fullGCRequested: () => boolean;
    };
    /** If true, the next GC run will do fullGC mode to regenerate the GC data for each node */
    private fullGCModeForAutoRecovery;
    constructor(configs: Pick<IGarbageCollectorConfigs, "gcEnabled" | "tombstoneMode" | "gcVersionInBaseSnapshot" | "gcVersionInEffect">);
    /**
     * Called during GC initialization. Initialize the latest summary data from the base snapshot data.
     */
    initializeBaseState(baseSnapshotData: IGarbageCollectionSnapshotData | undefined): void;
    /**
     * Summarizes three component of the GC data - GC state, tombstones and deleted nodes.
     * It does incremental summary, i.e., it writes summary tree / summary blob only for the component that changed.
     * For components that did not change, a summary handle is returned that points to the previous successful summary.
     * If none of the components changed, it returns a summary handle for the entire GC data.
     */
    summarize(trackState: boolean, gcState: IGarbageCollectionState, deletedNodes: Set<string>, tombstones: string[]): ISummarizeResult | undefined;
    /**
     * Builds the GC summary tree which contains GC state, deleted nodes and tombstones.
     * If trackState is false, all of GC state, deleted nodes and tombstones are written as summary blobs.
     * If trackState is true, only states that changed are written. Rest are written as handles.
     * @param serializedGCState - The GC state serialized as string.
     * @param serializedTombstones - The tombstone state serialized as string.
     * @param serializedDeletedNodes - Deleted nodes serialized as string.
     * @param trackState - Whether we are tracking GC state across summaries.
     * @returns the GC summary tree.
     */
    private buildGCSummaryTree;
    /**
     * Called to refresh the latest summary state. This happens when a pending summary is acked.
     */
    refreshLatestSummary(result: IRefreshSummaryResult): Promise<void>;
    /**
     * Called to update the state from a GC run's stats. Used to update the count of data stores whose state updated.
     */
    updateStateFromGCRunStats(stats: IGCStats): void;
}
//# sourceMappingURL=gcSummaryStateTracker.d.ts.map