/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
import { IGarbageCollectionDetailsBase, IGarbageCollectionData } from "@fluidframework/runtime-definitions/internal";
import type { IConfigProvider } from "@fluidframework/telemetry-utils/internal";
import { GCFeatureMatrix, GCVersion, IGCMetadata } from "./gcDefinitions.js";
import { IGarbageCollectionSnapshotData, IGarbageCollectionState } from "./gcSummaryDefinitions.js";
export declare function getGCVersion(metadata?: IGCMetadata): GCVersion;
/** Indicates what GC version is in effect for new GC data being written in this session */
export declare function getGCVersionInEffect(configProvider: IConfigProvider): number;
/**
 * Indicates whether Sweep is allowed for this document based on the persisted GC Feature Matrix and current gcGeneration.
 * This applies to the entire Sweep Phase the same - both Tombstone Enforcement (i.e. should loading a Tombstone fail?) and Deletion.
 *
 * In order to protect old documents that were created at a time when known bugs exist that violate GC's invariants
 * such that enforcing GC Sweep would cause legitimate data loss, the container author may increment the generation value for Sweep
 * such that containers created with a different value will not be subjected to GC Sweep.
 *
 * If no generation is provided, Sweep will be enabled for all documents.
 *
 * For backwards compatibility, the current generation value is also compared against the persisted gcTombstoneGeneration if present.
 *
 * @param featureMatrix - The GC Feature Matrix, containing the persisted generation value
 * @param currentGeneration - The current app-provided gcGeneration value
 * @returns true if GC Sweep should be allowed for this document
 */
export declare function shouldAllowGcSweep(featureMatrix: GCFeatureMatrix, currentGeneration: number | undefined): boolean;
/**
 * Sorts the given GC state as per the id of the GC nodes. It also sorts the outbound routes array of each node.
 */
export declare function generateSortedGCState(gcState: IGarbageCollectionState): IGarbageCollectionState;
/**
 * Concatenates the given GC states and returns the concatenated GC state.
 */
export declare function concatGarbageCollectionStates(gcState1: IGarbageCollectionState, gcState2: IGarbageCollectionState): IGarbageCollectionState;
/**
 * Helper function that clones the GC data.
 * @param gcData - The GC data to clone.
 * @returns a clone of the given GC data.
 */
export declare function cloneGCData(gcData: IGarbageCollectionData): IGarbageCollectionData;
/**
 * Concatenates the given GC data and returns the concatenated GC data.
 */
export declare function concatGarbageCollectionData(gcData1: IGarbageCollectionData, gcData2: IGarbageCollectionData): IGarbageCollectionData;
/**
 * Gets the base garbage collection state from the given snapshot tree. It contains GC state, deleted nodes and
 * tombstones. The GC state may be written into multiple blobs. Merge the GC state from all such blobs into one.
 */
export declare function getGCDataFromSnapshot(gcSnapshotTree: ISnapshotTree, readAndParseBlob: <T>(id: string) => Promise<T>): Promise<IGarbageCollectionSnapshotData>;
/**
 * Helper function that unpacks the GC details of the children from a given node's GC details.
 * @param gcDetails - The GC details of a node.
 * @returns A map of GC details of each children of the the given node.
 */
export declare function unpackChildNodesGCDetails(gcDetails: IGarbageCollectionDetailsBase): Map<string, IGarbageCollectionDetailsBase>;
/** Reformats a request URL to match expected format for a GC node path */
export declare function urlToGCNodePath(url: string): string;
/**
 * Pulls out the first path segment and formats it as a GC Node path
 * e.g. "/dataStoreId/ddsId" yields "/dataStoreId"
 */
export declare function dataStoreNodePathOnly(subDataStorePath: string): string;
/**
 * Utility to implement compat behaviors given an unknown message type
 * The parameters are typed to support compile-time enforcement of handling all known types/behaviors
 *
 * @param _unknownGCMessageType - Typed as never to ensure all known types have been
 * handled before calling this function (e.g. in a switch statement).
 * @param compatBehavior - Typed redundantly with CompatModeBehavior to ensure handling is added when updating that type
 */
export declare function compatBehaviorAllowsGCMessageType(_unknownGCMessageType: never, compatBehavior: "Ignore" | "FailToProcess" | undefined): boolean;
//# sourceMappingURL=gcHelpers.d.ts.map